/* ============================================================
   1. DESIGN TOKENS
   In Django this lives in static/reportengine_ui/css/tokens.css
   ============================================================ */
:root {
  /* Type */
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Type scale */
  --text-xs: 11px; --text-sm: 12px; --text-base: 13px; --text-md: 14px;
  --text-lg: 16px; --text-xl: 18px; --text-2xl: 22px; --text-3xl: 28px; --text-4xl: 36px;

  /* Spacing (4-pt grid) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  /* Radius */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-2xl: 28px; --r-full: 9999px;

  /* Layout */
  --nav-h: 64px;
  --container: 1360px;

  /* Brand gradient (driver of the whole look) */
  --grad-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --grad-aurora:  linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
  --grad-mint:    linear-gradient(135deg, #34d399 0%, #06b6d4 100%);
  --grad-coral:   linear-gradient(135deg, #fb7185 0%, #f97316 100%);
  --grad-amber:   linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

[data-theme="light"] {
  --bg-page: #f7f7fb;
  --bg-page-soft: #ffffff;
  --bg-card: #ffffff;
  --bg-soft: #f1f5f9;
  --bg-softer: #f8fafc;
  --bg-hover: rgba(99,102,241,.06);
  --bg-glass: rgba(255,255,255,.72);

  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #64748b;
  --text-4: #94a3b8;
  --text-on: #ffffff;

  --primary: #6366f1;
  --primary-bg: rgba(99,102,241,.10);
  --primary-strong: #4f46e5;

  --success: #10b981;  --success-bg: rgba(16,185,129,.10);
  --warn:    #f59e0b;  --warn-bg:    rgba(245,158,11,.12);
  --danger:  #ef4444;  --danger-bg:  rgba(239,68,68,.10);
  --info:    #0ea5e9;  --info-bg:    rgba(14,165,233,.10);
  --violet:  #a855f7;  --violet-bg:  rgba(168,85,247,.10);

  --border: rgba(15,23,42,.07);
  --border-strong: rgba(15,23,42,.12);

  --shadow-sm: 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05);
  --shadow-lg: 0 4px 12px rgba(15,23,42,.06), 0 24px 48px -12px rgba(15,23,42,.10);
  --shadow-glow: 0 8px 32px rgba(99,102,241,.18);
}

[data-theme="dark"] {
  --bg-page: #0b0d14;
  --bg-page-soft: #11131c;
  --bg-card: #161824;
  --bg-soft: #1d1f2c;
  --bg-softer: #14161f;
  --bg-hover: rgba(139,92,246,.10);
  --bg-glass: rgba(22,24,36,.72);

  --text-1: #f1f5f9;
  --text-2: #cbd5e1;
  --text-3: #94a3b8;
  --text-4: #64748b;
  --text-on: #ffffff;

  --primary: #a78bfa;
  --primary-bg: rgba(167,139,250,.14);
  --primary-strong: #c4b5fd;

  --success: #34d399; --success-bg: rgba(52,211,153,.14);
  --warn:    #fbbf24; --warn-bg:    rgba(251,191,36,.14);
  --danger:  #fb7185; --danger-bg:  rgba(251,113,133,.14);
  --info:    #38bdf8; --info-bg:    rgba(56,189,248,.14);
  --violet:  #c084fc; --violet-bg:  rgba(192,132,252,.14);

  --border: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.16);

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.3);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.4), 0 24px 48px -12px rgba(0,0,0,.5);
  --shadow-glow: 0 8px 32px rgba(167,139,250,.25);
}

/* ============================================================
   2. RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  min-height: 100vh; font-family: var(--font-body); font-size: var(--text-base);
  color: var(--text-1); background: var(--bg-page); line-height: 1.55;
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(99,102,241,.10), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(217,70,239,.06), transparent 60%);
  background-attachment: fixed;
}
[data-theme="dark"] body {
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(167,139,250,.18), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(56,189,248,.10), transparent 60%);
}
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-display); font-weight: 700; line-height: 1.18; letter-spacing: -.01em; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg-page); }

/* ============================================================
   3. TOP NAV  ← partials/_topnav.html
   ============================================================ */
.topnav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--bg-glass);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topnav__inner {
  max-width: var(--container); margin: 0 auto; height: 100%;
  padding: 0 var(--s-6);
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: var(--s-6);
}
.brand { display: flex; align-items: center; gap: var(--s-3); }
.brand__mark {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--grad-primary); color: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow-glow);
}
.brand__name { font-family: var(--font-display); font-weight: 800; font-size: var(--text-md); letter-spacing: -.01em; }
.brand__sub { font-size: var(--text-xs); color: var(--text-4); letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }

.nav { display: flex; align-items: center; gap: var(--s-1); justify-self: center; padding: 4px; background: var(--bg-soft); border-radius: var(--r-full); }
.nav__item {
  display: inline-flex; align-items: center; gap: var(--s-2);
  padding: 8px 14px; border-radius: var(--r-full);
  font-size: var(--text-sm); font-weight: 500; color: var(--text-2); white-space: nowrap;
  transition: all .15s;
}
.nav__item:hover { color: var(--text-1); background: var(--bg-card); }
.nav__item.is-active { background: var(--bg-card); color: var(--text-1); box-shadow: var(--shadow-sm); font-weight: 600; }
.nav__item.nav__item--accent { background: var(--grad-aurora); color: #fff; }
.nav__item.nav__item--accent:hover { color: #fff; opacity: .92; }

.nav__more {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--r-full);
  font-size: var(--text-sm); color: var(--text-2); position: relative;
}
.nav__more:hover { color: var(--text-1); background: var(--bg-card); }
.nav__more-pop {
  position: absolute; top: 110%; left: 0;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: 6px; min-width: 200px; display: none; z-index: 50;
}
.nav__more.is-open .nav__more-pop { display: block; }
.nav__more-pop a { display: flex; align-items: center; gap: var(--s-2); padding: 8px 12px; border-radius: var(--r-sm); font-size: var(--text-sm); color: var(--text-2); }
.nav__more-pop a:hover { background: var(--bg-soft); color: var(--text-1); }

.topnav__actions { display: flex; align-items: center; gap: var(--s-2); }
.iconbtn {
  width: 38px; height: 38px; border-radius: var(--r-md);
  display: grid; place-items: center; color: var(--text-2);
  background: var(--bg-card); border: 1px solid var(--border);
  transition: all .15s;
}
.iconbtn:hover { color: var(--text-1); background: var(--bg-soft); }
.iconbtn.has-dot { position: relative; }
.iconbtn.has-dot::after { content: ''; position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg-card); }

.searchbar {
  display: flex; align-items: center; gap: var(--s-2);
  background: var(--bg-soft); border: 1px solid transparent;
  border-radius: var(--r-md); padding: 8px 12px; min-width: 240px;
  font-size: var(--text-sm); color: var(--text-3);
}
.searchbar:focus-within { background: var(--bg-card); border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-bg); }
.searchbar input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--text-1); }
.searchbar kbd { font-family: var(--font-mono); font-size: 10px; color: var(--text-4); padding: 2px 6px; border-radius: 4px; background: var(--bg-card); border: 1px solid var(--border); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--grad-primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: var(--text-sm);
}
.avatar--lg { width: 56px; height: 56px; font-size: var(--text-lg); }
.avatar--sm { width: 28px; height: 28px; font-size: 11px; }

/* ============================================================
   4. CONTAINER + PAGE HEADER  ← partials/_page_header.html
   ============================================================ */
.container { max-width: var(--container); margin: 0 auto; padding: var(--s-8) var(--s-6) var(--s-12); }

.page { display: none; }
.page.is-active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.crumb { display: flex; align-items: center; gap: var(--s-2); font-size: var(--text-sm); color: var(--text-4); margin-bottom: var(--s-3); }
.crumb a { color: var(--text-3); }
.crumb a:hover { color: var(--primary); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-6); margin-bottom: var(--s-8); flex-wrap: wrap; }
.page-head__title { font-size: var(--text-4xl); font-family: var(--font-display); font-weight: 800; letter-spacing: -.025em; }
.page-head__sub { color: var(--text-3); margin-top: 6px; max-width: 60ch; }
.page-head__actions { display: flex; align-items: center; gap: var(--s-2); }

/* ============================================================
   5. BUTTONS  ← widgets/button.html
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-2); justify-content: center;
  padding: 9px 16px; border-radius: var(--r-md);
  font-size: var(--text-sm); font-weight: 600;
  transition: all .15s; white-space: nowrap;
  border: 1px solid transparent;
}
.btn--primary {
  background: var(--grad-primary); color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,.30);
}
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(99,102,241,.40); }
.btn--secondary { background: var(--bg-card); color: var(--text-1); border-color: var(--border); }
.btn--secondary:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.btn--ghost { color: var(--text-2); }
.btn--ghost:hover { background: var(--bg-soft); color: var(--text-1); }
.btn--danger { background: var(--danger-bg); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--sm { padding: 6px 12px; font-size: var(--text-xs); }
.btn--lg { padding: 12px 20px; font-size: var(--text-md); }
.btn--icon { padding: 8px; }

/* ============================================================
   6. CARD  ← widgets/card.html
   ============================================================ */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--s-5);
  box-shadow: var(--shadow-md);
}
.card--flush { padding: 0; overflow: hidden; }
.card--lg { padding: var(--s-6); border-radius: var(--r-xl); }
.card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-4); }
.card__title { font-size: var(--text-lg); font-family: var(--font-display); font-weight: 700; }
.card__sub { font-size: var(--text-xs); color: var(--text-4); margin-top: 2px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }

/* ============================================================
   7. STAT  ← widgets/stat.html
   ============================================================ */
.stat__label { font-size: var(--text-xs); color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.stat__value { font-family: var(--font-display); font-weight: 800; font-size: var(--text-3xl); margin-top: 6px; letter-spacing: -.02em; }
.stat__delta { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); font-weight: 600; padding: 3px 8px; border-radius: var(--r-full); margin-top: var(--s-3); }
.stat__delta.up   { background: var(--success-bg); color: var(--success); }
.stat__delta.down { background: var(--danger-bg);  color: var(--danger); }
.stat__delta.flat { background: var(--bg-soft);    color: var(--text-3); }

/* Hero stat (the big one on dashboard) */
.hero-stat {
  position: relative; overflow: hidden;
  background: var(--grad-primary); color: #fff;
  border-radius: var(--r-2xl); padding: var(--s-8); border: 0;
  box-shadow: var(--shadow-glow);
}
.hero-stat::after {
  content: ''; position: absolute; right: -60px; bottom: -60px;
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.25), transparent 70%);
  pointer-events: none;
}
.hero-stat .stat__label { color: rgba(255,255,255,.85); }
.hero-stat .stat__value { font-size: 56px; }
.hero-stat .stat__delta { background: rgba(255,255,255,.18); color: #fff; }

/* ============================================================
   8. BADGE / CHIP  ← widgets/badge.html
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: var(--text-xs); font-weight: 600;
  background: var(--bg-soft); color: var(--text-2);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--success, .badge--completed, .badge--paid, .badge--active   { background: var(--success-bg); color: var(--success); }
.badge--info,    .badge--processing                                 { background: var(--info-bg);    color: var(--info); }
.badge--warn,    .badge--pending, .badge--draft                     { background: var(--warn-bg);    color: var(--warn); }
.badge--danger,  .badge--failed, .badge--cancelled                  { background: var(--danger-bg);  color: var(--danger); }
.badge--violet,  .badge--free                                       { background: var(--violet-bg);  color: var(--violet); }
.badge--plain { background: var(--bg-soft); color: var(--text-2); }
.badge--plain::before { display: none; }
.badge.no-dot::before { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-full);
  background: var(--bg-soft); color: var(--text-2);
  font-size: var(--text-xs); font-weight: 600;
  border: 1px solid transparent; transition: all .15s;
}
.chip:hover { color: var(--text-1); background: var(--bg-card); border-color: var(--border); }
.chip.is-active { background: var(--bg-card); color: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.chip__count { background: var(--bg-card); color: var(--text-3); padding: 1px 6px; border-radius: var(--r-full); font-size: 10px; font-weight: 700; }
.chip.is-active .chip__count { background: var(--primary); color: #fff; }

/* Vendor pill */
.vendor { padding: 2px 8px; border-radius: var(--r-sm); font-size: var(--text-xs); font-weight: 600; }
.vendor--thyrocare { background: rgba(99,102,241,.12); color: #6366f1; }
.vendor--aarthi    { background: rgba(236,72,153,.12); color: #ec4899; }

/* ============================================================
   9. FILTER BAR  ← partials/_filter_bar.html
   In Django this is an actual <form method="get">.
   ============================================================ */
.filterbar {
  display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center;
  margin-bottom: var(--s-5);
}
.chips { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: var(--text-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.field input, .field select, .field textarea {
  padding: 9px 12px; background: var(--bg-card); color: var(--text-1);
  border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: var(--text-sm); transition: all .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 0; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-bg);
}
.input-wrap { position: relative; }
.input-wrap > svg.lead { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-4); pointer-events: none; }
.input-wrap > input { padding-left: 36px; }

/* ============================================================
   10. TABLE  ← widgets/table.html
   ============================================================ */
.table-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-md); }
.table-card__head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; }
.table thead th {
  text-align: left; font-size: var(--text-xs); font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--text-3);
  padding: 12px var(--s-5); background: var(--bg-softer); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td { padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-1); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--bg-hover); }
.table .who { display: flex; align-items: center; gap: 10px; }
.table .who__name { font-weight: 600; }
.table .who__sub { font-size: 11px; color: var(--text-4); }
.row-actions { display: inline-flex; gap: 4px; }
.row-actions .iconbtn { width: 32px; height: 32px; }

.pagination { display: flex; align-items: center; justify-content: space-between; padding: var(--s-3) var(--s-5); border-top: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-3); }
.pagination__pages { display: flex; align-items: center; gap: 4px; }
.pagination .iconbtn { width: 32px; height: 32px; }
.pagination .page-num { min-width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--r-sm); color: var(--text-2); font-weight: 600; }
.pagination .page-num:hover { background: var(--bg-soft); color: var(--text-1); }
.pagination .page-num.is-active { background: var(--primary); color: #fff; }

/* ============================================================
   11. SEGMENTED  ← widgets/segmented.html
   ============================================================ */
.segmented { display: inline-flex; padding: 4px; background: var(--bg-soft); border-radius: var(--r-md); gap: 2px; }
.segmented button { padding: 7px 14px; border-radius: var(--r-sm); font-size: var(--text-sm); font-weight: 600; color: var(--text-3); transition: all .15s; }
.segmented button:hover { color: var(--text-1); }
.segmented button.is-active { background: var(--bg-card); color: var(--text-1); box-shadow: var(--shadow-sm); }

/* ============================================================
   12. BENTO  (dashboard layout)
   ============================================================ */
.bento { display: grid; gap: var(--s-5); grid-template-columns: repeat(12, 1fr); }
.bento > .col-3  { grid-column: span 3; }
.bento > .col-4  { grid-column: span 4; }
.bento > .col-5  { grid-column: span 5; }
.bento > .col-6  { grid-column: span 6; }
.bento > .col-7  { grid-column: span 7; }
.bento > .col-8  { grid-column: span 8; }
.bento > .col-9  { grid-column: span 9; }
.bento > .col-12 { grid-column: span 12; }
@media (max-width: 1024px) {
  .bento > [class*="col-"] { grid-column: span 12; }
}

/* ============================================================
   13. SPARKLINE / CHART  ← widgets/sparkline.html
   ============================================================ */
.spark { width: 100%; height: 60px; }
.spark path.line { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.spark path.area { fill: var(--primary); opacity: .12; }

.area-chart { width: 100%; height: 220px; }
.area-chart path.line { fill: none; stroke: var(--primary); stroke-width: 2; }
.area-chart path.area { fill: url(#chartGrad); opacity: .9; }
.area-chart .grid line { stroke: var(--border); }
.area-chart .axis text { fill: var(--text-4); font-size: 10px; font-family: var(--font-body); }

/* ============================================================
   14. ACTIVITY FEED
   ============================================================ */
.feed { display: flex; flex-direction: column; }
.feed__row { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) 0; border-bottom: 1px dashed var(--border); }
.feed__row:last-child { border-bottom: 0; }
.feed__dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 8px; flex-shrink: 0; }
.feed__dot.success { background: var(--success); }
.feed__dot.info { background: var(--info); }
.feed__dot.warn { background: var(--warn); }
.feed__dot.danger { background: var(--danger); }
.feed__body { flex: 1; }
.feed__body strong { font-weight: 600; }
.feed__time { font-size: 11px; color: var(--text-4); margin-top: 2px; }

/* ============================================================
   15. TABS  ← widgets/tabs.html
   ============================================================ */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: var(--s-5); }
.tab {
  padding: 12px 16px; font-size: var(--text-sm); font-weight: 600;
  color: var(--text-3); border-bottom: 2px solid transparent; transition: all .15s;
}
.tab:hover { color: var(--text-1); }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ============================================================
   16. RANGE BAR  ← widgets/range_bar.html
   ============================================================ */
.range { position: relative; height: 12px; border-radius: var(--r-full); display: flex; overflow: hidden; }
.range__seg { height: 100%; }
.range__seg.low      { background: linear-gradient(90deg, #38bdf8, #06b6d4); }
.range__seg.optimal  { background: linear-gradient(90deg, #34d399, #10b981); }
.range__seg.sub      { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.range__seg.high     { background: linear-gradient(90deg, #fb923c, #f97316); }
.range__seg.crit     { background: linear-gradient(90deg, #fb7185, #ef4444); }
.range__marker {
  position: absolute; top: -6px; width: 4px; height: 24px; background: var(--text-1);
  border-radius: 2px; box-shadow: 0 4px 12px rgba(15,23,42,.20);
}
.range__marker::after {
  content: attr(data-val); position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%);
  background: var(--text-1); color: var(--bg-card); padding: 4px 10px; border-radius: var(--r-sm);
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.range__legend { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-4); font-size: var(--text-xs); color: var(--text-3); }
.range__legend-item { display: inline-flex; align-items: center; gap: 6px; }
.range__legend-item .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ============================================================
   17. EMPTY STATE  ← widgets/empty_state.html
   ============================================================ */
.empty { text-align: center; padding: var(--s-12) var(--s-6); color: var(--text-3); }
.empty__icon {
  width: 88px; height: 88px; border-radius: 50%;
  background: var(--grad-aurora); color: #fff;
  display: grid; place-items: center; margin: 0 auto var(--s-4);
  box-shadow: var(--shadow-glow);
}
.empty__title { color: var(--text-1); font-size: var(--text-2xl); margin-bottom: var(--s-2); }

/* ============================================================
   18. PROFILE CARD GRID
   ============================================================ */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s-4); }
.profile-card { padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-3); }
.profile-card__head { display: flex; align-items: center; gap: var(--s-3); }
.profile-card__name { font-weight: 700; font-family: var(--font-display); }
.profile-card__role { font-size: var(--text-xs); color: var(--text-3); }
.profile-card__meta { display: flex; flex-direction: column; gap: 6px; font-size: var(--text-xs); color: var(--text-3); padding-top: var(--s-3); border-top: 1px dashed var(--border); }
.profile-card__meta-row { display: flex; align-items: center; gap: 8px; }

/* ============================================================
   19. UTIL
   ============================================================ */
.row { display: flex; align-items: center; gap: var(--s-3); }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.muted { color: var(--text-3); }
.mono { font-family: var(--font-mono); font-size: 12px; }
.divider { height: 1px; background: var(--border); border: 0; margin: var(--s-5) 0; }
.kbd { font-family: var(--font-mono); font-size: 10px; padding: 2px 6px; border-radius: 4px; background: var(--bg-soft); border: 1px solid var(--border); color: var(--text-3); }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* ============================================================
   20. SALESDESK SHELL  (Aurora-redesigned · left/right preserved)
   Uses Aurora tokens so dark mode + theme cohesion work for free.
   In Django: salesdesk_ui/static/salesdesk_ui/css/sd.css
   ============================================================ */
.sd-shell {
  position: fixed; inset: 0; top: var(--nav-h);
  display: flex; flex-direction: column;
  background: var(--bg-page);
  font-family: var(--font-body); color: var(--text-1); z-index: 90;
}
.sd-shell h1, .sd-shell h2, .sd-shell h3 { font-family: var(--font-display); }

/* Sub-header (glass + indigo accent stripe) */
.sd-nav {
  position: relative;
  background: var(--bg-glass);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--s-6); height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-6);
}
.sd-nav::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--grad-primary); opacity: .8;
}
.sd-tabs {
  display: flex; align-items: center; gap: 2px;
  padding: 4px; background: var(--bg-soft); border-radius: var(--r-full);
}
.sd-tab {
  padding: 8px 16px; border-radius: var(--r-full);
  font-size: var(--text-sm); font-weight: 500; color: var(--text-2);
  display: inline-flex; align-items: center; gap: var(--s-2);
  white-space: nowrap; transition: all .15s;
}
.sd-tab:hover { color: var(--text-1); background: var(--bg-card); }
.sd-tab.active {
  background: var(--bg-card); color: var(--primary);
  font-weight: 600; box-shadow: var(--shadow-sm);
}
.sd-brand {
  display: inline-flex; align-items: center; gap: var(--s-3);
  font-weight: 800; font-family: var(--font-display);
  font-size: var(--text-md); color: var(--text-1);
}
.sd-brand .dot {
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: var(--grad-primary); color: #fff;
  display: grid; place-items: center; box-shadow: var(--shadow-glow);
}
.sd-brand small { display: block; font-size: 10px; color: var(--text-4); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; font-family: var(--font-body); }

.sd-main { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.sd-page { display: none; flex: 1; overflow: hidden; }
.sd-page.active { display: flex; flex-direction: column; }

/* Booking — left/right columns PRESERVED */
.sd-booking { display: grid; grid-template-columns: 5fr 7fr; height: 100%; }
.sd-left {
  background: var(--bg-page-soft);
  border-right: 1px solid var(--border);
  overflow: auto; padding: var(--s-6);
}
.sd-right {
  background: var(--bg-page); overflow: hidden;
  display: flex; flex-direction: column;
}
.sd-right-header {
  position: relative;
  background: var(--bg-page-soft);
  border-bottom: 1px solid var(--border);
  padding: var(--s-4) var(--s-6) var(--s-4) calc(var(--s-6) + 8px);
  display: flex; align-items: center; justify-content: space-between;
}
.sd-right-header::before {
  content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px;
  background: var(--grad-primary); border-radius: 0 4px 4px 0;
}
.sd-right-header h2 {
  color: var(--text-1); font-family: var(--font-display);
  font-weight: 800; font-size: var(--text-lg); letter-spacing: -.01em;
}
.sd-right-header .sub { font-size: var(--text-xs); color: var(--text-3); margin-top: 2px; }
.sd-live-pill {
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 4px 10px 4px 8px;
  border-radius: var(--r-full); letter-spacing: .08em;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 2px 8px rgba(239,68,68,.3);
}
.sd-live-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff;
  animation: sd-pulse 1.4s ease-in-out infinite;
}
@keyframes sd-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.sd-right-body { flex: 1; overflow: auto; padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); }

/* Paper = Aurora card */
.sd-paper {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--s-5);
  box-shadow: var(--shadow-md); transition: border-color .15s;
}
.sd-paper.tight { padding: var(--s-3); }
.sd-paper-title {
  font-family: var(--font-display); font-weight: 700;
  color: var(--text-1); font-size: var(--text-md);
  margin-bottom: var(--s-4); display: flex; align-items: center; gap: var(--s-3);
}
.sd-paper-title svg { color: var(--primary); }
.sd-paper-title .step {
  display: inline-grid; place-items: center; width: 26px; height: 26px;
  background: var(--grad-primary); color: #fff;
  border-radius: var(--r-sm); font-size: 12px; font-weight: 700;
  font-family: var(--font-display); flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(99,102,241,.30);
}

/* Form fields */
.sd-field label {
  display: block; font-size: var(--text-xs); font-weight: 600;
  color: var(--text-3); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: .06em;
}
.sd-field input, .sd-field select, .sd-field textarea {
  width: 100%; padding: 10px 12px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: var(--text-sm); font-family: inherit; color: var(--text-1);
  transition: all .15s;
}
.sd-field input:focus, .sd-field select:focus, .sd-field textarea:focus {
  outline: 0; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-bg);
}
.sd-field + .sd-field { margin-top: var(--s-3); }
.sd-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }

/* Buttons (Aurora-styled) */
.sd-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: var(--r-md);
  font-weight: 600; font-size: var(--text-sm); transition: all .15s;
  white-space: nowrap; border: 1px solid transparent;
}
.sd-btn.primary {
  background: var(--grad-primary); color: #fff;
  box-shadow: 0 4px 12px rgba(99,102,241,.30);
}
.sd-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(99,102,241,.40); }
.sd-btn.outline {
  border: 1px solid var(--border); color: var(--text-1); background: var(--bg-card);
}
.sd-btn.outline:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.sd-btn.subtle { background: var(--primary-bg); color: var(--primary); }
.sd-btn.subtle:hover { background: var(--primary); color: #fff; }
.sd-btn.lg { padding: 12px 20px; font-size: var(--text-md); }

/* Badges */
.sd-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-full);
  font-size: 10px; font-weight: 700; letter-spacing: .04em;
}
.sd-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sd-badge.green  { background: var(--success-bg); color: var(--success); }
.sd-badge.blue   { background: var(--info-bg);    color: var(--info); }
.sd-badge.yellow { background: var(--warn-bg);    color: var(--warn); }
.sd-badge.red    { background: var(--danger-bg);  color: var(--danger); }
.sd-badge.violet { background: var(--violet-bg);  color: var(--violet); }
.sd-badge.indigo { background: var(--primary-bg); color: var(--primary); }

/* Segmented */
.sd-segctl {
  display: inline-flex; padding: 4px; background: var(--bg-soft);
  border-radius: var(--r-md); gap: 2px;
}
.sd-segctl button {
  padding: 7px 14px; border-radius: var(--r-sm);
  font-size: var(--text-sm); font-weight: 600; color: var(--text-3); transition: all .15s;
}
.sd-segctl button:hover { color: var(--text-1); }
.sd-segctl button.active { background: var(--bg-card); color: var(--text-1); box-shadow: var(--shadow-sm); }

/* Calendar */
.sd-cal {
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--s-3); background: var(--bg-card); user-select: none; max-width: 320px;
}
.sd-cal-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 8px; }
.sd-cal-head .month { font-family: var(--font-display); font-weight: 700; font-size: var(--text-sm); }
.sd-cal-week { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; padding: 4px 8px; font-size: 10px; color: var(--text-4); text-align: center; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.sd-cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; padding: 0 8px 8px; }
.sd-cal-day {
  height: 36px; border-radius: var(--r-sm); font-size: var(--text-sm);
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all .12s;
}
.sd-cal-day:hover:not(.dim):not(.disabled) { background: var(--primary-bg); color: var(--primary); }
.sd-cal-day.dim { color: transparent; cursor: default; }
.sd-cal-day.disabled { color: var(--text-4); cursor: not-allowed; opacity: .4; }
.sd-cal-day.selected {
  background: var(--grad-primary); color: #fff; font-weight: 700;
  box-shadow: 0 4px 12px rgba(99,102,241,.30);
}
.sd-cal-day.today { box-shadow: inset 0 0 0 1.5px var(--primary); color: var(--primary); font-weight: 600; }

/* Slots */
.sd-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 6px; margin-top: var(--s-3); }
.sd-slot {
  padding: 9px 6px; border: 1px solid var(--border); background: var(--bg-card);
  border-radius: var(--r-sm); text-align: center; font-size: var(--text-xs); font-weight: 600;
  color: var(--text-2); cursor: pointer; transition: all .15s;
}
.sd-slot:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.sd-slot.selected {
  background: var(--grad-primary); border-color: transparent; color: #fff;
  box-shadow: 0 4px 10px rgba(99,102,241,.30);
}

/* Test card (Select a Test) */
.sd-test-card {
  text-align: left; cursor: pointer;
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--r-md); padding: var(--s-4);
  transition: all .15s; display: flex; flex-direction: column; gap: 4px;
}
.sd-test-card:hover {
  border-color: var(--primary); transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.sd-test-card.selected {
  border-color: var(--primary); background: var(--primary-bg);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.sd-test-card .name { font-weight: 700; font-family: var(--font-display); color: var(--text-1); font-size: var(--text-md); }
.sd-test-card.selected .name { color: var(--primary); }
.sd-test-card .meta { font-size: 11px; color: var(--text-3); }
.sd-test-card .price { font-family: var(--font-display); font-weight: 800; color: var(--text-1); margin-top: 4px; }
.sd-test-card.selected .price { color: var(--primary); }

/* Summary — indigo gradient hero */
.sd-summary {
  position: relative; overflow: hidden;
  background: var(--grad-primary); color: #fff;
  border-radius: var(--r-xl); padding: var(--s-6);
  box-shadow: var(--shadow-glow);
}
.sd-summary::after {
  content: ''; position: absolute; right: -60px; bottom: -60px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.22), transparent 70%);
  pointer-events: none;
}
.sd-summary-title {
  font-family: var(--font-display); font-weight: 800;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  margin-bottom: var(--s-3); opacity: .9; position: relative; z-index: 1;
}
.sd-summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: var(--text-sm); position: relative; z-index: 1; }
.sd-summary-row.total {
  font-size: var(--text-xl); font-weight: 800; color: #fff;
  border-top: 1px solid rgba(255,255,255,.25);
  padding-top: var(--s-3); margin-top: var(--s-2);
  font-family: var(--font-display);
}

/* Phase-1 callout (left panel notice) */
.sd-callout {
  margin-top: var(--s-4); padding: var(--s-3) var(--s-4);
  background: var(--primary-bg); border: 1px dashed var(--primary);
  border-radius: var(--r-md);
}
.sd-callout .lbl { font-size: 11px; color: var(--primary); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.sd-callout .msg { font-size: 11px; color: var(--text-2); margin-top: 4px; }

/* Page header for tables (bookings/payments/admin) */
.sd-page-header {
  padding: var(--s-5) var(--s-6); display: flex; justify-content: space-between;
  align-items: center; border-bottom: 1px solid var(--border); background: var(--bg-page-soft);
}
.sd-page-header h2 { font-size: var(--text-2xl); font-family: var(--font-display); font-weight: 800; color: var(--text-1); letter-spacing: -.01em; }
.sd-page-header .sub { font-size: var(--text-xs); color: var(--text-3); margin-top: 2px; }
.sd-page-body { flex: 1; overflow: auto; padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-5); }

/* Stats */
.sd-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-4); }
.sd-stat {
  background: var(--bg-card); border-radius: var(--r-lg); padding: var(--s-4) var(--s-5);
  box-shadow: var(--shadow-md); border: 1px solid var(--border);
}
.sd-stat .label { font-size: var(--text-xs); color: var(--text-3); text-transform: uppercase; font-weight: 600; letter-spacing: .06em; }
.sd-stat .value {
  font-size: var(--text-3xl); font-weight: 800; color: var(--text-1);
  margin-top: 4px; font-family: var(--font-display); letter-spacing: -.02em;
}

/* Tables */
.sd-table-wrap {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-md);
  overflow: hidden;
}
.sd-table { width: 100%; border-collapse: collapse; }
.sd-table thead th {
  text-align: left; padding: 12px var(--s-5); background: var(--bg-softer);
  border-bottom: 1px solid var(--border); font-size: var(--text-xs); font-weight: 600;
  text-transform: uppercase; color: var(--text-3); letter-spacing: .06em;
}
.sd-table tbody td { padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--border); font-size: var(--text-sm); color: var(--text-1); }
.sd-table tbody tr:last-child td { border-bottom: 0; }
.sd-table tbody tr { transition: background .15s; }
.sd-table tbody tr:hover { background: var(--bg-hover); }

/* Toast */
.sd-toast {
  position: fixed; bottom: 20px; right: 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  padding: var(--s-3) var(--s-5); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); font-size: var(--text-sm);
  color: var(--text-1); font-weight: 600;
  opacity: 0; transform: translateY(20px); transition: all .25s;
  pointer-events: none; z-index: 9999;
}
.sd-toast.show { opacity: 1; transform: translateY(0); }
