:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --surface-2: #f3f2ee;
  --ink: #0b0b0b; --ink-2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --border: rgba(11,11,11,0.10);
  --accent: #2a78d6; --accent-tint: rgba(42,120,214,0.10); --warn-tint: #fdf3dc; --warn-ink: #7a5300;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --band: rgba(42,120,214,0.12); --kid1: rgba(235,104,52,0.10); --kid2: rgba(98,80,214,0.10);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0A1630; --surface: #112244; --surface-2: #182c52;
    --ink: #f0efec; --ink-2: #c6cddb; --muted: #93a0b8;
    --grid: #22375e; --axis: #33497a; --border: rgba(255,255,255,0.11);
    --accent: #5a9cf0; --accent-tint: rgba(90,156,240,0.16); --warn-tint: #3a2f14; --warn-ink: #f2c45a;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --band: rgba(57,135,229,0.18); --kid1: rgba(217,89,38,0.16); --kid2: rgba(144,133,233,0.16);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0A1630; --surface: #112244; --surface-2: #182c52;
  --ink: #f0efec; --ink-2: #c6cddb; --muted: #93a0b8;
  --grid: #22375e; --axis: #33497a; --border: rgba(255,255,255,0.11);
  --accent: #5a9cf0; --accent-tint: rgba(90,156,240,0.16); --warn-tint: #3a2f14; --warn-ink: #f2c45a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --band: rgba(57,135,229,0.18); --kid1: rgba(217,89,38,0.16); --kid2: rgba(144,133,233,0.16);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { scrollbar-gutter: stable; } /* keep the width steady whether or not a page needs a scrollbar */
body { background: var(--page); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { padding: 20px 24px 0; max-width: 1720px; margin: 0 auto; }
header h1 { margin: 0; font-size: 22px; }
header p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.theme-btn { float: right; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); border-radius: 8px; padding: 6px 10px; cursor: pointer; font: inherit; font-size: 13px; }
nav { max-width: 1720px; margin: 14px auto 0; padding: 0 24px; display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
nav button { border: 0; background: none; color: var(--ink-2); padding: 10px 12px; font: inherit; font-size: 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
nav button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
main { max-width: 1720px; margin: 0 auto; padding: 20px 24px 60px; }
section.tab { display: none; }
section.tab.active { display: block; }
h2 { font-size: 18px; margin: 28px 0 8px; }
h2:first-child { margin-top: 4px; }
h3 { font-size: 15px; margin: 18px 0 6px; }
p.lead { color: var(--ink-2); margin: 0 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .grid.two { grid-template-columns: 1fr; } }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.note { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--ink-2); font-size: 14px; margin: 12px 0; }
.note.warn { background: var(--warn-tint); color: var(--warn-ink); }
.note strong { color: var(--ink); }
.note.warn strong { color: inherit; }
.stat .v { font-size: 26px; font-weight: 600; }
.stat .l { color: var(--ink-2); font-size: 13px; }
.stat .d { color: var(--muted); font-size: 12px; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 6px 0 12px; }
.controls label { font-size: 13px; color: var(--ink-2); display: flex; gap: 6px; align-items: center; max-width: 100%; min-width: 0; }
.controls select { max-width: 100%; min-width: 0; }
#sourcesBody a, #mapInfo a { overflow-wrap: anywhere; }
select, .seg button { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.seg { display: inline-flex; }
.seg button { border-radius: 0; cursor: pointer; margin-left: -1px; }
.seg button:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.seg button:last-child { border-radius: 0 8px 8px 0; }
.seg button[aria-pressed="true"] { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--ink-2); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; cursor: pointer; user-select: none; }
tbody tr:last-child td { border-bottom: 0; }
tr.hl td { background: var(--accent-tint); }
tr.hl td:first-child { font-weight: 600; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .lbl { fill: var(--ink-2); font-size: 11.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-2); margin: 6px 0 2px; }
.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; }
#tip { position: fixed; pointer-events: none; z-index: 2100; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); display: none; max-width: 300px; }
#tip .t { font-weight: 600; margin-bottom: 4px; }
#tip .r { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
#tip .r i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.timeline { font-size: 13px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--ink-2); }
.mixrow { display: grid; grid-template-columns: 150px 1fr 54px; gap: 10px; align-items: center; margin: 6px 0; font-size: 13px; }
.mapgrid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 12px; }
#map { height: 720px; border-radius: 12px; border: 1px solid var(--border); }
.leaflet-control-layers { font-size: 11.5px; line-height: 1.3; background: var(--surface); color: var(--ink); border: 1px solid var(--border) !important; }
.leaflet-control-layers-expanded { padding: 4px 8px; }
.leaflet-control-layers label { margin: 1px 0; }
.leaflet-control-layers input { width: 12px; height: 12px; margin: 0 4px 0 0; vertical-align: -2px; }
#mapInfo { height: 720px; overflow-y: auto; font-size: 13px; }
#mapInfo table { width: 100%; }
#mapInfo td { white-space: normal; vertical-align: top; border-bottom: 1px solid var(--grid); }
#mapInfo .empty { color: var(--muted); }
.info-btn { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; margin-left: 4px; line-height: 1; vertical-align: -2px; }
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--accent); }
#mapInfo tr.defrow td { background: var(--surface-2); color: var(--ink-2); font-size: 12px; padding: 6px 8px; text-align: left; }
.leaflet-container { background: var(--surface-2); font: inherit; }
.maplegend { background: var(--surface); color: var(--ink); padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); font-size: 12px; line-height: 1.4; }
.maplegend i { display: inline-block; width: 14px; height: 10px; margin-right: 6px; vertical-align: middle; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--ink); }
.leaflet-popup-content table { width: 100%; }
.leaflet-popup-content td { white-space: normal; vertical-align: top; }
ul.tight { margin: 6px 0; padding-left: 20px; }
ul.tight li { margin: 3px 0; }
a { color: var(--accent); }
code { font-size: 12.5px; }
@media (max-width: 640px) {
  header, nav, main { padding-left: 16px; padding-right: 16px; }
  .mixrow { grid-template-columns: 96px 1fr 44px; }
  #map { height: 480px; }
  .mapgrid { grid-template-columns: 1fr; }
  #mapInfo { height: auto; max-height: none; }
}

.leaflet-tooltip.city-label { background: rgba(17,17,17,.72); color: #fff; border: 0; box-shadow: none; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; }
.leaflet-tooltip.city-label::before { display: none; }
.map-expand { font: inherit; font-size: 12px; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 5px 9px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.map-expand:hover { color: var(--accent); }
.mapgrid.map-expanded { position: fixed; inset: 0; z-index: 2000; background: var(--page); padding: 12px; grid-template-columns: minmax(0, 1fr) 420px; }
.mapgrid.map-expanded > .leaflet-container { height: calc(100vh - 24px) !important; }
.mapgrid.map-expanded > aside { max-height: calc(100vh - 24px); overflow-y: auto; }
.mapgrid.has-panel.map-expanded { grid-template-columns: 270px minmax(0, 1fr) 400px; }
body.map-expanded-open { overflow: hidden; }
@media (max-width: 900px) { .mapgrid.map-expanded, .mapgrid.has-panel.map-expanded { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; } .mapgrid.map-expanded > .leaflet-container { height: calc(70vh - 24px) !important; } .mapgrid.map-expanded > aside { max-height: 30vh; } }

/* left layer panel on the Map tab */
.mapgrid.has-panel { grid-template-columns: 270px minmax(0, 1fr) 360px; }
.mappanel { padding: 10px 12px; max-height: 720px; overflow-y: auto; font-size: 13px; }
.mappanel h4 { margin: 12px 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.mappanel h4:first-of-type { margin-top: 0; }
.mappanel .mp-opt { display: flex; align-items: flex-start; gap: 6px; padding: 3px 6px; margin: 0 -6px; border-radius: 6px; cursor: pointer; line-height: 1.3; }
.mappanel .mp-opt input { margin: 2px 0 0; flex: none; }
.mappanel .mp-opt:hover { background: var(--accent-tint); }
.mappanel .mp-opt.on { background: var(--accent-tint); font-weight: 600; }
.mappanel details.mp-grp { margin: 2px 0; }
.mappanel details.mp-grp summary { cursor: pointer; color: var(--ink-2); font-size: 12.5px; padding: 3px 0; }
.mappanel details.mp-grp summary .muted { font-size: 11px; }
.mappanel select { width: 100%; font: inherit; font-size: 13px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; }
.mappanel .mp-toggle { display: none; width: 100%; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; cursor: pointer; text-align: left; }
@media (max-width: 1200px) { .mapgrid.has-panel { grid-template-columns: 220px minmax(0, 1fr); } .mapgrid.has-panel > #mapInfo { grid-column: 1 / -1; } }
@media (max-width: 760px) {
  .mapgrid.has-panel { grid-template-columns: 1fr; }
  .mappanel { max-height: none; }
  .mappanel .mp-toggle { display: block; }
  .mappanel:not(.open) .mp-body { display: none; }
  .mappanel.open .mp-body { margin-top: 10px; }
}

/* editorial blocks */
:root { --navy: #10223a; --navy-2: #1d3557; --gold: #e3ab2f; --gold-ink: #94650a; --gold-tint: rgba(227,171,47,0.16); }
:root[data-theme="dark"] { --gold-ink: #e8b84a; --navy: #1c3566; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --gold-ink: #e8b84a; --navy: #1c3566; } }  /* dark: title bands a step lighter than the #0A1630 page */
.hero { background: var(--navy); color: #f4f2ec; border-radius: 14px; padding: 22px 26px 20px; margin: 4px 0 16px; }
.hero-k { color: var(--gold); font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.hero-t { color: #fff; font-size: 30px; line-height: 1.15; margin: 8px 0 8px; font-weight: 750; }
.hero-s { color: #d9dde4; font-size: 15.5px; line-height: 1.55; }
.hero-s a { color: #fff; }
.hero-c { color: #a9b3c2; font-size: 13px; font-style: italic; margin: 10px 0 0; }
.takeaways { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 0 0 8px; }
.tk { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tk-k { color: var(--gold-ink); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.tk-v { font-size: 30px; font-weight: 750; line-height: 1.15; margin: 6px 0 4px; color: var(--ink); }
.tk-d { color: var(--ink-2); font-size: 13.5px; line-height: 1.4; }
h3.qh { font-size: 16px; margin: 26px 0 12px; padding-bottom: 8px; position: relative; text-transform: none; }
h3.qh::after { content: ""; position: absolute; left: 0; bottom: 0; width: 44px; height: 3px; border-radius: 2px; background: var(--gold); }
h3.qh .qn { color: var(--gold-ink); }
h3.qh .qa { color: var(--ink-2); font-weight: 600; }
.caveats { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; margin: 26px 0 8px; }
.caveats h3 { margin: 0 0 6px; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink); }
.caveats ul { margin: 0; padding-left: 18px; columns: 2 380px; column-gap: 32px; }
.caveats li { color: var(--ink-2); font-size: 13.5px; margin: 0 0 6px; break-inside: avoid; }
@media (max-width: 640px) { .hero { padding: 16px 16px 14px; } .hero-t { font-size: 23px; } .tk-v { font-size: 26px; } }
.hero.compact { padding: 14px 20px 12px; margin-bottom: 12px; }
.hero.compact .hero-t { font-size: 22px; margin: 4px 0 4px; }
.hero.compact .hero-s { font-size: 14px; }

/* early-vote tracker */
.ev-row { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.ev-row:last-of-type { border-bottom: 0; }
.ev-lab b { display: block; font-size: 15px; } .ev-lab span { color: var(--muted); font-size: 12px; }
.ev-bar { display: flex; align-items: center; gap: 8px; height: 22px; }
.ev-fill { display: block; height: 16px; border-radius: 0 4px 4px 0; min-width: 2px; }
.ev-val { font-weight: 700; font-size: 13px; } .ev-cn { color: var(--muted); font-size: 12px; }
.ev-cols { display: flex; gap: 10px; align-items: flex-end; height: 260px; padding-top: 10px; }
.ev-col { flex: 1; display: flex; flex-direction: column; height: 100%; border-radius: 8px; padding: 0 4px; }
.ev-col.now { background: var(--gold-tint); }
.ev-colbars { flex: 1; display: flex; gap: 4px; align-items: flex-end; }
.ev-cb { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.ev-cf { display: block; width: 100%; border-radius: 4px 4px 0 0; }
.ev-cv { font-size: 11.5px; font-weight: 700; margin-bottom: 2px; }
.ev-cy { text-align: center; padding: 6px 0 4px; } .ev-cy b { display: block; } .ev-cy span { color: var(--muted); font-size: 11.5px; }
tr.now td { background: var(--gold-tint); font-weight: 600; }

/* home page */
.home-start { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.home-go, .home-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.home-go:hover, .home-card:hover { border-color: var(--gold); background: var(--gold-tint); }
.home-go strong, .home-card strong { font-size: 15.5px; }
.home-go span, .home-card span { color: var(--ink-2); font-size: 13.5px; line-height: 1.4; }
.home-go:first-child { background: var(--navy); color: #fff; border-color: transparent; }
.home-go:first-child span { color: #d9dde4; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.home-list { margin: 0; padding-left: 18px; } .home-list li { margin: 0 0 8px; color: var(--ink-2); font-size: 14px; } .home-list strong { color: var(--ink); }

.about { max-width: 760px; font-size: 15.5px; line-height: 1.65; }
.about p { margin: 0 0 14px; color: var(--ink); }
.about-support { display: inline-block; font-weight: 600; color: var(--gold-ink); text-decoration: none; border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; background: var(--surface); }
.about-support:hover { background: var(--gold-tint); }

/* Compare: pick up to 3 schools */
.pick3 { margin-bottom: 18px; }
.search.pick { margin-left: 0; max-width: 360px; }
.pick-x { border: 0; background: none; color: var(--muted); font: inherit; font-size: 15px; line-height: 1; padding: 0 0 0 4px; cursor: pointer; }
.pick-x:hover { color: var(--ink); }
.pick-table td:first-child { color: var(--ink-2); white-space: nowrap; }
.pick-table th, .pick-table td { text-align: left; vertical-align: top; }

/* Map page: address lookup box */
.addr-form input { flex: 1 1 320px; min-width: 0; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.addr-form button { padding: 8px 16px; }

.note:empty { display: none; }
.mixrows { display: grid; gap: 3px; min-width: 220px; }
.mixrows .mr { display: grid; grid-template-columns: 11.5em 1fr 3em; align-items: center; gap: 6px; font-size: 12px; }
.mixrows .mr-l { color: var(--ink-2); white-space: nowrap; }
.mixrows .mr-track { height: 10px; background: var(--accent-tint); border-radius: 3px; overflow: hidden; }
.mixrows .mr-bar { height: 100%; border-radius: 3px; }
.mixrows.has-alt .mr { grid-template-columns: 11.5em 1fr 5em; }
.mixrows .mr-v { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink); }
/* school-year label above each student-mix block */
.mix-year { font-size: 14px; font-weight: 700; color: var(--ink); margin: 14px 0 6px; padding-bottom: 3px; border-bottom: 2px solid var(--gold); display: inline-block; font-variant-numeric: tabular-nums; }
.mix-year:first-child { margin-top: 2px; }
.pick-table .mixrows { min-width: 250px; }
.pick-table .mixrows .mr { grid-template-columns: 9em 1fr 2.8em; font-size: 11.5px; }

/* Contact form */
.contact { display: grid; gap: 14px; max-width: 640px; }
.contact label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.contact label .muted { font-weight: 400; }
.contact textarea, .contact input, .contact select { font: inherit; font-weight: 400; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.contact textarea { resize: vertical; min-height: 140px; }
.contact .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact button[disabled] { opacity: .55; cursor: not-allowed; }
