/* Turnout Tracker — no external dependencies, so it works on a server with no internet access. */
:root {
  --bg: #f5f6f8; --surface: #ffffff; --ink: #18202c; --muted: #5d6878; --line: #dde1e8;
  --accent: #2346a0; --accent-soft: #e4eaf8; --accent-ink: #ffffff;
  --s1: #0f7a6c; --s2: #5aa89b; --s3: #9aa3ae; --s4: #d99a4e; --s5: #b5562a; --s0: #c9ced6;
  --good: #1d7a45; --warn: #a86400; --bad: #b3261e;
  --display: "Arial Narrow", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --body: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c; --surface: #1a2029; --ink: #e8ebf0; --muted: #9aa4b2; --line: #2c3440;
    --accent: #8ea8ff; --accent-soft: #232d48; --accent-ink: #0d1530;
    --s1: #3fbfa9; --s2: #2f8577; --s3: #6d7682; --s4: #c98a40; --s5: #e07a4a; --s0: #3a424e;
    --good: #5cc98a; --warn: #e0a24a; --bad: #f08078;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); }
a { color: var(--accent); }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
header.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; padding-top: 12px; }
.brand { display: flex; align-items: baseline; gap: 12px; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.mark { font-family: var(--display); font-stretch: condensed; font-weight: 800; font-size: 1.4rem; letter-spacing: .02em; text-transform: uppercase; }
.seat { color: var(--muted); font-size: .9rem; }
.me { display: flex; gap: 12px; align-items: center; font-size: .88rem; }
.me form { margin: 0; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
nav.tabs, nav.subtabs { display: flex; gap: 4px; width: 100%; overflow-x: auto; }
nav.tabs a, nav.subtabs a { font-family: var(--display); font-stretch: condensed; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .85rem; color: var(--muted); text-decoration: none; padding: 10px 12px; border-bottom: 3px solid transparent; white-space: nowrap; }
nav.tabs a[aria-current="page"], nav.subtabs a[aria-current="page"] { color: var(--ink); border-color: var(--accent); }
nav.subtabs { border-bottom: 1px solid var(--line); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main { padding: 20px 0 60px; display: grid; gap: 20px; }
h2 { font-family: var(--display); font-stretch: condensed; font-weight: 800; font-size: 1.15rem; text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.sub { color: var(--muted); margin: 2px 0 0; font-size: .9rem; max-width: 75ch; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.nowrap { white-space: nowrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: grid; gap: 14px; min-width: 0; }
.panel.login { max-width: 440px; margin: 40px auto; width: 100%; }
.head-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: start; }
.banner { border-radius: var(--r); padding: 12px 14px; background: var(--accent-soft); font-size: .9rem; }
.banner.warn { border-left: 4px solid var(--warn); }
.banner.ok { border-left: 4px solid var(--good); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 2px; }
.kpi .lbl { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.kpi .num { font-family: var(--display); font-weight: 800; font-size: 2.2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .note { font-size: .85rem; color: var(--muted); }
.kpi.target { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 9.5rem 1fr 7.5rem; gap: 10px; align-items: center; font-size: .88rem; }
.track { height: 14px; background: var(--bg); border-radius: 3px; overflow: hidden; border: 1px solid var(--line); }
.fill { height: 100%; }
.val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.s0 { --sc: var(--s0); } .s1 { --sc: var(--s1); } .s2 { --sc: var(--s2); } .s3 { --sc: var(--s3); } .s4 { --sc: var(--s4); } .s5 { --sc: var(--s5); }
.dot, .fill, .mini b.s1 { background: var(--sc, var(--accent)); }
.hours { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; align-items: end; height: 140px; border-bottom: 1px solid var(--line); padding-top: 18px; }
.hours div { background: var(--accent); border-radius: 2px 2px 0 0; position: relative; min-height: 1px; }
.hours div.now { background: var(--s1); }
.hours span { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: .68rem; color: var(--muted); }
.hour-lbls { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; font-size: .68rem; color: var(--muted); text-align: center; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.acts-cell { white-space: nowrap; }
.acts-cell .status { display: block; }
.mini { display: inline-block; width: 70px; height: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 2px; vertical-align: middle; margin-left: 8px; overflow: hidden; }
.mini b { display: block; height: 100%; background: var(--accent); }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.controls > label, .stack > label, .form-grid > label { display: grid; gap: 3px; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
label.check { display: inline-flex !important; align-items: center; gap: 6px; text-transform: none !important; letter-spacing: 0 !important; font-size: .9rem !important; color: var(--ink) !important; font-weight: 500 !important; }
.stack { display: grid; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
fieldset.divs { border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 14px; }
fieldset.divs legend { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 0 4px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; min-width: 0; max-width: 100%; }
textarea { width: 100%; }
input[type="search"] { width: 16rem; }
.btn, button { font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; border-radius: 4px; padding: 7px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; display: inline-block; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button:disabled { opacity: .55; cursor: not-allowed; }
.voted-btn { min-width: 7.5rem; }
.voted-btn.yes { background: var(--good); border-color: var(--good); color: var(--surface); }
.support-select { border-left: 5px solid var(--sc, var(--line)); }
.party-select { border-left: 5px solid var(--pc, var(--line)); min-width: 6.5rem; }
.party-pill { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; margin-left: 6px; }
.party-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--pc); }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; background: var(--pc); }
.stack-bar { display: flex; height: 22px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); background: var(--bg); }
.stack-bar span { height: 100%; background: var(--pc); }
tr.ours td:first-child { box-shadow: inset 4px 0 0 var(--accent); }
.pill { display: inline-flex; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; margin-left: 6px; color: var(--muted); }
.pill.ride { color: var(--warn); border-color: currentColor; }
.pill.warn { color: var(--bad); border-color: currentColor; }
.chase { display: grid; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--sc, var(--s1)); border-radius: var(--r); padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; align-items: center; }
.card .who { font-weight: 700; }
.card .meta { color: var(--muted); font-size: .86rem; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.card .phone { color: var(--ink); font-variant-numeric: tabular-nums; }
.acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: end; align-items: center; }
.card input.notes { grid-column: 1 / -1; width: 100%; font-size: .86rem; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); justify-items: center; }
.empty strong { color: var(--ink); font-size: 1.05rem; }
.status { font-size: .86rem; color: var(--muted); }
.errors ul { margin: 0; padding-left: 18px; color: var(--bad); }
.errors.validation-summary-valid { display: none; }
dl.facts { display: grid; grid-template-columns: 9rem 1fr; gap: 6px 12px; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .85rem; }
dl.facts dd { margin: 0; }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; padding: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 6px; font-size: .9rem; z-index: 20; max-width: calc(100% - 32px); }
[hidden] { display: none !important; }
@media (max-width: 600px) {
  .bar-row { grid-template-columns: 7rem 1fr; }
  .bar-row .val { grid-column: 2; text-align: left; margin-top: -6px; }
  .card { grid-template-columns: 1fr; }
  .acts { justify-content: start; }
  .kpi .num { font-size: 1.8rem; }
  input[type="search"] { width: 100%; }
  dl.facts { grid-template-columns: 1fr; }
}
