/* =========================================================
   Dispatch Analytics — OMG Marketing
   Sleek ops dashboard · light + dark · Satoshi
   ========================================================= */

/* ---------- tokens: light (default) ---------- */
:root, [data-theme='light'] {
  /* surfaces */
  --bg:            #fafaf9;
  --surface:       #ffffff;
  --surface-2:     #f5f5f4;
  --surface-3:     #ececea;
  --surface-hover: #f0f0ee;

  /* ink */
  --ink:           #0a0a0a;
  --ink-1:         #27272a;
  --ink-2:         #52525b;
  --ink-3:         #71717a;
  --ink-4:         #a1a1aa;
  --ink-inverse:   #fafafa;

  /* lines */
  --line:          #e7e5e4;
  --line-strong:   #d6d3d1;
  --line-faint:    #f0efee;

  /* accent — electric indigo */
  --accent:        #5b5bd6;
  --accent-hover:  #4f46c4;
  --accent-soft:   #eef0fb;
  --accent-ink:    #ffffff;

  /* semantic */
  --ok:            #0f766e;
  --ok-soft:       #e4f3f0;
  --warn:          #b45309;
  --warn-soft:     #fbf1dc;
  --bad:           #b91c1c;
  --bad-soft:      #fbe9e9;
  --info:          #1d4ed8;
  --info-soft:     #e4ecfb;

  /* chart */
  --chart-1: #5b5bd6;
  --chart-2: #0f766e;
  --chart-3: #b45309;
  --chart-4: #b91c1c;
  --chart-5: #7e22ce;
  --chart-grid: rgba(0,0,0,0.06);

  /* shadows — feather-light */
  --shadow-xs: 0 1px 0 rgba(0,0,0,0.03);
  --shadow-sm: 0 1px 2px rgba(10,10,10,0.04), 0 0 0 1px rgba(10,10,10,0.03);
  --shadow-md: 0 4px 12px rgba(10,10,10,0.06);
  --shadow-lg: 0 12px 32px rgba(10,10,10,0.08);

  /* logo inversion */
  --logo-filter: none;
}

[data-theme='dark'] {
  --bg:            #0a0a0a;
  --surface:       #111111;
  --surface-2:     #161616;
  --surface-3:     #1d1d1d;
  --surface-hover: #1a1a1a;

  --ink:           #fafafa;
  --ink-1:         #e4e4e7;
  --ink-2:         #a1a1aa;
  --ink-3:         #71717a;
  --ink-4:         #52525b;
  --ink-inverse:   #0a0a0a;

  --line:          #27272a;
  --line-strong:   #3f3f46;
  --line-faint:    #1a1a1a;

  --accent:        #818cf8;
  --accent-hover:  #a5b4fc;
  --accent-soft:   #1e1b3e;
  --accent-ink:    #0a0a0a;

  --ok:            #4ade80;
  --ok-soft:       #0f2b1a;
  --warn:          #fbbf24;
  --warn-soft:     #2d1f08;
  --bad:           #f87171;
  --bad-soft:      #2d1414;
  --info:          #93bbfd;
  --info-soft:     #0f1a2e;

  --chart-1: #818cf8;
  --chart-2: #4ade80;
  --chart-3: #fbbf24;
  --chart-4: #f87171;
  --chart-5: #c084fc;
  --chart-grid: rgba(255,255,255,0.06);

  --shadow-xs: 0 0 0 1px rgba(255,255,255,0.02);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 20px 48px rgba(0,0,0,0.6);

  --logo-filter: invert(1);
}

/* respect OS dark mode when no explicit theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0a0a0a; --surface: #111111; --surface-2: #161616; --surface-3: #1d1d1d;
    --surface-hover: #1a1a1a;
    --ink: #fafafa; --ink-1: #e4e4e7; --ink-2: #a1a1aa; --ink-3: #71717a; --ink-4: #52525b;
    --line: #27272a; --line-strong: #3f3f46; --line-faint: #1a1a1a;
    --accent: #818cf8; --accent-hover: #a5b4fc; --accent-soft: #1e1b3e; --accent-ink: #0a0a0a;
    --ok: #4ade80; --ok-soft: #0f2b1a; --warn: #fbbf24; --warn-soft: #2d1f08;
    --bad: #f87171; --bad-soft: #2d1414; --info: #93bbfd; --info-soft: #0f1a2e;
    --chart-1: #818cf8; --chart-2: #4ade80; --chart-3: #fbbf24; --chart-4: #f87171; --chart-5: #c084fc;
    --chart-grid: rgba(255,255,255,0.06);
    --logo-filter: invert(1);
  }
}

/* ---------- legacy variable aliases (keep Chart.js + old code working) ---------- */
:root, [data-theme='light'] {
  --color-bg: var(--bg);
  --color-surface: var(--surface);
  --color-surface-2: var(--surface-2);
  --color-surface-offset: var(--surface-3);
  --color-surface-offset-2: var(--surface-hover);
  --color-divider: var(--line);
  --color-border: var(--line-strong);
  --color-text: var(--ink);
  --color-text-muted: var(--ink-2);
  --color-text-faint: var(--ink-3);
  --color-text-inverse: var(--ink-inverse);
  --color-primary: var(--accent);
  --color-primary-hover: var(--accent-hover);
  --color-primary-highlight: var(--accent-soft);
  --color-success: var(--ok);
  --color-success-highlight: var(--ok-soft);
  --color-warning: var(--warn);
  --color-warning-highlight: var(--warn-soft);
  --color-danger: var(--bad);
  --color-danger-highlight: var(--bad-soft);
  --color-info: var(--info);
  --color-info-highlight: var(--info-soft);
  --color-purple: var(--chart-5);
  --color-purple-highlight: color-mix(in srgb, var(--chart-5) 15%, transparent);
}

/* ---------- shared scalars ---------- */
:root {
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 180ms;

  --font-body: 'Satoshi', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --text-xs:  0.75rem;
  --text-sm:  0.8125rem;
  --text-base: 0.9375rem;
  --text-md:  1rem;
  --text-lg:  1.125rem;
  --text-xl:  1.375rem;
  --text-2xl: 1.75rem;
  --text-3xl: clamp(1.875rem, 1.5rem + 1.5vw, 2.625rem);

  --max-w: 1360px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; scroll-behavior: smooth; overflow-x: hidden; }
body {
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  font-feature-settings: "ss01","cv11","tnum" 0;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
table { border-collapse: collapse; width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
::selection { background: var(--accent); color: var(--accent-ink); }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 14px; min-width: 0;
}
.brand-logo {
  height: 22px; width: auto;
  flex-shrink: 0;
  transition: opacity var(--dur) var(--ease);
}
/* show black logo in light mode, white logo in dark mode */
.brand-logo--light { display: block; }
.brand-logo--dark  { display: none; }
[data-theme='dark'] .brand-logo--light { display: none; }
[data-theme='dark'] .brand-logo--dark  { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .brand-logo--light { display: none; }
  :root:not([data-theme]) .brand-logo--dark  { display: block; }
}
.brand-divider {
  width: 1px; height: 22px;
  background: var(--line-strong);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  font-size: 0.9375rem; font-weight: 600;
  letter-spacing: -0.01em; color: var(--ink);
  white-space: nowrap;
}
.brand-sub {
  font-size: 0.75rem; font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0.01em;
}
.top-actions { display: flex; align-items: center; gap: 10px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.75rem; font-weight: 500;
  padding: 5px 10px; border-radius: var(--radius-full);
  background: var(--surface-2); color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.badge.live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: 0.55 } }

.icon-btn {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--ink-2);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: all var(--dur) var(--ease);
}
.icon-btn:hover {
  color: var(--ink); border-color: var(--line-strong);
  background: var(--surface-hover);
}

/* ---------- layout ---------- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 28px 28px 80px;
}

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 2px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 28px;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 16px;
  border-radius: 7px;
  font-size: var(--text-sm); font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
}
.tab:hover { color: var(--ink); }
.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ---------- hero section ---------- */
.hero { margin-bottom: 32px; max-width: 760px; }
.hero h1 {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--ink);
  margin-bottom: 12px;
}
.hero .sub {
  font-size: var(--text-md);
  color: var(--ink-2);
  max-width: 620px;
  line-height: 1.55;
}
.hero .sub strong { color: var(--ink); font-weight: 600; }

.filters {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 20px;
}
.seg {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.seg-btn {
  padding: 6px 14px;
  font-size: var(--text-sm); font-weight: 500;
  color: var(--ink-2);
  border-radius: 7px;
  transition: all var(--dur) var(--ease);
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ---------- KPI row ---------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.kpi {
  position: relative;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur) var(--ease);
}
.kpi:hover { border-color: var(--line-strong); }
.kpi-label {
  font-size: 0.75rem; font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 1.75rem; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.kpi-delta {
  font-size: 0.75rem; font-weight: 500;
  margin-top: 6px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.kpi-delta.up { color: var(--ok); }
.kpi-delta.down { color: var(--bad); }

/* ---------- card blocks ---------- */
.card-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 20px;
  transition: border-color var(--dur) var(--ease);
}
.card-block:hover { border-color: var(--line-strong); }
.block-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.block-head h2 {
  font-size: var(--text-lg); font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.hint {
  font-size: var(--text-sm);
  color: var(--ink-3);
}
.muted { color: var(--ink-3); }

.alert-block {
  border-color: color-mix(in srgb, var(--bad) 30%, var(--line));
  background: color-mix(in srgb, var(--bad-soft) 40%, var(--surface));
}
.warning-block {
  border-color: color-mix(in srgb, var(--warn) 25%, var(--line));
  background: color-mix(in srgb, var(--warn-soft) 30%, var(--surface));
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  scrollbar-width: thin;
}
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }

.data-table {
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.data-table thead th {
  position: sticky; top: 0;
  background: var(--surface-2);
  text-align: right;
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--ink-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table thead th.th-main,
.data-table thead th.th-rank,
.data-table thead th:first-child { text-align: left; }
.data-table thead th.split { border-left: 1px solid var(--line); }

.data-table tbody td {
  padding: 12px;
  text-align: right;
  border-bottom: 1px solid var(--line-faint);
  color: var(--ink-1);
  vertical-align: middle;
}
.data-table tbody td.th-main,
.data-table tbody td.name-col,
.data-table tbody td:first-child {
  text-align: left;
  color: var(--ink);
  font-weight: 500;
}
.data-table tbody td.split { border-left: 1px solid var(--line-faint); }
.data-table tbody tr { transition: background var(--dur) var(--ease); }
.data-table tbody tr:hover { background: var(--surface-2); cursor: pointer; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .right { text-align: right; }

.th-rank { width: 42px; color: var(--ink-3); font-weight: 500; }
.rank-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.75rem; font-weight: 600;
  border: 1px solid var(--line);
}
.rank-num.rank-1 { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.name-cell {
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  flex-shrink: 0;
  letter-spacing: 0;
}
.avatar.v2 { background: #0f766e; }
.avatar.v3 { background: #b45309; }
.avatar.v4 { background: #7e22ce; }
.avatar.v5 { background: #b91c1c; }

/* ---------- chips & pills ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  font-size: 0.75rem; font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  transition: all var(--dur) var(--ease);
}
.chip:hover { background: var(--surface-hover); color: var(--ink); }
.chip.active {
  background: var(--ink); color: var(--ink-inverse);
  border-color: var(--ink);
}
.chip.ok    { background: var(--ok-soft);   color: var(--ok);   border-color: transparent; }
.chip.warn  { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad   { background: var(--bad-soft);  color: var(--bad);  border-color: transparent; }
.chip.info  { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.accent{ background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 6px; vertical-align: baseline;
}
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- dispatcher callouts ---------- */
.callout-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.callout {
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur) var(--ease);
}
.callout:hover { border-color: var(--line-strong); }
.callout-eyebrow {
  font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3);
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.callout-eyebrow .dot { margin: 0; width: 6px; height: 6px; }
.callout-value {
  font-size: 1.25rem; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 4px;
}
.callout-detail {
  font-size: 0.8125rem;
  color: var(--ink-2);
  line-height: 1.45;
}
.callout.win   { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.callout.alert { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.callout.warn  { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.callout.info  { border-color: color-mix(in srgb, var(--info) 35%, var(--line)); }

/* ---------- leaderboard enhancements ---------- */
.leader-table tbody td { padding: 14px 12px; }
.resp-cell {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.resp-cell.ok   { color: var(--ok); }
.resp-cell.warn { color: var(--warn); }
.resp-cell.bad  { color: var(--bad); }

.compliance-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.compliance-pill.ok   { background: var(--ok-soft);   color: var(--ok); }
.compliance-pill.warn { background: var(--warn-soft); color: var(--warn); }
.compliance-pill.bad  { background: var(--bad-soft);  color: var(--bad); }

.table-legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
  font-size: 0.75rem; color: var(--ink-3);
  padding-top: 16px; margin-top: 4px;
  border-top: 1px solid var(--line-faint);
}
.table-legend .spacer { flex: 1; }
.table-legend em { color: var(--ink-2); font-style: normal; font-weight: 500; }

/* ---------- leads / call-first boards ---------- */
.leads-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.lead-stat {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.lead-stat-label {
  font-size: 0.75rem; color: var(--ink-3); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.03em;
  margin-bottom: 6px;
}
.lead-stat-value {
  font-size: 1.5rem; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.lead-stat-sub { font-size: 0.75rem; color: var(--ink-3); margin-top: 2px; }

.disp-bar-row {
  display: grid;
  grid-template-columns: 170px 1fr 110px;
  align-items: center; gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-faint);
  font-size: var(--text-sm);
}
.disp-bar-row:last-child { border-bottom: 0; }
.disp-bar-name { font-weight: 500; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.disp-bar-track {
  height: 8px; border-radius: var(--radius-full);
  background: var(--surface-3);
  overflow: hidden; position: relative;
}
.disp-bar-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: var(--accent);
  border-radius: inherit;
  transition: width 400ms var(--ease);
}
.disp-bar-fill.ok   { background: var(--ok); }
.disp-bar-fill.warn { background: var(--warn); }
.disp-bar-fill.bad  { background: var(--bad); }
.disp-bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600; color: var(--ink-1);
  font-size: 0.8125rem;
}

/* ---------- heatmap ---------- */
.heatmap-wrap {
  overflow-x: auto;
  scrollbar-width: thin;
}
.heatmap-grid {
  display: grid;
  gap: 3px;
  min-width: 660px;
  padding: 4px 0;
}
.heatmap-cell {
  height: 26px;
  border-radius: 4px;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.6875rem;
  color: var(--ink-3);
  transition: transform var(--dur) var(--ease);
}
.heatmap-cell[data-val="1"] { background: color-mix(in srgb, var(--accent) 18%, var(--surface-3)); }
.heatmap-cell[data-val="2"] { background: color-mix(in srgb, var(--accent) 36%, var(--surface-3)); color: var(--ink-1); }
.heatmap-cell[data-val="3"] { background: color-mix(in srgb, var(--accent) 60%, var(--surface-3)); color: white; }
.heatmap-cell[data-val="4"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.heatmap-cell:hover { transform: scale(1.1); z-index: 1; }
.heatmap-label {
  font-size: 0.75rem; color: var(--ink-3);
  font-weight: 500;
  padding-right: 12px;
  display: flex; align-items: center;
  white-space: nowrap;
}
.heatmap-col-labels {
  display: grid;
  font-size: 0.6875rem; color: var(--ink-4);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-faint);
  margin-bottom: 6px;
}

/* ---------- profile cards ---------- */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 24px;
}
.profile-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--dur) var(--ease);
}
.profile-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.profile-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
}
.profile-card.tier-star::before { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.profile-card.tier-strong::before { background: var(--ok); }
.profile-card.tier-solid::before { background: var(--accent); }
.profile-card.tier-growth::before { background: var(--warn); }
.profile-card.tier-focus::before { background: var(--bad); }

.profile-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px;
}
.profile-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.125rem; font-weight: 700;
  letter-spacing: 0;
  flex-shrink: 0;
}
.profile-card.tier-star .profile-avatar { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1a1a1a; }
.profile-card.tier-strong .profile-avatar { background: var(--ok); color: white; }
.profile-card.tier-growth .profile-avatar { background: var(--warn); color: white; }
.profile-card.tier-focus .profile-avatar { background: var(--bad); color: white; }

.profile-name {
  font-size: 1.125rem; font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.2;
}
.profile-tier {
  font-size: 0.75rem; font-weight: 500;
  color: var(--ink-3);
  margin-top: 2px;
  display: inline-flex; align-items: center; gap: 6px;
}

.profile-headline {
  font-size: var(--text-sm);
  color: var(--ink-1);
  margin-bottom: 18px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
  line-height: 1.5;
}
.profile-card.tier-star .profile-headline { border-left-color: #f59e0b; }
.profile-card.tier-strong .profile-headline { border-left-color: var(--ok); }
.profile-card.tier-growth .profile-headline { border-left-color: var(--warn); }
.profile-card.tier-focus .profile-headline { border-left-color: var(--bad); }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.profile-stat {
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--line-faint);
}
.profile-stat-label {
  font-size: 0.6875rem; font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}
.profile-stat-value {
  font-size: 0.9375rem; font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.profile-stat-value.ok   { color: var(--ok); }
.profile-stat-value.warn { color: var(--warn); }
.profile-stat-value.bad  { color: var(--bad); }

.profile-section {
  margin-bottom: 14px;
}
.profile-section:last-child { margin-bottom: 0; }
.profile-section-title {
  font-size: 0.75rem; font-weight: 600;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.profile-section-title .icon {
  width: 14px; height: 14px;
  display: inline-flex; align-items: center; justify-content: center;
}
.profile-list {
  list-style: none;
  display: flex; flex-direction: column;
  gap: 6px;
}
.profile-list li {
  font-size: 0.8125rem;
  color: var(--ink-1);
  padding-left: 18px;
  position: relative;
  line-height: 1.5;
}
.profile-list.wins li::before {
  content: "";
  position: absolute; left: 0; top: 7px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ok-soft);
  border: 2px solid var(--ok);
}
.profile-list.growth li::before {
  content: "→";
  position: absolute; left: 0; top: 0;
  color: var(--warn);
  font-weight: 700;
  font-size: 0.9rem;
}
.profile-coaching {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--accent-soft);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--ink-1);
  line-height: 1.55;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}
.profile-coaching strong {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(520px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  transform: translateX(100%);
  transition: transform 280ms var(--ease);
  z-index: 60;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer-inner { display: flex; flex-direction: column; height: 100%; }
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}
.drawer-eyebrow {
  font-size: 0.6875rem; font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.drawer-head h3 {
  font-size: 1.125rem; font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.drawer-body {
  flex: 1; overflow-y: auto;
  padding: 22px 24px;
}
.drawer-scrim {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none;
  transition: opacity 280ms var(--ease);
  z-index: 55;
  backdrop-filter: blur(2px);
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
[data-theme='dark'] .drawer-scrim.open { background: rgba(0,0,0,0.65); }

/* ---------- pager, buttons ---------- */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding-top: 16px;
}
.btn-ghost {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 500;
  color: var(--ink-1);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: all var(--dur) var(--ease);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

/* ---------- footer ---------- */
.foot {
  display: flex; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  padding: 32px 0 0;
  margin-top: 40px;
  border-top: 1px solid var(--line);
  font-size: var(--text-sm);
  color: var(--ink-3);
}
.foot code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 2px 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-2);
}

/* ---------- chart wrap ---------- */
.chart-wrap {
  position: relative;
  height: 280px;
  width: 100%;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .topbar {
    padding: 10px 14px;
    gap: 10px;
  }
  .container { padding: 18px 14px 64px; }
  .brand { gap: 10px; }
  .brand-logo { height: 18px; }
  .brand-divider { display: none; }
  .brand-sub { display: none; }
  .brand-name { font-size: 0.875rem; }
  .top-actions { gap: 6px; }
  .badge { font-size: 0.6875rem; padding: 4px 8px; }
  .badge.live { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .icon-btn { width: 34px; height: 34px; }

  .tabs { margin-bottom: 20px; }
  .tab { padding: 7px 14px; }

  .hero { margin-bottom: 22px; }
  .hero h1 { font-size: 1.5rem; line-height: 1.15; }
  .hero .sub { font-size: 0.9375rem; }
  .hero--dispatch h1 { font-size: 1.6rem; line-height: 1.1; margin-bottom: 10px; }

  .filters { gap: 8px; margin-top: 16px; }
  .seg { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg-btn { padding: 6px 12px; font-size: 0.8125rem; flex-shrink: 0; }

  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; }
  .kpi { padding: 14px 14px; border-radius: var(--radius-md); }
  .kpi-label { font-size: 0.6875rem; margin-bottom: 6px; }
  .kpi-value { font-size: 1.375rem; }
  .kpi-delta { font-size: 0.6875rem; }

  .card-block { padding: 16px 14px; margin-bottom: 14px; border-radius: var(--radius-md); }
  .block-head { margin-bottom: 12px; gap: 10px; }
  .block-head h2 { font-size: 1rem; }
  .hint { font-size: 0.75rem; }

  .grid-two { grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }

  .disp-bar-row { grid-template-columns: 120px 1fr 70px; gap: 8px; }
  .profile-grid { grid-template-columns: 1fr; }
  .callout-row { grid-template-columns: 1fr; }

  /* tables: keep in scroll container with clear affordance */
  .table-wrap {
    margin: 0 -14px;
    padding: 0 14px 8px;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  }
  .data-table { font-size: 0.8125rem; }
  .data-table thead th { padding: 8px 10px; font-size: 0.6875rem; }
  .data-table tbody td { padding: 10px; }
  .data-table tbody td.td-main, .data-table tbody td.name-col, .data-table tbody td:first-child { min-width: 130px; white-space: normal; }
  .dispatch-name { font-size: 0.875rem; }
  .dispatch-sub { font-size: 0.6875rem; }

  .prev-day-note { font-size: 0.75rem; padding: 7px 12px; }

  .team-pledge { padding: 12px 14px; font-size: 0.8125rem; }
}

@media (max-width: 420px) {
  .container { padding: 14px 12px 60px; }
  .topbar { padding: 9px 12px; }
  .hero--dispatch h1 { font-size: 1.45rem; }
  .kpi-value { font-size: 1.25rem; }
  .badge.live { font-size: 0.625rem; max-width: 96px; padding: 3px 7px; }
  .badge.live::before { width: 5px; height: 5px; }
  .seg-btn { padding: 6px 10px; font-size: 0.78rem; }
}

/* ---------- legacy class aliases (keep app.js working) ---------- */
.callout .eyebrow { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 10px; }
.callout .headline { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); line-height: 1.2; margin-bottom: 4px; }
.callout .subline { font-size: 0.8125rem; color: var(--ink-2); line-height: 1.45; }
.callout.good  { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.callout.bad   { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.callout.warn  { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pill.resp-fast { background: var(--ok-soft);   color: var(--ok); }
.pill.resp-ok   { background: var(--ok-soft);   color: var(--ok); }
.pill.resp-slow { background: var(--warn-soft); color: var(--warn); }
.pill.resp-bad  { background: var(--bad-soft);  color: var(--bad); }
.pill.compliance-ok   { background: var(--ok-soft);   color: var(--ok); }
.pill.compliance-warn { background: var(--warn-soft); color: var(--warn); }
.pill.compliance-bad  { background: var(--bad-soft);  color: var(--bad); }

/* ---- leaderboard: time pill + rank number + td ---- */
.time-pill {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 0.75rem; font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2); color: var(--ink-1);
  border: 1px solid var(--line);
}
.time-pill.ok   { background: var(--ok-soft);   color: var(--ok);   border-color: transparent; }
.time-pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.time-pill.bad  { background: var(--bad-soft);  color: var(--bad);  border-color: transparent; }

.data-table tbody td.rank-num {
  text-align: center;
  color: var(--ink-3); font-weight: 600;
  font-size: 0.8125rem;
  padding: 12px 8px;
}
.data-table tbody td.rank-num.crown { color: #f59e0b; font-size: 1rem; }
.data-table tbody td.rank-num.bot   { color: var(--bad); }

.data-table tbody td.td-main { text-align: left; }
.dispatch-name { font-weight: 600; color: var(--ink); font-size: 0.9375rem; }
.dispatch-sub  { font-size: 0.75rem; color: var(--ink-3); margin-top: 2px; }

.data-table tbody tr.rank-1 { background: color-mix(in srgb, var(--ok) 5%, transparent); }
.data-table tbody tr.rank-last { background: color-mix(in srgb, var(--bad) 4%, transparent); }

/* ---- lead-stat cards (summary strip) ---- */
.lead-stat {
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.lead-stat .num {
  font-size: 1.625rem; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.lead-stat .lbl {
  font-size: 0.7rem; font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 6px;
}
.lead-stat.good { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.lead-stat.good .num { color: var(--ok); }
.lead-stat.bad  { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.lead-stat.bad  .num { color: var(--bad); }
.lead-stat.warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.lead-stat.warn .num { color: var(--warn); }

/* ---- call-first rows (bar chart list) ---- */
.call-first-list { display: flex; flex-direction: column; }
.cf-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.2fr) minmax(140px, 2fr) 110px;
  align-items: center; gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-faint);
}
.cf-row:last-child { border-bottom: 0; }
.cf-name { font-weight: 600; color: var(--ink); font-size: 0.9rem; }
.cf-sub  { font-size: 0.75rem; color: var(--ink-3); margin-top: 2px; }
.cf-sub strong { color: var(--ink-1); font-weight: 600; }
.cf-bar {
  height: 10px; border-radius: var(--radius-full);
  background: var(--surface-3); overflow: hidden; position: relative;
}
.cf-bar-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: linear-gradient(90deg, var(--bad), var(--warn) 50%, var(--ok));
  border-radius: inherit;
  transition: width 500ms var(--ease);
}
.cf-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700; color: var(--ink);
  font-size: 1rem;
  letter-spacing: -0.01em;
}
.cf-pct .ideal {
  display: block;
  font-size: 0.625rem; font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ---- recovery board ---- */
.recovery-list { display: flex; flex-direction: column; }
.recovery-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center; gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-faint);
}
.recovery-row:last-child { border-bottom: 0; }
.recovery-row.crown .recovery-rank { color: #f59e0b; font-size: 1.25rem; }
.recovery-rank {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.8125rem; font-weight: 600;
  border: 1px solid var(--line);
}
.recovery-name { font-weight: 600; color: var(--ink); font-size: 0.9375rem; }
.recovery-sub  { font-size: 0.75rem; color: var(--ink-3); margin-top: 2px; }
.recovery-metric { text-align: right; }
.recovery-metric .big {
  font-size: 1.5rem; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.recovery-metric .lil {
  font-size: 0.6875rem; font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-top: 4px;
}

/* ---- heatmap (app.js emits .heatmap / .hm-name / .hm-hd / .hm-cell) ---- */
.heatmap {
  display: grid;
  grid-template-columns: 140px repeat(24, minmax(28px, 1fr));
  gap: 3px;
  min-width: 820px;
  font-size: 0.6875rem;
}
.hm-name {
  display: flex; align-items: center;
  font-size: 0.75rem; font-weight: 500;
  color: var(--ink-1);
  padding-right: 10px;
  white-space: nowrap;
  border-right: 1px solid var(--line-faint);
}
.hm-hd {
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--ink-3);
  padding-bottom: 6px;
  font-variant-numeric: tabular-nums;
}
.hm-cell {
  height: 26px;
  border-radius: 4px;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.625rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  transition: transform var(--dur) var(--ease);
  cursor: default;
}
.hm-cell[data-level="1"] { background: color-mix(in srgb, var(--accent) 12%, var(--surface-3)); }
.hm-cell[data-level="2"] { background: color-mix(in srgb, var(--accent) 28%, var(--surface-3)); color: var(--ink-1); }
.hm-cell[data-level="3"] { background: color-mix(in srgb, var(--accent) 48%, var(--surface-3)); color: white; }
.hm-cell[data-level="4"] { background: color-mix(in srgb, var(--accent) 72%, var(--surface-3)); color: white; font-weight: 600; }
.hm-cell[data-level="5"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.hm-cell:hover { transform: scale(1.15); z-index: 2; }

/* ---------- utility ---------- */
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* =================================================================
   FUTURISTIC HERO — dispatch scene
   ================================================================= */
.hero--dispatch {
  max-width: 100%;
  margin-bottom: 40px;
}
.hero-scene {
  position: relative;
  width: 100%;
  aspect-ratio: 1200 / 420;
  max-height: 440px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 0%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 60%),
    linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  margin-bottom: 22px;
}
[data-theme='dark'] .hero-scene {
  background:
    radial-gradient(ellipse 80% 60% at 50% 100%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%),
    linear-gradient(180deg, #0d0d12 0%, #08080c 100%);
}
.hero-scene-inner {
  position: absolute; inset: 0;
}
.hero-svg {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--accent) 10%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--accent) 10%, transparent) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 70%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 70%, #000 30%, transparent 100%);
  opacity: 0.5;
}
.hero-scanline {
  position: absolute; left: 0; right: 0; top: -2px;
  height: 2px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 55%, transparent), transparent);
  opacity: 0;
  animation: scanline 8s linear infinite;
  animation-delay: 1s;
  pointer-events: none;
  will-change: transform, opacity;
}
@keyframes scanline {
  0%   { transform: translateY(0);    opacity: 0; }
  5%   { opacity: 0.85; }
  95%  { opacity: 0.85; }
  100% { transform: translateY(440px); opacity: 0; }
}

/* radar sweep — SVG <g> CSS transforms override parent attr transform,
   so bake (600,230) translate into both the default state and the keyframes. */
.hero-radar {
  transform: translate(410px, 215px);
  transform-origin: 0 0;
  animation: radar-sweep 9s linear infinite;
}
@keyframes radar-sweep {
  from { transform: translate(410px, 215px) rotate(0deg); }
  to   { transform: translate(410px, 215px) rotate(360deg); }
}

/* dispatcher aura pulse — opacity only, no scale to avoid SVG transform issues */
.hero-disp-aura {
  animation: aura-pulse 4s ease-in-out infinite;
}
.hero-disp-aura--2 {
  animation: aura-pulse 4s ease-in-out infinite;
  animation-delay: 2s;
}
@keyframes aura-pulse {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* live dot on headset */
.hero-live {
  animation: live-blink 1.4s ease-in-out infinite;
}
@keyframes live-blink {
  0%, 100% { opacity: 1;   }
  50%      { opacity: 0.35; }
}

/* houses — ring and light up.
   NOTE: SVG CSS transforms OVERRIDE the parent attribute transform, so we
   do NOT animate transform on .house (would pin it to 0,0). Instead we
   animate the inner aura/window only. The "ring" feel comes from the aura
   flash + window pulse. */
.house-aura {
  opacity: 0;
  animation: aura-flash 6s ease-in-out infinite;
  animation-delay: var(--ring-delay, 0s);
}
.house-window {
  animation: window-glow 6s ease-in-out infinite;
  animation-delay: var(--ring-delay, 0s);
  filter: drop-shadow(0 0 4px var(--warn));
}
@keyframes aura-flash {
  0%, 65%, 100% { opacity: 0; }
  75%           { opacity: 1; }
  90%           { opacity: 0.3; }
}
@keyframes window-glow {
  0%, 60%, 100% { fill: color-mix(in srgb, var(--warn) 45%, var(--surface-3)); }
  75%           { fill: var(--warn); }
}

/* beam — signal travels from house to dispatcher */
.hero-beams .beam {
  stroke-width: 1.5;
  stroke-dasharray: 18 280;
  stroke-dashoffset: 0;
  opacity: 0;
  animation: beam-travel 6s ease-in-out infinite;
}
.hero-beams .beam:nth-child(1) { animation-delay: 0s;   }
.hero-beams .beam:nth-child(2) { animation-delay: 1.1s; }
.hero-beams .beam:nth-child(3) { animation-delay: 2.2s; }
.hero-beams .beam:nth-child(4) { animation-delay: 0.6s; }
.hero-beams .beam:nth-child(5) { animation-delay: 1.7s; }
.hero-beams .beam:nth-child(6) { animation-delay: 2.8s; }
@keyframes beam-travel {
  0%   { stroke-dashoffset: 0;    opacity: 0; }
  8%   { opacity: 0.85; }
  40%  { stroke-dashoffset: -280; opacity: 0.6; }
  60%  { stroke-dashoffset: -280; opacity: 0; }
  100% { stroke-dashoffset: -280; opacity: 0; }
}

/* headset subtle breathing — opacity only, no transform so parent transform is preserved */
.hero-headset {
  animation: headset-breathe 4s ease-in-out infinite;
}
@keyframes headset-breathe {
  0%, 100% { opacity: 0.92; }
  50%      { opacity: 1; }
}

/* stat tickers overlay — top-right of scene, away from map + headset */
.hero-ticker {
  position: absolute;
  right: 20px; top: 18px;
  display: flex; gap: 10px; flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 55%;
  z-index: 2;
}
.ticker-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.ticker-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent);
  animation: live-blink 1.4s ease-in-out infinite;
}
.ticker-label { color: var(--ink-3); font-weight: 600; }
.ticker-val {
  color: var(--ink); font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.ticker-unit { color: var(--ink-3); }

/* hero copy block below scene */
.hero-copy {
  max-width: 780px;
  margin-top: 4px;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 14px;
  padding: 5px 11px;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius-full);
}
.eye-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
  animation: live-blink 1.4s ease-in-out infinite;
}
.hero--dispatch h1 {
  font-size: clamp(1.9rem, 1.4rem + 2.3vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin-bottom: 14px;
  background: linear-gradient(180deg, var(--ink) 0%, color-mix(in srgb, var(--ink) 80%, var(--accent) 20%) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* team-first pledge callout */
.team-pledge {
  display: flex; align-items: flex-start; gap: 12px;
  margin-top: 18px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--ok) 7%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--line));
  border-left: 3px solid var(--ok);
  border-radius: var(--radius-md);
  color: var(--ink-1);
  font-size: var(--text-sm);
  line-height: 1.55;
  max-width: 780px;
}
.team-pledge svg {
  flex-shrink: 0;
  color: var(--ok);
  margin-top: 2px;
}
.team-pledge strong { color: var(--ink); font-weight: 600; }
.team-pledge--full {
  margin-top: 0; margin-bottom: 24px; max-width: 100%;
  gap: 14px; padding: 16px 18px;
}
.team-pledge--full > div { display: flex; flex-direction: column; gap: 4px; }
.team-pledge--full > div > span { color: var(--ink-2); }

/* reduced-motion — kill all animations */
@media (prefers-reduced-motion: reduce) {
  .hero-scanline, .hero-radar, .hero-disp-aura, .hero-disp-aura--2,
  .hero-live, .house, .house-aura, .house-window, .hero-beams .beam,
  .hero-headset, .ticker-dot, .eye-dot, .badge.live::before {
    animation: none !important;
  }
}

/* mobile hero */
@media (max-width: 720px) {
  .hero-scene { aspect-ratio: 780 / 360; max-height: 260px; border-radius: var(--radius-md); margin-bottom: 12px; }
  .hero-ticker {
    right: 10px; left: 10px; top: auto; bottom: 10px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    max-width: none;
    justify-content: stretch;
  }
  .ticker-item {
    padding: 7px 9px;
    font-size: 0.66rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
  }
  .ticker-item > .ticker-dot { position: absolute; top: 8px; right: 8px; }
  .ticker-item { position: relative; }
  .ticker-val { font-size: 0.82rem; line-height: 1; }
  .ticker-label { font-size: 0.58rem; letter-spacing: 0.08em; text-transform: uppercase; }
  .ticker-unit { display: block; font-size: 0.58rem; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .team-pledge { flex-direction: column; gap: 8px; }
}
@media (max-width: 420px) {
  .hero-scene { aspect-ratio: 780 / 360; max-height: 230px; }
  .ticker-val { font-size: 0.78rem; }
  .ticker-item { padding: 6px 8px; }
}

/* =================================================================
   US MAP HERO
   ================================================================= */
.us-state {
  fill: color-mix(in srgb, var(--ink) 4%, transparent);
  stroke: color-mix(in srgb, var(--ink) 14%, transparent);
  stroke-width: 0.6;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  transition: fill 200ms var(--ease), stroke 200ms var(--ease);
}
[data-theme='dark'] .us-state {
  fill: color-mix(in srgb, var(--ink) 5%, transparent);
  stroke: color-mix(in srgb, var(--ink) 18%, transparent);
}
.us-state.active {
  fill: color-mix(in srgb, var(--accent) 22%, transparent);
  stroke: color-mix(in srgb, var(--accent) 80%, transparent);
  stroke-width: 1;
}
[data-theme='dark'] .us-state.active {
  fill: color-mix(in srgb, var(--accent) 28%, transparent);
  stroke: color-mix(in srgb, var(--accent) 90%, transparent);
}

/* call origin dots — glowing + pulsing */
.us-dot-ring {
  fill: var(--warn);
  fill-opacity: 0.22;
  animation: dot-ping 3.2s ease-out infinite;
  animation-delay: var(--dot-delay, 0s);
  transform-origin: center;
  transform-box: fill-box;
}
.us-dot-core {
  fill: var(--warn);
  filter: drop-shadow(0 0 5px var(--warn));
  animation: dot-core-pulse 3.2s ease-in-out infinite;
  animation-delay: var(--dot-delay, 0s);
}
@keyframes dot-ping {
  0%   { opacity: 0.7; transform: scale(0.3); }
  70%  { opacity: 0;   transform: scale(1.8); }
  100% { opacity: 0;   transform: scale(1.8); }
}
@keyframes dot-core-pulse {
  0%, 100% { fill-opacity: 0.6; }
  15%      { fill-opacity: 1; }
  45%      { fill-opacity: 0.6; }
}

/* beams from active states to the dispatcher headset */
.us-beam {
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 20 400;
  stroke-dashoffset: 0;
  fill: none;
  opacity: 0;
  animation: us-beam-travel 3.2s ease-in-out infinite;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 60%, transparent));
}
@keyframes us-beam-travel {
  0%   { stroke-dashoffset: 0;    opacity: 0; }
  8%   { opacity: 0.9; }
  50%  { stroke-dashoffset: -400; opacity: 0.5; }
  60%  { stroke-dashoffset: -400; opacity: 0; }
  100% { stroke-dashoffset: -400; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .us-dot-ring, .us-dot-core, .us-beam { animation: none !important; }
}

/* Mobile: map still scales via SVG viewBox — no extra rules needed */

/* === DISPATCH LEAD badge & row treatment === */
.lead-pill {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.35);
  text-transform: uppercase;
  line-height: 1.4;
}
[data-theme='dark'] .lead-pill {
  background: rgba(129, 140, 248, 0.14);
  border-color: rgba(129, 140, 248, 0.4);
  color: #a5b4fc;
}
tr.row-lead {
  background: rgba(99, 102, 241, 0.04);
}
[data-theme='dark'] tr.row-lead {
  background: rgba(129, 140, 248, 0.05);
}
tr.row-lead .rank-num {
  color: var(--text-muted);
  font-weight: 500;
}

/* Lead profile card — neutral, not green/red */
.profile-card.is-lead {
  border-color: rgba(99, 102, 241, 0.35);
  background: linear-gradient(180deg, rgba(99,102,241,0.04), transparent 60%);
}
[data-theme='dark'] .profile-card.is-lead {
  border-color: rgba(129, 140, 248, 0.35);
  background: linear-gradient(180deg, rgba(129,140,248,0.06), transparent 60%);
}
.profile-card.is-lead .profile-stat-value {
  color: var(--text);
}
.profile-card.is-lead .profile-stat-value.warn,
.profile-card.is-lead .profile-stat-value.bad,
.profile-card.is-lead .profile-stat-value.ok {
  color: var(--text);
}

/* previous-day note shown on 1-day range */
.prev-day-note {
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  background: color-mix(in oklab, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 28%, transparent);
}
.prev-day-note[hidden] { display: none; }
