/* ============================================================
   Pest Radar — Global Spread Case Study (GNORAB)
   Agri-intelligence dashboard. Sober greenhouse / agronomy palette.
   ============================================================ */

/* ---------- Type scale ---------- */
:root {
  --text-xs: clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.2vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.2vw, 1rem);
  --text-lg: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  --text-xl: clamp(1.375rem, 1.1rem + 1vw, 1.875rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-sm: 0.3rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 9999px;

  --transition-interactive: 160ms cubic-bezier(0.16, 1, 0.3, 1);

  --font-body: "Satoshi", "Helvetica Neue", system-ui, sans-serif;
  --font-display: "Cabinet Grotesk", "Satoshi", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --sidebar-w: 300px;
  --nav-h: 60px;
}

/* ---------- Light theme: warm linen + moss green ---------- */
:root,
[data-theme="light"] {
  --color-bg: #f1efe7;
  --color-surface: #f8f6ef;
  --color-surface-2: #fdfcf7;
  --color-surface-offset: #eae7dc;
  --color-surface-sunk: #e4e0d3;
  --color-divider: #ddd9cc;
  --color-border: #cfcabb;

  --color-text: #20271d;
  --color-text-muted: #6c6f62;
  --color-text-faint: #a4a596;
  --color-text-inverse: #f8f6ef;

  --color-primary: #2f5d34;       /* moss / leaf green */
  --color-primary-hover: #244a29;
  --comet-hue: #5a8f6a;           /* soft sage for travel trails (light) */
  --color-primary-soft: #d9e3d3;
  --color-accent: #b5772a;        /* harvest amber */
  --color-accent-soft: #ece0cd;
  --color-risk: #d19900;
  --color-trade: #2f5d34;

  /* EPPO status / event semantic colors (data viz) */
  --c-widespread: #7a2f2f;        /* deep red — present widespread */
  --c-restricted: #b5772a;        /* amber — restricted */
  --c-few: #c9a227;               /* gold — few occurrences */
  --c-nodetails: #5b7a4f;         /* muted green — present no details */
  --c-absent: #8d8c80;            /* grey — absent */

  --map-land: #e0ddd0;
  --map-land-stroke: #cbc6b6;
  --map-ocean: transparent;

  /* Emerging hot spot classes (Westland legend) */
  --hs-new: #c2402f;          /* red — newly invaded */
  --hs-intensifying: #e08214; /* orange — rising */
  --hs-persistent: #b58a1b;   /* amber — sustained */
  --hs-diminishing: #6a93c0;  /* blue — fading */
  --hs-historical: #8a8d7e;   /* grey — past */
  /* KDE intensity ramp stops */
  --kde-low: #2f5d34;
  --kde-mid: #d19900;
  --kde-high: #a8331f;

  --shadow-sm: 0 1px 2px rgba(40, 45, 30, 0.07);
  --shadow-md: 0 4px 14px rgba(40, 45, 30, 0.1);
  --shadow-lg: 0 16px 40px rgba(40, 45, 30, 0.16);
}

[data-theme="dark"] {
  --color-bg: #14160f;
  --color-surface: #1a1d14;
  --color-surface-2: #1f2218;
  --color-surface-offset: #20241a;
  --color-surface-sunk: #11130c;
  --color-divider: #2a2e21;
  --color-border: #353a2a;

  --color-text: #d6d8cb;
  --color-text-muted: #898d7c;
  --color-text-faint: #5b5f51;
  --color-text-inverse: #14160f;

  --color-primary: #74a86b;
  --color-primary-hover: #8ec083;
  --comet-hue: #8fc79c;           /* soft sage for travel trails (dark) */
  --color-primary-soft: #2a3a26;
  --color-accent: #d79a4f;
  --color-accent-soft: #3a2f1f;
  --color-risk: #e8af34;
  --color-trade: #8ec083;

  --c-widespread: #d96a6a;
  --c-restricted: #d79a4f;
  --c-few: #e0c14e;
  --c-nodetails: #8aab78;
  --c-absent: #777a6c;

  --map-land: #232719;
  --map-land-stroke: #343a26;
  --map-ocean: transparent;

  --hs-new: #e2624f;
  --hs-intensifying: #eda13f;
  --hs-persistent: #d8b441;
  --hs-diminishing: #7eaee0;
  --hs-historical: #9a9d8d;
  --kde-low: #5b9a62;
  --kde-mid: #e8af34;
  --kde-high: #d96a4f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #14160f; --color-surface: #1a1d14; --color-surface-2: #1f2218;
    --color-surface-offset: #20241a; --color-surface-sunk: #11130c;
    --color-divider: #2a2e21; --color-border: #353a2a;
    --color-text: #d6d8cb; --color-text-muted: #898d7c; --color-text-faint: #5b5f51;
    --color-primary: #74a86b; --color-primary-hover: #8ec083; --color-primary-soft: #2a3a26; --comet-hue: #8fc79c;
    --color-accent: #d79a4f; --color-accent-soft: #3a2f1f; --color-risk: #e8af34; --color-trade: #8ec083;
    --c-widespread: #d96a6a; --c-restricted: #d79a4f; --c-few: #e0c14e;
    --c-nodetails: #8aab78; --c-absent: #777a6c;
    --map-land: #232719; --map-land-stroke: #343a26;
  }
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body {
  min-height: 100dvh;
  line-height: 1.55;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
}
img, svg, canvas { display: block; max-width: 100%; }
button { cursor: pointer; background: none; border: none; color: inherit; font: inherit; }
input, select, button { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
h1, h2, h3, h4 { line-height: 1.15; text-wrap: balance; font-family: var(--font-display); }
a { color: var(--color-primary); }
a:hover { color: var(--color-primary-hover); }
:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: var(--radius-sm); }
a, button, input, select { transition: color var(--transition-interactive), background var(--transition-interactive), border-color var(--transition-interactive), box-shadow var(--transition-interactive); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-3); top: -3rem; z-index: 100;
  background: var(--color-primary); color: var(--color-text-inverse);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: var(--space-3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- App shell ---------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100dvh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: var(--space-6) var(--space-5) var(--space-8);
  display: flex; flex-direction: column; gap: var(--space-5);
  position: sticky; top: var(--nav-h); align-self: start; max-height: calc(100dvh - var(--nav-h));
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: var(--space-3); }
.brand-mark { width: 38px; height: 38px; color: var(--color-primary); flex-shrink: 0; }
.brand .eyebrow {
  font-size: var(--text-xs); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-text-muted); font-weight: 600; margin-bottom: 1px;
}
.brand h1 { font-size: var(--text-lg); letter-spacing: -0.01em; }

.side-block { display: flex; flex-direction: column; gap: var(--space-3); }
.side-block > h2 {
  font-family: var(--font-body); font-size: var(--text-xs); font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-text-muted);
}
.taxon-card {
  background: var(--color-surface-offset); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-4);
}
.taxon-card .latin { font-style: italic; font-weight: 700; font-size: var(--text-base); }
.taxon-card .syn { font-size: var(--text-sm); color: var(--color-text-muted); }
.taxon-card .syn em { font-style: italic; }
.taxon-card .common-names { font-size: var(--text-sm); color: var(--color-text); margin-top: 4px; line-height: 1.45; }
.taxon-figure {
  margin: var(--space-3) 0 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-surface);
}
.taxon-figure img { display: block; width: 100%; height: auto; }
.taxon-figure figcaption {
  padding: 6px 8px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
  border-top: 1px solid var(--color-border);
}
.taxon-figure .fig-credit { color: var(--color-text-faint, var(--color-text-muted)); }
.code-chip {
  display: inline-block; margin-top: var(--space-2); font-family: var(--font-mono);
  font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em;
  background: var(--color-primary-soft); color: var(--color-primary);
  padding: 2px var(--space-2); border-radius: var(--radius-sm);
}
[data-theme="dark"] .code-chip { color: var(--color-primary-hover); }

.dist-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.dist-stat {
  background: var(--color-surface-offset); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-3);
}
.dist-stat .num { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; line-height: 1; }
.dist-stat .lbl { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 3px; }

.status-list { display: flex; flex-direction: column; gap: 6px; }
.status-row { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); }
.status-row .dot { width: 9px; height: 9px; border-radius: var(--radius-full); flex-shrink: 0; }
.status-row .name { flex: 1; color: var(--color-text-muted); }
.status-row .ct { font-family: var(--font-mono); font-weight: 600; }

.continent-bars { display: flex; flex-direction: column; gap: var(--space-2); }
.cbar { font-size: var(--text-xs); }
.cbar-head { display: flex; justify-content: space-between; margin-bottom: 2px; }
.cbar-head .ct { font-family: var(--font-mono); color: var(--color-text-muted); }
.cbar-track { height: 5px; background: var(--color-surface-sunk); border-radius: var(--radius-full); overflow: hidden; }
.cbar-fill { height: 100%; background: var(--color-primary); border-radius: var(--radius-full); }

.source-links { display: flex; flex-direction: column; gap: var(--space-2); }
.source-link {
  display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm);
  text-decoration: none; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface-offset);
}
.source-link:hover { border-color: var(--color-primary); background: var(--color-primary-soft); }
.source-link svg { width: 14px; height: 14px; flex-shrink: 0; opacity: 0.8; }
.source-link .url { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); display: block; word-break: break-all; }

/* ---------- Main ---------- */
.dashboard { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-5) var(--space-8);
  border-bottom: 1px solid var(--color-border); background: var(--color-surface-2);
  position: sticky; top: 0; z-index: 20;
}
.topbar .eyebrow {
  font-size: var(--text-xs); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-primary); font-weight: 700;
}
[data-theme="dark"] .topbar .eyebrow { color: var(--color-primary-hover); }
.topbar h2 { font-size: var(--text-xl); letter-spacing: -0.015em; margin-top: 2px; }
.topbar .sub { font-size: var(--text-sm); color: var(--color-text-muted); margin-top: var(--space-1); max-width: 60ch; }
.topbar-actions { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }
.updated { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); text-align: right; }
.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px;
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text);
}
.theme-toggle:hover { border-color: var(--color-primary); color: var(--color-primary); }

.panel-pad { padding: var(--space-6) var(--space-8); }

/* ---------- KPI strip ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-3); padding: var(--space-6) var(--space-8) 0;
}
.kpi {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5);
}
.kpi .label { font-size: var(--text-xs); color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.kpi .value { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; line-height: 1.05; margin-top: var(--space-2); }
.kpi .note { font-size: var(--text-xs); color: var(--color-text-faint); margin-top: 2px; font-family: var(--font-mono); }

/* ---------- Map section ---------- */
.map-section { padding: var(--space-6) var(--space-8); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-4); flex-wrap: wrap; }
.section-head h3 { font-size: var(--text-lg); letter-spacing: -0.01em; }
.section-head .desc { font-size: var(--text-sm); color: var(--color-text-muted); }

.map-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
/* Single real, zoomable slippy map (Leaflet) */
.map-wrap {
  position: relative; width: 100%;
  background: var(--color-surface-sunk);
}
#map {
  width: 100%;
  height: clamp(440px, 56vh, 640px);
  background: var(--color-surface-sunk);
  z-index: 0;
}
@media (max-width: 760px) { #map { height: clamp(360px, 64vh, 520px); } }

/* Map navigation icon buttons (top-right, clear of Leaflet's zoom control top-left) */
.map-nav {
  position: absolute; right: var(--space-3); top: var(--space-3); z-index: 500;
  display: flex; flex-direction: column; gap: 6px;
}
.map-nav-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  color: var(--color-text); cursor: pointer;
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  border: 1px solid var(--color-border); border-radius: 9px;
  box-shadow: var(--shadow-sm);
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.map-nav-btn svg { width: 18px; height: 18px; }
.map-nav-btn:hover { background: var(--color-surface); border-color: var(--color-primary); color: var(--color-primary); }
.map-nav-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }

/* ---------------------------------------------------------------------------
   Fullscreen map mode (shared by global-spread + westland)
   Promotes the #map element to a full-viewport layer so the map can be viewed
   — and screen-recorded — edge to edge with no surrounding page chrome.
   Injected control: a [data-map-fs] toggle button (added to .map-nav / header).
   JS adds `map-fs-on` to <body> and re-runs Leaflet invalidateSize().
   --------------------------------------------------------------------------- */
.map-nav-btn[data-map-fs] svg { width: 18px; height: 18px; }
body.map-fs-on { overflow: hidden; }
/* The map fills the viewport. Both pages use id="map". */
body.map-fs-on #map {
  /* !important overrides Leaflet's inline position on the container. */
  position: fixed !important; inset: 0 !important;
  width: 100vw !important; height: 100vh !important; height: 100dvh !important;
  margin: 0 !important; z-index: 4000; border-radius: 0;
}
/* Keep the year badge readable, anchored to the viewport corner. */
body.map-fs-on .map-year-badge {
  position: fixed; right: clamp(16px, 3vw, 40px); bottom: clamp(16px, 3vw, 40px);
  z-index: 4200; font-size: clamp(2.25rem, 6vw, 4rem);
}
/* Floating control cluster (exit + play) shown only in fullscreen. */
.map-fs-bar {
  position: fixed; top: clamp(12px, 2vw, 22px); right: clamp(12px, 2vw, 22px);
  z-index: 4300; display: none; align-items: center; gap: 8px;
}
body.map-fs-on .map-fs-bar { display: flex; }
.map-fs-bar button {
  width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer;
  color: var(--color-text);
  background: color-mix(in srgb, var(--color-surface) 90%, transparent);
  border: 1px solid var(--color-border); border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.map-fs-bar button:hover { background: var(--color-surface); border-color: var(--color-primary); color: var(--color-primary); }
.map-fs-bar button:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.map-fs-bar button svg { width: 20px; height: 20px; }
/* Clean capture mode: hide every overlay so ONLY the map shows. */
body.map-fs-clean .map-fs-bar,
body.map-fs-clean .map-year-badge,
body.map-fs-clean .map-nav { display: none !important; }

/* The diffusion SVG overlay sits in Leaflet's overlayPane; let pointer events
   reach individual dots but pass through the empty regions to the map. */
.diffusion-overlay { position: absolute; pointer-events: none; overflow: visible; }
.diffusion-overlay .diff-dot { pointer-events: auto; }

/* Tame Leaflet chrome to match the design system */
.leaflet-container { font: inherit; background: var(--color-surface-sunk); }
.leaflet-bar a, .leaflet-bar a:hover {
  background: var(--color-surface); color: var(--color-text);
  border-bottom-color: var(--color-border);
}
.leaflet-bar { border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.leaflet-control-attribution {
  background: color-mix(in srgb, var(--color-surface) 82%, transparent) !important;
  color: var(--color-text-faint); font-size: 10px;
}
.leaflet-control-attribution a { color: var(--color-text-muted); }

/* ---------- Observed-diffusion dots (option C, refined) ---------- */
/* Single dot per country. Fill is a per-dot radial gradient: solid core ->
   soft transparent edge. Uncertainty grows the soft edge (handled in JS).
   No stroke/border so overlaps stay clean. */
.diff-dot {
  stroke: none;
  cursor: pointer;
  transition: r 500ms cubic-bezier(0.22, 1, 0.36, 1);
}
.diff-dot:hover { filter: drop-shadow(0 0 2px rgba(0,0,0,0.35)); }
.diff-dot:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.diff-dot.is-fresh { animation: dot-pop 620ms cubic-bezier(0.22, 1, 0.36, 1) both; transform-box: fill-box; transform-origin: center; }
@keyframes dot-pop {
  0%   { opacity: 0; transform: scale(0.1); }
  55%  { opacity: 1; transform: scale(1.4); }
  100% { opacity: 1; transform: scale(1); }
}

/* ---------- Soft, variable-width travel trails ---------- */
/* No hard arrowhead. A wide soft under-stroke + a thin brighter over-stroke
   give a tapered, airy ribbon; a soft glow dot marks the destination. */
.comet-path { fill: none; stroke-linecap: round; opacity: 0; }
.comet-under { stroke-width: 5.5; filter: blur(1.4px); }
.comet-over  { stroke-width: 1.6; }
/* duration is set per-path inline (scales with the playback speed) */
.comet-path.run { animation-name: comet-draw; animation-timing-function: cubic-bezier(0.33, 0, 0.2, 1); animation-fill-mode: forwards; }
@keyframes comet-draw {
  0%   { opacity: 0; }                  /* dashoffset starts at the inline (full-length) value */
  14%  { opacity: 1; }
  58%  { opacity: 1; stroke-dashoffset: 0; }
  100% { opacity: 0; stroke-dashoffset: 0; }
}
.comet-head {
  opacity: 0; pointer-events: none;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--comet-hue) 70%, transparent));
}
.comet-head.run { animation-name: comet-land; animation-timing-function: ease-out; animation-fill-mode: forwards; }
@keyframes comet-land {
  0%, 45% { opacity: 0; transform: scale(0.2); }
  62%     { opacity: 0.95; transform: scale(1.25); }
  80%     { opacity: 0.8; transform: scale(1); }
  100%    { opacity: 0; transform: scale(1); }
}
.comet-head { transform-box: fill-box; transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  .diff-dot.is-fresh, .comet-head.run { animation: none; }
  .comet-path.run { animation-name: comet-fade; animation-timing-function: linear; animation-fill-mode: forwards; }
  @keyframes comet-fade { 0%{opacity:0.7;stroke-dashoffset:0;} 80%{opacity:0.7;} 100%{opacity:0;} }
  .diff-dot { transition: none; }
}

.evt-point { cursor: pointer; transition: r 120ms ease; }
.evt-point.is-new { animation: pulse-in 600ms ease; }
@keyframes pulse-in { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }
.risk-point {
  fill: var(--color-risk);
  fill-opacity: var(--risk-opacity, 0.55);
  stroke: var(--color-surface-2);
  stroke-width: 0.9;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--color-risk) 38%, transparent));
  animation: risk-rise 420ms ease both;
}
.trade-arc {
  fill: none;
  stroke: var(--color-trade);
  stroke-opacity: 0.22;
  stroke-linecap: round;
  animation: trade-draw 520ms ease both;
}
@keyframes risk-rise { from { opacity: 0; transform: scale(0.75); } to { opacity: 1; transform: scale(1); } }
@keyframes trade-draw { from { opacity: 0; } to { opacity: 1; } }

/* Kernel density surface cells */
.kde-cell { stroke: none; mix-blend-mode: multiply; pointer-events: none; }
[data-theme="dark"] .kde-cell { mix-blend-mode: screen; }
.kde-surface { animation: trade-draw 420ms ease both; }

/* Emerging hot spot markers */
.hs-point {
  stroke: var(--color-surface-2);
  stroke-width: 0.9;
  fill-opacity: 0.9;
  animation: risk-rise 360ms ease both;
  cursor: pointer;
}
.hs-point.hs-new { fill: var(--hs-new); filter: drop-shadow(0 0 6px color-mix(in srgb, var(--hs-new) 55%, transparent)); }
.hs-point.hs-intensifying { fill: var(--hs-intensifying); filter: drop-shadow(0 0 5px color-mix(in srgb, var(--hs-intensifying) 45%, transparent)); }
.hs-point.hs-persistent { fill: var(--hs-persistent); }
.hs-point.hs-diminishing { fill: var(--hs-diminishing); }
.hs-point.hs-historical { fill: var(--hs-historical); fill-opacity: 0.55; }

/* Map legend strip (below the map, never clips) */
.map-legend-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-5);
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border); background: var(--color-surface);
  font-size: var(--text-xs);
}
.map-legend-bar[hidden] { display: none; }
.map-legend-bar .lg-title { font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); }
.map-legend-bar .lg-row { display: flex; align-items: center; gap: var(--space-2); color: var(--color-text-muted); }
.map-legend-bar .lg-row .dot { width: 9px; height: 9px; border-radius: var(--radius-full); }

/* Diffusion legend swatches */
.diff-swatch {
  width: 34px; height: 11px; border-radius: var(--radius-full); display: inline-block;
  background: linear-gradient(90deg, #2f7d46, #d39a17 55%, #c2402f);
}
/* soft fade-out swatch: solid centre -> transparent edge (matches dot gradient) */
.halo-swatch {
  width: 18px; height: 18px; border-radius: var(--radius-full); display: inline-block; flex-shrink: 0;
  background: radial-gradient(circle, #c2402f 0 22%, color-mix(in srgb, #c2402f 35%, transparent) 48%, transparent 78%);
}
/* soft tapered trail swatch: thin -> thicker, fading at both ends; no arrowhead */
.comet-swatch {
  width: 30px; height: 10px; display: inline-block; flex-shrink: 0; position: relative;
  background: linear-gradient(90deg, transparent, var(--comet-hue) 35%, var(--comet-hue) 70%, transparent)
              no-repeat left center / 30px 3px;
  border-radius: var(--radius-full);
}

.risk-dot { background: var(--color-risk); box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-risk) 18%, transparent); }
.line-swatch { width: 22px; height: 2px; border-radius: var(--radius-full); background: var(--color-trade); opacity: 0.55; display: inline-block; }
.kde-ramp { width: 56px; height: 9px; border-radius: var(--radius-full); display: inline-block;
  background: linear-gradient(90deg, var(--kde-low), var(--kde-mid), var(--kde-high)); }
.map-footnote {
  padding: 0 var(--space-5) var(--space-3);
  margin-top: calc(var(--space-2) * -1);
  background: var(--color-surface);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  max-width: none;
}

.map-year-badge {
  position: absolute; right: var(--space-4); bottom: var(--space-6); z-index: 450;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.75rem, 4vw, 2.75rem); line-height: 1;
  color: color-mix(in srgb, var(--color-primary) 78%, transparent);
  text-shadow: 0 1px 6px color-mix(in srgb, var(--color-surface-sunk) 80%, transparent);
  letter-spacing: -0.02em; pointer-events: none; user-select: none;
}

/* Tooltip */
.map-tip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 280px;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-3); box-shadow: var(--shadow-lg);
  font-size: var(--text-xs); opacity: 0; transition: opacity 120ms ease;
}
.map-tip.show { opacity: 1; }
.map-tip .tt-no { font-family: var(--font-mono); color: var(--color-primary); font-weight: 600; }
[data-theme="dark"] .map-tip .tt-no { color: var(--color-primary-hover); }
.map-tip .tt-title { font-weight: 600; margin: 2px 0; font-size: var(--text-sm); }
.map-tip .tt-meta { color: var(--color-text-muted); }

/* ---------- Timeline controls ---------- */
.timeline {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-4) var(--space-5); flex-wrap: wrap;
  border-top: 1px solid var(--color-border); background: var(--color-surface-2);
}
.play-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex-shrink: 0;
  border-radius: var(--radius-full); background: var(--color-primary); color: var(--color-text-inverse);
}
.play-btn:hover { background: var(--color-primary-hover); }
.play-btn svg { width: 20px; height: 20px; }
[data-theme="dark"] .play-btn { color: var(--color-surface-sunk); }

.slider-wrap { flex: 1 1 320px; min-width: 220px; }
.slider-labels { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-faint); margin-bottom: 4px; }
.year-display { font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); color: var(--color-text); }
.year-display .mode-tag { font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500; color: var(--color-text-muted); margin-left: var(--space-2); }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  background: var(--color-surface-sunk); border-radius: var(--radius-full); outline-offset: 4px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: var(--radius-full);
  background: var(--color-primary); border: 3px solid var(--color-surface-2); box-shadow: var(--shadow-sm); cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: var(--radius-full); border: 3px solid var(--color-surface-2);
  background: var(--color-primary); cursor: pointer;
}

.mode-toggle,
.layer-toggle { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; }
.mode-toggle button,
.layer-toggle button {
  padding: var(--space-2) var(--space-4); font-size: var(--text-sm); font-weight: 600;
  color: var(--color-text-muted); background: var(--color-surface);
}
.mode-toggle button[aria-pressed="true"],
.layer-toggle button[aria-pressed="true"] { background: var(--color-primary); color: var(--color-text-inverse); }
[data-theme="dark"] .mode-toggle button[aria-pressed="true"],
[data-theme="dark"] .layer-toggle button[aria-pressed="true"] { color: var(--color-surface-sunk); }

.speed-select {
  padding: var(--space-2) var(--space-3); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background: var(--color-surface); font-size: var(--text-sm);
}

/* ---------- Trade-linked hotspot model ---------- */
.model-section {
  padding: 0 var(--space-8) var(--space-8);
}
.model-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: var(--space-4);
}
.model-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.model-card-wide { grid-column: 1 / -1; }
.model-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.model-card .eyebrow,
.model-card-head .eyebrow {
  display: block;
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 700;
  margin-bottom: var(--space-3);
}
.model-card-head strong {
  max-width: 36ch;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  line-height: 1.2;
  color: var(--color-text);
}
.validation-bars {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: var(--space-4);
}
.validation-row {
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.validation-label {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: baseline;
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.validation-label strong {
  font-family: var(--font-mono);
  color: var(--color-text);
}
.bar-track {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-sunk);
  overflow: hidden;
}
.bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--color-primary), var(--color-risk));
}
.model-note {
  margin-top: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  max-width: 92ch;
}

/* ---- Spatial-temporal analysis section ---- */
.spatial-section { padding: 0 var(--space-8) var(--space-8); }
.spatial-foot { margin-top: var(--space-4); font-size: var(--text-sm); line-height: 1.55; color: var(--color-text-muted); }
.spatial-foot a { color: var(--color-primary); text-decoration: underline; text-underline-offset: 2px; }
.spatial-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: var(--space-4);
}
.accel-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  align-items: end;
  gap: var(--space-3);
  height: 150px;
  margin-top: var(--space-4);
  padding-top: var(--space-5);
}
.accel-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: var(--space-2); }
.accel-bar {
  width: 100%;
  max-width: 46px;
  min-height: 3px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: linear-gradient(180deg, var(--color-accent), var(--color-primary));
  position: relative;
  display: block;
}
.accel-val {
  position: absolute; top: -1.45em; left: 0; right: 0; text-align: center;
  font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text); font-weight: 600;
}
.accel-x { font-size: var(--text-xs); color: var(--color-text-muted); font-family: var(--font-mono); white-space: nowrap; }
.class-tally { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-3); }
.tally-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md); background: var(--color-surface-offset);
}
.tally-row .dot { width: 11px; height: 11px; border-radius: var(--radius-full); flex-shrink: 0; }
.tally-label { flex: 1; font-size: var(--text-sm); }
.tally-n { font-family: var(--font-mono); font-weight: 600; }
.method-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-top: var(--space-3); }
.method-cell { padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface-offset); margin: 0; }
.method-cell .mc-k { display: block; font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); margin-bottom: 3px; }
.method-cell .mc-v { display: block; margin: 0; font-size: var(--text-sm); font-weight: 600; font-family: var(--font-mono); }
#frontier-list li { display: block; }
.hl-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.hl-meta { display: block; margin-top: 3px; font-size: var(--text-xs); color: var(--color-text-muted); font-family: var(--font-mono); }
.hotspot-list em.hs-tag {
  font-style: normal; font-size: var(--text-xs); font-weight: 600;
  padding: 2px 8px; border-radius: var(--radius-full); color: var(--color-text-inverse);
  white-space: nowrap; flex-shrink: 0;
}
em.hs-tag.hs-new { background: var(--hs-new); }
em.hs-tag.hs-intensifying { background: var(--hs-intensifying); }
em.hs-tag.hs-persistent { background: var(--hs-persistent); }
em.hs-tag.hs-diminishing { background: var(--hs-diminishing); }
em.hs-tag.hs-historical { background: var(--hs-historical); }
[data-theme="dark"] .hotspot-list em.hs-tag { color: var(--color-surface-sunk); }
.hotspot-list,
.trade-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.hotspot-list li,
.trade-list li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface-offset);
}
.hotspot-list strong,
.trade-list strong {
  display: block;
  font-size: var(--text-sm);
  line-height: 1.2;
}
.hotspot-list span,
.trade-list span {
  display: block;
  margin-top: 2px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.hotspot-list em,
.trade-list em {
  font-style: normal;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}
[data-theme="dark"] .hotspot-list em,
[data-theme="dark"] .trade-list em { color: var(--color-primary-hover); }
.driver-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: var(--space-3);
}
.driver {
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.driver-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
}
.driver-top strong { text-transform: capitalize; }
.driver-top span {
  font-family: var(--font-mono);
  color: var(--color-accent);
  font-weight: 700;
}
.driver p {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.45;
}

/* ---------- Narrative ---------- */
.narrative { padding: var(--space-8); border-top: 1px solid var(--color-border); }
.narrative-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4); margin-top: var(--space-5);
}
.narr-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-5);
}
.narr-card .step { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-accent); font-weight: 600; }
.narr-card h4 { font-size: var(--text-base); margin: var(--space-2) 0; font-family: var(--font-display); }
.narr-card p { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.5; }
.narr-card .yr { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-faint); display: block; margin-top: var(--space-2); }

/* ---------- Caveats ---------- */
.caveats {
  margin: 0 var(--space-8) var(--space-8); padding: var(--space-5);
  background: var(--color-accent-soft); border: 1px solid color-mix(in srgb, var(--color-accent) 35%, transparent);
  border-radius: var(--radius-lg);
}
.caveats h4 { font-size: var(--text-sm); text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-accent); display: flex; align-items: center; gap: var(--space-2); font-family: var(--font-body); }
[data-theme="dark"] .caveats h4 { color: var(--color-accent); }
.caveats ul { margin: var(--space-3) 0 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.caveats li { font-size: var(--text-sm); color: var(--color-text); max-width: 90ch; }

/* ---------- Event feed / table ---------- */
.feed-section { padding: var(--space-8); border-top: 1px solid var(--color-border); }
.feed-controls { display: flex; gap: var(--space-3); flex-wrap: wrap; margin: var(--space-4) 0; align-items: center; }
.search-box { position: relative; flex: 1 1 280px; min-width: 200px; }
.search-box svg { position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--color-text-faint); }
.search-box input {
  width: 100%; padding: var(--space-3) var(--space-3) var(--space-3) var(--space-8);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); font-size: var(--text-sm);
}
.search-box input:focus { border-color: var(--color-primary); outline: none; }
.filter-select {
  padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background: var(--color-surface); font-size: var(--text-sm);
}
.feed-count { font-size: var(--text-sm); color: var(--color-text-muted); font-family: var(--font-mono); margin-left: auto; }

.table-scroll { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); }
.evt-table { font-size: var(--text-sm); min-width: 760px; }
.evt-table thead th {
  position: sticky; top: 0; background: var(--color-surface-offset); z-index: 2;
  text-align: left; padding: var(--space-3) var(--space-4); font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-muted); font-weight: 700;
  border-bottom: 1px solid var(--color-border); white-space: nowrap;
}
.evt-table tbody td { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-divider); vertical-align: top; }
.evt-table tbody tr:last-child td { border-bottom: none; }
.evt-table tbody tr:hover { background: var(--color-surface-offset); }
.evt-table .c-no { font-family: var(--font-mono); font-size: var(--text-xs); white-space: nowrap; color: var(--color-text-muted); }
.evt-table .c-date { font-family: var(--font-mono); font-size: var(--text-xs); white-space: nowrap; color: var(--color-text-muted); }
.evt-table .c-title { font-weight: 500; max-width: 380px; }
.evt-table .c-country { white-space: nowrap; }
.evt-table .c-src a { display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); white-space: nowrap; text-decoration: none; }
.evt-table .c-src svg { width: 12px; height: 12px; }
.muted-dash { color: var(--color-text-faint); }

.type-badge {
  display: inline-block; font-size: var(--text-xs); font-weight: 600; white-space: nowrap;
  padding: 2px var(--space-2); border-radius: var(--radius-full);
  background: var(--color-surface-sunk); color: var(--color-text);
}
.type-badge::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; background: currentColor; }
.type-first_report { color: var(--c-widespread); }
.type-local_spread { color: var(--c-restricted); }
.type-new_data { color: var(--c-nodetails); }
.type-status_update { color: var(--color-primary); }
.type-eradication { color: var(--color-accent); }
.type-regulatory { color: var(--c-few); }
.type-management { color: var(--c-absent); }

.empty-row td { text-align: center; color: var(--color-text-muted); padding: var(--space-10); font-style: italic; }

/* ---------- Footer ---------- */
.site-footer {
  padding: var(--space-6) var(--space-8); border-top: 1px solid var(--color-border);
  font-size: var(--text-xs); color: var(--color-text-muted); display: flex;
  justify-content: space-between; gap: var(--space-4); flex-wrap: wrap;
}
.site-footer a { font-size: var(--text-xs); }

/* ---------- Mobile ---------- */
.menu-btn { display: none; }
@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(320px, 86vw); z-index: 60;
    transform: translateX(-100%); transition: transform 220ms cubic-bezier(0.16,1,0.3,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 55;
  }
  .sidebar-backdrop.show { display: block; }
  .menu-btn {
    display: grid; place-items: center; width: 40px; height: 40px;
    border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface);
  }
  .topbar { padding: var(--space-4); }
  .panel-pad, .map-section, .model-section, .spatial-section, .narrative, .feed-section { padding-left: var(--space-4); padding-right: var(--space-4); }
  .kpi-grid { padding-left: var(--space-4); padding-right: var(--space-4); }
  .caveats { margin-left: var(--space-4); margin-right: var(--space-4); }
  .updated { display: none; }
  .model-grid, .spatial-grid { grid-template-columns: 1fr; }
  .layer-toggle { flex-wrap: wrap; }
  .validation-bars, .driver-grid { grid-template-columns: 1fr; }
  .layer-toggle, .mode-toggle { width: 100%; }
  .layer-toggle button, .mode-toggle button { flex: 1; padding-left: var(--space-2); padding-right: var(--space-2); }
  /* spatial section: stop horizontal clipping on narrow screens */
  #frontier-list li { display: block; }
  .hl-head { flex-wrap: wrap; gap: var(--space-2); }
  .hl-meta { white-space: normal; word-break: break-word; }
  .hotspot-list em.hs-tag { white-space: normal; }
  .method-grid { grid-template-columns: 1fr; }
  .method-cell .mc-v { white-space: normal; word-break: break-word; }
  .accel-chart { gap: var(--space-2); overflow-x: auto; }
  .accel-x { font-size: 0.62rem; }
}
@media (min-width: 961px) { .menu-btn { display: none; } }

/* ---------- Slim methodology note (site-wide pattern) ---------- */
.method-note {
  margin-top: var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}
.method-note > summary {
  cursor: pointer;
  list-style: none;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  user-select: none;
}
.method-note > summary::-webkit-details-marker { display: none; }
.method-note > summary::before {
  content: "";
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 180ms ease;
  flex-shrink: 0;
}
.method-note[open] > summary::before { transform: rotate(45deg); }
.method-note > summary:hover { color: var(--color-text); }
.method-note-body {
  padding: 0 var(--space-4) var(--space-4);
  font-size: var(--text-xs);
  line-height: 1.55;
  color: var(--color-text-muted);
}
.method-note-body p { margin: 0 0 var(--space-2); max-width: 70ch; }
.method-note-body p:last-child { margin-bottom: 0; }
.method-note-body strong { color: var(--color-text); }
.method-src { color: var(--color-text-faint); }
.method-src a { color: var(--color-primary); text-decoration: none; }
.method-src a:hover { text-decoration: underline; }
[data-theme="dark"] .method-src a { color: var(--color-primary-hover); }

/* ============================================================
   Site-wide chrome added in Round 4: top nav, language switcher,
   context rail, distribution snapshot, landing + stub pages.
   ============================================================ */

/* ---------- Top navigation (all pages) ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 70;
  height: var(--nav-h);
  display: flex; align-items: center; gap: var(--space-4);
  padding: 0 var(--space-5);
  background: color-mix(in srgb, var(--color-surface) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.site-brand {
  display: flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-display); font-weight: 800; letter-spacing: -0.01em;
  font-size: var(--text-base); color: var(--color-text); text-decoration: none;
  flex-shrink: 0;
}
.site-brand .brand-mark { width: 26px; height: 26px; color: var(--color-primary); }
.site-links { display: flex; align-items: center; gap: 2px; margin-left: var(--space-2); flex: 1; }
.site-links a {
  font-size: var(--text-sm); font-weight: 500; color: var(--color-text-muted);
  text-decoration: none; padding: 7px var(--space-3); border-radius: var(--radius-md);
  transition: background 140ms ease, color 140ms ease;
}
.site-links a:hover { color: var(--color-text); background: var(--color-surface-offset); }
.site-links a[aria-current="page"] { color: var(--color-primary); background: var(--color-primary-soft); font-weight: 600; }
[data-theme="dark"] .site-links a[aria-current="page"] { color: var(--color-primary-hover); }
.site-nav-actions { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }

/* Language switcher */
.lang-switch { position: relative; }
.lang-btn {
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.04em;
  color: var(--color-text); background: var(--color-surface-offset);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 6px 10px; transition: border-color 140ms ease, background 140ms ease;
}
.lang-btn svg { width: 15px; height: 15px; opacity: 0.7; }
.lang-btn:hover { border-color: var(--color-primary); }
.lang-btn .caret { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-left: 1px; opacity: 0.6; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 150px;
  background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 5px;
  display: none; z-index: 80;
}
.lang-menu.open { display: block; }
.lang-menu button {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; text-align: left;
  font-size: var(--text-sm); color: var(--color-text); background: transparent; border: 0; cursor: pointer;
  padding: 8px 10px; border-radius: var(--radius-sm);
}
.lang-menu button:hover { background: var(--color-surface-offset); }
.lang-menu button[aria-current="true"] { color: var(--color-primary); font-weight: 600; }
[data-theme="dark"] .lang-menu button[aria-current="true"] { color: var(--color-primary-hover); }
.lang-menu .flag { font-size: 1rem; line-height: 1; }

/* ---------- Shared top nav: mobile ---------- */
@media (max-width: 760px) {
  .site-nav {
    gap: var(--space-2); padding: 0 var(--space-3);
    height: auto; min-height: var(--nav-h);
    flex-wrap: wrap; row-gap: 6px; padding-top: 8px; padding-bottom: 8px;
  }
  .site-brand { font-size: var(--text-sm); }
  .site-brand .brand-mark { width: 22px; height: 22px; }
  .site-nav-actions { margin-left: auto; }
  .site-links {
    order: 3; flex-basis: 100%; margin-left: 0; flex: 0 0 100%;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    gap: 2px; padding-bottom: 2px; scrollbar-width: none;
  }
  .site-links::-webkit-scrollbar { display: none; }
  .site-links a { white-space: nowrap; padding: 6px 10px; font-size: var(--text-xs); }
  .lang-btn { padding: 5px 8px; }
}

/* The app-shell's left column starts under the sticky nav */
.app-shell { min-height: calc(100dvh - var(--nav-h)); }

/* ---------- Context rail (redesigned sidebar) ---------- */
.rail-text { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.5; margin-top: var(--space-3); }
.rail-explain h2 { margin-bottom: 2px; }
.rail-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-3); }
.rail-list li { display: flex; gap: var(--space-3); font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.45; }
.rail-list li strong { color: var(--color-text); font-weight: 600; }
.rail-list li > span { flex-shrink: 0; margin-top: 4px; }
.rl-dot { width: 11px; height: 11px; border-radius: var(--radius-full); background: radial-gradient(circle at 50% 50%, var(--c-restricted), transparent 72%); }
.rl-size {
  width: 16px; height: 11px; border-radius: var(--radius-full);
  background:
    radial-gradient(circle at 22% 50%, color-mix(in srgb, var(--c-few) 90%, transparent) 0 26%, transparent 30%),
    radial-gradient(circle at 78% 50%, var(--c-widespread) 0 42%, transparent 46%);
}
.rl-trail { width: 16px; height: 3px; border-radius: var(--radius-full); margin-top: 8px; background: linear-gradient(90deg, transparent, var(--comet-hue), transparent); }
.rail-note { font-size: var(--text-xs); color: var(--color-text-faint); line-height: 1.45; margin-top: var(--space-2); }

/* ---------- Distribution snapshot section ---------- */
.dist-section { padding: var(--space-6) var(--space-8) 0; }
.dist-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: var(--space-4); margin-top: var(--space-4); }
.dist-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-5);
}
.dist-card h4 {
  font-family: var(--font-body); font-size: var(--text-xs); font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}
@media (max-width: 760px) { .dist-grid { grid-template-columns: 1fr; } .dist-section { padding: var(--space-5) var(--space-4) 0; } }

/* ---------- Landing / stub pages (shared content layout) ---------- */
.page-wrap { max-width: 1080px; margin: 0 auto; padding: var(--space-12) var(--space-6) var(--space-16); }
.hero { text-align: center; padding: var(--space-12) 0 var(--space-10); }
.hero .eyebrow { justify-content: center; }
.hero h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem); letter-spacing: -0.02em; line-height: 1.05; }
.hero p.lead { font-size: var(--text-lg); color: var(--color-text-muted); max-width: 64ch; margin: var(--space-4) auto 0; line-height: 1.5; }
.hero-cta { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; margin-top: var(--space-6); }
.btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  font-weight: 600; font-size: var(--text-sm); text-decoration: none; cursor: pointer;
  padding: 11px var(--space-5); border-radius: var(--radius-md); border: 1px solid transparent;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}
.btn-primary { background: var(--color-primary); color: var(--color-text-inverse); }
.btn-primary:hover { background: var(--color-primary-hover); transform: translateY(-1px); }
.btn-ghost { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-ghost:hover { border-color: var(--color-primary); color: var(--color-primary); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-5); margin-top: var(--space-8); }
.feature-card {
  display: flex; flex-direction: column; gap: var(--space-3);
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-6); text-decoration: none; color: inherit;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}
a.feature-card:hover { border-color: var(--color-primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.feature-card .fc-icon { width: 34px; height: 34px; color: var(--color-primary); }
.feature-card h3 { font-family: var(--font-display); font-weight: 700; font-size: var(--text-lg); letter-spacing: -0.01em; }
.feature-card p { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.5; }
.feature-card .fc-tag {
  margin-top: auto; font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600;
  color: var(--color-primary); letter-spacing: 0.03em;
}
[data-theme="dark"] .feature-card .fc-icon, [data-theme="dark"] .feature-card .fc-tag { color: var(--color-primary-hover); }
.badge-soon { font-family: var(--font-mono); font-size: 0.65rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-faint); border: 1px solid var(--color-border); border-radius: var(--radius-full); padding: 2px 8px; }

.section-block { margin-top: var(--space-16); }
.section-block > h2 { font-family: var(--font-display); font-weight: 800; font-size: var(--text-xl); letter-spacing: -0.015em; }
.section-block > p.desc { font-size: var(--text-base); color: var(--color-text-muted); max-width: 70ch; margin-top: var(--space-2); line-height: 1.55; }
.prose { max-width: 72ch; }
.prose p { font-size: var(--text-base); color: var(--color-text-muted); line-height: 1.6; margin-top: var(--space-3); }
.prose a { color: var(--color-primary); text-decoration: none; } .prose a:hover { text-decoration: underline; }
[data-theme="dark"] .prose a { color: var(--color-primary-hover); }

.page-footer {
  border-top: 1px solid var(--color-border); margin-top: var(--space-16);
  padding: var(--space-6) var(--space-6); text-align: center;
  font-size: var(--text-sm); color: var(--color-text-faint);
}
.page-footer a { color: var(--color-text-muted); text-decoration: none; } .page-footer a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .site-links { gap: 0; margin-left: 0; }
  .site-links a { padding: 7px 9px; font-size: var(--text-xs); }
  .site-brand span { display: none; }
}

/* ============================================================
   Emerging pests page
   ============================================================ */
.tier-contrast {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: var(--space-4);
  align-items: stretch;
}
.tier-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.tier-national { border-left: 3px solid var(--c-restricted); }
.tier-regional { border-left: 3px solid var(--color-primary); }
.tier-tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}
.tier-card h3 { margin: 0; font-family: var(--font-display); }
.tier-list {
  list-style: none;
  padding: 0;
  margin: var(--space-2) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.tier-list li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.tier-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.55em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--color-text-faint);
}
.tier-verdict {
  margin-top: auto;
  padding-top: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text);
}
.tier-verdict a { color: var(--color-primary); text-decoration: none; font-weight: 500; }
.tier-verdict a:hover { text-decoration: underline; }
.tier-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-faint);
  width: 48px;
}
.tier-arrow svg { width: 40px; height: 22px; }

/* EPPO-style pest index (jump links) */
.pest-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-6);
}
.pest-index-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.pest-index-item:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
}
.pi-latin {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--color-text);
  font-size: var(--text-base);
}
.pi-common { color: var(--color-text-muted); font-size: var(--text-sm); }
.pi-code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  letter-spacing: 0.04em;
}

/* Pest profile card */
#pest-registry > .pest-profile + .pest-profile {
  margin-top: var(--space-8);
}
.pest-profile {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-top: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.pp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.pp-name {
  font-family: var(--font-display);
  font-style: italic;
  margin: 0.1em 0 0;
  font-size: var(--text-xl);
}
.pp-common { color: var(--color-text); font-weight: 600; margin: 0.25em 0 0; font-size: var(--text-base); }
.pp-common-alt { color: var(--color-text-muted); font-size: var(--text-sm); margin: 0.15em 0 0; }
.pp-intro { max-width: 60ch; color: var(--color-text); margin: 0; }

.pp-body-row {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-5);
  align-items: start;
}
.pp-figure {
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface-offset);
}
.pp-figure img { display: block; width: 100%; height: auto; }
.pp-figure figcaption {
  padding: 8px 10px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
  border-top: 1px solid var(--color-border);
}
.pp-fig-credit { color: var(--color-text-faint, var(--color-text-muted)); }
@media (max-width: 720px) {
  .pp-body-row { grid-template-columns: 1fr; }
  .pp-figure { max-width: 340px; }
}

.pp-map-row {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: var(--space-4);
  align-items: start;
}
.pp-rail h4 { margin: 0 0 var(--space-2); font-family: var(--font-display); }
.pp-map-wrap { display: flex; flex-direction: column; gap: var(--space-2); }
.em-map {
  width: 100%;
  height: 460px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-sunk);
}
.em-det-list {
  list-style: none;
  padding: 0;
  margin: var(--space-3) 0 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.em-det { display: flex; gap: var(--space-2); align-items: flex-start; }
.em-det-dot {
  flex: 0 0 auto;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-top: 0.35em;
}
.em-det-head { margin: 0; font-size: var(--text-sm); }
.em-det-meta {
  margin: 0.1em 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.em-det-note { margin: 0.1em 0 0; font-size: var(--text-sm); color: var(--color-text-muted); }

.pp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-5);
}
.pp-section h4 { margin: 0 0 var(--space-1); font-family: var(--font-display); }
.pp-section p { margin: 0; color: var(--color-text-muted); font-size: var(--text-sm); }
.pp-source {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-divider);
  padding-top: var(--space-3);
}
.pp-source a { color: var(--color-primary); }

.rl-dot-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

@media (max-width: 880px) {
  .tier-contrast { grid-template-columns: 1fr; }
  .tier-arrow { transform: rotate(90deg); width: auto; height: 40px; margin: 0 auto; }
  .pp-map-row { grid-template-columns: 1fr; }
  .em-map { height: 380px; }
}

/* ============================================================
   Westland forecast page — prototype components, new tokens
   (map-dominant workspace; reuses .app-shell/.sidebar/.dashboard/
   .topbar/.kpi-grid/.kpi/.map-card/#map from the shared system)
   ============================================================ */

/* KPI value/label/note for the prototype's span/strong/small markup */
.kpi > span:first-child,
.kpi .label {
  font-size: var(--text-xs); color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
}
.kpi > strong,
.kpi .value {
  display: block; font-family: var(--font-display); font-size: var(--text-xl);
  font-weight: 700; line-height: 1.05; margin-top: var(--space-2);
}
.kpi > small,
.kpi .note {
  display: block; font-size: var(--text-xs); color: var(--color-text-faint);
  margin-top: 2px; font-family: var(--font-mono);
}

/* Workspace grid: map dominant up top, supporting panels in a fluid grid */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  gap: var(--space-5);
  padding: var(--space-6) var(--space-8) var(--space-8);
  align-items: start;
}
.workspace > * { min-width: 0; }
.workspace > .map-card { grid-column: 1; grid-row: 1; }
.workspace > .control-panel { grid-column: 2; grid-row: 1 / span 3; align-self: stretch; }
.workspace > .weather-card { grid-column: 1; }
.workspace > .insight-card { grid-column: 1; }
.workspace > .comparison-card { grid-column: 1 / -1; }
.workspace > .detail-card { grid-column: 1 / -1; }
.workspace > .prototype-footer { grid-column: 1 / -1; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .workspace > * { grid-column: 1 !important; grid-row: auto !important; }
}
@media (max-width: 760px) {
  .workspace { padding: var(--space-5) var(--space-4) var(--space-6); }
}

/* Shared card surface for the supporting panels */
.control-panel,
.weather-card,
.insight-card,
.comparison-card,
.detail-card {
  background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: var(--space-5) var(--space-6);
  display: flex; flex-direction: column; gap: var(--space-4);
}

.panel-heading {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap;
}
.panel-heading .eyebrow {
  font-size: var(--text-xs); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-primary); font-weight: 700;
}
[data-theme="dark"] .panel-heading .eyebrow { color: var(--color-primary-hover); }
.panel-heading h2, .panel-heading h3 {
  font-family: var(--font-display); font-size: var(--text-lg);
  letter-spacing: -0.01em; margin-top: 2px;
}
.panel-heading > span {
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--color-text-muted); text-align: right; max-width: 24ch;
}

/* ---- Map card header + legend + caption ---- */
.map-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-4); flex-wrap: wrap;
  padding: var(--space-5) var(--space-6) var(--space-4);
}
.map-header .eyebrow {
  font-size: var(--text-xs); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-primary); font-weight: 700;
}
[data-theme="dark"] .map-header .eyebrow { color: var(--color-primary-hover); }
.map-header h2 { font-family: var(--font-display); font-size: var(--text-lg); letter-spacing: -0.01em; margin-top: 2px; }
.map-card .legend {
  display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3);
  max-width: 480px; justify-content: flex-end;
}
.map-card .legend > span {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--text-xs); color: var(--color-text-muted);
}
.swatch { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; display: inline-block; }
.swatch.new-hot { background: #e2574b; }
.swatch.intensifying-hot { background: #ef8a3d; }
.swatch.persistent-hot { background: #d8b13a; }
.swatch.diminishing-hot { background: #7fae6e; }
.swatch.historical-hot { background: #8a8d7c; }
.swatch.cone-optimistic { background: rgba(116,168,107,0.55); border: 1px solid #74a86b; }
.swatch.cone-expected { background: rgba(216,177,58,0.5); border: 1px solid #d8b13a; }
.swatch.cone-worst { background: rgba(226,87,75,0.45); border: 1px solid #e2574b; }
.map-caption {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--color-divider);
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ---- Control panel ---- */
.control-grid { display: flex; flex-direction: column; gap: var(--space-4); }
.filter-group { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.filter-group legend {
  font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--color-text-muted); padding: 0;
}
.filter-group select,
.filter-group input[type="range"] { width: 100%; }
.filter-group select {
  background: var(--color-surface-2); color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3); font: inherit; font-size: var(--text-sm);
}
.filter-group select:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.range-row { display: flex; align-items: center; gap: var(--space-3); }
.range-row input[type="range"] { flex: 1; accent-color: var(--color-primary); }
.range-row output {
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 600;
  color: var(--color-text); min-width: 6ch; text-align: right;
}
.quick-periods { display: flex; gap: var(--space-2); }
.quick-periods button {
  flex: 1; font-size: var(--text-xs); font-weight: 600; font-family: var(--font-mono);
  padding: var(--space-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-sm); background: var(--color-surface-2);
  color: var(--color-text-muted); cursor: pointer;
}
.quick-periods button:hover { border-color: var(--color-primary); color: var(--color-primary); }
.playback-button {
  margin-top: var(--space-1); width: 100%; cursor: pointer;
  padding: var(--space-3); border-radius: var(--radius-md);
  border: 1px solid var(--color-primary); background: var(--color-primary-soft);
  color: var(--color-primary); font-weight: 700; font-size: var(--text-sm);
}
[data-theme="dark"] .playback-button { color: var(--color-primary-hover); }
.playback-button:hover { background: var(--color-primary); color: var(--color-text-inverse); }
.playback-button.is-playing { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-text-inverse); }

.filter-group.toggles { gap: var(--space-1); }
.filter-group.toggles label {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--text-sm); color: var(--color-text); cursor: pointer;
}
.filter-group.toggles input { accent-color: var(--color-primary); }

.ghost-button {
  font-size: var(--text-xs); font-weight: 600; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
  border: 1px solid var(--color-border); background: var(--color-surface-2);
  color: var(--color-text-muted);
}
.ghost-button:hover { border-color: var(--color-primary); color: var(--color-primary); }

.report-action {
  display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-4); border-radius: var(--radius-md);
  background: var(--color-surface-offset); border: 1px solid var(--color-border);
}
.report-action .eyebrow { font-size: var(--text-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-text-muted); font-weight: 700; }
.report-action h3 { font-family: var(--font-display); font-size: var(--text-base); }
.report-action p { font-size: var(--text-sm); color: var(--color-text-muted); }
.report-button {
  cursor: pointer; padding: var(--space-3); border-radius: var(--radius-md);
  border: 1px solid var(--color-primary); background: var(--color-primary);
  color: var(--color-text-inverse); font-weight: 700; font-size: var(--text-sm);
}
.report-button:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.report-status { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--color-text-muted); min-height: 1em; }

.scenario-note {
  padding: var(--space-4); border-radius: var(--radius-md);
  background: var(--color-surface-sunk); border: 1px solid var(--color-divider);
}
.scenario-note h3 { font-family: var(--font-display); font-size: var(--text-base); margin-bottom: var(--space-2); }
.scenario-note p { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.5; }

/* ---- Weather card ---- */
.weather-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: var(--space-4); }
@media (max-width: 720px) { .weather-layout { grid-template-columns: 1fr; } }
.weather-selected {
  background: var(--color-surface-offset); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-4);
}
.weather-selected h3 { font-family: var(--font-display); font-size: var(--text-base); }
.weather-selected p { font-size: var(--text-sm); color: var(--color-text-muted); margin: var(--space-2) 0 var(--space-3); line-height: 1.5; }
.weather-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2) var(--space-3); }
.weather-metrics span { display: flex; flex-direction: column; font-size: var(--text-xs); color: var(--color-text-muted); }
.weather-metrics strong { font-family: var(--font-display); font-size: var(--text-base); color: var(--color-text); }
.weather-forecast { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--space-2); }
.weather-day {
  display: flex; flex-direction: column; gap: 2px; cursor: pointer; text-align: left;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
  border: 1px solid var(--color-border); background: var(--color-surface-2);
  font-size: var(--text-xs); color: var(--color-text-muted);
}
.weather-day:hover { border-color: var(--color-primary); }
.weather-day.is-active { border-color: var(--color-primary); background: var(--color-primary-soft); }
.weather-day strong { font-family: var(--font-display); font-size: var(--text-sm); color: var(--color-text); }
.suitability-bar { display: block; height: 5px; border-radius: var(--radius-full); background: var(--color-surface-sunk); overflow: hidden; margin: 3px 0; }
.suitability-bar i { display: block; height: 100%; background: var(--color-risk); border-radius: var(--radius-full); }

/* ---- Trend chart ---- */
.chart-wrap { position: relative; height: 240px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }

/* ---- Comparison cards ---- */
.comparison-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3); }
.strategy-card {
  background: var(--color-surface-offset); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-2);
}
.strategy-card.is-best { border-color: var(--color-primary); background: var(--color-primary-soft); }
.strategy-badge {
  align-self: flex-start; font-family: var(--font-mono); font-size: var(--text-xs);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px var(--space-2); border-radius: var(--radius-sm);
  background: var(--color-surface-sunk); color: var(--color-text-muted);
}
.strategy-card.is-best .strategy-badge { background: var(--color-primary); color: var(--color-text-inverse); }
.strategy-card h3 { font-family: var(--font-display); font-size: var(--text-base); }
.strategy-card p { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.45; }
.strategy-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); margin-top: auto; }
.strategy-metrics span { display: flex; flex-direction: column; font-size: var(--text-xs); color: var(--color-text-muted); }
.strategy-metrics strong { font-family: var(--font-display); font-size: var(--text-lg); color: var(--color-text); line-height: 1; }
.literature-note {
  font-size: var(--text-xs); color: var(--color-text-faint); line-height: 1.5;
  border-top: 1px solid var(--color-divider); padding-top: var(--space-3);
}

/* ---- Incident table ---- */
.table-wrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.detail-card { min-width: 0; }
.detail-card table { min-width: 560px; }
.detail-card table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.detail-card th {
  text-align: left; font-size: var(--text-xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted);
  padding: var(--space-3); background: var(--color-surface-offset);
  border-bottom: 1px solid var(--color-border); white-space: nowrap;
}
.detail-card td { padding: var(--space-3); border-bottom: 1px solid var(--color-divider); color: var(--color-text); }
.detail-card tbody tr:last-child td { border-bottom: 0; }
.detail-card tbody tr:hover td { background: var(--color-surface-offset); }
.risk-pill {
  display: inline-block; font-family: var(--font-mono); font-size: var(--text-xs);
  font-weight: 600; padding: 2px var(--space-2); border-radius: var(--radius-full);
}
.risk-pill.high { background: rgba(226,87,75,0.16); color: #e2574b; }
.risk-pill.medium { background: rgba(239,138,61,0.16); color: #ef8a3d; }
.risk-pill.low { background: var(--color-primary-soft); color: var(--color-primary); }
[data-theme="dark"] .risk-pill.low { color: var(--color-primary-hover); }
.biocontrol-tag {
  display: inline-block; font-family: var(--font-mono); font-size: var(--text-xs);
  padding: 2px var(--space-2); border-radius: var(--radius-sm);
  background: var(--color-surface-offset); color: var(--color-text-muted);
}
.biocontrol-tag.lag { background: rgba(239,138,61,0.16); color: #ef8a3d; }

/* ---- Prototype footer ---- */
.prototype-footer {
  font-size: var(--text-xs); color: var(--color-text-faint); line-height: 1.6;
  border-top: 1px solid var(--color-divider); padding-top: var(--space-4);
}
.prototype-footer a { color: var(--color-primary); }
[data-theme="dark"] .prototype-footer a { color: var(--color-primary-hover); }

/* Plain rail list (no marker dots) for assumptions */
.rail-list.rail-list-plain { list-style: none; padding: 0; }
.rail-list.rail-list-plain li {
  font-size: var(--text-sm); color: var(--color-text-muted);
  padding-left: var(--space-3); position: relative; margin-bottom: var(--space-2);
}
.rail-list.rail-list-plain li::before {
  content: ""; position: absolute; left: 0; top: 0.55em;
  width: 4px; height: 4px; border-radius: var(--radius-full); background: var(--color-primary);
}

/* Notice block in the rail */
.notice {
  background: var(--color-accent-soft, var(--color-surface-offset));
  border: 1px solid var(--color-border); border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-md); padding: var(--space-4);
}
.notice h2 { font-family: var(--font-body); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-accent); margin-bottom: var(--space-2); }
.notice p { font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.5; }

/* ---- Westland page wrappers (hero + notice + footer over the shared workspace) ---- */
.wl-page { min-height: calc(100dvh - var(--nav-h)); }
.wl-hero {
  max-width: 1180px; margin: 0 auto; padding: var(--space-10) var(--space-8) var(--space-2);
  text-align: center;
}
.wl-hero .eyebrow { justify-content: center; }
.wl-hero h1 { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.9rem, 1.3rem + 2.6vw, 2.9rem); letter-spacing: -0.02em; line-height: 1.05; }
.wl-hero p.lead { font-size: var(--text-lg); color: var(--color-text-muted); max-width: 70ch; margin: var(--space-3) auto 0; line-height: 1.5; }
.wl-notice {
  max-width: 70ch; margin: var(--space-5) auto 0; text-align: left;
}
.wl-page .kpi-grid {
  max-width: 1180px; margin: var(--space-5) auto 0;
  padding: 0 var(--space-8);
}
.wl-page .workspace { max-width: 1180px; margin: 0 auto; }
.wl-footer { max-width: 1180px; margin: 0 auto; padding: var(--space-6) var(--space-8) var(--space-12); }
.wl-footer p { font-size: var(--text-xs); color: var(--color-text-faint); line-height: 1.6; }
.wl-sources { margin-top: var(--space-3); }
.wl-sources a { color: var(--color-primary); }
[data-theme="dark"] .wl-sources a { color: var(--color-primary-hover); }
@media (max-width: 760px) {
  .wl-hero { padding: var(--space-8) var(--space-4) var(--space-2); }
  .wl-page .kpi-grid { padding: 0 var(--space-4); }
  .wl-footer { padding: var(--space-5) var(--space-4) var(--space-10); }
}
