/* Feld Fire Dashboard: glass design system
   Dark is the default; light is a selected theme, not an inversion. */

:root {
  color-scheme: dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg-0: #070a14;
  --bg-blob-1: rgba(64, 104, 255, 0.42);
  --bg-blob-2: rgba(232, 84, 60, 0.30);
  --bg-blob-3: rgba(30, 190, 170, 0.22);

  --glass: rgba(255, 255, 255, 0.075);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --glass-hover: rgba(255, 255, 255, 0.11);
  --glass-edge: rgba(255, 255, 255, 0.16);
  --glass-shine: rgba(255, 255, 255, 0.28);
  --glass-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 20px 50px -20px rgba(0, 0, 0, 0.65), 0 2px 8px rgba(0, 0, 0, 0.25);
  --blur: blur(28px) saturate(170%);

  --text-1: #f4f6fb;
  --text-2: #b9c0d0;
  --text-3: #8790a5;
  --hairline: rgba(255, 255, 255, 0.09);
  --hairline-strong: rgba(255, 255, 255, 0.16);
  --surface-chart: #161b2b;

  --accent: #4f8dff;
  --accent-soft: rgba(79, 141, 255, 0.18);
  --accent-ink: #ffffff;

  /* data viz: reference palette, dark steps */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-muted: #6b7286;
  --seq-0: #1b2338; --seq-1: #184f95; --seq-2: #1c5cab; --seq-3: #256abf; --seq-4: #2a78d6; --seq-5: #3987e5; --seq-6: #5598e7; --seq-7: #86b6ef;
  --div-neg-3: #e66767; --div-neg-2: #b85454; --div-neg-1: #7a4646; --div-mid: #383835; --div-pos-1: #2c4a73; --div-pos-2: #2a63ad; --div-pos-3: #3987e5;

  --good: #0ca30c;  --good-ink: #5ee05e;
  --warn: #fab219;  --warn-ink: #ffc94d;
  --bad: #d03b3b;   --bad-ink: #ff7a7a;

  --r-xl: 26px; --r-lg: 20px; --r-md: 14px; --r-sm: 10px; --r-pill: 999px;
  --sidebar-w: 248px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg-0: #eef1f7;
  --bg-blob-1: rgba(90, 140, 255, 0.40);
  --bg-blob-2: rgba(255, 140, 110, 0.32);
  --bg-blob-3: rgba(70, 210, 190, 0.26);
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-hover: rgba(255, 255, 255, 0.68);
  --glass-edge: rgba(255, 255, 255, 0.85);
  --glass-shine: rgba(255, 255, 255, 0.95);
  --glass-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 20px 50px -24px rgba(30, 40, 80, 0.35), 0 2px 8px rgba(30, 40, 80, 0.08);
  --text-1: #0d1220;
  --text-2: #3f4659;
  --text-3: #6a7183;
  --hairline: rgba(15, 25, 50, 0.08);
  --hairline-strong: rgba(15, 25, 50, 0.14);
  --surface-chart: #f6f7fb;
  --accent: #2a6fe8;
  --accent-soft: rgba(42, 111, 232, 0.14);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-muted: #9aa0ad;
  --seq-0: #e6ebf3; --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #2a78d6; --seq-6: #1c5cab; --seq-7: #104281;
  --div-neg-3: #d03b3b; --div-neg-2: #e98b8b; --div-neg-1: #f5c9c9; --div-mid: #f0efec; --div-pos-1: #cde2fb; --div-pos-2: #86b6ef; --div-pos-3: #2a78d6;
  --good-ink: #067a06; --warn-ink: #9a6400; --bad-ink: #b42828;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--text-1);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  overflow-x: hidden;
}
.backdrop {
  position: fixed; inset: -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 45% at 12% 8%, var(--bg-blob-1), transparent 70%),
    radial-gradient(38% 40% at 92% 18%, var(--bg-blob-2), transparent 72%),
    radial-gradient(45% 45% at 70% 98%, var(--bg-blob-3), transparent 70%),
    radial-gradient(30% 30% at 30% 80%, var(--bg-blob-1), transparent 70%),
    var(--bg-0);
  filter: saturate(115%);
}
.backdrop::after { /* fine grain keeps big gradients from banding */
  content: ""; position: absolute; inset: 0; opacity: .035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
.num, .tnum { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

/* ---------- glass primitives ---------- */
.glass {
  position: relative;
  background: linear-gradient(180deg, var(--glass-strong), var(--glass) 38%);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-xl);
  box-shadow: var(--glass-shadow);
}
.glass::before { /* specular rim along the top edge */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, var(--glass-shine), transparent 22%) top / 100% 1px no-repeat;
  opacity: .9;
  mask: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 14px; margin: 14px 0 14px 14px; height: calc(100vh - 28px);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(145deg, #ff6b4a, #c2261b); box-shadow: 0 6px 18px -6px rgba(220, 60, 40, .8), inset 0 1px 0 rgba(255,255,255,.35);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11.5px; color: var(--text-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 12px;
  color: var(--text-2); font-weight: 500; transition: background .2s var(--ease), color .2s var(--ease);
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav a:hover { background: var(--glass-hover); color: var(--text-1); }
.nav a[aria-current="page"] { background: var(--glass-strong); color: var(--text-1); box-shadow: inset 0 0 0 1px var(--glass-edge); }
.nav-sep { height: 1px; background: var(--hairline); margin: 10px 8px; }
.sidebar-foot { margin-top: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 13px; background: var(--accent-soft); color: var(--text-1); box-shadow: inset 0 0 0 1px var(--glass-edge); }
.who-name { font-weight: 600; font-size: 13px; }
.who-scope { font-size: 11.5px; color: var(--text-3); }

.main { min-width: 0; padding: 14px 22px 40px; }
.topbar {
  position: sticky; top: 14px; z-index: 4; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px 10px 20px; border-radius: var(--r-lg); margin-bottom: 18px;
}
.page-title { font-size: 20px; font-weight: 680; letter-spacing: -0.02em; margin-right: auto; display: flex; align-items: baseline; gap: 10px; }
.page-title small { font-size: 12.5px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-3); padding: 0 6px; white-space: nowrap; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(12,163,12,.6); animation: pulse 2.4s infinite; }
.live.stale i { background: var(--warn); animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(12,163,12,.55); } 70% { box-shadow: 0 0 0 7px rgba(12,163,12,0); } 100% { box-shadow: 0 0 0 0 rgba(12,163,12,0); } }

/* ---------- controls ---------- */
.select, .input {
  appearance: none; -webkit-appearance: none;
  height: 34px; border-radius: var(--r-pill); padding: 0 34px 0 14px;
  background: var(--glass) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238790a5' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 13px center;
  border: 1px solid var(--glass-edge); color: var(--text-1); font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; transition: background-color .2s var(--ease);
  max-width: 220px;
}
.select:hover { background-color: var(--glass-hover); }
.select option { color: #0d1220; }
.input { background-image: none; padding: 0 14px; cursor: text; max-width: none; }
.input::placeholder { color: var(--text-3); }

.seg { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 3px; border-radius: var(--r-pill); background: var(--glass); border: 1px solid var(--glass-edge); gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 5px 13px; border-radius: var(--r-pill); font-size: 13px; font-weight: 550;
  color: var(--text-2); cursor: pointer; transition: all .22s var(--ease); white-space: nowrap;
}
.seg button:hover { color: var(--text-1); }
.seg button[aria-pressed="true"] { background: var(--glass-strong); color: var(--text-1); box-shadow: 0 1px 0 var(--glass-shine) inset, 0 4px 14px -6px rgba(0,0,0,.5); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 34px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1px solid var(--glass-edge); background: var(--glass-strong); color: var(--text-1); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform .15s var(--ease), background .2s var(--ease);
}
.btn:hover { background: var(--glass-hover); }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, #5b97ff, #2f6fe6); border-color: rgba(255,255,255,.25); color: #fff; box-shadow: 0 8px 22px -10px rgba(47,111,230,.9), inset 0 1px 0 rgba(255,255,255,.35); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--glass-hover); color: var(--text-1); }
.btn.danger { color: var(--bad-ink); }
.btn.icon { width: 34px; padding: 0; }
.btn svg { width: 16px; height: 16px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); user-select: none; }
.check input { appearance: none; width: 18px; height: 18px; border-radius: 6px; border: 1px solid var(--hairline-strong); background: var(--glass); display: grid; place-items: center; margin: 0; cursor: pointer; }
.check input:checked { background: var(--accent); border-color: transparent; }
.check input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }

/* ---------- layout ---------- */
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.g-2 { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.g-2e { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.mt { margin-top: 16px; }

.card { padding: 20px 22px; min-width: 0; }
.card.tight { padding: 16px 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 28px; }
.card-title { font-size: 14.5px; font-weight: 640; letter-spacing: -0.01em; }
.card-sub { font-size: 12.5px; color: var(--text-3); }
.card-head .spacer + * { flex: none; }
.link { color: var(--accent); font-weight: 560; font-size: 13px; cursor: pointer; background: none; border: 0; padding: 0; }
.link:hover { text-decoration: underline; }

/* ---------- KPI ---------- */
.kpi { padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi-label { font-size: 12.5px; color: var(--text-2); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 30px; font-weight: 680; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-foot { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--bad-ink); }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 650; white-space: nowrap; border: 1px solid transparent; }
.pill svg { width: 12px; height: 12px; }
.pill.good { color: var(--good-ink); background: rgba(12,163,12,.14); border-color: rgba(12,163,12,.28); }
.pill.warn { color: var(--warn-ink); background: rgba(250,178,25,.14); border-color: rgba(250,178,25,.3); }
.pill.bad { color: var(--bad-ink); background: rgba(208,59,59,.15); border-color: rgba(208,59,59,.32); }
.pill.neutral { color: var(--text-2); background: var(--glass); border-color: var(--glass-edge); }

/* progress vs target */
.meter { position: relative; height: 8px; border-radius: 99px; background: var(--hairline); overflow: visible; }
.meter > b { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--series-1); }
.meter > b.good { background: linear-gradient(90deg, #138f13, #22b322); }
.meter > b.warn { background: linear-gradient(90deg, #c98500, #f0ad14); }
.meter > b.bad { background: linear-gradient(90deg, #a93030, #d84646); }
.meter > i { position: absolute; top: -4px; width: 2px; height: 16px; border-radius: 2px; background: var(--text-1); opacity: .85; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; border-radius: var(--r-md); max-height: 640px; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.t th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3);
  padding: 10px 12px; background: var(--surface-chart); border-bottom: 1px solid var(--hairline); white-space: nowrap; cursor: default;
}
.t th.sortable { cursor: pointer; }
.t th.sortable:hover { color: var(--text-1); }
.t th .arrow { opacity: .8; margin-left: 4px; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr { transition: background .15s; }
.t tbody tr.click { cursor: pointer; }
.t tbody tr:hover td { background: var(--glass); }
.t .r { text-align: right; font-variant-numeric: tabular-nums; }
.t td.name { font-weight: 560; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.t tfoot td { font-weight: 650; border-top: 1px solid var(--hairline-strong); border-bottom: 0; position: sticky; bottom: 0; background: var(--surface-chart); }
.t .meter-cell { width: 160px; }

/* ---------- charts ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--hairline); stroke-width: 1; }
.chart .axis-line { stroke: var(--hairline-strong); stroke-width: 1; }
.chart .hover-line { stroke: var(--text-3); stroke-width: 1; opacity: 0; }
.chart.hovering .hover-line { opacity: .6; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px) !important; height: 2px; }
.legend i.sq { width: 10px; height: 10px; border-radius: 3px; }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none; min-width: 150px; max-width: 280px;
  padding: 10px 12px; border-radius: 14px; font-size: 12.5px; line-height: 1.5;
  background: rgba(20, 25, 40, .82); color: #f4f6fb; border: 1px solid rgba(255,255,255,.14);
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 14px 40px -12px rgba(0,0,0,.6); opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
:root[data-theme="light"] .tooltip { background: rgba(255,255,255,.88); color: #0d1220; border-color: rgba(15,25,50,.1); }
.tooltip.show { opacity: 1; transform: none; }
.tooltip .tt-title { font-weight: 650; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tooltip .tt-row span:first-child { display: inline-flex; align-items: center; gap: 6px; opacity: .8; }
.tooltip .tt-row b { font-weight: 650; font-variant-numeric: tabular-nums; }
.tooltip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* horizontal bars */
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 12px; align-items: center; font-size: 13px; }
.hbar .lbl { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { position: relative; height: 10px; border-radius: 4px; background: var(--hairline); }
.hbar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--series-1); }
.hbar .ghost { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-2); border-radius: 1px; opacity: .7; }
.hbar .val { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 72px; text-align: right; }

/* ---------- division cards ---------- */
.div-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform .25s var(--ease), background .25s; }
.div-card:hover { transform: translateY(-2px); }
.div-top { display: flex; align-items: center; gap: 10px; }
.div-icon { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--glass-edge); }
.div-icon svg { width: 18px; height: 18px; }
.div-name { font-weight: 650; }
.div-val { font-size: 24px; font-weight: 680; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.subs { display: flex; flex-direction: column; gap: 7px; }
.sub { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; font-size: 12.5px; align-items: center; }
.sub span:first-child { color: var(--text-2); }
.sub .tnum { font-weight: 600; }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 8px 16px; border-radius: var(--r-pill); font-weight: 560; color: var(--text-2); border: 1px solid transparent; cursor: pointer; background: none; font-size: 13.5px; }
.tab:hover { color: var(--text-1); background: var(--glass); }
.tab[aria-selected="true"] { color: var(--text-1); background: var(--glass-strong); border-color: var(--glass-edge); box-shadow: inset 0 1px 0 var(--glass-shine); }

/* rep cards */
.rep-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: transform .25s var(--ease); }
.rep-card:hover { transform: translateY(-2px); }
.rep-top { display: flex; align-items: center; gap: 10px; }
.rep-name { font-weight: 640; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rep-meta { font-size: 12px; color: var(--text-3); }
.rep-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rep-nums div { display: flex; flex-direction: column; }
.rep-nums small { font-size: 11px; color: var(--text-3); }
.rep-nums b { font-size: 15px; font-variant-numeric: tabular-nums; font-weight: 640; }

/* ---------- map ---------- */
.map-wrap { position: relative; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-chart); border: 1px solid var(--hairline); touch-action: none; }
.map-wrap svg { width: 100%; height: 100%; display: block; cursor: grab; }
.map-wrap svg.dragging { cursor: grabbing; }
.map-wrap .county { stroke: var(--hairline-strong); stroke-width: .35; vector-effect: non-scaling-stroke; transition: fill .3s var(--ease); }
.map-wrap .county.empty { fill: var(--seq-0); }
.map-wrap .county:hover { stroke: var(--text-1); stroke-width: 1.5; }
.map-wrap .county.sel { stroke: var(--text-1); stroke-width: 2.2; }
.map-wrap .states { fill: none; stroke: var(--text-2); stroke-width: 1.2; vector-effect: non-scaling-stroke; opacity: .75; pointer-events: none; }
.map-wrap .terr { fill: none; stroke: #ffd166; stroke-width: 2.6; vector-effect: non-scaling-stroke; pointer-events: none; stroke-linejoin: round; filter: drop-shadow(0 0 4px rgba(255, 209, 102, .55)); }
:root[data-theme="light"] .map-wrap .terr { stroke: #c27a00; filter: none; }
.map-wrap .lowconv { fill: url(#hatch); pointer-events: none; }
.map-tools { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.map-tools .btn { width: 34px; padding: 0; border-radius: 12px; }
.map-legend { position: absolute; left: 10px; bottom: 10px; padding: 8px 10px; border-radius: 12px; font-size: 11px; display: flex; flex-direction: column; gap: 4px; max-width: min(260px, calc(100% - 20px)); }
.map-legend .ramp span { width: 22px; height: 8px; }
.ramp { display: flex; gap: 2px; }
.ramp span { width: 30px; height: 10px; border-radius: 2px; }
.ramp-labels { display: flex; justify-content: space-between; color: var(--text-3); gap: 8px; }
.hatch-key { display: inline-block; width: 14px; height: 10px; border-radius: 2px; background: repeating-linear-gradient(45deg, var(--bad-ink) 0 2px, transparent 2px 5px); border: 1px solid var(--bad-ink); }
.terr-key { display: inline-block; width: 14px; height: 0; border-top: 2.6px solid #ffd166; }

.panel-list { display: flex; flex-direction: column; gap: 2px; }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--hairline); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--text-2); }
.kv b { font-variant-numeric: tabular-nums; font-weight: 620; }

/* ---------- opportunities ---------- */
.opp { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--hairline); }
.opp:last-child { border-bottom: 0; }
.opp-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--glass-edge); }
.opp-ic svg { width: 16px; height: 16px; }
.opp-ic.lapsed { background: rgba(208,59,59,.16); color: var(--bad-ink); }
.opp-ic.declining { background: rgba(250,178,25,.16); color: var(--warn-ink); }
.opp-ic.open_quote { background: var(--accent-soft); color: var(--accent); }
.opp-ic.low_conversion { background: rgba(217,89,38,.16); color: #f08a5d; }
.opp-ic.cold_county { background: rgba(120,140,200,.16); color: #a8b8ec; }
.opp-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opp-detail { font-size: 12.5px; color: var(--text-3); }
.opp-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.opp-val { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.opp-val small { display: block; font-size: 11px; color: var(--text-3); font-weight: 500; }

/* ---------- misc ---------- */
.banner { padding: 12px 18px; border-radius: var(--r-lg); margin-bottom: 16px; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.banner.demo { background: linear-gradient(90deg, rgba(250,178,25,.18), rgba(250,178,25,.06)); border: 1px solid rgba(250,178,25,.35); }
.banner.err { background: rgba(208,59,59,.14); border: 1px solid rgba(208,59,59,.35); }
.banner svg { width: 18px; height: 18px; flex: none; }
.empty-state { padding: 36px 10px; text-align: center; color: var(--text-3); font-size: 13.5px; }
.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.err-text { color: var(--bad-ink); font-size: 13px; }
.code { font-family: var(--mono); font-size: 12.5px; padding: 10px 12px; border-radius: 12px; background: var(--surface-chart); border: 1px solid var(--hairline); word-break: break-all; user-select: all; }
ol.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; color: var(--text-2); }
ol.steps b { color: var(--text-1); }

.skeleton { position: relative; overflow: hidden; background: var(--glass); border-radius: 10px; min-height: 14px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.08), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.loading-card { height: 120px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 200; padding: 10px 16px; border-radius: var(--r-pill); font-size: 13px; font-weight: 560; opacity: 0; transition: all .3s var(--ease); pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.fade-in { animation: fadeIn .35s var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); padding: 34px 30px 28px; display: flex; flex-direction: column; gap: 16px; }
.login-card .brand { padding: 0 0 6px; }
.login-card h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.login-card p { margin: 0; color: var(--text-3); font-size: 13.5px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.field .input { height: 42px; border-radius: 13px; font-size: 14px; }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.widget { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.widget .card-head { margin-bottom: 0; }
.badge { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; padding: 3px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.badge.claude { background: rgba(217, 119, 87, .18); color: #f0a07e; }

.builder { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; align-items: end; }
.builder .field .select { max-width: none; width: 100%; border-radius: 12px; height: 38px; }
.metric-checks { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 0; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .g-2 { grid-template-columns: 1fr; }
}
@media (max-width: 1080px) {
  :root { --sidebar-w: 78px; }
  .brand-name, .brand-sub, .nav a span, .who-text, .sidebar-foot .btn span { display: none; }
  .nav a { justify-content: center; padding: 11px; }
  .brand { justify-content: center; padding: 4px 0 16px; }
  .who { justify-content: center; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: auto; bottom: 10px; left: 10px; right: 10px; height: auto; margin: 0;
    flex-direction: row; padding: 6px; border-radius: 22px; z-index: 50;
  }
  .brand, .nav-sep, .sidebar-foot { display: none; }
  .nav { flex-direction: row; justify-content: space-around; width: 100%; }
  .nav a { padding: 10px; flex: 1; }
  .main { padding: 10px 12px 100px; }
  .topbar { top: 8px; padding: 10px 12px; }
  .page-title { width: 100%; font-size: 18px; }
  .filters { width: 100%; }
  .select { max-width: none; flex: 1 1 130px; }
  .g-2e { grid-template-columns: 1fr; }
  .kpi-value { font-size: 25px; }
  .board { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 128px 1fr auto; gap: 8px; }
  .hbar .val { min-width: 56px; }
  .seg::-webkit-scrollbar { display: none; }
  .map-legend .muted { display: none; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: #1a2032; }
  :root[data-theme="light"] .glass { background: #ffffff; }
}

/* map fills (classes, so theme vars apply) */
.map-wrap .f-s1 { fill: var(--seq-1); } .map-wrap .f-s2 { fill: var(--seq-2); } .map-wrap .f-s3 { fill: var(--seq-3); }
.map-wrap .f-s4 { fill: var(--seq-4); } .map-wrap .f-s5 { fill: var(--seq-5); } .map-wrap .f-s6 { fill: var(--seq-6); } .map-wrap .f-s7 { fill: var(--seq-7); }
.map-wrap .f-d0 { fill: var(--div-neg-3); } .map-wrap .f-d1 { fill: var(--div-neg-2); } .map-wrap .f-d2 { fill: var(--div-neg-1); }
.map-wrap .f-d3 { fill: var(--div-mid); } .map-wrap .f-d4 { fill: var(--div-pos-1); } .map-wrap .f-d5 { fill: var(--div-pos-2); } .map-wrap .f-d6 { fill: var(--div-pos-3); }
.map-wrap .f-new { fill: var(--seq-4); }

/* links into NetSuite + customer page */
a.link { text-decoration: none; }
a.plain { color: inherit; text-decoration: none; }
a.plain:hover { color: var(--accent); text-decoration: underline; }
.link.ns { white-space: nowrap; }
.tag { display: inline-block; vertical-align: 2px; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--glass-2, rgba(255,255,255,.08)); border: 1px solid var(--line, rgba(255,255,255,.12)); }
.t td a.plain, .t td a.link { font-size: inherit; }
.status-pill { font-size: 12px; font-weight: 600; text-transform: capitalize; }
.status-pill.open { color: var(--accent); }
.status-pill.processed { color: var(--good-ink); }
.status-pill.expired, .status-pill.closed { color: var(--text-3); }
.field > span { font-size: 12.5px; color: var(--text-2); font-weight: 550; }
.field .select, .field .input { max-width: none; width: 100%; }
.ok-text { color: var(--good-ink); font-size: 13px; }
a.who { color: inherit; text-decoration: none; border-radius: 12px; padding: 4px; margin: -4px; }
a.who:hover { background: var(--glass); }
.composer { display: flex; gap: 10px; align-items: stretch; }
.composer textarea { flex: 1; resize: vertical; min-height: 52px; padding: 12px 14px; line-height: 1.4; font: inherit; height: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip { font: inherit; font-size: 12.5px; color: var(--text-2); background: var(--glass); border: 1px solid var(--hairline); border-radius: 999px; padding: 5px 11px; cursor: pointer; }
.chip:hover { color: var(--text-1); border-color: var(--hairline-strong); }
@media (max-width: 700px) { .composer { flex-direction: column; } }
.qr { width: 190px; height: 190px; background: #fff; border-radius: 14px; padding: 6px; }
.qr svg { width: 100%; height: 100%; display: block; }
.recovery { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin: 12px 0; }
.recovery code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; padding: 8px 10px; border-radius: 10px; background: var(--glass); border: 1px solid var(--hairline); text-align: center; user-select: all; }
.section-title { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.rep-mix { font-size: 12px; color: var(--text-3); margin: -2px 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rep-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-box { padding: 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--hairline); cursor: pointer; }
.line-box:hover { border-color: var(--hairline-strong); }
.line-box.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
