/* ═══════════════════════════════════════════════════════
   MDClaim360 — Modern Light UI System
   Single source of truth: one consistent theme, no patch
   layers on top of patch layers. Every selector below is a
   real class used somewhere in the templates.
   ═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Design tokens ── */
:root {
  /* Brand */
  --brand:       #16a34a;
  --brand-dim:   #15803d;
  --brand-glow:  rgba(22,163,74,.10);
  --brand-mid:   rgba(22,163,74,.18);
  --accent:      #2563eb;
  --accent-glow: rgba(37,99,235,.10);
  --amber:       #d97706;
  --red:         #dc2626;
  --red-dim:     rgba(220,38,38,.10);
  --purple:      #7c3aed;
  --cyan:        #0891b2;
  --teal:        #0d9488;
  --rose:        #e11d48;

  /* Surfaces */
  --bg:       #f4f6fa;
  --bg2:      #ffffff;
  --bg3:      #f0f3f8;
  --bg4:      #e8ecf2;
  --bg5:      #dfe4ec;
  --surface:  #ffffff;
  --surface2: #f7f9fc;
  --card:     #ffffff;
  --card2:    #fbfcfe;

  /* Borders */
  --border:   #e7eaf1;
  --border2:  #dde2eb;
  --border3:  #c9d0db;

  /* Text */
  --text:    #0f172a;
  --text2:   #475569;
  --text3:   #94a3b8;
  --text4:   #cbd5e1;

  /* Sidebar / topbar */
  --sb-w: 252px;
  --top-h: 60px;

  /* Misc */
  --r: 12px;
  --r-sm: 8px;
  --r-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow:    0 1px 2px rgba(15,23,42,.04), 0 6px 16px rgba(15,23,42,.06);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08), 0 1px 3px rgba(15,23,42,.06);
  --shadow-lg: 0 20px 48px rgba(15,23,42,.14), 0 4px 12px rgba(15,23,42,.06);
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --ease: cubic-bezier(.4,0,.2,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 13px; line-height: 1.5; overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-dim); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--brand); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg5); border-radius: 99px; border: 2px solid transparent; }
::-webkit-scrollbar-thumb:hover { background: var(--text4); }

/* ════════════ LAYOUT ════════════ */
.app { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sb-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .3s var(--ease);
}
.sidebar::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 180px;
  background: radial-gradient(ellipse 100% 100% at 50% 0%, var(--brand-glow), transparent);
  pointer-events: none;
}
.sb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 1;
}
.sb-logo { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; flex-shrink: 0; box-shadow: var(--shadow-sm); }
.sb-logo-fallback {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-dim));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px;
}
.sb-brand-text .name { font-size: 13.5px; font-weight: 800; color: var(--text); letter-spacing: -.01em; }
.sb-brand-text .sub  { font-size: 10px; color: var(--text3); margin-top: 1px; }

.sb-user {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  position: relative; z-index: 1;
}
.sb-user .name   { font-size: 12.5px; font-weight: 700; color: var(--text); }
.sb-user .role   { font-size: 9.5px; color: var(--text3); text-transform: uppercase; letter-spacing: .07em; margin-top: 2px; }
.sb-user .avail  { font-size: 10.5px; color: var(--brand-dim); margin-top: 4px; font-weight: 500; }

.sb-section { padding: 6px 10px 2px; position: relative; z-index: 1; }
.sb-section-label { font-size: 9.5px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .1em; padding: 10px 8px 5px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 1px;
  border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 500; color: var(--text2);
  position: relative;
  transition: background .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.nav-link i { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.nav-link:hover { background: var(--bg3); color: var(--text); transform: translateX(1px); }
.nav-link.active {
  background: var(--brand-glow); color: var(--brand-dim); font-weight: 700;
}
.nav-link.active::before {
  content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 2px; background: var(--brand);
}
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px;
  min-width: 16px; text-align: center;
}

.sb-footer { margin-top: auto; padding: 12px; position: relative; z-index: 1; }
.sb-phi-warn {
  display: flex; align-items: flex-start; gap: 7px;
  padding: 9px 10px; background: rgba(217,119,6,.07);
  border: 1px solid rgba(217,119,6,.18); border-radius: var(--r-sm);
  font-size: 10.5px; color: #92600a; line-height: 1.45;
}
.sb-phi-warn i { color: var(--amber); margin-right: 1px; flex-shrink: 0; }

/* ── Main / Topbar ── */
.main { margin-left: var(--sb-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--top-h); background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-title { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.topbar-sub   { font-size: 10.5px; color: var(--text3); margin-top: 1px; }
.topbar-space { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.tb-btn {
  position: relative;
  width: 34px; height: 34px; border-radius: var(--r-sm);
  border: 1px solid var(--border2); background: var(--bg2); color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px;
  transition: all .15s var(--ease);
}
.tb-btn:hover { background: var(--bg3); color: var(--text); border-color: var(--border3); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.tb-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff; font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px; border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--bg2);
}
.topbar-user { display: flex; align-items: center; gap: 8px; padding-left: 8px; border-left: 1px solid var(--border); margin-left: 4px; }
.topbar-user .name { font-size: 12px; font-weight: 700; }
.topbar-user .role { font-size: 10px; color: var(--text3); text-transform: capitalize; }
.avail-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-glow); flex-shrink: 0;
}
.avail-dot.away    { background: var(--amber); box-shadow: 0 0 0 2px rgba(217,119,6,.16); }
.avail-dot.offline { background: var(--text4); box-shadow: none; }
.sb-toggle { display: none; background: none; border: none; color: var(--text2); cursor: pointer; font-size: 19px; padding: 4px; }

.content { padding: 22px; flex: 1; animation: fadeIn .35s var(--ease); }
[id] { scroll-margin-top: calc(var(--top-h) + 16px); }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.page-title { font-size: 21px; font-weight: 800; letter-spacing: -.015em; }
.page-sub   { font-size: 12px; color: var(--text3); margin-top: 3px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Flash messages ── */
.flash-msgs { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.flash {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 14px; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 500;
  animation: slideDown .25s var(--ease-spring);
  box-shadow: var(--shadow-sm);
}
.flash-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.flash-danger  { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.flash-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.flash-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* ═══════════ CARDS ═══════════ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.card:hover { border-color: var(--border3); }
.card-header {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.card-title { font-size: 13px; font-weight: 700; color: var(--text); }
.card-body  { padding: 16px; }
.card-footer { padding: 11px 16px; border-top: 1px solid var(--border); background: var(--surface2); border-radius: 0 0 var(--r) var(--r); }

/* ── Clickable cards (data-href) ── */
[data-href] { cursor: pointer; }
[data-href]:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--border3); }
[data-href]:active { transform: translateY(-1px) scale(.997); }

/* ── Stat cards ── */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(155px,1fr)); gap: 12px;
}
.stat-card {
  position: relative; overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 15px 16px;
  box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--sc, var(--brand));
}
.stat-card::after {
  content: ''; position: absolute; top: -30px; right: -30px; width: 90px; height: 90px;
  border-radius: 50%; background: var(--sc-glow, var(--brand-glow));
}
.stat-card:hover { border-color: var(--sc, var(--brand)); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--sc-glow, var(--brand-glow)); color: var(--sc, var(--brand));
  display: flex; align-items: center; justify-content: center; font-size: 14px;
  margin-bottom: 10px; position: relative; z-index: 1;
}
.stat-val   { font-size: 23px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); line-height: 1; position: relative; z-index: 1; }
.stat-label { font-size: 11px; color: var(--text3); margin-top: 4px; font-weight: 500; position: relative; z-index: 1; }
.stat-delta { font-size: 11px; margin-top: 7px; font-weight: 600; position: relative; z-index: 1; }
.stat-delta.good { color: var(--brand-dim); }
.stat-delta.bad  { color: var(--red); }

.sc-green  { --sc: var(--brand);  --sc-glow: var(--brand-glow); }
.sc-blue   { --sc: #2563eb; --sc-glow: rgba(37,99,235,.10); }
.sc-amber  { --sc: #d97706; --sc-glow: rgba(217,119,6,.10); }
.sc-red    { --sc: #dc2626; --sc-glow: rgba(220,38,38,.10); }
.sc-purple { --sc: #7c3aed; --sc-glow: rgba(124,58,237,.10); }
.sc-cyan   { --sc: #0891b2; --sc-glow: rgba(8,145,178,.10); }
.sc-teal   { --sc: #0d9488; --sc-glow: rgba(13,148,136,.10); }
.sc-rose   { --sc: #e11d48; --sc-glow: rgba(225,29,72,.10); }

/* ══════════ TABLES ══════════ */
.tbl-wrap { overflow-x: auto; border-radius: var(--r); }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl thead tr { background: var(--surface2); }
.tbl th {
  text-align: left; padding: 10px 14px; font-size: 10.5px; font-weight: 700;
  color: var(--text3); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl th:hover { color: var(--text2); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text2); }
.tbl tbody tr { transition: background .12s var(--ease); }
.tbl tbody tr:hover { background: var(--surface2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl td a { color: var(--text); font-weight: 600; }
.tbl td a:hover { color: var(--brand-dim); }
.tbl .sticky { position: sticky; left: 0; background: inherit; z-index: 1; }

/* ══════════ BADGES ══════════ */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 9px; border-radius: 99px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-purple { background: #f3e8ff; color: #6d28d9; }
.badge-gray   { background: #eef1f6; color: #475569; }
.badge-cyan   { background: #cffafe; color: #0e7490; }
.badge-rose   { background: #ffe4e6; color: #be123c; }

/* ══════════ BUTTONS ══════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap;
  transition: all .15s var(--ease);
  position: relative;
}
.btn:active { transform: scale(.97); }
.btn i { font-size: 13px; }
.btn[disabled] { cursor: not-allowed; opacity: .65; }

.btn-primary { background: var(--brand-dim); color: #fff; border-color: var(--brand-dim); box-shadow: 0 1px 2px rgba(21,128,61,.15); }
.btn-primary:hover { background: var(--brand); border-color: var(--brand); box-shadow: 0 4px 12px rgba(21,128,61,.25); transform: translateY(-1px); }

.btn-outline { background: #fff; color: var(--text2); border-color: var(--border3); }
.btn-outline:hover { background: var(--bg3); color: var(--text); border-color: var(--text3); transform: translateY(-1px); }

.btn-danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.btn-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }

.btn-ghost { background: transparent; color: var(--text3); border-color: transparent; }
.btn-ghost:hover { background: var(--bg3); color: var(--text2); }

.btn-sm  { padding: 4px 9px; font-size: 11.5px; }
.btn-lg  { padding: 10px 20px; font-size: 14px; }
.btn-icon { padding: 6px; }
.btn-block { width: 100%; justify-content: center; }

/* Loading state (applied briefly on submit so a click never feels ignored) */
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ''; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px;
  top: calc(50% - 7px); left: calc(50% - 7px);
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff;
  border-radius: 50%; animation: spin .6s linear infinite;
}
.btn-outline.is-loading::after, .btn-ghost.is-loading::after, .btn-danger.is-loading::after {
  border-color: rgba(71,85,105,.25); border-top-color: var(--text2);
}

/* ══════════ FORMS ══════════ */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 11px; font-weight: 600; color: var(--text2);
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: .03em;
}
.form-control, .form-select {
  width: 100%; padding: 8px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--border3); background: #fff; color: var(--text);
  font-size: 12.5px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.form-control:focus, .form-select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.form-control::placeholder { color: var(--text3); }
.form-control:disabled { background: var(--bg3); color: var(--text3); cursor: not-allowed; }
.form-select { cursor: pointer; }
.form-select option { background: #fff; }

.form-row   { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 12px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.form-hint  { font-size: 10.5px; color: var(--text3); margin-top: 4px; }
.form-check { display: flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12.5px; }
.form-check input[type=checkbox] { accent-color: var(--brand-dim); width: 14px; height: 14px; }

.search-wrap { position: relative; }
.search-wrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 13px; pointer-events: none; }
.search-wrap .form-control { padding-left: 31px; }

/* ══════════ FILTERS BAR ══════════ */
.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 100px; flex: 1; max-width: 200px; }
.filter-bar .search-wrap { flex: 2; min-width: 180px; max-width: 320px; }

/* ══════════ TABS ══════════ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab {
  background: none; border: none; cursor: pointer;
  padding: 10px 14px; font-size: 12.5px; font-weight: 600; color: var(--text3);
  border-bottom: 2px solid transparent; white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.tab:hover { color: var(--text2); }
.tab.active { color: var(--brand-dim); border-bottom-color: var(--brand); }
.tab-pane { display: none; animation: fadeIn .25s var(--ease); }
.tab-pane.active { display: block; }

/* ══════════ TIMELINE ══════════ */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 16px; animation: fadeUp .3s both; }
.tl-item::before {
  content: ''; position: absolute; left: -21px; top: 3px;
  width: 9px; height: 9px; border-radius: 50%; background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}
.tl-time  { font-size: 10px; color: var(--text3); font-family: var(--mono); }
.tl-event { font-size: 12.5px; color: var(--text2); margin-top: 2px; }
.tl-event b { color: var(--text); }

/* ══════════ BAR CHART ══════════ */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; padding-top: 10px; }
.bc-group { display: flex; align-items: flex-end; gap: 2px; flex: 1; flex-direction: column; }
.bc-bars  { display: flex; align-items: flex-end; gap: 2px; width: 100%; }
.bc-bar { flex: 1; border-radius: 3px 3px 0 0; min-height: 4px; transition: opacity .15s var(--ease); animation: barUp .5s var(--ease) both; }
.bc-bar:hover { opacity: .8; }
.bc-billed    { background: linear-gradient(to top, #1d4ed8, #60a5fa); }
.bc-collected { background: linear-gradient(to top, var(--brand-dim), #4ade80); }
.bc-label { font-size: 9px; color: var(--text3); font-family: var(--mono); margin-top: 5px; text-align: center; width: 100%; }
.bc-value { font-size: 8.5px; color: var(--text3); font-family: var(--mono); white-space: nowrap; }
.bc-legend { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }
.bc-legend-item { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--text3); }
.bc-legend-dot { width: 10px; height: 6px; border-radius: 2px; }

.chart-summary { display: flex; gap: 10px; margin-bottom: 12px; }
.chart-summary-box { flex: 1; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 10px 12px; }
.chart-summary-label { font-size: 10px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.chart-summary-value { font-size: 16px; font-weight: 800; color: var(--text); margin-top: 3px; }

/* ══════════ ONLINE STATUS ══════════ */
.online-badge { display: flex; align-items: center; gap: 5px; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 2px var(--brand-glow); }
.online-dot.away    { background: var(--amber); box-shadow: 0 0 0 2px rgba(217,119,6,.16); }
.online-dot.offline { background: var(--text4); box-shadow: none; }

/* ══════════ CLAIM REF ══════════ */
.claim-ref {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  color: var(--brand-dim); background: var(--brand-glow);
  padding: 2px 7px; border-radius: 5px;
  transition: background .15s var(--ease);
}
.claim-ref:hover { background: var(--brand-mid); color: var(--brand-dim); }

/* ══════════ PROGRESS ══════════ */
.progress { height: 6px; background: var(--bg5); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress-bar { height: 100%; border-radius: 99px; transition: width 1s var(--ease); }
.pb-green  { background: linear-gradient(to right, var(--brand-dim), var(--brand)); }
.pb-blue   { background: linear-gradient(to right, #1d4ed8, #60a5fa); }
.pb-amber  { background: linear-gradient(to right, #b45309, var(--amber)); }
.pb-red    { background: linear-gradient(to right, #b91c1c, var(--red)); }

/* ══════════ PAGINATION ══════════ */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; padding: 16px 0; }
.pg-btn {
  min-width: 28px; height: 28px; border-radius: var(--r-sm);
  border: 1px solid var(--border2); background: #fff; color: var(--text2);
  font-size: 11.5px; font-weight: 600;
  cursor: pointer; transition: all .15s var(--ease);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; padding: 0 6px;
}
.pg-btn:hover { border-color: var(--brand-dim); color: var(--brand-dim); }
.pg-btn.active { background: var(--brand-dim); border-color: var(--brand-dim); color: #fff; }
.pg-btn.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ══════════ MODAL ══════════ */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(2px);
  z-index: 500;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; animation: fadeIn .18s var(--ease); }
.modal {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: scaleIn .22s var(--ease-spring);
}
.modal-lg { max-width: 780px; }
.modal-header { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title  { font-size: 14.5px; font-weight: 700; }
.modal-body   { padding: 18px 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.modal-close { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 19px; padding: 2px; border-radius: 6px; transition: all .15s var(--ease); }
.modal-close:hover { color: var(--text); background: var(--bg3); }

/* ══════════ EMPTY STATE ══════════ */
.empty { text-align: center; padding: 44px 20px; color: var(--text3); }
.empty i { font-size: 38px; opacity: .35; margin-bottom: 12px; display: block; color: var(--text4); }
.empty h4 { font-size: 14px; font-weight: 700; color: var(--text2); margin-bottom: 6px; }
.empty p  { font-size: 12.5px; }

/* ══════════ PHI WARNING ══════════ */
.phi-warn {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 12px;
  background: rgba(217,119,6,.07);
  border: 1px solid rgba(217,119,6,.2);
  border-radius: var(--r-sm);
  font-size: 11.5px; color: #92400e;
  margin-bottom: 10px;
}
.phi-warn i { flex-shrink: 0; margin-top: 1px; }

/* ══════════ KPIS / METERS ══════════ */
.kpi-row { display: flex; gap: 10px; align-items: center; margin-bottom: 7px; }
.kpi-label { font-size: 11px; color: var(--text3); width: 120px; flex-shrink: 0; }
.kpi-bar { flex: 1; height: 6px; background: var(--bg4); border-radius: 99px; overflow: hidden; }
.kpi-fill { height: 100%; border-radius: 99px; transition: width .6s var(--ease); }
.kpi-val { font-size: 11.5px; font-weight: 700; width: 50px; text-align: right; }

/* ══════════ GRID LAYOUTS ══════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
.grid-dash { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.grid-dash-3 { display: grid; grid-template-columns: 3fr 2fr 2fr; gap: 14px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

/* ══════════ SECTION HEADERS ══════════ */
.section-hdr { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; }
.section-title { font-size: 12.5px; font-weight: 700; color: var(--text2); }
.section-sep { flex: 1; height: 1px; background: var(--border); }
.section-action { font-size: 11.5px; }

/* ══════════ ACTION ROW ══════════ */
.action-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ══════════ TEAM CARD ══════════ */
.team-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.team-card-header { padding: 13px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.team-member { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--border); transition: background .15s var(--ease); }
.team-member:hover { background: var(--surface2); }
.team-member:last-child { border-bottom: none; }

/* ══════════ AVATAR ══════════ */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dim));
  color: #fff; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-transform: uppercase;
  box-shadow: var(--shadow-sm);
}
.avatar-md { width: 38px; height: 38px; font-size: 14px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.avatar-img-sm { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; box-shadow: var(--shadow-sm); }

/* ══════════ ALERT CARDS ══════════ */
.alert-card { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-radius: var(--r-sm); margin-bottom: 8px; transition: background .15s var(--ease); }
.alert-urgent { background: #fef2f2; border: 1px solid #fecaca; color: var(--text2); }
.alert-warn   { background: #fffbeb; border: 1px solid #fde68a; color: var(--text2); }
.alert-info   { background: #eff6ff; border: 1px solid #bfdbfe; color: var(--text2); }
.alert-icon   { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.alert-icon.red    { color: var(--red); }
.alert-icon.amber  { color: var(--amber); }
.alert-icon.blue   { color: var(--accent); }
.alert-body .title { font-weight: 700; color: var(--text); font-size: 12.5px; }
.alert-body .sub   { font-size: 11px; color: var(--text3); margin-top: 2px; }

/* ══════════ LOGIN PAGE ══════════ */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); position: relative; overflow: hidden; padding: 20px;
}
.login-bg { position: absolute; inset: 0; z-index: 0; }
.login-bg::before {
  content: ''; position: absolute; top: -10%; left: -10%; width: 60%; height: 60%;
  background: radial-gradient(circle, var(--brand-glow), transparent 70%);
}
.login-bg::after {
  content: ''; position: absolute; bottom: -15%; right: -10%; width: 55%; height: 55%;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
}
.login-card {
  position: relative; z-index: 1;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  padding: 36px 34px; width: 100%; max-width: 400px;
  animation: scaleIn .35s var(--ease-spring);
}
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo img { width: 54px; height: 54px; border-radius: 14px; margin: 0 auto 12px; object-fit: cover; box-shadow: var(--shadow-sm); }
.login-logo h1 { font-size: 18px; font-weight: 800; }
.login-logo p  { font-size: 12px; color: var(--text3); margin-top: 4px; }
.login-hint { font-size: 10.5px; color: var(--text3); text-align: center; margin-top: 16px; line-height: 1.5; }

/* ══════════ MONTHLY PERFORMANCE ══════════ */
.monthly-performance-card { overflow: hidden; }
.monthly-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.monthly-box { padding: 16px 18px; }
.monthly-box.current-month { background: var(--brand-glow); border-right: 1px solid var(--border); }
.monthly-title { font-size: 14px; font-weight: 800; color: var(--text); }
.monthly-sub { font-size: 10.5px; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-bottom: 10px; }
.monthly-kpis { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px 10px; }
.monthly-val { font-size: 16px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.monthly-val.green { color: var(--brand-dim); }
.monthly-val.amber { color: var(--amber); }
.monthly-val.red   { color: var(--red); }
.monthly-label { font-size: 10px; color: var(--text3); margin-top: 2px; }
.monthly-actions { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
@media (max-width: 860px) {
  .monthly-grid { grid-template-columns: 1fr; }
  .monthly-box.current-month { border-right: none; border-bottom: 1px solid var(--border); }
  .monthly-kpis { grid-template-columns: repeat(2,1fr); }
}

/* ══════════ PROFILE ══════════ */
.profile-page-wrap { max-width: 880px; margin: 0 auto; }
.profile-hero { display: flex; align-items: center; gap: 18px; padding: 22px; }
.profile-hero-avatar-wrap { flex-shrink: 0; }
.profile-hero-avatar-img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow-md); }
.profile-hero-avatar-initials {
  width: 76px; height: 76px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-dim));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; box-shadow: var(--shadow-md);
}
.profile-hero-info { flex: 1; min-width: 0; }
.profile-name { font-size: 19px; font-weight: 800; }
.profile-meta { font-size: 12px; color: var(--text3); margin-top: 3px; text-transform: capitalize; }
.profile-status { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--brand-dim); font-weight: 600; margin-top: 8px; }
.profile-status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }

.avatar-picker-note { font-size: 11.5px; color: var(--text3); margin-bottom: 12px; }
.avatar-group-title { font-size: 10.5px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; margin: 14px 0 8px; }
.avatar-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px,1fr)); gap: 10px; }
.avatar-choice { cursor: pointer; }
.avatar-choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.avatar-choice-card {
  border: 2px solid var(--border2); border-radius: var(--r-sm);
  padding: 10px 6px; text-align: center;
  transition: all .15s var(--ease);
}
.avatar-choice-card:hover { border-color: var(--border3); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.avatar-choice-card img { width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 6px; }
.avatar-choice-label { font-size: 10px; color: var(--text2); font-weight: 500; }
.avatar-choice input:checked + .avatar-choice-card {
  border-color: var(--brand); background: var(--brand-glow); box-shadow: 0 0 0 3px var(--brand-glow);
}
.avatar-choice-initials {
  width: 40px; height: 40px; border-radius: 50%; margin: 0 auto 6px;
  background: var(--bg4); color: var(--text2); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
@media (max-width: 600px) {
  .profile-hero { flex-direction: column; text-align: center; }
  .avatar-picker-grid { grid-template-columns: repeat(auto-fill, minmax(68px,1fr)); }
}

/* ══════════ MISC UTILS ══════════ */
.text-sm     { font-size: 11.5px; }
.text-xs     { font-size: 10.5px; }
.text-muted  { color: var(--text3); }
.text-brand  { color: var(--brand-dim); }
.text-red    { color: var(--red); }
.text-amber  { color: var(--amber); }
.text-blue   { color: var(--accent); }
.fw-bold     { font-weight: 700; }
.fw-semi     { font-weight: 600; }
.mono        { font-family: var(--mono); }
.d-flex      { display: flex; }
.d-grid      { display: grid; }
.d-none      { display: none; }
.align-center{ align-items: center; }
.gap-4       { gap: 4px; }
.gap-6       { gap: 6px; }
.gap-8       { gap: 8px; }
.gap-10      { gap: 10px; }
.gap-12      { gap: 12px; }
.gap-16      { gap: 16px; }
.gap-20      { gap: 20px; }
.ml-auto     { margin-left: auto; }
.mr-auto     { margin-right: auto; }
.me-2        { margin-right: 8px; }
.mt-8        { margin-top: 8px; }
.mt-12       { margin-top: 12px; }
.mt-16       { margin-top: 16px; }
.mt-20       { margin-top: 20px; }
.mb-8        { margin-bottom: 8px; }
.mb-12       { margin-bottom: 12px; }
.mb-16       { margin-bottom: 16px; }
.mb-20       { margin-bottom: 20px; }
.p-12        { padding: 12px; }
.p-16        { padding: 16px; }
.w-100       { width: 100%; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap      { white-space: nowrap; }

/* ══════════ ANIMATIONS ══════════ */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp   { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown{ from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn  { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes barUp    { from { transform: scaleY(0); transform-origin: bottom; } to { transform: scaleY(1); transform-origin: bottom; } }
@keyframes pulse    { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
@keyframes spin     { to { transform: rotate(360deg); } }

.anim-stagger > * { animation: fadeUp .4s var(--ease) both; }
.anim-stagger > *:nth-child(1){ animation-delay: .03s; }
.anim-stagger > *:nth-child(2){ animation-delay: .06s; }
.anim-stagger > *:nth-child(3){ animation-delay: .09s; }
.anim-stagger > *:nth-child(4){ animation-delay: .12s; }
.anim-stagger > *:nth-child(5){ animation-delay: .15s; }
.anim-stagger > *:nth-child(6){ animation-delay: .18s; }
.anim-stagger > *:nth-child(7){ animation-delay: .21s; }
.anim-stagger > *:nth-child(8){ animation-delay: .24s; }

/* ══════════ PRINT ══════════ */
@media print {
  .sidebar, .topbar, .page-actions, .btn, .modal-backdrop { display: none !important; }
  .main { margin-left: 0; }
  body { background: #fff; }
}

/* ══════════ RESPONSIVE ══════════ */
@media (max-width: 1100px) {
  .grid-dash, .grid-dash-3 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: span 1; }
}
@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row-3, .form-row-4 { grid-template-columns: 1fr 1fr; }
  .modal { max-width: 94vw; }
}
@media (max-width: 720px) {
  .sb-toggle { display: flex; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.sb-open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { padding: 0 14px; }
}
@media (max-width: 520px) {
  .content { padding: 14px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .form-row, .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .filter-bar .form-control, .filter-bar .form-select, .filter-bar .search-wrap { max-width: none; min-width: 0; flex: 1 1 100%; }
}


/* v19 hotfix: keep button text colors stable on hover */
a.btn-primary,
a.btn-primary:hover,
.btn-primary:hover {
  color: #fff !important;
}

/* v19 hotfix: red sign-out with confirmation */
.nav-link.signout-link {
  color: var(--red) !important;
  font-weight: 700;
}

.nav-link.signout-link i {
  color: var(--red) !important;
}

.nav-link.signout-link:hover {
  background: #fef2f2 !important;
  color: var(--red) !important;
}

.nav-link.signout-link:hover i {
  color: var(--red) !important;
}


/* SOP sidebar fallback hotfix */
.sop-sidebar-fallback {
  display: block !important;
  padding: 8px 10px 16px;
}

.sop-sidebar-fallback .sb-section-title {
  display: block !important;
  margin: 14px 10px 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #94a3b8;
}

.sop-sidebar-fallback .nav-link {
  display: flex !important;
  align-items: center;
  gap: 10px;
  margin: 4px 6px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: #334155 !important;
  font-weight: 600;
}

.sop-sidebar-fallback .nav-link i {
  color: inherit !important;
}

.sop-sidebar-fallback .nav-link:hover,
.sop-sidebar-fallback .nav-link.active {
  background: #ecfdf5 !important;
  color: #009245 !important;
}

.sop-sidebar-fallback .signout-link,
.sop-sidebar-fallback .signout-link i {
  color: #dc2626 !important;
}

.sop-sidebar-fallback .signout-link:hover {
  background: #fef2f2 !important;
  color: #dc2626 !important;
}
