:root {
  --bg: #f4f3ef;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --line: #e2e0da;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7a7973;
  --dem: #2a6fd6;
  --dem-soft: #dbe7f8;
  --rep: #c8323a;
  --rep-soft: #f6dcdd;
  --oth: #a8a69e;
  --neutral: #f0efec;
  --nodata: #e4e2dc;
  --hatch: #c9c7bf;
  --accent: #6b4fd8;
  --seq-0: #f1eefb;
  --seq-1: #3a2a8c;
  --live: #0ca30c;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #31312e;
    --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86;
    --dem: #4b8cf0; --dem-soft: #1d2c45; --rep: #ec5a5f; --rep-soft: #46201f; --oth: #77766f;
    --neutral: #383835; --nodata: #2a2a28; --hatch: #4a4a46; --accent: #9b86ff;
    --seq-0: #26233a; --seq-1: #c9bcff; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #31312e;
  --text: #f0efec; --text-2: #c3c2b7; --muted: #8f8e86;
  --dem: #4b8cf0; --dem-soft: #1d2c45; --rep: #ec5a5f; --rep-soft: #46201f; --oth: #77766f;
  --neutral: #383835; --nodata: #2a2a28; --hatch: #4a4a46; --accent: #9b86ff;
  --seq-0: #26233a; --seq-1: #c9bcff; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 'Public Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.wrap { max-width: 1320px; margin: 0 auto; padding-block: 20px 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1 { font-size: clamp(24px, 3.4vw, 34px); line-height: 1.1; margin: 0; font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: 18px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 6px; font-weight: 700; }
.sub { margin: 6px 0 0; color: var(--text-2); }
.muted { color: var(--muted); margin: 2px 0 0; font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.status { display: flex; align-items: center; gap: 10px; }
.live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(12,163,12,.6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(12,163,12,.5); } 70% { box-shadow: 0 0 0 8px rgba(12,163,12,0); } 100% { box-shadow: 0 0 0 0 rgba(12,163,12,0); } }
button { font: inherit; color: inherit; cursor: pointer; }
.ghost { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; width: 34px; height: 34px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi .value { font-size: clamp(22px, 2.6vw, 30px); font-weight: 800; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .foot { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.kpi .bar { margin-top: 8px; }

.controls { display: flex; gap: 10px 18px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.seg { display: inline-flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.seg-label { font-size: 12px; color: var(--muted); padding: 0 8px 0 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 999px; font-size: 13.5px; color: var(--text-2); font-weight: 500; }
.seg button.on { background: var(--text); color: var(--surface); }

.ai-run { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.run { border: 1px solid var(--accent); background: var(--surface); color: var(--accent); border-radius: 999px; padding: 7px 14px; font-size: 13.5px; font-weight: 600; }
.run:hover:not(:disabled) { background: var(--accent); color: var(--surface); }
.run:disabled { opacity: .55; cursor: progress; }
.run:focus-visible, .seg button:focus-visible, .ghost:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.run-status { font-size: 12.5px; color: var(--text-2); }
.stale { font-size: 12.5px; color: var(--text-2); background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px; margin-top: 8px; }
.ai-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; min-width: 0; }
.card-head { margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.grid .card { margin-bottom: 14px; }
.map { width: 100%; }
.map svg { width: 100%; height: auto; display: block; }
.state { stroke: var(--surface); stroke-width: 1; cursor: pointer; transition: opacity .15s; }
.state:hover { stroke: var(--text); stroke-width: 1.5; }
.state.sel { stroke: var(--text); stroke-width: 2.2; }
.state.dim { opacity: .28; }
.state-label { font-size: 10px; font-weight: 700; pointer-events: none; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 2.5px; stroke-opacity: .7; }
.hint { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }

.legend { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: var(--text-2); }
.legend .ramp { height: 10px; width: 220px; border-radius: 3px; }
.legend .ends { display: flex; justify-content: space-between; width: 220px; font-size: 11.5px; color: var(--muted); }
.sw { display: inline-block; width: 14px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }

.panel { position: sticky; top: calc(12px + env(safe-area-inset-top, 0px)); max-height: calc(100vh - 24px); overflow: auto; }
.panel .empty { color: var(--text-2); }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.panel h2 { font-size: 22px; }
.pill { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill.D { background: var(--dem-soft); color: var(--dem); }
.pill.R { background: var(--rep-soft); color: var(--rep); }
.big-edge { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.big-edge.D { color: var(--dem); } .big-edge.R { color: var(--rep); }
.stackbar { display: flex; gap: 2px; height: 12px; border-radius: 4px; overflow: hidden; margin: 8px 0 4px; background: var(--surface-2); }
.stackbar span { display: block; height: 100%; }
.stackbar .d { background: var(--dem); } .stackbar .r { background: var(--rep); } .stackbar .o { background: var(--oth); }
.stacklegend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.stacklegend b { color: var(--text); font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 12px 0; }
.fact .k { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.fact .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.section { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.race { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; font-size: 14px; }
.race .who { color: var(--text-2); font-size: 13px; }
.ai { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.ai-tag { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.ai .headline { font-weight: 700; font-size: 15.5px; margin: 4px 0 6px; }
.ai p { margin: 6px 0; font-size: 14px; }
.ai ul { margin: 6px 0; padding-left: 18px; font-size: 13.5px; }
.ai li { margin: 3px 0; }
.ai .small { font-size: 12px; color: var(--muted); }
.cmp { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; font-size: 13px; margin: 8px 0; }
.cmp .mini { display: flex; gap: 2px; height: 8px; border-radius: 3px; overflow: hidden; }
.cmp .mini span { display: block; }

.keyraces { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.kr { border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: var(--surface); }
.kr:hover { border-color: var(--text-2); }
.kr .row1 { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.kr .title { font-weight: 700; }
.kr .cands { font-size: 12.5px; color: var(--text-2); margin: 4px 0 8px; min-height: 18px; }
.kr .ev { display: flex; justify-content: space-between; font-size: 13px; }
.edge.D { color: var(--dem); font-weight: 700; } .edge.R { color: var(--rep); font-weight: 700; }

.house { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.hd { border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: pointer; }
.hd .row1 { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--surface); }
th.sorted { color: var(--text); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
td .races { color: var(--muted); font-size: 12px; }

.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; font-size: 13px; box-shadow: 0 6px 24px rgba(0,0,0,.14); max-width: 260px; }
.tip .t { font-weight: 700; margin-bottom: 4px; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; }
.tip .r span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }

.foot { color: var(--text-2); font-size: 13px; margin-top: 24px; }
.foot p { margin: 8px 0; max-width: 920px; }

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .kpis { gap: 8px; }
  .kpi { padding: 12px; }
  .state-label { display: none; }
  .seg button { padding: 6px 9px; font-size: 13px; }
}

/* ---- Florida tracker ---- */
.polls { margin: -6px 0 14px; font-size: 14px; color: var(--text-2); }
.polls b { color: var(--text); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.methods { display: grid; gap: 14px; }
.mrow .mhead { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.mrow .mname { font-weight: 600; }
.mrow.mtotal { border-top: 1px solid var(--line); padding-top: 12px; }
.mlegend, .keyrow { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.keyrow { margin-top: 2px; }
.stackbar .r { background: var(--rep); } .stackbar .d { background: var(--dem); }
.timeline svg { width: 100%; height: auto; display: block; overflow: visible; }
.timeline .grid line { stroke: var(--line); }
.timeline .axis text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.timeline .axis path, .timeline .axis line { stroke: var(--line); }
.timeline .tl-label { font-size: 11.5px; fill: var(--text-2); font-weight: 600; }
.timeline .cross { stroke: var(--muted); stroke-dasharray: 3 3; }
.tl-now { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); }
.tl-now b { color: var(--text); font-variant-numeric: tabular-nums; }
.empty { color: var(--text-2); }
.county { stroke: var(--surface); stroke-width: .8; cursor: pointer; }
.county:hover { stroke: var(--text); stroke-width: 1.4; }
.c-label { font-size: 10.5px; font-weight: 700; pointer-events: none; fill: var(--text); paint-order: stroke; stroke: var(--surface); stroke-width: 2.5px; stroke-opacity: .75; }
.mini-table { width: 100%; margin-top: 10px; font-size: 13px; }
.mini-table th, .mini-table td { padding: 6px 6px; }
.mini-table tr.tot td { font-weight: 700; border-bottom: 0; }
.mini-table tbody tr { cursor: default; }
.race.click { cursor: pointer; }
.ai-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.ai-run { margin-left: 0; }
.ai h3 { margin-top: 10px; }
.edge.R { color: var(--rep); font-weight: 700; } .edge.D { color: var(--dem); font-weight: 700; }
@media (max-width: 980px) { .two { grid-template-columns: 1fr; } }
.race { align-items: center; }
.race > .pill { flex: none; }
.vs22 { font-size: 12.5px; color: var(--text-2); margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.vs22 b { color: var(--text); }
.m22 { display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 6px; margin-top: 6px; opacity: .75; }
.m22 .stackbar { margin: 0; }
.m22-label, .muted-inline { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.m22-text { justify-content: space-between; }
.mini-table th, .mini-table td { padding: 6px 5px; font-size: 12.5px; }
.mini-table th { font-size: 10.5px; }
.updated-line { font-size: 13px; color: var(--text-2); margin: 2px 0 4px; }
.updated-line b { color: var(--text); }
.updated-line.is-stale b, .stale-txt { color: var(--muted); }
.updated-line.is-stale::after { content: " · no new numbers in over an hour"; color: var(--muted); }
.cmp-table td { line-height: 1.35; vertical-align: top; }
.cmp-table td:last-child { white-space: normal; min-width: 120px; }
.mgrid { display: grid; grid-template-columns: minmax(84px, 1.1fr) auto minmax(80px, 2fr) auto minmax(96px, auto); column-gap: 14px; align-items: center; }
.mg-head, .mg-row { display: contents; }
.mg-head span { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.mg-head span:nth-child(2), .mg-head span:nth-child(4), .mg-head span:nth-child(5) { text-align: right; }
.mg-row > span { padding: 12px 0; border-bottom: 1px solid var(--line); cursor: default; }
.mg-total > span { border-bottom: 0; font-weight: 700; }
.mg-name { font-weight: 600; display: flex; flex-direction: column; line-height: 1.25; }
.mg-num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.mg-bar .stackbar { margin: 0; }
.mg-edge { text-align: right; font-size: 15px; }
.mg-vs { text-align: right; font-size: 12.5px; color: var(--text-2); line-height: 1.35; }
.mg-row:hover > span { background: var(--surface-2); }
.methods .keyrow { margin-top: 12px; align-items: center; }
@media (max-width: 520px) {
  .mgrid { grid-template-columns: 1fr auto auto auto; column-gap: 10px; }
  .mg-head span:nth-child(3), .mg-bar { display: none; }
}
.bottom-line { font-size: 15px; line-height: 1.55; margin: 0 0 14px; max-width: 90ch; }
.cmp-wrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.hist-table th { text-align: right; }
.hist-table td { vertical-align: top; }
.hist-table td.now, .hist-table th:last-child { background: var(--surface-2); }
.row-label { display: block; font-weight: 600; color: var(--text); }
.row-note, .cell-note { display: block; font-size: 11.5px; color: var(--muted); white-space: normal; font-weight: 400; }
.hist-table td:first-child { white-space: normal; min-width: 170px; }
.proj { background: var(--surface-2); border-radius: 12px; padding: 14px; }
.proj-table th { white-space: normal; }
@media (max-width: 980px) { .cmp-wrap { grid-template-columns: 1fr; } }
