:root {
  --bg: #070b12;
  --panel: rgba(10, 16, 28, 0.92);
  --card: rgba(15, 23, 42, 0.78);
  --border: rgba(148, 163, 184, 0.16);
  --border-hi: rgba(148, 163, 184, 0.32);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --dim: #64748b;
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.14);
  --amber: #facc15;
  --orange: #f97316;
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.16);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  background: #090f1c;
  border-bottom: 1px solid var(--border);
  z-index: 30;
  flex-shrink: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #67e8f9, #0891b2);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.8);
}

.brand-tld { color: var(--cyan); font-weight: 600; }

.badge-crisis {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fecaca;
  background: rgba(185, 28, 28, 0.34);
  border: 1px solid rgba(239, 68, 68, 0.55);
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.weather-pill {
  font-family: var(--mono);
  font-size: 9.5px;
  color: #a5f3fc;
  background: rgba(8, 145, 178, 0.16);
  border: 1px solid rgba(34, 211, 238, 0.32);
  padding: 2px 7px;
  border-radius: 99px;
  white-space: nowrap;
}

.weather-pill.fallback {
  color: #fde68a;
  background: rgba(217, 119, 6, 0.16);
  border-color: rgba(245, 158, 11, 0.38);
}

.preset-bar, .action-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.scenario-select {
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  border: 1px solid rgba(248, 113, 113, 0.55);
  border-radius: 6px;
  padding: 4px 8px;
  height: 28px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--sans);
  max-width: 245px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.scenario-select:hover { border-color: #f87171; }

.preset-btn, .action-btn {
  background: rgba(30, 41, 59, 0.65);
  color: #cbd5e1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.preset-btn:hover, .action-btn:hover {
  background: rgba(51, 65, 85, 0.85);
  color: #fff;
  border-color: var(--border-hi);
}

.preset-btn.active {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(248, 113, 113, 0.65);
  color: #fff;
}

.preset-btn.pin-btn.active {
  background: rgba(34, 211, 238, 0.24);
  border-color: var(--cyan);
  color: #cffafe;
}

.action-btn.accent {
  background: rgba(8, 145, 178, 0.3);
  border-color: rgba(34, 211, 238, 0.55);
  color: #e0f2fe;
  font-weight: 600;
}
.action-btn.accent:hover { background: rgba(8, 145, 178, 0.52); }

.action-btn.accent-purple {
  background: rgba(147, 51, 234, 0.28);
  border-color: rgba(192, 132, 252, 0.62);
  color: #f3e8ff;
  font-weight: 600;
}
.action-btn.accent-purple:hover { background: rgba(147, 51, 234, 0.48); }

/* ── 70 kPa Shear Alert Banner ── */
.alert-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 14px;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.96), rgba(8, 47, 73, 0.72), rgba(15, 23, 42, 0.96));
  border-bottom: 1px solid rgba(34, 211, 238, 0.26);
  font-size: 12px;
  flex-shrink: 0;
  z-index: 25;
}

.alert-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.alert-tag {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: #070b12;
  background: var(--cyan);
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}

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

.mini-pill {
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
  border: 1px solid var(--border-hi);
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.mini-pill:hover { background: rgba(51, 65, 85, 0.95); }
.mini-pill.cyan { border-color: rgba(34, 211, 238, 0.6); color: #a5f3fc; background: rgba(8, 145, 178, 0.24); }
.mini-pill.cyan.active { background: var(--cyan); color: #06121e; }

/* ── Main 3-Column Workspace ── */
.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 318px 1fr 352px;
  min-height: 0;
  position: relative;
}

.panel {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 15;
}

.right-panel {
  border-right: none;
  border-left: 1px solid var(--border);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #cbd5e1;
}

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-scroll::-webkit-scrollbar { width: 6px; }
.panel-scroll::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.25); border-radius: 3px; }

/* ── Control Cards ── */
.control-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-card.highlight-cyan {
  border-color: rgba(34, 211, 238, 0.34);
  background: linear-gradient(180deg, rgba(8, 47, 73, 0.35), rgba(15, 23, 42, 0.8));
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.card-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #cbd5e1;
}

.mono-meta, .mono-dim { font-family: var(--mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.mono-val { font-family: var(--mono); font-size: 11px; font-weight: 600; color: #f8fafc; white-space: nowrap; flex-shrink: 0; }
.mono-cyan { font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--cyan); white-space: nowrap; }

.scenario-summary {
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.45;
}

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: rgba(7, 11, 18, 0.7);
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 6px;
  border-radius: 4px;
  cursor: pointer;
}

.seg-btn.active {
  background: rgba(34, 211, 238, 0.18);
  color: #e0f2fe;
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.45);
}

.field-label { font-size: 11px; font-weight: 600; color: var(--muted); }

.select-input {
  width: 100%;
  background: #0b1220;
  color: var(--text);
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: var(--sans);
}

.slider-group { display: flex; flex-direction: column; gap: 4px; }
.slider-row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: 11.5px; color: #cbd5e1; }

input[type="range"] {
  width: 100%;
  accent-color: var(--cyan);
  cursor: pointer;
  height: 4px;
}

.sub-hint { font-size: 10.5px; color: var(--dim); font-family: var(--mono); }

.chip-row { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 2px; }
.chip {
  flex: 1;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
  color: #cbd5e1;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}
.chip:hover { border-color: var(--border-hi); color: #fff; }
.chip.active { background: rgba(250, 204, 21, 0.16); border-color: rgba(250, 204, 21, 0.55); color: #fef08a; }
.chip.cyan.active, .chip.cyan:hover { background: rgba(34, 211, 238, 0.22); border-color: var(--cyan); color: #cffafe; }

/* Sounding Table */
.sounding-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 10.5px;
}
.sounding-table th {
  text-align: left;
  color: var(--dim);
  font-weight: 600;
  padding: 3px 4px;
  border-bottom: 1px solid var(--border);
}
.sounding-table td {
  padding: 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  color: #e2e8f0;
}
.sounding-table tr.row-70kpa td {
  color: #67e8f9;
  font-weight: 700;
  background: rgba(34, 211, 238, 0.08);
}

/* ── Map Stage ── */
.map-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 400px;
  background: #060a12;
  overflow: hidden;
}

#map-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.overlay-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#fallback-map-canvas { z-index: 1; }
#wind-canvas { z-index: 5; }
#plume-canvas { z-index: 6; }
#iso-canvas { z-index: 9; pointer-events: auto; background: #0f1b33; }
#webgpu-canvas { z-index: 10; pointer-events: none; background: #091020; }
#webgpu-hud-canvas { z-index: 11; pointer-events: auto; }

/* Floating Map HUD */
.map-hud-top {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 10px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  pointer-events: none;
}

/* Dark theme override for MapLibre navigation buttons */
.maplibregl-ctrl-group {
  background: rgba(8, 13, 24, 0.90) !important;
  border: 1px solid rgba(148, 163, 184, 0.30) !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45) !important;
}
.maplibregl-ctrl-group button {
  filter: invert(0.88) hue-rotate(180deg);
}
.maplibregl-ctrl-group button + button {
  border-top: 1px solid rgba(148, 163, 184, 0.25) !important;
}

.hud-pill-group, .hud-toggles {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(8, 13, 24, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-hi);
  border-radius: 6px;
  padding: 2px;
  max-width: 100%;
  flex-wrap: wrap;
}

.hud-prefix {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  color: var(--dim);
  padding: 0 4px;
  white-space: nowrap;
}

.hud-pill {
  background: transparent;
  border: none;
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.hud-pill:hover { color: #fff; background: rgba(148, 163, 184, 0.14); }
.hud-pill.active { background: rgba(249, 115, 22, 0.28); color: #ffedd5; box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.65); }
.hud-pill.cyan.active { background: rgba(34, 211, 238, 0.24); color: #cffafe; box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.7); }
.hud-pill.purple.active { background: rgba(168, 85, 247, 0.28); color: #f3e8ff; box-shadow: inset 0 0 0 1px rgba(192, 132, 252, 0.8); }
.hud-pill.zone.active { background: linear-gradient(135deg, rgba(239, 68, 68, 0.30), rgba(163, 230, 53, 0.28)); color: #fefce8; box-shadow: inset 0 0 0 1px rgba(250, 204, 21, 0.85); }
.hud-pill.agri.active { background: rgba(132, 204, 22, 0.24); color: #ecfccb; box-shadow: inset 0 0 0 1px rgba(163, 230, 53, 0.72); }
.hud-pill.water.active { background: rgba(14, 165, 233, 0.26); color: #e0f2fe; box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.78); }
.hud-pill.pop.active { background: rgba(244, 63, 94, 0.24); color: #ffe4e6; box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.75); }
.hud-pill.sat.active { background: rgba(16, 185, 129, 0.26); color: #d1fae5; box-shadow: inset 0 0 0 1px rgba(52, 211, 153, 0.78); }
.hud-pill.topo.active { background: rgba(217, 119, 6, 0.28); color: #fef3c7; box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.78); }
.hud-pill.gpu.active { background: linear-gradient(135deg, rgba(239, 68, 68, 0.34), rgba(168, 85, 247, 0.32)); color: #fef2f2; box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.85); }
.hud-pill.iso.active { background: linear-gradient(135deg, rgba(217, 119, 6, 0.34), rgba(132, 204, 22, 0.28)); color: #fef3c7; box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.78); }
.hud-pill.tilt-btn.active { background: rgba(56, 189, 248, 0.28); color: #e0f2fe; box-shadow: inset 0 0 0 1px #38bdf8; }
.hud-pill.danger-pill { background: rgba(220, 38, 38, 0.35); color: #fecaca; box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.75); font-weight: 700; }
.hud-pill.danger-pill:hover { background: rgba(220, 38, 38, 0.62); color: #fff; }

.chart-tabs { flex-wrap: nowrap; gap: 2px; width: 100%; }
.chart-tabs .mini-tab { padding: 2px 4px; font-size: 9px; }
#btn-open-graphs-inline { margin-left: auto; }
.modal-box.xwide { width: min(1040px, 96vw); }
.graphs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.graph-tile { background: #070d18; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.graph-tile-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 600; color: #e2e8f0; }
.modal-chart-canvas { width: 100%; height: 225px; display: block; border-radius: 5px; }
.modal-chart-canvas.clickable { cursor: crosshair; }
@media (max-width: 820px) { .graphs-grid { grid-template-columns: 1fr; } }

.speed-btn {
  height: 28px;
  min-width: 34px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--border-hi);
  background: rgba(15, 23, 42, 0.9);
  color: #a5f3fc;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.speed-btn:hover { background: rgba(30, 41, 59, 0.95); }

.ctx-opacity-slider {
  width: 58px !important;
  margin: 0 5px 0 3px;
  accent-color: var(--cyan);
}

.chk-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #cbd5e1;
  padding: 3px 7px;
  cursor: pointer;
  user-select: none;
}
.chk-pill input { accent-color: var(--cyan); }

/* Floating Legend */
.map-legend {
  position: absolute;
  left: 10px;
  bottom: 78px;
  z-index: 12;
  background: rgba(8, 13, 24, 0.90);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-hi);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 215px;
  font-size: 11px;
}

.legend-title {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #e2e8f0;
  margin-bottom: 5px;
}

.legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 3px 0;
  font-size: 10.5px;
  color: #e2e8f0;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  flex-shrink: 0;
}

/* Inspector Card */
.inspector-card {
  position: absolute;
  right: 12px;
  bottom: 78px;
  z-index: 14;
  width: 260px;
  background: rgba(9, 15, 28, 0.95);
  border: 1px solid rgba(34, 211, 238, 0.55);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

.inspector-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
}

.inspector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
}

/* Bottom Timeline Bar */
.timeline-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 12;
  background: rgba(8, 13, 24, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-hi);
  border-radius: 9px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(34, 211, 238, 0.55);
  background: rgba(8, 145, 178, 0.25);
  color: #e0f2fe;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.play-btn:hover { background: rgba(34, 211, 238, 0.4); }

.timeline-main { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.timeline-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.timeline-mode-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timeline-mode-tabs .mini-tab { padding: 2px 6px; font-size: 9.5px; }
.time-jumps { display: flex; gap: 4px; flex-wrap: wrap; }
.jump-btn.danger-jump { border-color: rgba(248, 113, 113, 0.65); color: #fecaca; background: rgba(185, 28, 28, 0.28); font-weight: 700; }
.jump-btn.danger-jump:hover { background: rgba(220, 38, 38, 0.52); color: #fff; }

.micromort-card { border-color: rgba(192, 132, 252, 0.36); background: linear-gradient(180deg, rgba(88, 28, 135, 0.16), rgba(15, 23, 42, 0.82)); }
.tz-summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tz-kpi { background: #070d18; border: 1px solid var(--border-hi); border-radius: 7px; padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; }
.tz-kpi-lbl { font-size: 10px; font-weight: 700; letter-spacing: 0.02em; color: var(--muted); }
.tz-kpi-val { font-family: var(--mono); font-size: 14px; font-weight: 700; color: #f8fafc; }
.tz-kpi-sub { font-family: var(--mono); font-size: 9.5px; color: var(--dim); }
@media (max-width: 820px) { .tz-summary-strip { grid-template-columns: 1fr 1fr; } }

.jump-btn {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid var(--border);
  color: #cbd5e1;
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
}
.jump-btn:hover { border-color: var(--border-hi); color: #fff; }
.jump-btn.cyan { border-color: rgba(34, 211, 238, 0.55); color: #a5f3fc; }

/* ── Right Panel: KPIs, Cross-Section, Communities ── */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kpi-card.cyan-border { border-color: rgba(34, 211, 238, 0.42); }
.kpi-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.kpi-val { font-family: var(--mono); font-size: 16px; font-weight: 700; color: #f8fafc; }
.kpi-val.cyan { color: var(--cyan); }
.kpi-val.danger { color: #f87171; }
.kpi-val.warn { color: #facc15; }
.kpi-sub { font-family: var(--mono); font-size: 10px; color: var(--dim); }

.xsec-canvas {
  width: 100%;
  height: 162px;
  border-radius: 6px;
  display: block;
}

.xsec-legend {
  display: flex;
  gap: 12px;
  font-size: 10px;
  color: var(--muted);
  font-family: var(--mono);
}

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }
.dot.orange { background: #fb923c; }
.dot.amber { background: #facc15; }
.dot.cyan { background: #22d3ee; }

.search-row { display: flex; gap: 6px; }
.search-row input {
  flex: 1;
  background: #0b1220;
  border: 1px solid var(--border-hi);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
}
.search-btn {
  background: rgba(34, 211, 238, 0.22);
  border: 1px solid rgba(34, 211, 238, 0.55);
  color: #e0f2fe;
  font-weight: 600;
  font-size: 11.5px;
  padding: 0 11px;
  border-radius: 6px;
  cursor: pointer;
}

.address-result {
  background: rgba(7, 11, 18, 0.85);
  border: 1px solid rgba(34, 211, 238, 0.35);
  border-radius: 6px;
  padding: 8px;
  font-size: 11.5px;
}

.mini-tabs { display: flex; gap: 4px; flex-shrink: 0; }
.mini-tab {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.mini-tab.active { background: rgba(249, 115, 22, 0.24); border-color: rgba(249, 115, 22, 0.65); color: #ffedd5; }
.mini-tab.cyan.active { background: rgba(34, 211, 238, 0.24); border-color: var(--cyan); color: #cffafe; }
.mini-tab.agri.active { background: rgba(132, 204, 22, 0.24); border-color: #a3e635; color: #ecfccb; }
.mini-tab.water.active { background: rgba(14, 165, 233, 0.26); border-color: #38bdf8; color: #e0f2fe; }
.mini-tab.pop.active { background: rgba(244, 63, 94, 0.24); border-color: #fb7185; color: #ffe4e6; }

.domain-body { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; }
.domain-stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.domain-stat {
  background: rgba(7, 11, 18, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 6px;
  padding: 6px 8px;
}
.domain-stat .ds-lbl { display: block; font-size: 10px; color: var(--muted); font-weight: 600; }
.domain-stat .ds-val { font-family: var(--mono); font-size: 13px; font-weight: 700; color: #f8fafc; }
.domain-stat .ds-sub { display: block; font-family: var(--mono); font-size: 9.5px; color: var(--dim); }
.domain-list { display: flex; flex-direction: column; gap: 4px; }
.domain-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: rgba(7, 11, 18, 0.52);
  border-radius: 5px;
  border-left: 2px solid rgba(56, 189, 248, 0.55);
  font-size: 10.5px;
}
.domain-row.warn { border-left-color: #f97316; }
.domain-row.agri { border-left-color: #a3e635; }
.domain-row.pop { border-left-color: #fb7185; }
.domain-note { font-size: 10.5px; color: #94a3b8; line-height: 1.4; }

.town-table-wrap { max-height: 215px; overflow-y: auto; }
.town-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.town-table th {
  position: sticky;
  top: 0;
  background: #0f172a;
  text-align: left;
  font-size: 10px;
  color: var(--dim);
  padding: 4px;
  border-bottom: 1px solid var(--border);
}
.town-table td {
  padding: 5px 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}
.town-table tr { cursor: pointer; }
.town-table tr:hover td { background: rgba(34, 211, 238, 0.08); }

.sev-pill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
}
.sev-red { background: rgba(239, 68, 68, 0.22); color: #fca5a5; }
.sev-orange { background: rgba(249, 115, 22, 0.22); color: #fdba74; }
.sev-amber { background: rgba(250, 204, 21, 0.18); color: #fef08a; }
.sev-cyan { background: rgba(34, 211, 238, 0.18); color: #a5f3fc; }
.sev-ok { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; }

.safety-card { border-color: rgba(250, 204, 21, 0.24); }
.safety-list { padding-left: 16px; display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: #cbd5e1; }
.disclaimer-mini { font-size: 10.5px; color: var(--dim); border-top: 1px solid var(--border); padding-top: 6px; }
.disclaimer-mini a { color: var(--cyan); text-decoration: none; }
.disclaimer-mini a:hover { text-decoration: underline; }

/* ── Modals & Toast ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 14, 0.76);
  backdrop-filter: blur(5px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-box {
  background: #0c1424;
  border: 1px solid var(--border-hi);
  border-radius: 12px;
  width: min(680px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.modal-box.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 16px; font-weight: 700; }
.modal-lead { color: var(--muted); font-size: 12.5px; }

.icon-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
}
.icon-close:hover { color: #fff; }

.modal-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.modal-tab {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--border);
  color: #cbd5e1;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.modal-tab.active { background: rgba(34, 211, 238, 0.22); border-color: var(--cyan); color: #cffafe; }

.code-block {
  background: #060a12;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: #a5f3fc;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.5;
}

.modal-foot { display: flex; justify-content: flex-end; gap: 8px; }

.method-body { display: flex; flex-direction: column; gap: 10px; font-size: 12.5px; color: #cbd5e1; }
.method-body h4 { color: #f8fafc; font-size: 13px; margin-top: 4px; }
.method-body code { font-family: var(--mono); background: rgba(34, 211, 238, 0.12); color: #67e8f9; padding: 1px 4px; border-radius: 3px; font-size: 11.5px; }
.method-body ul { padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }

.toast {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 145, 178, 0.94);
  border: 1px solid rgba(103, 232, 249, 0.65);
  color: #f8fafc;
  font-weight: 600;
  font-size: 11.5px;
  padding: 6px 14px;
  border-radius: 99px;
  z-index: 80;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  white-space: nowrap;
}

.hidden { display: none !important; }

/* ── Responsive Tablet / Mobile ── */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 280px 1fr 310px; }
}

@media (max-width: 920px) {
  html, body { overflow: auto; }
  #app { height: auto; min-height: 100vh; }
  .workspace { grid-template-columns: 1fr; }
  .map-stage { height: 64vh; min-height: 440px; order: -1; }
  .panel { border: none; border-top: 1px solid var(--border); }
  .alert-strip { flex-direction: column; align-items: flex-start; }
}
