:root {
  --bg: #f6f7f5; --card: #fff; --ink: #1b2a2f; --muted: #56656b; --line: #dde3e1; --accent: #0b5c6b;
  /* Okabe-Ito colorblind-safe; always paired with a text label */
  --high: #c84b00; --medium: #d99a00; --low: #0072b2;
  --high-bg: #fbe9df; --medium-bg: #fdf3d6; --low-bg: #e1eff8;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; color: var(--accent); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; margin-top: 1.25rem; }
a { color: var(--accent); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); font-weight: normal; }
.small { font-size: .85rem; }
.print-only { display: none; }
[hidden] { display: none !important; }

.top { background: var(--card); border-bottom: 1px solid var(--line); padding: 20px 0; margin-bottom: 24px; }
.top-row { display: flex; gap: 24px; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; }
.lede { margin: 0 0 .25rem; max-width: 62ch; }
.meta { margin: 0; color: var(--muted); font-size: .9rem; }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select, button { font: inherit; padding: 8px 12px; border-radius: 6px; border: 1px solid #9aa8ad; background: #fff; color: var(--ink); }
button { cursor: pointer; }
#print { background: var(--accent); color: #fff; border-color: var(--accent); }
button:focus-visible, select:focus-visible, tr:focus-visible, summary:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #f0b400; outline-offset: 2px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid; white-space: nowrap; }
.badge.high { color: #8a3300; background: var(--high-bg); border-color: var(--high); }
.badge.medium { color: #6b4b00; background: var(--medium-bg); border-color: var(--medium); }
.badge.low { color: #00527f; background: var(--low-bg); border-color: var(--low); }

.link { border: 0; padding: 0; background: none; color: var(--accent); text-decoration: underline; font-size: inherit; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin-bottom: 24px; }
.foot { color: var(--muted); font-size: .85rem; padding-bottom: 32px; }
.chart { height: 180px; }
.nowrap { white-space: nowrap; }
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11pt; }
  .no-print, .leaflet-control-container { display: none !important; }
  .print-only { display: block; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== Official report (index.html). Scoped to body.report so citizen.html keeps the base above. ===== */
.report {
  --bg: #f4f2ed; --ink: #141d21; --muted: #525c5f; --line: #dcd8cf; --accent: #0d5563;
  /* risk: dark red / light amber / grey differ in lightness too, so they stay apart for colour-blind readers; always paired with text */
  --r-high: #b3261e; --r-med: #e9a319; --r-low: #a3abad;
  --display: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
}
.report .wrap { max-width: 1400px; padding: 0 28px; }
.report h1, .report h2, .report h3 { color: var(--ink); }
.report button { border-color: var(--line); }

.topbar { border-bottom: 1px solid var(--line); background: var(--bg); }
.bar-row { display: flex; align-items: center; gap: 20px; height: 56px; }
.brand { font: 800 1.15rem/1 var(--display); letter-spacing: -.01em; color: var(--ink); text-decoration: none; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--r-high); margin-right: 8px; vertical-align: 1px; }
.bar-actions { margin-left: auto; display: flex; gap: 8px; }
.ghost { font-size: .9rem; padding: 7px 14px; border: 1px solid var(--ink); border-radius: 999px; color: var(--ink); background: transparent; text-decoration: none; line-height: 1.3; }
.ghost:hover { background: var(--ink); color: var(--bg); }

.report .hero { padding-top: 30px; padding-bottom: 22px; }
.hero h1 { font: 800 clamp(2.3rem, 4.6vw, 4.2rem)/1 var(--display); letter-spacing: -.01em; margin: 0 0 12px; }
.hero h1 .n { color: var(--r-high); }
.sub { margin: 0; font-size: 1.15rem; color: var(--muted); }
.notice { margin: 12px 0 0; padding: 8px 12px; border-radius: 8px; background: #fdf6e6; border: 1px solid var(--r-med); display: inline-block; }

.stage { display: grid; grid-template-columns: 3fr 2fr; gap: 28px; height: max(480px, calc(100vh - 240px)); }
.map-col { order: -1; display: flex; flex-direction: column; min-height: 0; }
#map { flex: 1; position: relative; border-radius: 14px; border: 1px solid var(--line); background: #ececec; }
.map-off { margin: 0; padding: 24px; color: var(--muted); }
.map-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: .85rem; padding: 4px 6px 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; display: inline-flex; gap: 8px; align-items: center; }
.chip b { background: var(--r-high); color: #fff; border-radius: 999px; min-width: 22px; padding: 0 6px; text-align: center; font-size: .8rem; }
.chip b.zero { background: #e4e1da; color: var(--muted); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.map-wrap { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.legend { position: absolute; z-index: 500; top: 10px; right: 10px; display: flex; gap: 12px; font-size: .8rem; color: var(--ink); background: rgba(255,255,255,.92); padding: 4px 10px; border-radius: 999px; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.leaflet-tile-pane { filter: grayscale(1) contrast(.85) brightness(1.06); }
/* the map sits at a fractional y (vw-sized headline); its own layer keeps tile edges pixel-aligned, so no seams */
.leaflet-tile-container { will-change: transform; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.dot.high { background: var(--r-high); width: 13px; height: 13px; vertical-align: -2px; } .dot.medium { background: var(--r-med); } .dot.low { background: var(--r-low); width: 7px; height: 7px; vertical-align: 1px; }
.mk { stroke: #fff; } .mk.high { fill: var(--r-high); } .mk.medium { fill: var(--r-med); } .mk.low { fill: var(--r-low); }
.mk.sel { stroke: var(--ink); stroke-width: 4px; } .leaflet-interactive:focus { outline: none; }
.city-pin { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; transform: translate(-50%, -50%); padding: 5px 12px 5px 5px; border-radius: 999px; border: 0; background: var(--ink); color: #fff; font: 600 .9rem/1 var(--display); box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.city-pin b { background: var(--r-high); border-radius: 999px; min-width: 28px; height: 28px; display: grid; place-items: center; font-size: 1rem; }
.city-pin.calm { background: #fff; color: var(--ink); } .city-pin.calm b { background: #e4e1da; color: var(--muted); }

.act { display: flex; flex-direction: column; min-height: 0; }
.eyebrow { font: 650 .8rem/1 var(--display); text-transform: uppercase; letter-spacing: .12em; color: var(--muted) !important; margin: 0 0 12px; }
.act-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.act-card { width: 100%; text-align: left; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; padding: 16px 18px; border: 1px solid var(--line) !important; border-left: 5px solid var(--r-low) !important; border-radius: 12px; background: #fff; }
.act-card.high { border-left-color: var(--r-high) !important; } .act-card.medium { border-left-color: var(--r-med) !important; }
.act-card:hover { box-shadow: 0 4px 18px rgba(20,29,33,.10); }
.rank { font: 800 1.9rem/1 var(--display); color: var(--ink); grid-row: span 2; min-width: 1.1em; }
.act-main { display: grid; gap: 7px; min-width: 0; }
.act-name { font: 650 1.25rem/1.2 var(--display); }
.act-city { font: 500 .9rem system-ui; color: var(--muted); margin-left: 8px; }
.act-do { font-size: .95rem; font-weight: 600; color: var(--accent); }
.act-card .ev { grid-column: 2; justify-self: start; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: .8rem; padding: 1px 8px; border-radius: 6px; background: #efece5; color: #333d40; white-space: nowrap; }
.ev { font-size: .78rem; color: var(--muted); padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; white-space: nowrap; }
.ev.weak { border-style: dashed; color: #8a5a00; border-color: var(--r-med); }
.ev.weak::before { content: "Thin · "; font-weight: 600; }
.act-foot { margin: 14px 0 0; color: var(--muted); font-size: .95rem; }
.see-all { font-weight: 600; color: var(--accent); }
.quiet { color: var(--muted); }

.report .below { margin-top: 64px; }
.sec { border-top: 2px solid var(--ink); }
.sec:last-child { border-bottom: 1px solid var(--line); }
.sec + .sec { border-top: 1px solid var(--line); }
.sec > summary { display: flex; align-items: baseline; gap: 16px; padding: 18px 0; cursor: pointer; list-style: none; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: "+"; margin-left: auto; font: 500 1.5rem/1 var(--display); color: var(--muted); }
.sec[open] > summary::after { content: "–"; }
.sec > summary h2 { font: 650 1.35rem/1.2 var(--display); margin: 0; }
.sec-note { color: var(--muted); font-size: .9rem; }
.sec[open] { padding-bottom: 28px; }

.alerts { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.alert { display: grid; grid-template-columns: 5.5rem 1fr; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); break-inside: avoid; }
.alert h3 { margin: 0 0 4px; font-size: 1rem; }
.alert p { margin: 2px 0; font-size: .92rem; max-width: 95ch; }
.report .badge { border: 0; border-radius: 6px; padding: 2px 8px; justify-self: start; align-self: start; }
.report .badge.high { background: var(--r-high); color: #fff; }
.report .badge.medium { background: var(--r-med); color: #2b1d00; }
.report .badge.low { background: #e4e1da; color: #3b4447; }

.streams td { vertical-align: middle; border-color: #e7e3da; }
.streams tbody tr { cursor: pointer; }
.streams tr.high td { background: #fbeeec; } .streams tr.medium td { background: #fdf6e6; }
.streams tbody tr:hover td { background: #fff; }
.streams .link.name { font-weight: 700; color: var(--ink); text-decoration: none; text-align: left; }
.streams .link.name:hover { text-decoration: underline; }
.streams .rk { width: 2.5rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.low-wrap > summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 12px 0; }

.brief p, .brief ol { max-width: 80ch; }
.how p { max-width: 85ch; }
.rules { margin: .5rem 0 1rem; }

.scrim { position: fixed; inset: 0; z-index: 999; background: rgba(20,29,33,.35); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: #fff; z-index: 1000; overflow-y: auto; padding: 28px 28px 40px; box-shadow: -12px 0 40px rgba(20,29,33,.18); border-left: 1px solid var(--line); }
.drawer[hidden] { display: none; }
.close { position: absolute; top: 20px; right: 20px; width: 40px; height: 40px; border-radius: 50%; font-size: 1.5rem; line-height: 1; padding: 0; border: 1px solid var(--line); background: #fff; }
.d-city { margin: 0 0 4px; font-size: .9rem; }
.drawer h2 { font: 800 1.9rem/1.1 var(--display); letter-spacing: -.02em; margin: 0 56px 10px 0; }
.d-city { margin-right: 56px !important; }
.trend { width: 100%; height: auto; display: block; font-size: 12px; }
.trend text { fill: var(--muted); }
.trend .grid { stroke: #eceae4; }
.trend polyline { fill: none; stroke: var(--ink); stroke-width: 2; }
.trend circle { fill: var(--ink); }
.verdict { display: inline-block; font-weight: 700; margin: 0 0 10px; padding: 3px 10px; border-radius: 6px; }
.verdict.high { background: var(--r-high); color: #fff; } .verdict.medium { background: var(--r-med); color: #2b1d00; } .verdict.low { background: #e4e1da; }
.d-do { margin: 12px 0 0; font-size: .95rem; }
.drawer h3 { font-size: .95rem; margin: 22px 0 8px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.d-ev { margin: 0; padding-left: 1.1rem; font-size: .9rem; }
.d-ev li { margin: 3px 0; }
.lab-bar { display: grid; grid-template-columns: 9.5rem 1fr 2.5rem; gap: 10px; align-items: center; font-size: .88rem; margin: 6px 0; }
.track { height: 8px; background: #efece5; border-radius: 4px; overflow: hidden; }
.fill { display: block; height: 100%; background: var(--r-low); }
.lab-bar.mid .fill { background: var(--r-med); } .lab-bar.hi .fill { background: var(--r-high); }
.val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.lab-pos { margin: -5px 0 6px calc(9.5rem + 10px); } .d-hab { font-size: .9rem; margin: 10px 0; }
.d-links { margin-top: 24px; }

.report .foot { margin-top: 40px; }
.load summary { cursor: pointer; }

@media (max-width: 900px) {
  .report .wrap { padding: 0 16px; }
  .bar-row { height: auto; padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  .bar-actions { margin-left: 0; }
  .report .hero { padding-top: 22px; padding-bottom: 16px; }
  .stage { grid-template-columns: 1fr; height: auto; }
  .map-col { order: 0; }
  #map { height: 380px; flex: none; }
  .map-wrap { flex: none; }
  .act-card { padding: 14px; }
  .alert { grid-template-columns: 1fr; gap: 4px; }
  .sec > summary { flex-wrap: wrap; gap: 4px 12px; }
}

/* Printing: the map takes its paper size before print layout, so tiles are positioned and loaded for it */
.printing #map { width: 680px; height: 340px; flex: none; }

/* short laptop screens (1280x720): keep all three cards and "See all" above the fold */
@media (min-width: 901px) and (max-height: 760px) {
  .report .hero { padding-top: 16px; padding-bottom: 12px; }
  .hero h1 { font-size: clamp(2rem, 3.6vw, 3rem); margin-bottom: 6px; }
  .sub { font-size: 1rem; }
  .stage { height: max(440px, calc(100vh - 170px)); }
  .eyebrow { margin-bottom: 8px; }
  .act-list { gap: 8px; }
  .act-card { padding: 10px 14px; }
  .act-main { gap: 5px; }
  .act-name { font-size: 1.1rem; }
  .rank { font-size: 1.5rem; }
  .act-foot { margin-top: 10px; }
}
@media (max-width: 400px) {
  .bar-row { gap: 8px; }
  .ghost { padding: 6px 10px; font-size: .85rem; }
}

@media print {
  .report { background: #fff; }
  .report .wrap { padding: 0; max-width: none; }
  .topbar { border: 0; } .bar-row { height: auto; }
  .print-only#print-city { display: inline; font-weight: 600; }
  .hero { padding: 8px 0 12px; } .hero h1 { font-size: 26pt; }
  .stage { display: block; height: auto; }
  .drawer, .scrim, .map-foot, .leaflet-control-container { display: none !important; }
  .map-col { display: block; margin-top: 12px; break-inside: avoid; }
  #map { width: 680px; height: 340px; flex: none; }
  .streams td, .streams th { padding: 4px 6px; font-size: 8.5pt; }
  .streams .tags { gap: 2px; } .streams .tag, .streams .ev { font-size: 7.5pt; padding: 0 5px; }
  .streams .small { font-size: 7.5pt; }
  .legend { box-shadow: none; border: 1px solid #ccc; }
  .act-card { break-inside: avoid; margin-bottom: 6px; border: 1px solid #ccc !important; border-left-width: 5px !important; }
  .below { margin-top: 18px; }
  .sec > summary::after { display: none; }
  .sec { break-before: auto; }
  tr, .alert { break-inside: avoid; }
  .alert.medium, .alert.low { display: none; }
  .low-wrap > summary { color: var(--muted); }
  .alerts .print-only { display: block; padding-top: 10px; }
  .streams tr.high td, .streams tr.medium td { background: none; }
}
.groups { margin: 4px 0 0; padding-left: 1.1rem; font-size: .92rem; max-width: 95ch; } .groups li { margin: 3px 0; }
