:root{
  --bg:#f7f8fa; --panel:#ffffff; --border:#e1e4e9; --border-soft:#eceef1;
  --text:#1a2130; --text-muted:#5b6472; --text-faint:#8a92a0;
  --accent:#2458d6; --accent-soft:#e8eefd;
  --radius:10px;
  --shadow:0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  font-size:15px;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  color:var(--text); background:var(--bg); display:flex; flex-direction:column;
}
/* Long unbroken strings (file paths, code identifiers -- e.g. the NAAF
   tab's "data/Malawi_Climate_Monitoring_NAAF_..._Plan.md" source-mapping
   line) have no natural break point (no spaces, underscores don't count
   as one to a browser's default word-break), so a narrow mobile viewport
   was forced wider than the screen just by that one <code> span --
   confirmed via a real Playwright mobile screenshot 2026-08-31 (375px
   viewport rendered at 568px actual width). code always wraps now
   instead of pushing the whole page into horizontal scroll. */
code{overflow-wrap:break-word; word-break:break-word}

/* ---------- header / nav ---------- */
header{
  display:flex; align-items:center; gap:18px; padding:10px 18px;
  background:var(--panel); border-bottom:1px solid var(--border); flex:0 0 auto; z-index:20;
}
header h1{font-size:16px; margin:0; font-weight:650; letter-spacing:-.01em}
header .subtitle{font-size:12px; color:var(--text-muted); margin-top:1px}
.brand-home{display:flex; align-items:center; gap:9px; text-decoration:none; color:inherit; margin-right:6px; border-radius:8px; padding:2px 4px; margin-left:-4px}
.brand-home:hover{background:var(--border-soft)}
.brand-logo{width:26px; height:26px; flex:0 0 auto}
.brand{display:flex; flex-direction:column}
nav.tabs{display:flex; gap:4px; margin-left:8px}
nav.tabs button{
  border:none; background:transparent; padding:7px 14px; border-radius:999px;
  font-size:13.5px; font-weight:560; color:var(--text-muted); cursor:pointer;
}
nav.tabs button.active{background:var(--accent-soft); color:var(--accent)}
nav.tabs button:hover:not(.active){background:var(--border-soft)}

/* "More" nav dropdown (2026-09-03) -- 5 less-frequently-used/technical
   tabs (Explore, Methodology, NAAF Alignment, Experimental, What's
   changed) tucked behind one toggle, so a first-time visitor sees 5
   everyday destinations up front, not 10 flat options. */
.nav-more{position:relative}
.nav-more-btn{display:flex; align-items:center; gap:3px}
.nav-more-caret{font-size:10px; transition:transform .12s}
.nav-more.open .nav-more-caret{transform:rotate(180deg)}
.nav-more-menu{
  /* z-index 2000, not 30 (2026-09-23 fix): Leaflet's own default CSS
     gives its controls/panes z-index up to 800 (.leaflet-control),
     and .leaflet-container never establishes its own stacking context
     (position:relative with no z-index of its own), so those values
     compare directly against this menu's -- a real bug, not
     hypothetical: this menu was rendering BEHIND the Basins & Lakes
     map's own zoom control once that map sat far enough up the page.
     2000 is safely above every Leaflet z-index this project uses on
     any map (Map tab, Basins & Lakes, Vulnerability), including an
     open popup (700). */
  display:none; position:absolute; top:calc(100% + 6px); left:0; z-index:2000;
  background:var(--panel); border:1px solid var(--border); border-radius:10px;
  box-shadow:0 10px 28px rgba(16,24,40,.14); padding:6px; min-width:190px;
  flex-direction:column; gap:1px;
}
.nav-more.open .nav-more-menu{display:flex}
.nav-more-menu button{
  border:none; background:transparent; padding:9px 12px; border-radius:7px;
  font-size:13.5px; font-weight:560; color:var(--text); cursor:pointer;
  text-align:left; width:100%;
}
.nav-more-menu button.active{background:var(--accent-soft); color:var(--accent)}
.nav-more-menu button:hover:not(.active){background:var(--border-soft)}
#status-badge{
  margin-left:auto; font-size:12px; color:var(--text-muted); text-align:right;
  display:flex; align-items:center; gap:8px;
}
.dot{width:8px; height:8px; border-radius:50%; background:#9aa4b2; flex:0 0 auto}
.dot.ok{background:#1a9e6b}
.dot.stale{background:#e0972b}

/* ---------- first-visit banner ---------- */
/* Shown once, only when a visitor's very first page load lands directly
   on a non-Home tab (a shared/bookmarked deep link) -- 2026-09-03. The
   Home tab is already the default landing view and already has its own
   full "how it works" orientation (hero, 3-step guide, nav grid), so
   showing this SAME pointer again on top of Home itself would be
   redundant; this exists specifically for the visitor who never sees
   Home at all. Tracked in localStorage (mwi_visited), set the moment
   this either gets dismissed OR any real navigation happens. */
.first-visit-banner{
  display:flex; align-items:center; justify-content:space-between; gap:14px;
  background:var(--accent-soft); border-bottom:1px solid var(--border);
  padding:9px 18px; font-size:13px; color:var(--text);
}
.first-visit-banner[hidden]{display:none}
.first-visit-banner a{color:var(--accent); font-weight:600}
.first-visit-actions{display:flex; align-items:center; gap:8px; flex:0 0 auto}
.first-visit-dismiss{
  border:none; background:transparent; font-size:18px; line-height:1; cursor:pointer;
  color:var(--text-faint); padding:2px 4px;
}
.first-visit-dismiss:hover{color:var(--text)}
@media (max-width:640px){
  .first-visit-banner{flex-direction:column; align-items:flex-start; gap:8px}
}

/* ---------- view switching ---------- */
.view{display:none; min-height:0; flex:1}
.view.active{display:flex}

/* ---------- map view ---------- */
#map-view{position:relative}
#map{flex:1; min-width:0}
#map-toolbar{
  background:var(--panel); border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:10px; width:270px; margin:0;
}
#toolbarBody{display:flex; flex-direction:column; gap:8px; margin-top:8px}
.toolbar-toggle{
  display:none; width:100%; align-items:center; justify-content:space-between;
  background:none; border:none; padding:0; font-size:12.5px; font-weight:650;
  color:var(--text); cursor:pointer;
}
.toolbar-toggle span:last-child{color:var(--text-faint); font-size:11px}
#map-toolbar label{font-size:11px; font-weight:650; color:var(--text-faint); text-transform:uppercase; letter-spacing:.04em}
#map-toolbar select,#map-toolbar input{
  width:100%; padding:7px 8px; border:1px solid var(--border); border-radius:7px;
  font-size:13px; background:#fff; color:var(--text);
}
#search-results{
  max-height:220px; overflow:auto; border:1px solid var(--border); border-radius:7px;
  display:none; background:#fff;
}
#search-results div{padding:7px 9px; font-size:13px; cursor:pointer; border-bottom:1px solid var(--border-soft)}
#search-results div:last-child{border-bottom:none}
#search-results div:hover{background:var(--accent-soft)}
.muted-sm{color:var(--text-faint); font-size:11px}
#date-note:not(:empty){margin-top:4px; line-height:1.4}
.toolbar-checkbox{display:flex; align-items:center; gap:6px; font-size:12px; font-weight:normal; text-transform:none; letter-spacing:normal; color:var(--text); cursor:pointer; user-select:none; margin-top:2px}
.toolbar-checkbox input{margin:0; cursor:pointer; flex:0 0 auto}
/* A layer-visibility toggle (gwLayerToggle) sitting unlabelled among the
   Region/District/TA/Date scope filters read as "doesn't really make
   sense there" (real user feedback, 2026-09-02) -- it's a different KIND
   of control, not another way to narrow scope. A thin top border plus a
   small eyebrow label gives it its own visibly separate mini-section
   instead of blending into the filter list above it, without moving it
   away from the toolbar checkbox's own original discoverability fix
   (Round 2026-08-30: the built-in Leaflet layer-switcher icon alone
   wasn't discoverable at all). */
.toolbar-section-label{
  font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
  color:var(--text-faint); margin:10px 0 4px; padding-top:8px; border-top:1px solid var(--border-soft);
}
#resetBtn{width:100%; margin-top:2px}
#pdfReportBtn{width:100%; margin-top:6px}

.legend-box{
  position:absolute; bottom:14px; left:12px; z-index:15; background:var(--panel);
  border:1px solid var(--border); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:9px 11px; font-size:12px; min-width:150px; max-width:260px;
}
.legend-title{font-weight:650; margin-bottom:4px; font-size:11.5px; color:var(--text-muted)}
.legend-def{font-size:11px; color:var(--text-muted); line-height:1.4; margin-bottom:7px}
.legend-source{display:block; color:var(--text-faint); font-style:italic}
.legend-row{display:flex; align-items:center; gap:6px; padding:1.5px 0}
.legend-swatch{width:13px; height:13px; border-radius:3px; flex:0 0 auto}

#panel{
  width:380px; flex:0 0 auto; overflow-y:auto; border-left:1px solid var(--border);
  background:var(--panel); padding:16px 18px;
}
#panel h2{font-size:15px; margin:16px 0 8px; font-weight:650}
#panel h2:first-child{margin-top:0}
.muted{color:var(--text-muted); font-size:12.5px}
.metric{display:grid; grid-template-columns:1fr auto; gap:8px; padding:6px 0; border-bottom:1px solid var(--border-soft)}
.metric span{color:var(--text-muted); font-size:13px}
.metric b{font-weight:620; font-size:13px}
.placeholder{color:var(--text-faint); font-size:13px; padding:30px 4px; text-align:center; line-height:1.5}
.toolbar-row{display:flex; gap:6px; margin:10px 0}
.toolbar-row select{flex:1; padding:6px 7px; border:1px solid var(--border); border-radius:7px; font-size:12.5px}
button.btn{
  padding:6px 11px; border-radius:7px; border:1px solid var(--border); background:#fff;
  font-size:12.5px; font-weight:560; cursor:pointer; color:var(--text);
}
button.btn:hover{background:var(--border-soft)}
button.btn.primary{background:var(--accent); border-color:var(--accent); color:#fff}
button.btn.primary:hover{filter:brightness(1.08)}
button.btn.sm{padding:5px 9px; font-size:11.5px}
.btn-row{display:flex; gap:6px; flex-wrap:wrap; margin:8px 0}
canvas#trend{max-height:170px; margin-top:6px}
canvas#hazardChart{max-height:130px; width:100%; margin:8px 0 4px}
canvas#exposureChart{max-height:150px; width:100%; margin:8px 0 4px}
canvas#nationalChart{max-height:280px; width:100%; margin:10px 0} /* 220->280 2026-09-02: each row's y-axis label grew a second line (population figure) */
/* "Top 100 TAs, ranked" -- a horizontal row chart, 100 rows tall. No
   fixed max-height here (unlike this file's other canvases) -- its own
   render code sets the canvas PARENT's height directly in JS, scaled to
   the row count (same pattern barChartHorizontal() already uses
   elsewhere), and a max-height here would just clamp that back down. */
canvas#nationalDetailChart{width:100%; margin:10px 0}
/* Seasonal outlook Stage 2/3 charts (Experimental tab) -- same fix as
   the three above: without an explicit max-height, Chart.js's
   responsive resize loop and this card's own auto-height CSS grid row
   feed back into each other and the canvas grows unbounded (found via
   a real Playwright screenshot coming back ~6000px tall). */
canvas#chartSeasonalOutlook, canvas#chartRiskBandsDry, canvas#chartRiskBandsWet{max-height:220px; width:100%}
/* Experimental-tab mini maps -- small, non-interactive-basemap
   choropleths of the TA layer already loaded for the main Map tab (see
   loadTA()'s own taFeatures global), reused here rather than a second
   GeoJSON fetch. Fixed height (Leaflet needs an explicit container
   size, unlike the Chart.js canvases above which size via max-height). */
.exp-map{height:260px; border-radius:var(--radius); overflow:hidden; background:var(--panel-alt, #eef1f5)}
/* 2026-09-07 -- the national sub-TA (5km cell) map needs real room to be
   usable: ~6,100 individual polygons, meant to be zoomed/panned/clicked,
   not glanced at like the small single-purpose maps .exp-map was sized
   for. */
.exp-map-large{height:560px; border-radius:var(--radius); overflow:hidden; background:var(--panel-alt, #eef1f5)}
.exp-map-legend{display:flex; flex-wrap:wrap; gap:10px; margin-top:8px; font-size:12px}
.exp-map-legend span.swatch{display:inline-block; width:11px; height:11px; border-radius:2px; margin-right:4px; vertical-align:middle}
.badge{display:inline-block; padding:2px 8px; border-radius:999px; background:var(--border-soft); font-size:11px; font-weight:600; color:var(--text-muted)}

/* Analytics tab (2026-09-02): a TA filter was added alongside the
   existing district filter, real user feedback that without a visible
   reminder of current scope it's easy to mistake a single-TA chart for
   the national/district picture, especially once printed or exported on
   its own (printSingleCard reparents just one .analytics-card -- a
   scope note living only in the shared toolbar above would be lost the
   moment that happens). One small label lives inside every scoped chart
   card itself instead, so it's real DOM content that travels with the
   card into any print/export path, not a JS overlay. Empty by default
   (":empty" hides it) -- populated by updateAnalyticsScopeLabels(). */
.chart-scope-label{
  display:inline-flex; align-items:center; gap:5px; font-size:10.5px; font-weight:700;
  letter-spacing:.03em; color:var(--accent); background:var(--accent-soft);
  border-radius:999px; padding:2px 9px; margin:2px 0 6px;
}
.chart-scope-label:empty{display:none}
#analyticsScopeBanner:empty{display:none}

/* ---------- TA detail-panel grouping (2026-09-02) ----------
   Every section here used to be a flat run of identically-styled h2s --
   a user reported it hard to tell what kind of thing each number even
   was (today's alert vs. a raw daily reading vs. a static, rarely-
   changing context layer). Three visually distinct group types now wrap
   related sections: .detail-group-headline (today's own alert reading,
   most prominent), the plain .detail-group (day-to-day satellite
   readings), and .detail-group-static (context that's the same every
   day -- WASH infrastructure, groundwater -- with a dashed border and
   its own "static" tag so it reads as a different kind of number on
   sight, not just by reading the caveat text under it). */
.detail-group{
  border:1px solid var(--border); border-radius:var(--radius);
  padding:2px 14px 6px; margin:14px 0;
}
.detail-group h2{margin-top:14px}
.detail-group h2:first-child{margin-top:12px}
.detail-eyebrow{
  font-size:10.5px; font-weight:700; letter-spacing:.07em; text-transform:uppercase;
  color:var(--text-faint); margin:0 0 -4px 2px;
}
.detail-group-headline{
  background:var(--accent-soft); border-color:transparent;
}
.detail-group-headline .detail-eyebrow{color:var(--accent)}
.detail-group-static{
  background:var(--panel-alt, #f5f6f8); border-style:dashed;
}
/* Collapsed by default (2026-09-03, direct user request: progressive
   disclosure so a first-time/non-technical visitor sees Alert Level +
   day-to-day signals first, not a wall of groundwater/salinity/cropland
   detail before anything else). <details>/<summary> -- native, no JS
   needed for the toggle itself, keyboard-accessible by default. The
   summary reuses .detail-eyebrow's own look so collapsed vs. expanded
   reads as the same section, just foldable, not two different designs. */
.detail-group-static summary.detail-eyebrow{
  cursor:pointer; list-style:none; display:flex; align-items:center; padding:4px 0;
}
.detail-group-static summary.detail-eyebrow::-webkit-details-marker{display:none}
.detail-group-static summary.detail-eyebrow::before{
  content:'▸'; display:inline-block; margin-right:5px; font-size:9px;
  color:var(--text-faint); transition:transform .12s;
}
.detail-group-static[open] summary.detail-eyebrow::before{transform:rotate(90deg)}
.detail-group-static summary.detail-eyebrow:hover{color:var(--text)}
.detail-group-static h2:first-of-type{margin-top:10px}
.static-tag{
  display:inline-flex; align-items:center; gap:4px; font-size:10.5px; font-weight:700;
  letter-spacing:.05em; text-transform:uppercase; color:var(--text-faint);
  background:var(--panel); border:1px solid var(--border); border-radius:999px;
  padding:2px 8px; vertical-align:middle; margin-left:8px;
}

/* ---------- info-icon pop-up (hover on desktop, tap-to-toggle on touch) ---------- */
.info-icon{
  display:inline-flex; align-items:center; justify-content:center; width:15px; height:15px;
  border-radius:50%; background:var(--border-soft); color:var(--text-muted); font-size:10px;
  font-weight:700; font-style:italic; font-family:Georgia,serif; cursor:help; margin-left:5px;
  position:relative; vertical-align:middle; user-select:none;
}
.info-icon:hover,.info-icon.active{background:var(--accent); color:#fff}
.info-icon .info-tip{
  display:none; position:absolute; bottom:135%; left:50%; transform:translateX(-50%);
  background:#1a2130; color:#fff; font-size:11.5px; font-weight:400; font-style:normal;
  /* NOT font-family:inherit -- .info-icon itself sets Georgia,serif (for
     the "i" glyph's own look), and `inherit` takes the immediate parent's
     computed value, so every tooltip page-wide was silently rendering in
     serif instead of the site's real body font. Found 2026-08-30 from a
     direct user report of "inconsistent fonts" -- confirmed by reading
     this rule, not guessed. Same stack as body{} in this file. */
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  line-height:1.45; padding:9px 11px; border-radius:8px; width:230px;
  box-shadow:0 6px 18px rgba(0,0,0,.28); z-index:1200; text-align:left; white-space:normal;
}
.info-icon .info-tip::after{
  content:''; position:absolute; top:100%; left:50%; transform:translateX(-50%);
  border:5px solid transparent; border-top-color:#1a2130;
}
.info-icon:hover .info-tip,.info-icon.active .info-tip{display:block}
h2 .info-icon,.legend-title .info-icon{font-size:9px; width:14px; height:14px}
/* The legend sits near the map's left edge -- a centred tip would overflow
   off-screen to the left there, so anchor that one leftward instead. */
.legend-title .info-tip{left:0; transform:none}
.legend-title .info-tip::after{left:7px; transform:none}
/* Panel h2 icons sit right under the fixed page header (screenshot QA
   caught the upward-opening tip clipping under it for headers near the
   top of a scrolled panel) -- open downward instead, which also reads
   more naturally as "explaining the section below". */
h2 .info-tip,.metric .info-tip{bottom:auto; top:135%}
h2 .info-tip::after,.metric .info-tip::after{top:auto; bottom:100%; border-top-color:transparent; border-bottom-color:#1a2130}
/* Opt-out for an h2 whose tooltip would otherwise pop down onto content
   directly below it (e.g. "Hazard profile", which sits right above its
   own chart canvas -- a downward tip landed on top of the chart,
   reported unreadable by a user 2026-09-02). Restores the default
   upward placement for just that icon. */
h2 .info-icon-up .info-tip{bottom:135%; top:auto}
h2 .info-icon-up .info-tip::after{top:100%; bottom:auto; border-top-color:#1a2130; border-bottom-color:transparent}
/* h2/metric rows sit inside the narrow 380px #panel -- a centred 230px
   tip on a heading/row anywhere but dead-centre of that panel runs off
   one edge or the other. Left-anchor both, same fix .legend-title
   already had -- found 2026-08-30 from a direct user report that these
   ("Groundwater & long-term dryness context" named specifically) were
   running off-screen; h2 had the vertical (opens-downward) fix already
   but was missing this horizontal one. */
.metric .info-tip,h2 .info-tip{left:0; transform:none}
.metric .info-tip::after,h2 .info-tip::after{left:8px; transform:none}
.source-line{font-size:11px; color:var(--text-faint); margin-top:10px; line-height:1.5}

/* ---------- methodology view ---------- */
#doc-view{overflow-y:auto; padding:0; justify-content:center}
.doc-wrap{max-width:880px; width:100%; padding:28px 28px 60px; margin:0 auto}
.doc-wrap h1{font-size:22px; margin:0 0 4px}
.doc-wrap h2{font-size:16px; margin:30px 0 10px; padding-top:6px; border-top:1px solid var(--border-soft)}
.doc-wrap h2:first-of-type{border-top:none}
.doc-wrap h3{font-size:13.5px; margin:16px 0 6px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.03em}
.doc-wrap p{line-height:1.6; color:var(--text); font-size:13.8px}
.doc-wrap ul{line-height:1.7; font-size:13.8px; padding-left:20px}
.doc-wrap ol{line-height:1.7; font-size:13.8px; padding-left:20px}
.doc-wrap .doc-steps>li{margin-bottom:12px}
.doc-wrap .doc-steps ul{margin-top:6px}

/* Vulnerability tab's own small choropleth maps (2026-09-05) -- no
   Leaflet tile layer (deliberately: these are small comparison maps of
   Malawi's own TA shapes, not a pannable/zoomable basemap view like the
   Map tab's own main map), so plain flex sizing is enough; height fixed
   rather than aspect-ratio since Malawi's own tall/narrow shape means a
   fixed height reads consistently regardless of container width. */
.vuln-map-row{display:flex; flex-wrap:wrap; gap:14px; align-items:flex-start; margin:10px 0}
/* flex:1 1 0, not 1 1 auto (2026-09-23 fix) -- a block-level child with
   no explicit width resolves an "auto" flex-basis to something that can
   effectively claim the WHOLE row's available width, leaving no room
   for a sibling (.vuln-legend, or the Basins & Lakes detail card) to
   sit beside it -- forcing a wrap even when there is genuinely enough
   combined width. min-width:0 is needed too (flex items default to
   min-width:auto, which refuses to shrink below content size). Matches
   the Map tab's own already-correct #map{flex:1; min-width:0}. */
.vuln-map{flex:1 1 0; min-width:0; height:420px; background:var(--panel); border:1px solid var(--border-soft); border-radius:var(--radius)}
.vuln-legend{flex:0 0 130px; font-size:12px; padding-top:4px}
.vuln-legend-item{display:flex; align-items:center; gap:6px; margin-bottom:4px}
.vuln-legend-swatch{width:12px; height:12px; border-radius:2px; flex-shrink:0}
.vuln-rank-table{width:100%; border-collapse:collapse; font-size:12.5px; margin:10px 0 18px}
.vuln-rank-table th{text-align:left; padding:6px 8px; font-weight:650; color:var(--text-muted); border-bottom:1px solid var(--border-soft)}
.vuln-rank-table td{padding:6px 8px; border-bottom:1px solid var(--border-soft)}
.vuln-rank-table td:last-child, .vuln-rank-table th:last-child{text-align:right}

/* Sticky in-page contents (2026-08-29 site review) -- the Methodology page
   had grown to ~5 screens of scroll with no way to jump to a section,
   so it worked as a one-time read but not as a reference to come back to.
   position:sticky works fine inside #doc-view's own overflow-y:auto --
   its containing block is .doc-wrap, not the viewport, which is all
   sticky needs. */
.doc-toc{
  position:sticky; top:0; z-index:5; display:flex; flex-wrap:wrap; gap:6px;
  background:var(--bg); padding:10px 0 12px; margin-bottom:6px;
  border-bottom:1px solid var(--border-soft);
}
.doc-toc a{
  font-size:12px; color:var(--accent); text-decoration:none; white-space:nowrap;
  background:var(--accent-soft); border-radius:999px; padding:5px 11px;
}
.doc-toc a:hover{filter:brightness(0.95)}

/* Simple box-and-arrow / swatch diagrams -- plain HTML/CSS, no image
   assets or diagram library, consistent with this page's existing
   no-build-step approach (formula callouts are already styled <code>
   blocks, not screenshots). */
.diagram{border:1px solid var(--border); border-radius:var(--radius); background:var(--panel); padding:14px 16px; margin:14px 0}
.diagram-title{font-size:11.5px; font-weight:650; text-transform:uppercase; letter-spacing:.03em; color:var(--text-muted); margin-bottom:10px}
.arch-diagram-row{display:flex; align-items:stretch; gap:6px; flex-wrap:wrap}
.arch-box{
  flex:1 1 140px; border-radius:8px; padding:10px 12px; display:flex; flex-direction:column; gap:3px;
  background:var(--accent-soft); border:1px solid var(--border);
}
.arch-box b{font-size:12.5px}
.arch-box span{font-size:11px; color:var(--text-muted); line-height:1.4}
.arch-box-compute{background:#fdf3e5}
.arch-box-store{background:#eaf6ef}
.arch-arrow{display:flex; align-items:center; justify-content:center; font-size:18px; color:var(--text-faint); flex:0 0 auto; padding:0 2px}
.arch-diagram-note{font-size:12px; color:var(--text-muted); line-height:1.5; margin-top:10px}
.scale-diagram-row{display:flex; align-items:center; gap:12px; padding:8px 0; border-top:1px solid var(--border-soft)}
.scale-diagram-row:first-of-type{border-top:none}
.scale-diagram-label{flex:0 0 100px; font-size:12px; font-weight:600}
.scale-diagram-label span{display:block; font-weight:400; color:var(--text-muted); font-size:10.5px; text-transform:none}
.scale-diagram-swatches{display:flex; flex:0 0 auto; border-radius:5px; overflow:hidden; box-shadow:0 0 0 1px var(--border)}
.scale-diagram-swatches span{width:26px; height:20px; display:block}
.scale-diagram-note{font-size:11.5px; color:var(--text-muted); line-height:1.4}
@media (max-width:640px){
  .arch-diagram-row{flex-direction:column}
  .arch-arrow{transform:rotate(90deg); padding:2px 0}
  .scale-diagram-row{flex-wrap:wrap}
  .scale-diagram-note{flex-basis:100%}
}
.card-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:10px; margin:12px 0}
.card{border:1px solid var(--border); border-radius:var(--radius); padding:12px 14px; background:var(--panel)}
.card h4{margin:0 0 5px; font-size:13px}
.card p{margin:0; font-size:12.5px; color:var(--text-muted); line-height:1.5}
table.dict{width:100%; border-collapse:collapse; font-size:12.5px; margin-top:8px}
table.dict th{
  text-align:left; padding:7px 8px; border-bottom:2px solid var(--border); color:var(--text-muted);
  font-weight:650; position:sticky; top:0; background:var(--panel);
}
table.dict td{padding:7px 8px; border-bottom:1px solid var(--border-soft); vertical-align:top}
table.dict tr:hover td{background:var(--accent-soft)}
.dict-filter{margin:10px 0; display:flex; gap:8px}
.dict-filter input{flex:1; padding:7px 9px; border:1px solid var(--border); border-radius:7px; font-size:13px}
.dict-wrap{max-height:520px; overflow:auto; border:1px solid var(--border); border-radius:var(--radius)}
.dict-wrap table{margin-top:0}
.ds-wrap{max-height:none; overflow-x:auto}
.ds-table{font-size:12px; min-width:1180px}
.ds-table th.ds-cat{background:var(--accent-soft); color:var(--text); font-weight:700; position:static}
.ds-table td code{font-size:11px; white-space:nowrap}
.ds-table td:nth-child(2) code{white-space:normal; word-break:break-word}
.ds-table td:nth-child(1){min-width:170px}
.ds-table td:nth-child(7){min-width:190px}
.ds-table td .ds-note{display:block; color:var(--text-muted); margin-top:3px}
.ds-filter{display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin:10px 0 6px}
.ds-filter label{cursor:pointer}
.badge.ds-kind-live{background:#dcefdc; color:#1f6b2f}
.badge.ds-kind-static{background:#e3e8f5; color:#2f4a8a}
.badge.ds-kind-manual{background:#fbe9d0; color:#8a5a1a}
.callout{background:var(--accent-soft); border-radius:var(--radius); padding:12px 14px; font-size:13px; line-height:1.55; margin:14px 0}
.callout.warn{background:#fdf3e5}

/* NAAF Alignment tab -- one card per hazard trigger */
.naaf-page-header{display:flex; align-items:flex-start; gap:16px; margin-bottom:4px}
.naaf-coat-of-arms{width:56px; height:auto; flex:0 0 auto; margin-top:2px}
.naaf-page-header h1{margin-bottom:2px}
.naaf-card{border:1px solid var(--border); border-radius:var(--radius); background:var(--panel); padding:14px 16px; margin:14px 0}
.naaf-chart{max-height:170px; width:100%; margin-top:10px}
.naaf-chart-label{font-size:11px; font-weight:650; color:var(--text-muted); text-transform:uppercase; letter-spacing:.02em; margin-top:12px}
.naaf-where-wrap{margin-top:6px; position:relative}
.naaf-where-wrap .no-data{margin-top:4px}
.naaf-card-head{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:6px}
.naaf-card-head h3{margin:0; font-size:15px; text-transform:none; letter-spacing:normal; color:var(--text); font-weight:700}
.naaf-badge{font-size:11px; font-weight:650; padding:3px 9px; border-radius:999px; white-space:nowrap}
.naaf-badge-tracked{background:#e3f5ea; color:#1a7a45}
.naaf-badge-partial{background:#fdf3e5; color:#a3660a}
.naaf-badge-gap{background:var(--border-soft); color:var(--text-muted)}
.naaf-badge-alert{background:#fde3e1; color:#b3261e}
/* Analytics loading overlay -- covers the whole card (not just the
   canvas) while data is in flight, which can now take a few seconds
   against the growing archive (see Round 24/25). A blank white card
   during that wait reads as broken; this makes a slow load look like a
   slow load. .analytics-card is already position:relative (chart-expand
   feature), so this pins reliably regardless of card content height. */
.analytics-loading{
  position:absolute; inset:0; z-index:5; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:8px;
  background:var(--panel); border-radius:var(--radius);
  color:var(--text-muted); font-size:13px;
}
.analytics-loading .spinner{
  width:20px; height:20px; border-radius:50%;
  border:3px solid var(--border); border-top-color:var(--accent);
  animation:analytics-spin .8s linear infinite;
}
@keyframes analytics-spin{to{transform:rotate(360deg)}}

.naaf-row{display:grid; grid-template-columns:150px 1fr; gap:8px; padding:4px 0; font-size:13px}
.naaf-row span{color:var(--text-faint)}
.naaf-row b{font-weight:600}
@media (max-width:600px){.naaf-row{grid-template-columns:1fr}}

/* LIVE-only forecast content, separated into its own visually distinct
   block within a NAAF trigger card (2026-08-31, direct user feedback) --
   these fields are NULL on all but a handful of dates ever (LIVE rarely
   completes -- see the Methodology tab's LIVE-vs-hindcast section), so
   giving them their own labelled block with an explicit "why is this
   often empty" note keeps a quiet/missing forecast from reading as a
   broken always-on metric. */
.naaf-live-block{margin:8px 0 2px; padding:8px 10px; border-radius:8px; background:var(--accent-soft); border:1px solid transparent}
.naaf-live-head{display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:2px}
.naaf-badge-live{background:var(--accent); color:#fff}
.naaf-live-block .naaf-row{padding:2px 0}

/* GloFAS gauge panel (NAAF Alignment tab) -- 2 fixed real river gauges,
   shown as cards side by side (not a map -- see app/glofas.py's own
   docstring for why this is 2 points, not a per-TA layer yet). */
.glofas-gauge-grid{display:grid; grid-template-columns:repeat(auto-fit, minmax(320px, 1fr)); gap:14px; margin:10px 0 14px}
.glofas-gauge-card{border:1px solid var(--border); border-radius:var(--radius); background:var(--panel); padding:14px 16px}
.glofas-gauge-card h4{margin:0 0 4px; font-size:14.5px}
.glofas-gauge-card .glofas-pct{font-size:26px; font-weight:700; margin:6px 0 2px}
.glofas-gauge-card .chart-tall-wrap{height:170px; margin-top:10px}

/* Changelog ("What's changed" tab) -- one dated entry per push, newest
   first. Left accent bar makes each date's boundary obvious when scanning,
   distinct from the Methodology tab's plain h2/h3 section headers. */
.changelog-entry{border-left:3px solid var(--accent); padding:2px 0 2px 16px; margin:22px 0}
.changelog-entry h3{
  font-size:14.5px; margin:0 0 8px; color:var(--text); text-transform:none;
  letter-spacing:normal; font-weight:700;
}
.changelog-entry ul{margin:0}
.changelog-entry li{margin-bottom:6px}
.changelog-entry li:last-child{margin-bottom:0}
.downloads-list{display:flex; flex-wrap:wrap; gap:8px; margin:12px 0 6px}

/* ---------- ENSO/IOD/MJO climate-driver context (Stage A, kept on its
   own separate "Experimental" page rather than the NAAF Alignment tab,
   per direct user instruction) ---------- */
.enso-divider{border:none; border-top:1px solid var(--border); margin:34px 0 22px}
.enso-section h2{border-top:none; margin-top:0}
.enso-section .badge, .doc-wrap h1 .badge{margin-left:8px; vertical-align:middle}
#ensoHeadline{font-size:14px}
#ensoHeadline b{font-size:17px}

/* ---------- home / landing page ---------- */
/* Replaced the old first-visit splash modal 2026-08-31, per direct user
   feedback that the site "needs a simple visually appealing landing page
   that does not scare new visitors" -- a modal that only shows once (and
   sits on top of the busy live map underneath it) doesn't give a calm,
   persistent "what is this and where do I go" home base the way a real
   first tab does. This view is now the default landing (marked "active"
   directly in index.html) and reachable any time via the Home tab or the
   header logo.

   Redesigned again same day, per direct feedback that the first version
   "looks like any other AI generated website" -- centered hero, uniform
   emoji-card grid, one font size throughout. Fixes applied: an
   asymmetric two-column hero (real product screenshot on the right, not
   another icon), a deliberately wide type scale (40px headline down to
   11px eyebrow label), tight single-sentence copy instead of paragraphs,
   a real-numbers stat strip (proof this is a live product, not
   placeholder text), and a nav grid with two visually "featured" cards
   (Map/Analytics, the two most-used destinations) instead of seven
   identical tiles. */
.home-wrap{max-width:1080px; width:100%; padding:44px 28px 60px; margin:0 auto}

.home-hero{display:grid; grid-template-columns:1.05fr 1fr; gap:40px; align-items:center; padding:0 0 30px}
.home-eyebrow{
  font-size:11px; font-weight:700; letter-spacing:.08em; color:var(--accent);
  margin-bottom:10px;
}
.home-hero h1{font-size:40px; line-height:1.12; margin:0 0 14px; letter-spacing:-.02em; font-weight:750}
.home-hero-body{font-size:15.5px; line-height:1.55; color:var(--text-muted); margin:0 0 22px; max-width:46ch}
.home-hero-actions{display:flex; gap:10px; flex-wrap:wrap}
button.btn.lg{padding:11px 20px; font-size:14.5px; border-radius:9px}
.home-stats{display:flex; gap:26px; margin-top:30px; padding-top:20px; border-top:1px solid var(--border-soft)}
.home-stats div{display:flex; flex-direction:column}
.home-stats b{font-size:19px; font-weight:750; color:var(--text); letter-spacing:-.01em}
.home-stats span{font-size:11.5px; color:var(--text-faint); margin-top:1px}

.home-hero-media{min-width:0}
.home-browser-frame{
  border:1px solid var(--border); border-radius:12px; overflow:hidden;
  background:var(--panel); box-shadow:0 16px 40px -12px rgba(16,24,40,.22), 0 2px 8px rgba(16,24,40,.06);
}
.home-browser-bar{display:flex; gap:5px; padding:9px 11px; background:var(--border-soft)}
.home-browser-bar span{width:9px; height:9px; border-radius:50%; background:#c7ccd4}
.home-browser-frame img{display:block; width:100%; height:auto}

/* Alternating text/screenshot rows -- historical-trends and district/
   national-scope value props (2026-08-31, per direct user feedback
   asking for more images and more explicit emphasis on both). Same
   browser-chrome-frame treatment as the hero's own screenshot, reused
   rather than a new visual language, so the page still reads as one
   design. .home-feature-rev flips the visual column order only (via
   `order`, not DOM order) -- copy stays first in markup either way, for
   a sane reading/tab order regardless of viewport. */
.home-feature{display:grid; grid-template-columns:1fr 1fr; gap:40px; align-items:center; padding:38px 0; border-top:1px solid var(--border-soft)}
.home-feature-rev .home-feature-copy{order:2}
.home-feature-rev .home-feature-media{order:1}
.home-feature-copy h2{font-size:23px; line-height:1.24; margin:6px 0 12px; letter-spacing:-.01em; font-weight:700}
.home-feature-copy p{font-size:14px; line-height:1.6; color:var(--text-muted); margin:0 0 10px}
.home-feature-copy a{color:var(--accent); font-weight:600}
.home-feature-note{font-size:12px; color:var(--text-faint)}
.home-feature-media{min-width:0}

.home-rationale{
  padding:26px 28px; margin:6px 0 10px; border-radius:12px;
  background:var(--accent-soft); border:1px solid transparent;
}
.home-rationale h2{font-size:21px; line-height:1.26; margin:6px 0 10px; letter-spacing:-.01em; font-weight:700}
.home-rationale p{font-size:14px; line-height:1.6; color:var(--text-muted); margin:0; max-width:72ch}

/* "How it works" -- a short, plain-language inline section on the Home
   page itself (2026-08-31, direct user feedback that sending the "How it
   works" button to the full Methodology tab risked overwhelming a new
   visitor). Three short numbered steps, deliberately not the full
   technical detail -- that stays one link away, not the default. */
.home-how{padding:8px 0 30px; border-top:1px solid var(--border-soft)}
.home-how-steps{list-style:none; counter-reset:how; margin:0; padding:0; display:grid; grid-template-columns:repeat(3,1fr); gap:20px}
.home-how-steps li{counter-increment:how; position:relative; padding-left:34px; font-size:13.8px; line-height:1.55; color:var(--text-muted)}
.home-how-steps li::before{
  content:counter(how); position:absolute; left:0; top:0; width:24px; height:24px;
  border-radius:50%; background:var(--accent-soft); color:var(--accent); font-weight:700; font-size:12.5px;
  display:flex; align-items:center; justify-content:center;
}
.home-how-steps b{color:var(--text)}
.home-how-more{margin:16px 0 0; font-size:13px; color:var(--text-faint)}
.home-how-more a{color:var(--accent); font-weight:600}

.home-section-head{font-size:12.5px; margin:34px 0 14px; color:var(--text-faint); text-transform:uppercase; letter-spacing:.08em; font-weight:700}
.home-nav-grid{display:grid; grid-template-columns:repeat(4,1fr); gap:10px}
.home-nav-card{
  cursor:pointer; padding:16px 16px 15px; border:1px solid var(--border); border-radius:10px;
  background:var(--panel); transition:box-shadow .12s, border-color .12s, transform .12s;
}
.home-nav-card:hover{box-shadow:var(--shadow); border-color:var(--accent); transform:translateY(-1px)}
.home-nav-card h4{margin:0 0 4px; font-size:14.5px}
.home-nav-card p{margin:0; font-size:12.3px; line-height:1.45; color:var(--text-muted)}
.home-nav-card-feature{grid-column:span 2; background:var(--accent-soft); border-color:transparent}
.home-nav-card-feature h4{font-size:16px}
.home-nav-card-feature p{color:var(--text-muted); font-size:12.8px}

.home-footnote{
  margin-top:34px; padding-top:16px; border-top:1px solid var(--border-soft);
  font-size:12px; line-height:1.6; color:var(--text-faint); max-width:70ch;
}

/* ---------- backfill progress bar (Analytics tab's own progress card) ---------- */
.backfill-bar{display:block; width:100%; height:4px; border-radius:999px; background:#d7deea; overflow:hidden}
.backfill-bar.wide{height:7px; margin-top:8px}
.backfill-bar-fill{display:block; height:100%; background:var(--accent); border-radius:999px; transition:width .4s}

/* ---------- analytics view ---------- */
#analytics-view{overflow-y:auto; padding:0; justify-content:center}
.analytics-wrap{max-width:1100px; width:100%; padding:28px 28px 60px; margin:0 auto}
.analytics-wrap h1{font-size:22px; margin:0 0 4px}
.analytics-wrap h2{font-size:16px; margin:26px 0 8px}
.analytics-toolbar{display:flex; align-items:flex-end; gap:14px; margin:14px 0; flex-wrap:wrap}
.analytics-toolbar > div{display:flex; flex-direction:column; gap:4px}
.analytics-toolbar label{font-size:11px; font-weight:650; color:var(--text-faint); text-transform:uppercase; letter-spacing:.04em}
.analytics-toolbar select{padding:6px 8px; border:1px solid var(--border); border-radius:7px; font-size:13px; min-width:170px}
.analytics-toolbar .btn{margin-bottom:1px}
.analytics-smooth-toggle{
  display:flex; align-items:center; gap:6px; font-size:12.5px; color:var(--text);
  align-self:center; cursor:pointer; user-select:none;
}
.analytics-smooth-toggle input{margin:0; cursor:pointer}
.chart-interaction-hint{align-self:center; margin-left:auto}
.compare-metric-checks{display:flex; flex-direction:column; gap:10px; flex:1 1 100%}
.compare-check-group{display:flex; align-items:baseline; gap:10px; flex-wrap:wrap}
.compare-check-group-label{
  flex:0 0 150px; font-size:11px; font-weight:650; color:var(--text-faint);
  text-transform:uppercase; letter-spacing:.04em;
}
.compare-check-group-items{display:flex; flex-wrap:wrap; gap:6px 14px; flex:1 1 auto; min-width:0}
.compare-check{
  display:flex; align-items:center; gap:5px; font-size:12.5px; color:var(--text);
  cursor:pointer; user-select:none; white-space:nowrap;
}
.compare-check input{margin:0; cursor:pointer}
@media (max-width:640px){
  .compare-check-group{flex-direction:column; align-items:flex-start; gap:4px}
  .compare-check-group-label{flex-basis:auto}
}

/* ---------- "closest to escalating" proximity lists ---------- */
.proximity-list{display:flex; flex-direction:column; gap:1px}
.proximity-row{
  display:flex; align-items:center; gap:10px; padding:7px 6px; border-radius:6px;
  background:none; border:none; width:100%; text-align:left; cursor:pointer; font:inherit; color:inherit;
}
.proximity-row:hover{background:var(--accent-soft)}
.proximity-row .prox-name{flex:1 1 auto; min-width:0}
.proximity-row .prox-name b{font-size:12.8px; display:block}
.proximity-row .prox-name span{font-size:11px; color:var(--text-muted)}
.proximity-row .prox-gap{flex:0 0 auto; text-align:right; font-size:12px; font-weight:650}
.proximity-row .prox-gap span{display:block; font-size:10px; font-weight:400; color:var(--text-muted)}
.proximity-row .prox-bar{flex:0 0 60px; height:6px; border-radius:999px; background:var(--border-soft); overflow:hidden}
.proximity-row .prox-bar-fill{display:block; height:100%; border-radius:999px}
.analytics-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(400px,1fr)); gap:14px; margin:14px 0}
.analytics-card{position:relative; border:1px solid var(--border); border-radius:var(--radius); padding:14px 16px; background:var(--panel)}
.analytics-card h3{margin:0 0 4px; font-size:13.5px}
#chartAlertTrend,#chartTierDist,#chartTierDistPop,#chartPopAlert,#chartWindHeat,#chartRainZ,#chartDrySpell,#chartFloodTas,#chartVegSoil{max-height:230px; width:100%}

/* Full-width charts (not inside .analytics-grid's 2-column layout, so
   they span the whole page) need their own explicit-height wrapper --
   Chart.js's responsive engine reads the canvas's immediate parent box,
   and a parent whose own height is just "auto-fit its content" (the
   canvas plus toolbar/note siblings) is a circular sizing dependency
   that leaves the canvas at whatever its bare HTML height attribute
   says, which read as "too short" on a wide screen (2026-09-01 user
   report, with a screenshot) since a ~110px-tall chart spanning nearly
   the full viewport width looks badly squashed. clamp() scales the
   height with viewport width so it looks proportionate at any screen
   size, not just a single fixed pixel value. */
.chart-tall-wrap{position:relative; height:clamp(320px, 28vw, 480px)}
.chart-tall-wrap canvas{max-height:none !important}
.analytics-card.expanded .chart-tall-wrap{flex:1 1 auto; height:auto; min-height:0}

/* ---------- Explore tab: correlation matrix + scatter ---------- */
.corr-legend{display:flex; flex-wrap:wrap; align-items:center; gap:12px; font-size:12px; color:var(--text-muted); margin:8px 0 14px}
.corr-legend-label{font-weight:650; color:var(--text)}
.corr-legend-item{display:flex; align-items:center; gap:5px; white-space:nowrap}
.corr-swatch{width:14px; height:14px; border-radius:3px; flex:0 0 auto; display:inline-block}
.corr-matrix-wrap{overflow-x:auto; margin:12px 0}
/* Basins & Lakes tables (2026-09-20) -- same "let a wide table scroll
   within its own box on narrow screens, don't force the whole page to
   scroll" pattern as .corr-matrix-wrap above. Found via a real mobile
   Playwright check: adding the "Recent 7d rain" column pushed
   #basinListTable's own intrinsic width past a 390px viewport. */
#basinListTable, #riverPointsTable{overflow-x:auto}
table.corr-matrix{border-collapse:collapse; font-size:11.5px}
table.corr-matrix th{padding:5px 6px; font-weight:600; text-align:center; white-space:nowrap; max-width:90px; vertical-align:bottom}
table.corr-matrix th.row-label{text-align:right; max-width:160px; white-space:normal}
table.corr-matrix td{
  width:44px; height:34px; text-align:center; font-variant-numeric:tabular-nums;
  cursor:pointer; border:1px solid rgba(255,255,255,.6); color:#1a2130;
}
table.corr-matrix td:hover{outline:2px solid var(--accent); outline-offset:-2px}
table.corr-matrix td.diag{cursor:default; color:var(--text-faint)}
/* Bigger than the standard analytics-card canvas -- the ask was
   specifically for a chart with more room to zoom/resize into. */
#chartScatter{max-height:480px; width:100%}
#scatterCard{padding-bottom:10px}
/* 2026-09-05, Round 86: the Vulnerability tab's own compound-view
   scatter needs the exact same guard -- without an explicit max-height,
   Chart.js's responsive:true/maintainAspectRatio:false combination has
   nothing to bound itself against inside a plain .analytics-card (which
   sets no CSS height of its own), and the canvas grows to an enormous,
   scroll-breaking height instead of a normal chart -- caught directly via
   a real Playwright bounding-box check (~3290px tall), not assumed. */
#compoundScatter{max-height:480px; width:100%}
#compoundScatterCard{padding-bottom:10px}

/* Per-chart reset-zoom / expand controls (wireChartExpandControls in app.js).
   Sit top-right, above the canvas -- .analytics-card is position:relative
   (set inline by JS) so this pins reliably regardless of card content. */
.chart-tools{position:absolute; top:10px; right:12px; display:flex; gap:6px; z-index:2}
.chart-tools button{
  background:var(--panel); border:1px solid var(--border); border-radius:6px;
  width:24px; height:24px; padding:0; font-size:13px; line-height:1; cursor:pointer;
  color:var(--text-muted); display:flex; align-items:center; justify-content:center;
}
.chart-tools button:hover{background:var(--border-soft); color:var(--text)}
.chart-tools button.hidden{display:none}

/* Expanded (fullscreen) chart card: reparents nothing, just goes
   position:fixed and lets Chart.js's responsive resize fill it. A dimmed
   backdrop (body.chart-expanded::before) sits behind it so the rest of the
   page reads as inactive without needing a separate overlay element. */
body.chart-expanded::before{content:''; position:fixed; inset:0; background:rgba(16,20,28,.5); z-index:498}
.analytics-card.expanded{
  position:fixed; inset:24px; z-index:500; display:flex; flex-direction:column;
  box-shadow:0 12px 40px rgba(16,24,40,.3);
}
.analytics-card.expanded canvas{flex:1 1 auto; max-height:none !important; width:100% !important}
.analytics-card.expanded .chart-expand{font-size:15px}
.analytics-stats-row{display:flex; flex-wrap:wrap; gap:18px; margin:10px 0 4px}
.analytics-stats-row div{display:flex; flex-direction:column}
.analytics-stats-row b{font-size:19px; font-weight:700; color:var(--text)}
.analytics-stats-row span{font-size:11px; color:var(--text-muted)}

/* ---------- district PDF download row ---------- */
.district-download-row{margin:14px 0 4px}
.district-download-controls{display:flex; gap:8px; margin-top:6px; flex-wrap:wrap}
.district-download-controls select{padding:7px 9px; border:1px solid var(--border); border-radius:7px; font-size:13px; min-width:200px; flex:1}

/* ---------- email alert signup form ---------- */
.alert-form{max-width:520px; margin-top:18px}
.alert-form-row{margin-bottom:20px; display:flex; flex-direction:column; gap:8px}
.alert-form-row > label:first-child{font-size:11px; font-weight:650; color:var(--text-faint); text-transform:uppercase; letter-spacing:.04em}
.alert-form input[type="email"]{padding:9px 11px; border:1px solid var(--border); border-radius:7px; font-size:14px; width:100%; box-sizing:border-box}
.alert-form select{padding:8px 10px; border:1px solid var(--border); border-radius:7px; font-size:13px; margin-top:6px; max-width:320px}
.alert-form .btn-row label{font-size:13.5px; font-weight:400; text-transform:none; letter-spacing:normal; display:flex; align-items:center; gap:5px; color:var(--text)}
#alertSignalChecks label{display:flex; align-items:flex-start; gap:7px; font-size:13.5px; color:var(--text); margin-bottom:8px; cursor:pointer}
#alertSignalChecks input{margin-top:3px}
.alert-consent{display:flex; align-items:flex-start; gap:8px; font-size:12.5px; color:var(--text-muted); font-weight:400; text-transform:none; letter-spacing:normal; cursor:pointer}
.alert-consent input{margin-top:2px; flex-shrink:0}

@media (max-width:880px){
  header{flex-wrap:wrap; row-gap:6px; padding:8px 12px}
  header h1{font-size:14.5px}
  .subtitle{display:none}
  nav.tabs{margin-left:0; flex-wrap:wrap; row-gap:4px}
  #status-badge{margin-left:auto; flex-basis:100%; justify-content:flex-end; font-size:11px; order:4}
  #map-view{flex-direction:column}
  #panel{width:100%; border-left:none; border-top:1px solid var(--border); max-height:50vh}
  #map{min-height:42vh}
  #map-toolbar{width:min(84vw,270px)}
  .doc-wrap,.analytics-wrap,.home-wrap{padding:18px 14px 50px}
  .analytics-grid{grid-template-columns:1fr}
  .analytics-card.expanded{inset:8px}
  .home-hero{grid-template-columns:1fr; gap:26px}
  .home-hero-media{order:-1}
  .home-hero h1{font-size:27px}
  .home-hero-body{max-width:none}
  .home-stats{gap:20px; flex-wrap:wrap}
  .home-feature{grid-template-columns:1fr; gap:18px; padding:28px 0}
  .home-how-steps{grid-template-columns:1fr; gap:16px}
  .home-feature-rev .home-feature-copy,.home-feature-rev .home-feature-media{order:0}
  .home-rationale{padding:20px 18px}
  .home-nav-grid{grid-template-columns:repeat(2,1fr)}
  .home-nav-card-feature{grid-column:span 2}
  .district-download-controls{flex-direction:column}
  .district-download-controls select{min-width:0}
}

@media (max-width:520px){
  .home-nav-grid{grid-template-columns:1fr}
  .home-nav-card-feature{grid-column:span 1}
  .home-hero h1{font-size:23px}
}

@media (max-width:520px){
  html{font-size:14px}
  header{padding:8px 10px}
  .brand-logo{width:22px; height:22px}
  nav.tabs button{padding:6px 10px; font-size:12.5px}
  /* Toolbar (top-left) and legend (bottom-left) are both Leaflet overlay
     controls stacked on the same short mobile map -- on a phone-height map
     their combined content can exceed the available space and the legend
     was found (real device-width screenshot QA) to render on top of the
     toolbar's date/reset fields. Two complementary fixes: the toolbar now
     collapses behind a toggle by default on this breakpoint (JS sets this
     initial state; .toolbar-toggle is only ever visible here), so most of
     the time there's no toolbar body to collide with at all -- and both
     are still individually shrunk (hidden field labels, compact legend)
     for the case where a visitor does expand the toolbar. */
  .toolbar-toggle{display:flex}
  #map-toolbar{width:min(90vw,230px); padding:7px}
  #toolbarBody{gap:4px; margin-top:7px}
  #map-toolbar label{display:none}
  #toolbarBody > div{margin-bottom:0}
  #map-toolbar select,#map-toolbar input{padding:5px 6px; font-size:12.5px}
  #resetBtn,#pdfReportBtn{margin-top:1px; padding:5px 8px; font-size:11.5px}
  .legend-box{max-width:min(60vw,190px); font-size:10px; padding:6px 8px}
  .legend-title{font-size:10.5px; margin-bottom:2px}
  .legend-row{padding:1px 0}
  .legend-swatch{width:11px; height:11px}
  #map{min-height:54vh}
  #panel{max-height:40vh}
  body.toolbar-expanded-mobile .legend-box{display:none}
  .card-grid{grid-template-columns:1fr}
  table.dict{font-size:11.5px}
  .downloads-list .btn{flex:1 1 auto; text-align:center}
  canvas#hazardChart{max-height:150px}
  canvas#exposureChart{max-height:170px}
}

/* ------------------------------------------------------------ print (Analytics tab) */
/* Browser-native print/"Save as PDF" rather than a server-rendered PDF --
   the charts are already live <canvas> elements in the DOM, so printing
   the page itself is the simplest correct way to get them onto paper/PDF,
   no headless-render pipeline needed. .view{display:none} on inactive
   tabs already keeps this scoped to whichever tab is open when Print is
   used -- most useful from Analytics (the "Print / save as PDF" button
   lives there), but works the same from any tab. */
/* Landscape, not the browser's portrait default -- these are wide
   horizontal-timeline charts, and portrait was cropping/squashing them
   (real user feedback, 2026-09-02). Applies to every print from this app
   (whole-page and the single-chart target below both go through
   window.print() on this same document, so one @page rule covers both). */
@page { size: landscape; margin: 12mm; }
@media print {
  header, .analytics-toolbar .btn, .chart-tools,
  .chart-interaction-hint, .proximity-list a .muted-sm, #status-badge,
  .info-icon { display: none !important; }
  body { background: #fff; }
  .analytics-card, .analytics-grid, .card { break-inside: avoid; }
  canvas { max-width: 100% !important; }
}
/* Print-a-single-chart (printSingleCard() in app.js): everything at the
   body's own top level is hidden except #print-single-target, which is
   where the real card gets reparented to for the duration of the print
   dialog -- see that function's own comment for why a reparent, not a
   clone. Scoped to direct children of body (not a blanket "hide
   .analytics-card" rule) so it works regardless of which page/tab the
   card was printed from. */
#print-single-target { display: none; }
body.print-single-chart #print-single-target { display: block; }
@media print {
  body.print-single-chart > :not(#print-single-target) { display: none !important; }
  body.print-single-chart #print-single-target .chart-tools { display: none !important; }
  /* A single printed chart has the whole landscape page to itself --
     override the analytics-grid card's normal (narrow-column-sized) max-
     heights so it actually uses that space, rather than printing small
     and mostly-blank-paged the way the grid-tuned sizing would. */
  body.print-single-chart #print-single-target .analytics-card { max-width: none; }
  body.print-single-chart #print-single-target canvas { max-height: 70vh !important; height: 70vh !important; }
}
