:root {
  --bg: #ffffff;
  --text: #333333;
  --muted: #666666;
  --primary: #0084B4;
  --primary-dark: #006B94;
  --positive: #16a34a;
  --negative: #DC3545;
  --card: #ffffff;
  --border: #D0D0D0;
  --hover: #F0F9FC;
  --secondary-bg: #E8F4F8;
  --table-header-bg: #0073A1;
  --table-header-border: #005A7D;
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg); color: var(--text);
}
.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.container-wide { width: 100%; margin: 0; padding: 0 16px; }
.topbar { position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 700; letter-spacing: 0.2px; margin: 0; display:flex; align-items:center; gap:10px; }
.brand-logo { height: 40px; object-fit: contain; }
.brand-name { font-weight: 600; font-size: 15px; color: var(--text); }
.nav { display: flex; align-items: center; gap: 12px; }
.nav-link { color: var(--text); text-decoration: none; padding: 8px 12px; border-radius: 8px; }
.nav-link:hover { background: #f3f4f6; }
.inline { display: inline; }
.main { padding: 24px 0; }

.layout { display: grid; grid-template-columns: 260px 1fr; }
.layout.no-sidebar { grid-template-columns: 1fr; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.main { padding: 12px 0 20px; }
@media (max-width: 640px) {
  .topbar-inner { height: 50px; }
  .brand-logo { height: 32px; }
  .brand-name { display: none; }
  .container, .container-wide { padding: 0 12px; }
  .card { padding: 12px; }
  .toolbar { flex-wrap: wrap; padding: 16px; gap: 12px; }
  .table th, .table td { padding: 12px; }
  label { font-size: 13px; }
  input, select { font-size: 14px; }
  .btn { padding: 10px 16px; }
  .icon-btn { padding: 10px; }
}
@media (max-width: 480px) {
.table-wrap .table { min-width: 640px; }
}
.sidebar { border-right: 1px solid var(--border); background: #fff; }
.sidebar-inner { position: sticky; top: 64px; display: grid; padding: 16px; gap: 4px; }
.side-link { display: block; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.side-link:hover { background: #f3f4f6; }
.side-link.active { background: #eef2ff; color: #1e40af; }
.link-button { all: unset; cursor: pointer; display: block; width: 100%; }
.content { min-height: calc(100vh - 64px - 88px); }

.content-wide { width: 100%; max-width: none; padding-left: 16px; padding-right: 16px; }
.content-wide .card { margin-left: 0; margin-right: 0; }

body.sidebar-collapsed .sidebar { display: none; }
body.sidebar-collapsed .layout { grid-template-columns: 1fr; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.two { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 14px; box-shadow: var(--shadow); }
.card.narrow { max-width: 400px; margin: 24px auto; }
.card.compact { padding: 10px; }
.dashboard-chart { margin-top: 20px; }

.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row; }
@media (max-width: 900px) { .stats { grid-template-columns: 1fr; } }
.stat-label { color: var(--muted); font-size: 14px; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-value.positive { color: var(--positive); }
.stat-value.negative { color: var(--negative); }

.btn { border: 1px solid var(--border); background: #f9fafb; color: var(--text); padding: 10px 20px; border-radius: 4px; cursor: pointer; font-weight: 600; font-size: 14px; }
.btn:hover { background: #f3f4f6; }
.btn-ghost { border: none; background: transparent; color: var(--muted); cursor: pointer; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:active { box-shadow: 0 2px 4px rgba(0,84,180,0.3); }
.icon-btn { border: none; background: transparent; color: var(--muted); cursor: pointer; padding: 8px; transition: transform .15s ease-in-out, filter .15s ease-in-out; }
.icon-btn:hover { transform: scale(1.15); filter: brightness(1.1); }
.icon-btn[title="Edit"] { color: var(--primary); }
.icon-btn[title="Delete"] { color: var(--negative); }
.icon { width: 20px; height: 20px; display: inline-block; vertical-align: middle; }

.form-grid { display: grid; gap: 10px; }
label { display: grid; gap: 6px; font-size: 14px; }
input, select { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 15px; }
input:focus, select:focus { border-color: var(--primary); outline: none; }

.toolbar { display:flex; align-items:center; gap:16px; margin-bottom:20px; background: #F5F5F5; padding: 16px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.toolbar label { font-weight: 600; font-size: 14px; color: #333333; }
.toolbar span { font-size: 13px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { padding: 8px 10px; border-radius: 999px; background: #f3f4f6; color: var(--muted); border: 1px solid var(--border); }

.table { width: 100%; border-collapse: collapse; }
.table-wrap { overflow-x: auto; }
.table-wrap .table { min-width: 900px; }
.table th, .table td { padding: 14px; border-bottom: 1px solid #E0E0E0; font-size: 14px; color: #333333; }
.table thead tr { background: var(--table-header-bg); }
.table thead th { text-align: left; color: #ffffff; font-weight: 600; font-size: 13px; letter-spacing: 0.5px; border-bottom: 2px solid var(--table-header-border); }
.table tbody tr { background: #ffffff; transition: background-color .2s ease-in-out; }
.table tbody tr:hover { background: var(--hover); cursor: pointer; }
.table.striped tbody tr:nth-child(even) { background: #FAFAFA; }
.mono { font-feature-settings: "tnum" on; font-variant-numeric: tabular-nums; }

.alert { padding: 10px 12px; border-radius: 12px; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.muted { color: var(--muted); }

.footer { border-top: 1px solid var(--border); padding: 16px 0; margin-top: 16px; text-align: center; }

/* Modal */
.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(17,24,39,0.35); }
.modal-card { position: relative; max-width: 720px; width: 96%; }
.toolbar { display:flex; align-items:center; gap:8px; margin-bottom:12px; }
.chart-small { height: 160px; }

h3 { font-weight: 600; font-size: 16px; }
.muted { color: var(--muted); }

a, button, .btn, .icon-btn, input, select { outline-offset: 2px; }
a:focus-visible, button:focus-visible, .btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--primary); }
.chart-small { height: 160px; }

/* Modern Styles for User Management & Salary */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.page-title h2 { font-size: 24px; font-weight: 700; color: #111827; margin: 0; }
.page-title p { color: #6B7280; margin: 4px 0 0; font-size: 14px; }

.filters-card { background: #fff; padding: 16px; border-radius: 12px; border: 1px solid #E5E7EB; margin-bottom: 24px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.filters-group { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; flex: 1; }
.filter-item select, .filter-item input { padding: 8px 12px; border: 1px solid #D1D5DB; border-radius: 6px; font-size: 14px; color: #374151; background-color: #F9FAFB; }
.filter-item input { min-width: 200px; }
.filter-item select:focus, .filter-item input:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.1); }

.data-card { background: #fff; border-radius: 12px; border: 1px solid #E5E7EB; overflow: hidden; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); }

.table-responsive { overflow-x: auto; }
.modern-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.modern-table th { background: #F9FAFB; padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: #6B7280; border-bottom: 1px solid #E5E7EB; cursor: pointer; user-select: none; }
.modern-table th a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 4px; }
.modern-table th:hover { background: #F3F4F6; }
.modern-table td { padding: 16px; border-bottom: 1px solid #F3F4F6; color: #1F2937; font-size: 14px; vertical-align: middle; }
.modern-table tr:last-child td { border-bottom: none; }
.modern-table tr:hover td { background-color: #F9FAFB; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 9999px; font-size: 12px; font-weight: 500; }
.badge-purple { background-color: #EDE9FE; color: #5B21B6; }
.badge-blue { background-color: #DBEAFE; color: #1E40AF; }
.badge-green { background-color: #D1FAE5; color: #065F46; }
.badge-gray { background-color: #F3F4F6; color: #4B5563; }

.amount-cell { font-family: 'Monaco', 'Consolas', monospace; font-weight: 600; text-align: right; color: #DC2626; }
.detail-row { display: flex; justify-content: space-between; font-size: 12px; color: #6B7280; margin-top: 2px; }
.action-cell { display: flex; gap: 8px; justify-content: flex-end; }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-top: 1px solid #E5E7EB; background: #fff; }
.pagination-info { font-size: 14px; color: #6B7280; }
.pagination-controls { display: flex; gap: 8px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Modal Two Column Grid */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* Compact Dashboard Status Cards */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: row; /* Side-by-side layout */
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  height: auto;
  min-height: 80px;
}

.stat-content {
  position: relative;
  z-index: 2;
  flex: 1;
}

.stat-label {
  font-size: 13px;
  color: #6B7280;
  font-weight: 500;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.stat-chart-container {
  height: 50px;
  width: 100px;
  margin: 0;
  flex-shrink: 0;
}

.stat-chart-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
