@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/jbmono-400.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/jbmono-500.woff2") format("woff2");
}

:root {
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Light Topo theme (default) */
  --bg: #e2e8f0;
  --hud-bg: rgba(255, 255, 255, 0.90);
  --hud-elevated: rgba(248, 250, 252, 0.98);
  --hud-well: rgba(241, 245, 249, 0.92);
  --hud-border: rgba(15, 23, 42, 0.11);
  --hud-border-hi: rgba(2, 132, 199, 0.45);
  --hud-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.10);

  --ink-1: #0f172a;
  --ink-2: #475569;
  --ink-3: #64748b;

  --accent: #0284c7;
  --accent-hover: #0369a1;
  --accent-tint: rgba(2, 132, 199, 0.11);
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #e11d48;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --hud-bg: rgba(15, 23, 42, 0.84);
  --hud-elevated: rgba(30, 41, 59, 0.94);
  --hud-well: rgba(2, 6, 23, 0.56);
  --hud-border: rgba(148, 163, 184, 0.16);
  --hud-border-hi: rgba(56, 189, 248, 0.45);
  --hud-shadow: 0 2px 6px rgba(0, 0, 0, 0.32), 0 12px 28px rgba(0, 0, 0, 0.42);

  --ink-1: #f8fafc;
  --ink-2: #cbd5e1;
  --ink-3: #94a3b8;

  --accent: #0ea5e9;
  --accent-hover: #38bdf8;
  --accent-tint: rgba(14, 165, 233, 0.18);
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #f43f5e;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink-1);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  letter-spacing: normal;
  color: inherit;
}

.field-val, .time-readout, .telemetry, .mini-v, .legend-ticks {
  font-variant-numeric: tabular-nums;
}

.hidden { display: none !important; }

#map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

/* MapLibre native controls */
.maplibregl-ctrl-top-right { top: 432px !important; right: 12px !important; }
.maplibregl-ctrl-bottom-left { bottom: 62px !important; left: 12px !important; }
.maplibregl-ctrl-bottom-right { display: none !important; }
.maplibregl-ctrl-group {
  background: var(--hud-bg) !important;
  backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid var(--hud-border) !important;
  border-radius: 10px !important;
  box-shadow: var(--hud-shadow) !important;
  overflow: hidden;
}
.maplibregl-ctrl-group button {
  background: transparent !important;
  border-color: var(--hud-border) !important;
}
.maplibregl-ctrl-group button:hover { background: var(--hud-well) !important; }
[data-theme="dark"] .maplibregl-ctrl-icon { filter: invert(0.92) brightness(1.1); }
.maplibregl-ctrl-scale {
  background: var(--hud-bg) !important;
  backdrop-filter: blur(14px);
  border: 1px solid var(--hud-border) !important;
  border-top: none !important;
  border-radius: 0 0 6px 6px;
  color: var(--ink-2) !important;
  font-family: var(--mono) !important;
  font-size: 11px !important;
  padding: 2px 7px !important;
}

/* Frosted HUD surface */
.hud {
  position: fixed;
  z-index: 10;
  background: var(--hud-bg);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--hud-border);
  border-radius: 11px;
  box-shadow: var(--hud-shadow);
}

/* Top Bar */
.topbar {
  top: 12px;
  left: 12px;
  right: 12px;
  height: 44px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  z-index: 45;
}
.top-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}
.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
}
.brand-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--ink-1);
}
.search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 440px;
}
.search-select, .search-input {
  height: 30px;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 7px;
  color: var(--ink-1);
  font-size: 12px;
  font-weight: 400;
  padding: 0 9px;
  outline: none;
}
.search-select { width: 254px; flex-shrink: 0; }
.search-input { flex: 1; min-width: 140px; }
.search-input::placeholder { color: var(--ink-3); }
.search-input:focus, .search-select:focus { border-color: var(--hud-border-hi); }

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.seg-group {
  display: inline-flex;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.seg-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-2);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: 120ms ease;
}
.seg-btn:hover { color: var(--ink-1); }
.seg-btn.active {
  background: var(--hud-elevated);
  color: var(--ink-1);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--hud-border);
  background: var(--hud-elevated);
  color: var(--ink-1);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: 120ms ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--hud-border-hi); }
.btn.active {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent);
}
.btn:disabled {
  opacity: 0.42;
  pointer-events: none;
}
.btn-xs {
  padding: 3px 7px;
  font-size: 11px;
}
.btn-icon {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}
.btn.primary {
  height: 34px;
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
  font-size: 12.5px;
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.compare {
  height: 32px;
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.42);
  color: var(--warn);
  font-weight: 500;
}

/* Left Scenario Drawer */
.drawer {
  top: 66px;
  left: 12px;
  width: 256px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sec-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sec-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.upload-link {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}
.upload-link:hover { text-decoration: underline; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}
.tool-btn {
  padding: 6px 6px;
  font-size: 12px;
  text-align: center;
}

.divider {
  height: 1px;
  background: var(--hud-border);
  margin: 2px 0;
}

.intervention-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(13, 148, 136, 0.10);
  border: 1px solid rgba(13, 148, 136, 0.28);
  font-size: 12px;
  color: var(--ink-1);
}
.iv-actions { display: flex; gap: 4px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.field-label {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-2);
}
.field-val {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-1);
}
input[type="range"] {
  width: 100%;
  height: 4px;
  accent-color: var(--accent);
  margin: 2px 0;
  cursor: pointer;
}

.adv-details {
  border: 1px solid var(--hud-border);
  border-radius: 8px;
  background: var(--hud-well);
  padding: 6px 8px;
}
.adv-summary {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.adv-summary::after { content: "▾"; font-size: 11px; color: var(--ink-3); }
.adv-details[open] .adv-summary::after { content: "▴"; }
.adv-body {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ctl-select {
  width: 100%;
  height: 28px;
  background: var(--hud-elevated);
  border: 1px solid var(--hud-border);
  border-radius: 6px;
  color: var(--ink-1);
  font-size: 11.5px;
  padding: 0 6px;
}
.ctl-select-xs {
  width: auto;
  height: 24px;
  font-size: 11px;
  padding: 0 4px;
}
.cta-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

.nwp-card {
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nwp-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nwp-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-tint);
  color: var(--accent);
}
.nwp-badge.high { background: rgba(22, 163, 74, 0.14); color: var(--ok); }
.nwp-badge.moderate { background: rgba(217, 119, 6, 0.14); color: var(--warn); }
.nwp-badge.low { background: rgba(225, 29, 72, 0.14); color: var(--danger); }
.nwp-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
.nwp-row {
  display: flex;
  justify-content: space-between;
  color: var(--ink-2);
}
.nwp-row strong { font-weight: 500; color: var(--ink-1); }

/* Top-Right Layer Card */
.layer-panel {
  top: 66px;
  right: 12px;
  width: 214px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.layer-toggles { display: flex; gap: 4px; }
.layer-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}
.legend-bar {
  height: 8px;
  border-radius: 999px;
  border: 1px solid var(--hud-border);
}
.legend-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
}
.legend-note {
  font-size: 11px;
  line-height: 1.4;
  color: var(--ink-3);
}

/* Floating Inspector */
.inspector {
  right: 12px;
  bottom: 66px;
  width: 336px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.inspector-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.inspector-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
}
.chart-svg {
  width: 100%;
  height: 124px;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 8px;
}
.mini-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.mini-stat {
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 7px;
  padding: 6px 8px;
}
.mini-k {
  font-size: 11px;
  color: var(--ink-3);
}
.mini-v {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
  margin-top: 1px;
}
.mini-v.good { color: #0d9488; }
.mini-v.bad { color: var(--danger); }

/* Bottom-Left Status & Cursor Pill */
.status-pill {
  left: 12px;
  bottom: 14px;
  height: 36px;
  max-width: calc(50vw - 275px);
  padding: 0 9px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
}
.honesty-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--ink-1);
  white-space: nowrap;
}
.honesty-inline .dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ok);
}
.honesty-inline.fail .dot { background: var(--danger); }
.pill-sep { color: var(--ink-3); }
.telemetry {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  white-space: nowrap;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bottom-Center Compact Playback Capsule */
.timeline {
  left: 50%;
  transform: translateX(-50%);
  bottom: 14px;
  width: 530px;
  height: 38px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.time-readout {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-1);
  min-width: 215px;
  text-align: center;
  white-space: nowrap;
}
.scrubber { flex: 1; }
.scrubber:focus { outline: none; }

/* Adaptive Multi-Day / Interval Forecast Bar */
.forecast-bar {
  position: fixed;
  right: 12px;
  bottom: 14px;
  width: 680px;
  padding: 0;
  overflow: visible;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  z-index: 25;
}
.fb-playback {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  height: 44px;
  box-sizing: border-box;
  flex-shrink: 0;
}
.fb-playback .btn {
  height: 30px;
  min-width: 34px;
  padding: 0 8px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}
.fb-card {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
}
.fb-callout-rail {
  position: relative;
  height: 0;
}
.fb-callout {
  position: absolute;
  bottom: 10px;
  left: 0%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #ffffff;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.22);
  pointer-events: none;
}
.fb-callout::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--accent);
}
.fb-track {
  height: 6px;
  background: rgba(15, 23, 42, 0.12);
  border-radius: 10px 10px 0 0;
  overflow: hidden;
}
[data-theme="dark"] .fb-track { background: rgba(255, 255, 255, 0.14); }
.fb-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
}
.fb-segments {
  display: flex;
  width: 100%;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}
.fb-seg {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-2);
  border-right: 1px solid var(--hud-border);
  white-space: nowrap;
}
.fb-seg:last-child { border-right: none; }
.fb-seg.active {
  background: rgba(2, 132, 199, 0.14);
  color: var(--accent);
  font-weight: 600;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-card {
  width: min(640px, 92vw);
  max-height: 78vh;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}
.src-card {
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.src-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: var(--accent-tint);
  color: var(--accent);
}
.src-badge.pub { background: rgba(22, 163, 74, 0.14); color: var(--ok); }

.btn.recording {
  background: rgba(225, 29, 72, 0.16);
  border-color: var(--danger);
  color: var(--danger);
}
.director-caption {
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-1);
  pointer-events: none;
  max-width: 520px;
  text-align: center;
}
.left-stack {
  position: fixed;
  top: 66px;
  left: 12px;
  width: 288px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 20;
  pointer-events: none;
}
[data-presentation="true"] .left-stack {
  top: 14px;
}
[data-profile="public"] #drawer,
[data-profile="public"] #sim-dir-drawer,
[data-profile="public"] #btn-mob-tools,
[data-profile="public"] #btn-open-sim,
[data-profile="public"] #btn-saved-sims,
[data-profile="public"] #btn-export-asc,
[data-profile="public"] #btn-export-csv,
[data-profile="public"] [data-layer="diff"] {
  display: none !important;
}
[data-profile="researcher"][data-sim-phase="draft"] #timeline,
[data-profile="researcher"][data-sim-phase="draft"] #forecast-bar,
[data-profile="researcher"][data-sim-phase="draft"] .layer-panel,
[data-profile="researcher"][data-sim-phase="draft"] .left-stack,
[data-profile="researcher"][data-sim-phase="draft"] #inspector,
[data-profile="researcher"][data-sim-phase="draft"] #btn-mob-summary,
[data-profile="researcher"][data-sim-phase="draft"] #btn-mob-layers,
[data-profile="researcher"][data-sim-phase="solving"] #timeline,
[data-profile="researcher"][data-sim-phase="solving"] #forecast-bar,
[data-profile="researcher"][data-sim-phase="solving"] .layer-panel,
[data-profile="researcher"][data-sim-phase="solving"] .left-stack,
[data-profile="researcher"][data-sim-phase="solving"] #inspector,
[data-profile="researcher"][data-sim-phase="solving"] #btn-mob-summary,
[data-profile="researcher"][data-sim-phase="solving"] #btn-mob-layers {
  display: none !important;
}
.drawer-top-head {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--hud-border);
}
.sim-phase-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 999px;
}
.sim-phase-badge.draft {
  background: rgba(2, 132, 199, 0.14);
  color: #0369a1;
}
.sim-phase-badge.results {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
}
.sim-phase-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sim-summary-card,
.sim-result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  font-size: 11.5px;
  color: var(--ink-2);
  line-height: 1.35;
}
.sim-summary-text {
  min-width: 0;
  flex: 1;
}
.sim-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(15, 23, 42, 0.36);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.sim-overlay-card {
  position: static;
  width: min(400px, 92vw);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sim-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sim-overlay-title-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--ink-1);
}
.sim-spinner-lg {
  width: 16px;
  height: 16px;
  border-width: 2.5px;
}
.sim-elapsed {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}
.sim-overlay-sub {
  font-size: 12.5px;
  color: var(--ink-2);
}
.sim-stepper {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.sim-step {
  font-size: 11.5px;
  padding: 6px 8px;
  border-radius: 7px;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  color: var(--ink-3);
  font-weight: 500;
}
.sim-step.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}
.sim-step.done {
  border-color: rgba(16, 185, 129, 0.45);
  color: #047857;
}
.sim-overlay-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
  border-top: 1px solid var(--hud-border);
}
.sim-overlay-note {
  font-size: 11px;
  color: var(--ink-3);
}
.sim-dir-drawer {
  top: 66px;
  left: 12px;
  width: 304px;
  bottom: 68px;
  z-index: 32;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sim-dir-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sim-dir-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}
.sim-dir-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 9px;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.sim-dir-card:hover {
  border-color: var(--accent);
}
.sim-dir-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.sim-dir-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.sim-dir-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.sim-dir-seq {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(2, 132, 199, 0.14);
  color: #0369a1;
  flex-shrink: 0;
}
.sim-dir-seq.cfg {
  background: rgba(100, 116, 139, 0.16);
  color: var(--ink-2);
}
.sim-dir-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sim-dir-fork {
  font-size: 10.5px;
  color: var(--ink-3);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.sim-dir-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 10.5px;
  color: var(--ink-2);
}
.sim-dir-chip {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--hud-bg);
  border: 1px solid var(--hud-border);
}
.sim-dir-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.sim-dir-summary {
  font-size: 11px;
  color: var(--ink-3);
  padding-top: 6px;
  border-top: 1px solid var(--hud-border);
}
@media (max-width: 768px) {
  .sim-dir-drawer {
    top: 98px;
    left: 8px;
    right: 8px;
    width: auto;
    bottom: 62px;
    z-index: 36;
  }
}
.saved-sims-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.saved-sim-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
}
.saved-sim-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.saved-sim-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-1);
}
.saved-sim-meta {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-sim-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.saved-sim-badge.sim {
  background: rgba(2, 132, 199, 0.14);
  color: var(--accent);
}
.saved-sim-badge.cfg {
  background: rgba(100, 116, 139, 0.14);
  color: var(--ink-2);
}
.saved-sim-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
a.btn {
  text-decoration: none;
}
.toast-bar {
  z-index: 40;
}
.modal-backdrop {
  z-index: 80;
}
.search-wrap {
  min-width: 0;
  flex-shrink: 1;
}
.search-input {
  min-width: 155px;
}
.alerts-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.alert-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.alert-btn.none {
  color: var(--ink-3);
}
.alert-btn.advisory {
  background: rgba(2, 132, 199, 0.14);
  border-color: rgba(2, 132, 199, 0.45);
  color: #0369a1;
}
.alert-btn.warning {
  background: rgba(217, 119, 6, 0.16);
  border-color: rgba(217, 119, 6, 0.55);
  color: #b45309;
}
.alert-btn.danger {
  background: rgba(220, 38, 38, 0.16);
  border-color: rgba(220, 38, 38, 0.6);
  color: #b91c1c;
}
.alert-tri {
  font-size: 11px;
  line-height: 1;
}
.alerts-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 320px;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 8px;
  z-index: 70;
}
.alerts-dd-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-1);
}
.alerts-dd-sub {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-3);
}
.alerts-dd-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 295px;
}
.alert-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.alert-row:hover {
  border-color: var(--accent);
  background: rgba(2, 132, 199, 0.08);
}
.alert-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-1);
}
.alert-row-meta {
  font-size: 11px;
  color: var(--ink-3);
}
.alert-pill {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.alert-pill.danger { background: rgba(220, 38, 38, 0.16); color: #b91c1c; }
.alert-pill.warning { background: rgba(217, 119, 6, 0.18); color: #b45309; }
.alert-pill.advisory { background: rgba(2, 132, 199, 0.16); color: #0369a1; }

/* Zoom-aware pulsing flood beacons (State -> District -> Region -> Disappear) */
.flood-beacon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}
.flood-beacon.singular {
  width: 16px;
  height: 16px;
}
.flood-beacon-core {
  position: relative;
  z-index: 2;
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.35);
}
.flood-beacon.singular .flood-beacon-core {
  min-width: 14px;
  width: 14px;
  height: 14px;
  padding: 0;
}
.flood-beacon-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  margin-top: -13px;
  border-radius: 999px;
  z-index: 1;
  animation: beacon-pulse 1.9s cubic-bezier(0.2, 0.6, 0.4, 1) infinite;
  pointer-events: none;
}
.flood-beacon.singular .flood-beacon-ring {
  width: 16px;
  height: 16px;
  margin-left: -8px;
  margin-top: -8px;
}
.flood-beacon.advisory .flood-beacon-core { background: #0284c7; }
.flood-beacon.advisory .flood-beacon-ring { background: rgba(2, 132, 199, 0.45); }
.flood-beacon.warning .flood-beacon-core { background: #d97706; }
.flood-beacon.warning .flood-beacon-ring { background: rgba(217, 119, 6, 0.48); }
.flood-beacon.danger .flood-beacon-core { background: #dc2626; }
.flood-beacon.danger .flood-beacon-ring { background: rgba(220, 38, 38, 0.52); }

@keyframes beacon-pulse {
  0% { transform: scale(0.75); opacity: 0.85; }
  75% { transform: scale(2.05); opacity: 0; }
  100% { transform: scale(2.05); opacity: 0; }
}
.beacon-tooltip {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  font-size: 11.5px;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.35);
  max-width: 240px;
}
.beacon-tooltip strong { display: block; font-size: 12px; margin-bottom: 2px; }
.beacon-tooltip .bt-sub { color: #cbd5e1; font-size: 10.5px; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
}
.settings-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 14px 0;
}
.loc-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-radius: 8px;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
}
.loc-form-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.loc-form-row input[type="number"] {
  width: 78px;
}
.loc-mini-field {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-3);
}
.loc-star-btn {
  font-size: 14px;
  line-height: 1;
  padding: 3px 7px;
  color: var(--ink-3);
}
.loc-star-btn.active {
  color: #d97706;
  border-color: rgba(217, 119, 6, 0.45);
  background: rgba(217, 119, 6, 0.12);
}
.focus-chip {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-1);
}
.fb-track {
  touch-action: none;
  user-select: none;
  cursor: grab;
  overflow: visible;
  height: 6px;
}
.fb-track:active, .fb-callout:active {
  cursor: grabbing;
}
.fb-callout {
  touch-action: none;
  user-select: none;
  cursor: grab;
  pointer-events: auto;
}
.incident-pin {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(185, 28, 28, 0.94);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.35);
  cursor: pointer;
  white-space: nowrap;
}
[data-profile="researcher"]:not([data-presentation="true"]) .public-outlook {
  display: none !important;
}
body.has-forecast-bar .status-pill {
  max-width: calc(100vw - 716px);
}
body.has-forecast-bar .inspector,
body.has-forecast-bar .site-verdict {
  bottom: 94px;
}
.coord-well {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
}
.nwp-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sim-progress {
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-1);
  z-index: 35;
}
.sim-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--hud-border);
  border-top-color: var(--accent);
  animation: arus-spin 0.75s linear infinite;
}
@keyframes arus-spin {
  to { transform: rotate(360deg); }
}
.toast-bar {
  bottom: 66px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-1);
  z-index: 45;
  max-width: min(460px, calc(100vw - 24px));
}
.site-verdict {
  right: 12px;
  bottom: 66px;
  width: 320px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 25;
}
.sv-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sv-coords {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.2;
  color: var(--ink-3, #64748b);
  margin: -4px 0 4px;
  user-select: all;
  cursor: pointer;
}
.sv-coords:hover {
  color: var(--ink-1, #0f172a);
}
.sv-summary {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-2);
}
.sv-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--hud-border);
}
.sv-ffe {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-2);
}
.sv-ffe .ctl-select {
  width: auto;
  padding: 3px 6px;
  font-size: 11px;
}
.fb-controls-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
}
.fb-main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.fb-track {
  cursor: pointer;
}
.fb-seg {
  cursor: pointer;
}
[data-presentation="true"] #fb-play {
  display: none !important;
}
.po-spot.clickable {
  cursor: pointer;
  border-radius: 5px;
  padding: 2px 4px;
  margin: 0 -4px;
  pointer-events: auto;
}
.po-spot.clickable:hover {
  background: var(--hud-well);
}
.public-outlook {
  pointer-events: auto;
}
body.picking-site #map {
  cursor: crosshair !important;
}
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Responsive layouts for tablets & phones */
@media (max-width: 1120px) {
  .topbar {
    height: auto;
    min-height: 44px;
    flex-wrap: wrap;
    padding: 6px 10px;
    gap: 6px;
  }
  .search-select { width: 190px; }
  .search-input { width: 130px; min-width: 110px; }
  .status-pill { max-width: calc(50vw - 220px); }
  .timeline { width: min(460px, calc(100vw - 24px)); }
  .forecast-bar { width: min(540px, calc(100vw - 24px)); }
}
.mobile-only {
  display: none !important;
}
@media (max-width: 768px) {
  .mobile-only {
    display: inline-flex !important;
  }
  .topbar {
    top: 8px;
    left: 8px;
    right: 8px;
    padding: 6px 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    z-index: 45;
  }
  .brand-name {
    display: none;
  }
  .top-left {
    width: 100%;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .search-wrap {
    flex: 1;
    min-width: 0;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .search-select {
    flex: 1;
    width: auto;
    min-width: 0;
    font-size: 12.5px;
  }
  .search-input-wrap,
  #coord-search,
  #btn-save-view {
    display: none;
  }
  body.mob-menu-open .top-left {
    flex-wrap: wrap;
  }
  body.mob-menu-open .search-wrap {
    flex-wrap: wrap;
    row-gap: 6px;
  }
  body.mob-menu-open .search-select {
    flex: 1 1 40%;
  }
  body.mob-menu-open .search-input-wrap {
    display: block;
    flex: 1 1 60%;
    min-width: 150px;
    order: 10;
  }
  body.mob-menu-open #coord-search {
    display: block;
    width: 100%;
  }
  .search-results {
    position: fixed;
    top: 96px;
    left: 8px;
    right: 8px;
    width: auto;
  }
  body.mob-menu-open #btn-save-view {
    display: inline-flex;
    order: 11;
  }
  body.mob-menu-open .mobile-dock {
    display: none !important;
  }
  .top-actions {
    display: none;
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid var(--hud-border);
    overflow-x: visible;
  }
  body.mob-menu-open .top-actions {
    display: flex;
  }
  .alerts-dropdown {
    position: fixed;
    top: 58px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
  }
  .mobile-dock {
    position: fixed;
    top: 60px;
    left: 8px;
    right: 8px;
    z-index: 22;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
  }
  .mob-pill {
    position: relative;
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-1);
    cursor: pointer;
  }
  .mob-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #10b981;
  }
  .mob-dot.moderate { background: #f59e0b; }
  .mob-dot.high { background: #f97316; }
  .mob-dot.danger { background: #dc2626; }
  .focus-chip {
    top: 98px;
    font-size: 11px;
  }
  .left-stack {
    display: none;
    top: 98px;
    bottom: auto;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: calc(100vh - 185px);
    overflow-y: auto;
    pointer-events: auto;
    z-index: 30;
  }
  body.mob-summary-open .left-stack {
    display: flex;
  }
  .layer-panel {
    display: none;
    top: 98px;
    right: 8px;
    left: auto;
    width: min(260px, calc(100vw - 16px));
    z-index: 30;
  }
  body.mob-layers-open .layer-panel {
    display: block;
  }
  .maplibregl-ctrl-top-right {
    top: 102px !important;
    right: 8px !important;
  }
  .status-pill {
    display: none;
  }
  .timeline,
  .forecast-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    transform: none;
    gap: 6px;
  }
  .fb-playback {
    height: 40px;
    padding: 4px;
    gap: 4px;
  }
  .fb-playback .btn {
    height: 28px;
    min-width: 28px;
    padding: 0 6px;
    font-size: 11px;
  }
  .fb-seg {
    font-size: 10px;
    padding: 5px 2px;
  }
  .fb-callout {
    font-size: 11px;
    padding: 4px 9px;
  }
  #site-verdict,
  #inspector {
    left: 8px;
    right: 8px;
    bottom: 62px;
    width: auto;
    max-width: none;
  }
  .time-readout {
    min-width: 96px;
    font-size: 11px;
  }
  .drawer {
    display: none;
    top: 98px;
    left: 8px;
    right: 8px;
    width: auto;
    max-height: 54vh;
    z-index: 30;
  }
  body.mob-tools-open .drawer {
    display: flex;
  }
  .btn,
  .seg-btn {
    min-height: 36px;
  }
  .arus-pin-ctrl {
    display: none !important;
  }
}
.arus-pin-ctrl {
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  margin-bottom: 4px !important;
}
.arus-pin-ctrl-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 38px;
  padding: 0;
  border: none !important;
  background: transparent !important;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.32));
  transition: transform 0.14s ease, filter 0.14s ease;
}
.arus-pin-ctrl-btn:hover {
  background: transparent !important;
  transform: translateY(-2px) scale(1.08);
  filter: drop-shadow(0 4px 7px rgba(15, 23, 42, 0.38));
}
.arus-pin-ctrl-btn:active {
  cursor: grabbing;
  transform: scale(0.96);
}
.arus-pin-ctrl-btn.active {
  background: transparent !important;
  transform: translateY(-2px) scale(1.12);
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.7));
}
[data-profile="researcher"] .arus-pin-ctrl {
  display: none !important;
}
.flood-beacon {
  z-index: 1;
}
.incident-pin {
  z-index: 2;
}
.arus-dropped-pin {
  width: 28px;
  height: 40px;
  cursor: grab;
  z-index: 3;
  filter: drop-shadow(0 2px 4px rgba(15, 23, 42, 0.38));
}
.arus-dropped-pin:active {
  cursor: grabbing;
}
body.pin-drop-mode .maplibregl-canvas-container {
  cursor: crosshair !important;
}
.arus-pin-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  transform: translate(-50%, -100%);
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.42));
}
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: min(360px, calc(100vw - 24px));
  max-height: 300px;
  overflow-y: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 70;
}
.search-result-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-1);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.search-result-item:hover,
.search-result-item.active {
  background: var(--hud-well);
}
.search-result-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-1);
  line-height: 1.25;
}
.search-result-sub {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.25;
}
.search-result-empty {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--ink-3);
}
.modal-wide {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-tabs {
  display: flex;
  gap: 4px;
  background: var(--hud-well);
  padding: 4px;
  border-radius: 9px;
  border: 1px solid var(--hud-border);
}
.modal-tabs .seg-btn {
  flex: 1;
  text-align: center;
}
.modal-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 640px) {
  .modal-grid-2 { grid-template-columns: 1fr; }
}
.modal-sec {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-1);
  cursor: pointer;
}
.toggle-row input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}
.modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--hud-border);
}
.modal-foot-right {
  display: flex;
  gap: 8px;
}
.context-box {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-2);
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mjo-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  background: rgba(2, 132, 199, 0.14);
  color: var(--accent);
}
.stale-warn {
  color: var(--warn);
  font-weight: 600;
}
.engine-badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-2);
}
.left-stack > .hud {
  position: static;
  width: 100%;
  box-sizing: border-box;
}
.public-outlook {
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}
.po-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.po-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-1);
}
.po-risk {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.po-risk.low { background: rgba(22, 163, 74, 0.16); color: var(--ok); }
.po-risk.moderate { background: rgba(217, 119, 6, 0.18); color: var(--warn); }
.po-risk.high { background: rgba(225, 29, 72, 0.18); color: var(--danger); }
.po-summary {
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-2);
}
.po-hotspots {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 4px;
  border-top: 1px solid var(--hud-border);
}
.po-spot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 11.5px;
}
.po-spot-name { color: var(--ink-1); font-weight: 500; }
.po-spot-val { color: var(--ink-2); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.po-spot-val.warn { color: var(--warn); font-weight: 500; }
.po-spot-val.danger { color: var(--danger); font-weight: 500; }
.po-foot {
  font-size: 10.5px;
  color: var(--ink-3);
  padding-top: 4px;
  border-top: 1px solid var(--hud-border);
}
.legend-river {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--hud-border);
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-2);
}
.river-swatch {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: #059669;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
}

/* Live Per-Frame Area Flood Gauge (aligned in .left-stack below Public Outlook card) */
.live-metrics {
  padding: 10px 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: auto;
}
[data-profile="researcher"] .left-stack {
  top: auto;
  left: 326px;
  bottom: 62px;
}
.lm-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.lm-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-1);
}
.lm-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.lm-trend {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-2);
}
.lm-trend.rising { color: var(--danger); }
.lm-trend.receding { color: var(--ok); }
.lm-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.lm-badge.low { background: rgba(22, 163, 74, 0.16); color: var(--ok); }
.lm-badge.moderate { background: rgba(234, 179, 8, 0.20); color: #a16207; }
.lm-badge.high { background: rgba(234, 88, 12, 0.18); color: #c2410c; }
.lm-badge.danger { background: rgba(225, 29, 72, 0.18); color: var(--danger); }
[data-theme="dark"] .lm-badge.moderate { color: #facc15; }
[data-theme="dark"] .lm-badge.high { color: #fb923c; }
.lm-bar-wrap {
  position: relative;
  height: 10px;
  display: flex;
  align-items: center;
}
.lm-bar {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #16a34a 0%, #eab308 35%, #f97316 68%, #e11d48 100%);
}
.lm-marker {
  position: absolute;
  left: 0%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  border: 2.5px solid #0f172a;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
}
.lm-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--ink-3);
  margin-top: -3px;
}
.lm-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.lm-cell {
  background: var(--hud-well);
  border: 1px solid var(--hud-border);
  border-radius: 7px;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.lm-cell-wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.mini-stat-wide {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.lm-k { font-size: 10px; color: var(--ink-3); }
.lm-v { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--ink-1); }
/* Clean broadcast / recording presentation mode (hides editor chrome, keeps key viewer info) */
[data-presentation="true"] .topbar,
[data-presentation="true"] .drawer,
[data-presentation="true"] .maplibregl-ctrl-top-right,
[data-presentation="true"] .layer-panel .sec-head,
[data-presentation="true"] .layer-panel .layer-tabs,
[data-presentation="true"] #btn-play,
[data-presentation="true"] #btn-speed,
[data-presentation="true"] #btn-inspector-close {
  display: none !important;
}
[data-presentation="true"] .status-pill {
  left: 12px;
  bottom: 14px;
  max-width: 560px;
}
[data-presentation="true"] .timeline {
  left: auto;
  right: 12px;
  transform: none;
  width: 440px;
}
[data-presentation="true"] .director-caption {
  top: 14px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 8px 18px;
  max-width: 720px;
}
[data-presentation="true"] .layer-panel {
  top: 14px;
  width: 196px;
}
[data-presentation="true"] .timeline {
  width: 470px;
}
.spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -1px;
  margin-right: 5px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Quick overlay toggles inside Layers card */
.layer-overlays {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ov-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  user-select: none;
}
.ov-toggle input {
  margin: 0;
  accent-color: #0d9488;
  cursor: pointer;
}
.ov-count {
  margin-left: auto;
  font-size: 10px;
  font-family: "JetBrains Mono", monospace;
  color: #64748b;
}
.shelter-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: #0d9488;
  border: 1.5px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.18);
  flex-shrink: 0;
}
.weather-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: linear-gradient(135deg, #38bdf8, #22c55e 50%, #f59e0b);
  flex-shrink: 0;
}
.weather-legend {
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed rgba(148, 163, 184, 0.28);
}
.weather-legend.hidden { display: none; }
.weather-bar {
  height: 7px;
  border-radius: 4px;
  background: linear-gradient(90deg, #6f6f6f 0%, #3c74a0 14%, #3ba1a1 34%, #3ba13d 48%, #82a13b 58%, #a1a13b 68%, #a13b3b 80%, #a13ba1 94%, #a8a8a8 100%);
  margin-bottom: 3px;
}

/* Rounded-square Relief Center (shelter) markers */
.shelter-pin {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.shelter-pin svg { transition: transform 0.12s ease; }
.shelter-pin:hover svg { transform: scale(1.15); }
.shelter-pin.cap-ok { background: #0d9488; }
.shelter-pin.cap-warn { background: #d97706; }
.shelter-pin.cap-crit { background: #dc2626; }
.shelter-popup {
  font-family: Inter, system-ui, sans-serif;
  font-size: 11.5px;
  line-height: 1.4;
  color: #0f172a;
  min-width: 195px;
}
.shelter-popup-title {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 3px;
}
.shelter-popup-sub {
  color: #475569;
  font-size: 10.5px;
  margin-bottom: 6px;
}
.shelter-popup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  padding: 5px 0;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 4px;
}
.shelter-popup-k { color: #64748b; font-size: 10px; }
.shelter-popup-v { font-weight: 600; font-family: "JetBrains Mono", monospace; font-size: 11px; }
.maplibregl-marker { z-index: 10; }
.maplibregl-control-container { position: relative; z-index: 15 !important; }
.maplibregl-popup { z-index: 40 !important; }
#arus-weather-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}
