/* Layout: sticky status bar, KPI strip, then a map-first workspace (map left, district panel right) followed by evidence sections. */
:root {
  --bg: #f2f5f5; --surface: #ffffff; --surface-2: #e9efef; --ink: #0d1b1e; --ink-2: #44575b; --muted: #74868a;
  --line: #d9e2e2; --accent: #0b6e72; --accent-ink: #ffffff; --focus: #0b6e72;
  /* risk tiers: one hue, light to dark (ordinal) */
  --t0: #f6dbe2; --t1: #e99cb1; --t2: #cf4f77; --t3: #8a1543; --t3-ink: #ffffff; --nodata: #e3e9e9;
  /* sequential + diverging endpoints, read by the map at render time */
  --seq-lo: #dbe9fb; --seq-hi: #0f3f86; --div-neg: #2a78d6; --div-mid: #eceeed; --div-pos: #d03b3b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --critical: #d03b3b; --good: #0a8f0a;
  --font-d: "Sora", "Inter", system-ui, sans-serif; --font-b: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-m: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 10px; --shadow: 0 1px 2px rgba(13, 27, 30, .06), 0 8px 24px -16px rgba(13, 27, 30, .25);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #091214; --surface: #101c1f; --surface-2: #17272b; --ink: #e8f0f0; --ink-2: #b4c3c5; --muted: #80928f;
    --line: #213337; --accent: #58c9c5; --accent-ink: #06201f; --focus: #58c9c5;
    --t0: #3a2530; --t1: #7d3552; --t2: #c9507a; --t3: #f79bb8; --t3-ink: #2a0a16; --nodata: #1b292c;
    --seq-lo: #16283f; --seq-hi: #7db4f5; --div-neg: #3987e5; --div-mid: #2b3536; --div-pos: #e66767;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --critical: #e66767; --good: #0ca30c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #091214; --surface: #101c1f; --surface-2: #17272b; --ink: #e8f0f0; --ink-2: #b4c3c5; --muted: #80928f;
  --line: #213337; --accent: #58c9c5; --accent-ink: #06201f; --focus: #58c9c5;
  --t0: #3a2530; --t1: #7d3552; --t2: #c9507a; --t3: #f79bb8; --t3-ink: #2a0a16; --nodata: #1b292c;
  --seq-lo: #16283f; --seq-hi: #7db4f5; --div-neg: #3987e5; --div-mid: #2b3536; --div-pos: #e66767;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --critical: #e66767; --good: #0ca30c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font-b); -webkit-font-smoothing: antialiased; }
.wrap { max-width: 1320px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
h1, h2, h3 { font-family: var(--font-d); margin: 0; text-wrap: balance; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); }
.num, td.n, th.n { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-m); font-size: 12px; }
.muted { color: var(--muted); }
.eyebrow { font: 600 11px/1 var(--font-b); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

/* status bar */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 9; background: var(--surface); border-bottom: 1px solid var(--line); }
.bar .wrap { padding-block: 8px 0; }
.bar .top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 17px/1 var(--font-d); }
.brand svg { flex: none; }
.bar .meta { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--ink-2); font-size: 12.5px; margin-left: auto; }
.bar .meta b { color: var(--ink); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 6px; }

main { padding-block: 20px 48px; }
.tab { display: flex; flex-direction: column; gap: 28px; }
section { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.head p { color: var(--ink-2); max-width: 70ch; }

/* KPI strip: one band, hairline-separated, not five separate cards */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.kpi { padding: 14px 16px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi .v { font: 600 28px/1.1 var(--font-d); letter-spacing: -.02em; }
.kpi .s { color: var(--ink-2); font-size: 12.5px; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi { border-left: 0; border-top: 1px solid var(--line); } .kpi:nth-child(-n+2) { border-top: 0; } .kpi:nth-child(even) { border-left: 1px solid var(--line); } .kpi:last-child { grid-column: 1 / -1; border-left: 0; } }

/* workspace */
.work { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 980px) { .work { grid-template-columns: minmax(0, 1fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.panel.pad { padding: 16px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.controls label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
select, button, input { font: inherit; color: inherit; }
select { background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; padding: 6px 28px 6px 10px; max-width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 6px 10px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); border-left: 1px solid var(--line); }
.seg button:first-child { border-left: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button:hover:not([aria-pressed="true"]) { background: var(--surface-2); }
.chk { cursor: pointer; }
.chk input { accent-color: var(--accent); }
.mapbox { position: relative; }
#map { display: block; width: 100%; height: auto; aspect-ratio: 2.15 / 1; touch-action: none; cursor: grab; background: var(--surface); border-radius: 0 0 var(--r) var(--r); }
@media (max-width: 700px) { #map { aspect-ratio: 1.25 / 1; } }
#map path.d { stroke: var(--surface); stroke-width: .5; vector-effect: non-scaling-stroke; cursor: pointer; }
#map path.d:hover { stroke: var(--ink); stroke-width: 1.2; }
#map path.d.sel { stroke: var(--ink); stroke-width: 2; }
#map .ob { fill: var(--ink); fill-opacity: .75; stroke: var(--surface); vector-effect: non-scaling-stroke; stroke-width: .6; pointer-events: none; }
#map .hs { fill: none; stroke: var(--ink); vector-effect: non-scaling-stroke; stroke-width: 1.4; pointer-events: none; }
#map .site { stroke: var(--surface); vector-effect: non-scaling-stroke; stroke-width: .5; pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }
.legend .ramp { display: inline-block; width: 140px; height: 10px; border-radius: 3px; vertical-align: -1px; margin: 0 6px; }
.legend .note { margin-left: auto; color: var(--muted); }
.mk { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.mk.ring { background: none; border: 1.5px solid var(--ink); }
.tip { position: fixed; z-index: 20; pointer-events: none; background: var(--ink); color: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: 12px; line-height: 1.4; max-width: 260px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.tip b { font-weight: 600; }
.tip .k { opacity: .7; }

/* tier pill: colour + label, never colour alone */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 999px; font: 600 11.5px/1.6 var(--font-b); border: 1px solid var(--line); white-space: nowrap; }
.pill i { width: 9px; height: 9px; border-radius: 2px; }
.t-Low i { background: var(--t0); } .t-Moderate i { background: var(--t1); } .t-High i { background: var(--t2); } .t-Very i { background: var(--t3); }

/* district panel */
.side { display: flex; flex-direction: column; }
.side header { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.side header .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.side h2 { font-size: 18px; }
.btn { background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; padding: 5px 10px; cursor: pointer; font-size: 12.5px; }
.btn:hover { border-color: var(--muted); }
.blk { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.blk:last-child { border-bottom: 0; }
.big { display: flex; flex-wrap: wrap; gap: 6px 22px; align-items: baseline; }
.big .v { font: 600 30px/1 var(--font-d); letter-spacing: -.02em; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; font-size: 13px; }
.kv dt { color: var(--ink-2); } .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.rank { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow: auto; }
.rank li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.rank li:hover { background: var(--surface-2); }
.rank .nm { min-width: 0; } .rank .nm b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .nm span { color: var(--muted); font-size: 12px; }
.rank .rv { text-align: right; font-variant-numeric: tabular-nums; } .rank .rv small { display: block; color: var(--muted); }
.pyr { display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr); gap: 2px 6px; align-items: center; font-size: 11px; }
.pyr .b { height: 9px; border-radius: 2px; }
.pyr .m { justify-self: end; background: var(--s1); border-radius: 2px 0 0 2px; } .pyr .f { background: var(--s2); border-radius: 0 2px 2px 0; }
.pyr .a { text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; }
.pyr .h { font-weight: 600; color: var(--ink-2); } .pyr .h.m { background: none; }

/* evidence */
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.card-h { display: flex; flex-direction: column; gap: 3px; margin-bottom: 12px; }
.card-h p { color: var(--ink-2); font-size: 12.5px; }
.bars { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 7px 10px; align-items: center; font-size: 12.5px; }
.bars .trk { height: 12px; background: var(--surface-2); border-radius: 3px; position: relative; }
.bars .fill { position: absolute; inset: 0 auto 0 0; background: var(--s1); border-radius: 3px 4px 4px 3px; }
.bars .fill.ref { background: var(--muted); }
.bars .val { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-2); }
.scroll { overflow-x: auto; }
.scroll > table:not(.heat) { min-width: 680px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font: 600 11px/1.3 var(--font-b); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); 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; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; }
tbody tr.click { cursor: pointer; } tbody tr.click:hover { background: var(--surface-2); }
.inbar { display: inline-block; height: 8px; border-radius: 2px; background: var(--s1); vertical-align: middle; margin-right: 6px; }
.heat { border-collapse: separate; border-spacing: 2px; font-size: 11px; width: auto; }
.heat td, .heat th { padding: 0; border: 0; text-align: center; }
.heat td.c { width: 30px; height: 24px; border-radius: 3px; font-variant-numeric: tabular-nums; color: var(--ink); }
.heat th { font-size: 10.5px; letter-spacing: 0; text-transform: none; font-weight: 500; padding: 0 2px; }
.heat th.r { text-align: right; padding-right: 8px; white-space: nowrap; color: var(--ink-2); font-size: 12px; }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; }
svg.chart text { fill: var(--muted); font: 11px var(--font-b); font-variant-numeric: tabular-nums; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .axis { stroke: var(--muted); stroke-opacity: .5; }
.lg { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--ink-2); }
.lg i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 28px; color: var(--ink-2); font-size: 13px; }
.notes b { color: var(--ink); }
@media (max-width: 800px) { .notes { grid-template-columns: minmax(0, 1fr); } }
.finding { border-left: 3px solid var(--accent); padding: 2px 0 2px 12px; color: var(--ink-2); max-width: 75ch; }
.finding b { color: var(--ink); }
footer { color: var(--muted); font-size: 12px; padding-block: 0 32px; }
@media (prefers-reduced-motion: no-preference) { .fill { transition: width .4s ease; } }

/* ===== v2: tabs, hero, plain-language blocks, motion ===== */
[hidden] { display: none !important; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-top: 6px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 9px 14px 8px; font: 600 13.5px/1.2 var(--font-b); color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
@media (max-width: 640px) { .hide-s { display: none; } .bar .meta { margin-left: 0; } }
@media (prefers-reduced-motion: no-preference) {
  .tab:not([hidden]) > * { animation: rise .45s ease both; }
  .tab:not([hidden]) > *:nth-child(2) { animation-delay: .05s; } .tab:not([hidden]) > *:nth-child(3) { animation-delay: .1s; } .tab:not([hidden]) > *:nth-child(4) { animation-delay: .15s; }
  .gbar { animation: grow .9s cubic-bezier(.2, .8, .2, 1) both; }
  .drops span { animation: drift 9s ease-in-out infinite; }
  .dot { animation: pulse 2s ease-in-out infinite; }
  .aud-c, .how .panel, .rows .row { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
  .aud-c:hover, .how .panel:hover { transform: translateY(-3px); }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes grow { from { width: 0; } }
@keyframes drift { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-18px) scale(1.06); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--good) 25%, transparent); } }

/* hero */
.hero { position: relative; overflow: hidden; border-radius: 18px; border: 1px solid var(--line); padding: clamp(20px, 4vw, 40px);
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--t2) 20%, var(--surface)) 0%, transparent 55%), linear-gradient(135deg, color-mix(in srgb, var(--accent) 18%, var(--surface)), var(--surface)); }
.hero-in { position: relative; display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.hero h1 { font: 700 clamp(26px, 4.4vw, 42px)/1.12 var(--font-d); letter-spacing: -.02em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.lead { font-size: 16px; color: var(--ink-2); max-width: 60ch; }
.drops span { position: absolute; border-radius: 50%; background: var(--accent); opacity: .10; }
.drops span:nth-child(1) { width: 120px; height: 120px; right: 6%; top: 10%; }
.drops span:nth-child(2) { width: 54px; height: 54px; right: 24%; top: 56%; animation-delay: -2s; background: var(--t2); opacity: .14; }
.drops span:nth-child(3) { width: 200px; height: 200px; right: -40px; bottom: -70px; animation-delay: -4s; }
.drops span:nth-child(4) { width: 28px; height: 28px; right: 38%; top: 14%; animation-delay: -6s; background: var(--t2); opacity: .18; }
.drops span:nth-child(5) { width: 76px; height: 76px; right: 15%; bottom: 8%; animation-delay: -3s; opacity: .08; }
.find { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.find label { font: 600 12px/1 var(--font-b); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.find input { width: 100%; max-width: 440px; font-size: 16px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); }
.find input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.found { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); max-width: 640px; }
.found-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.found-h h3 { font-size: 18px; }
.found ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.found .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.found .stats div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.found .stats b { font: 600 18px/1.2 var(--font-d); } .found .stats span { color: var(--ink-2); font-size: 12px; }
.found .acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
@media (max-width: 520px) { .found .stats { grid-template-columns: minmax(0, 1fr); } }

/* audience chooser */
.aud { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 800px) { .aud { grid-template-columns: minmax(0, 1fr); } }
.aud-c { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; box-shadow: var(--shadow); }
.aud-c b { font: 600 15px/1.3 var(--font-d); } .aud-c span { color: var(--ink-2); font-size: 13px; }
.aud-c:hover { border-color: var(--accent); }

/* ranked rows with animated bars */
.rows { display: flex; flex-direction: column; gap: 4px; }
.row { display: grid; grid-template-columns: minmax(0, 11em) minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 6px 8px; border-radius: 9px; background: none; border: 0; text-align: left; width: 100%; font: inherit; color: inherit; }
button.row { cursor: pointer; }
button.row:hover { background: var(--surface-2); }
.row .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 13.5px; }
.row .nm span { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.row .trk { height: 14px; background: var(--surface-2); border-radius: 7px; overflow: hidden; }
.gbar { display: block; height: 100%; border-radius: 7px; width: var(--w); background: var(--c, var(--accent)); }
.row .v { font-variant-numeric: tabular-nums; font-size: 13px; text-align: right; min-width: 4.5em; color: var(--ink-2); }
.row .v b { color: var(--ink); }
@media (max-width: 560px) { .row { grid-template-columns: minmax(0, 8em) minmax(0, 1fr) auto; } }
.foot { font-size: 12px; margin-top: 10px; }
.top-grid > section { min-width: 0; }

/* how to read */
.how { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 800px) { .how { grid-template-columns: minmax(0, 1fr); } }
.how .panel { display: flex; flex-direction: column; gap: 8px; } .how p { color: var(--ink-2); font-size: 13.5px; }
.big-n { font: 700 38px/1 var(--font-d); color: var(--accent); }
.tiers { display: flex; gap: 4px; height: 38px; align-items: center; } .tiers i { width: 38px; height: 22px; border-radius: 6px; }
.tiers .t-Low { background: var(--t0); } .tiers .t-Moderate { background: var(--t1); } .tiers .t-High { background: var(--t2); } .tiers .t-Very { background: var(--t3); }

/* map extras */
.layer-desc { padding: 8px 14px; font-size: 12.5px; color: var(--ink-2); border-bottom: 1px solid var(--line); min-height: 2.6em; }

/* inspection */
.score-how { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 800px) { .score-how { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.score-how div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; color: var(--ink-2); }
.score-how b { display: block; color: var(--ink); font: 600 13.5px/1.3 var(--font-d); margin-bottom: 2px; }

/* evidence */
.take { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .take { grid-template-columns: minmax(0, 1fr); } }
.take > div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.take .tag { align-self: flex-start; font: 600 11px/1 var(--font-b); letter-spacing: .05em; text-transform: uppercase; padding: 4px 8px; border-radius: 999px; }
.take .yes { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.take .meh { background: color-mix(in srgb, var(--s2) 20%, transparent); color: var(--s2); }
.take .no { background: var(--surface-2); color: var(--muted); }
.take p { font-size: 13.5px; color: var(--ink-2); } .take b { color: var(--ink); }
.read { margin-top: 10px; font-size: 12.5px; color: var(--ink-2); border-top: 1px dashed var(--line); padding-top: 8px; }

/* about */
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } } @media (max-width: 520px) { .steps { grid-template-columns: minmax(0, 1fr); } }
.steps li { counter-increment: s; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 14px/28px var(--font-d); text-align: center; }
.steps b { color: var(--ink); font: 600 14.5px/1.3 var(--font-d); }
.gloss { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 28px; margin: 0; }
@media (max-width: 800px) { .gloss { grid-template-columns: minmax(0, 1fr); } }
.gloss div { border-bottom: 1px solid var(--line); padding-bottom: 10px; } .gloss dt { font-weight: 600; } .gloss dd { margin: 2px 0 0; color: var(--ink-2); font-size: 13.5px; }
.kpi .v { font-variant-numeric: tabular-nums; }

/* address search + surroundings */
.find-row { display: flex; flex-wrap: wrap; gap: 8px; }
.find-row input { flex: 1 1 300px; max-width: 520px; }
.find-row .btn { padding: 10px 14px; font-weight: 600; }
.fine { font-size: 12.5px; color: var(--ink-2); margin: 0; }
.fine.warn { color: var(--critical); font-weight: 600; }
.fine.muted { color: var(--muted); }
.cands { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.verdict { border-radius: 10px; padding: 10px 12px; font-size: 14px; border: 1px solid var(--line); border-left-width: 5px; background: var(--surface-2); }
.verdict.alert { border-left-color: var(--critical); background: color-mix(in srgb, var(--critical) 10%, var(--surface)); }
.verdict.watch { border-left-color: var(--s2); background: color-mix(in srgb, var(--s2) 10%, var(--surface)); }
.verdict.calm { border-left-color: var(--good); }
.rad { display: flex; align-items: center; gap: 10px; }
.found .stats.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 640px) { .found .stats.five { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.near { list-style: none; padding-left: 0 !important; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.near li { display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 3px; }
#map .pinr { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: var(--accent); stroke-width: 2; stroke-dasharray: 7 5; vector-effect: non-scaling-stroke; pointer-events: none; }
.lang { margin-left: 4px; }
.lang button { padding: 4px 9px; font-weight: 600; font-size: 12px; }
.bar .meta { align-items: center; }
.side header .row2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.caution { border: 1px solid var(--line); border-left: 5px solid var(--s2); border-radius: 10px; background: color-mix(in srgb, var(--s2) 8%, var(--surface)); padding: 10px 14px; font-size: 13.5px; color: var(--ink-2); max-width: 90ch; }
.caution b { color: var(--ink); }
#roles td { vertical-align: top; } #roles td:first-child { min-width: 11em; }
.st { display: inline-block; font-size: 12.5px; font-weight: 600; }
.st-ok { color: var(--good); } .st-part { color: var(--s2); } .st-no { color: var(--muted); }
#map .pin { fill: var(--accent); stroke: var(--surface); stroke-width: 2.5; vector-effect: non-scaling-stroke; pointer-events: none; }

/* ===== v3: use the space ===== */
.wrap { max-width: 1600px; }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.theme-btn:hover { color: var(--ink); border-color: var(--muted); }
.sep { flex: 0 0 1px; align-self: stretch; background: var(--line); margin: 0 4px; }
.mk.pinmk { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }

/* hero: text left, live map right */
.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(16px, 3vw, 44px); align-items: center; }
.hero-in { max-width: none; }
.hero-map { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 8px; }
.hero-map svg { display: block; width: 100%; height: auto; }
.hero-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); }
.hero-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; }
.mini-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); margin-right: 5px; }
.hm { stroke: var(--surface); stroke-width: .4; cursor: pointer; }
.hm:hover { stroke: var(--ink); stroke-width: 1.2; }
.mini-ob { fill: var(--ink); fill-opacity: .7; stroke: var(--surface); stroke-width: .4; pointer-events: none; }
@media (max-width: 980px) { .hero { grid-template-columns: minmax(0, 1fr); } }

/* tier summary under the ranked districts so both columns end together */
.top-grid > section { display: flex; flex-direction: column; gap: 14px; }
.tier-row { grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr) auto; cursor: default; }
.tier-row .v { min-width: 0; font-size: 12.5px; }

/* map tab: the card fills the viewport height; the side panel scrolls inside it */
.work { align-items: stretch; height: clamp(560px, calc(100vh - 215px), 880px); grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); }
.mapcard { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.mapcard .mapbox { flex: 1 1 auto; min-height: 0; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.work .side { overflow-y: auto; min-height: 0; }
.rank { max-height: none; overflow: visible; }
#map circle.ob { stroke-width: .8; }
#map circle.sa { stroke: var(--surface); stroke-width: .5; vector-effect: non-scaling-stroke; fill-opacity: .9; pointer-events: none; }
.legend .note { text-align: right; max-width: 60ch; }
@media (max-width: 980px) { .work { height: auto; grid-template-columns: minmax(0, 1fr); } .mapcard .mapbox { flex: none; aspect-ratio: 1.1 / 1; } .work .side { overflow: visible; } }

/* inspection: summary row, table left, map right */
.ins-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; align-items: stretch; }
.ins-top .caution { max-width: none; margin: 0; display: flex; align-items: center; }
.ins-top .score-how { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .ins-top { grid-template-columns: minmax(0, 1fr); } }
.ins-work { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .ins-work { grid-template-columns: minmax(0, 1fr); } }
.q-scroll { max-height: calc(100vh - 240px); min-height: 360px; overflow-y: auto; }
.imap-card { position: sticky; top: 118px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.imap-card svg { display: block; width: 100%; height: auto; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tiles div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; }
.tiles b { font: 600 22px/1.1 var(--font-d); } .tiles span { font-size: 12px; color: var(--ink-2); }
.im { fill: var(--surface-2); stroke: var(--surface); stroke-width: .5; cursor: pointer; }
.im.on { fill: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); }
.isite { stroke: var(--surface); stroke-width: 1; cursor: pointer; fill-opacity: .92; }
.isite:hover { stroke: var(--ink); stroke-width: 2; }
.imap-card .legend { padding: 0; border: 0; }

/* evidence: cards in a row share a height, with the takeaway pinned to the bottom */
.grid2 > .panel { display: flex; flex-direction: column; }
.grid2 > .panel > .read { margin-top: auto; }
.grid2 > .panel > .read, .grid2 > .panel > .lg { margin-top: 12px; }
.grid2 > .panel > .read { margin-top: auto; padding-top: 10px; }

/* v3 fixes */
.drops { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* map tab: height follows the map (the two halves of Malaysia are about 2.4:1); the watch list scrolls inside the same height */
.work { height: auto; }
.mapcard .mapbox { flex: none; aspect-ratio: 2.3 / 1; }
.work .side { height: 0; min-height: 100%; overflow-y: auto; }
@media (max-width: 980px) { .work .side { height: auto; min-height: 0; } .mapcard .mapbox { aspect-ratio: 1.1 / 1; } }

/* map overlays are sized from the zoom level in JS (see sizePts), so CSS must not rescale their strokes too */
#map circle.ob, #map circle.hs, #map circle.sa, #map circle.site, #map circle.pin, #map path.pinr { vector-effect: none !important; }

/* inspection polish */
.ins-top .caution { display: block; }
#queue td, #queue th { padding-left: 8px; padding-right: 8px; }
#queue td:nth-child(3), #queue td:nth-child(4), #queue td:nth-child(5) { white-space: nowrap; }
#queue .inbar { max-width: 40px; }
.scroll > #queue { min-width: 760px; }
#queue td:last-child { white-space: nowrap; }

/* Selected district: highlight its own shape. The browser's rectangular focus outline is scaled by the map zoom and turns
   into a thick box, so districts get a shape-following focus style instead. */
#map path.d:focus, #map path.d:focus-visible { outline: none; }
#map path.d:focus-visible { stroke: var(--focus); stroke-width: 3; }
#map.has-sel path.d:not(.sel) { fill-opacity: .6; }
#map path.d.sel { stroke: var(--ink); stroke-width: 2.5; fill-opacity: 1; }
