:root {
  --ink: #06162f;
  --muted: #64748b;
  --navy: #021E4D;
  --line: rgba(2, 30, 77, 0.14);
  --paper: #fffdf8;
  --glass: rgba(255, 253, 248, 0.88);
  --shadow: 0 24px 70px rgba(2, 30, 77, 0.18);
  --radius: 24px;
  font-family: "Inter Tight", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body, .dashboard, #map { height: 100%; margin: 0; }
body { color: var(--ink); background: #e8eef6; overflow: hidden; }
.dashboard { position: relative; isolation: isolate; }
#map { width: 100%; }
.glass {
  background: var(--glass);
  border: 1px solid rgba(255,255,255,0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.05);
}
.panel {
  position: absolute; z-index: 5; left: 22px; top: 22px; bottom: 22px;
  width: min(390px, calc(100vw - 44px)); border-radius: var(--radius);
  padding: 22px; overflow: auto;
}
.brand-row { display: flex; align-items: center; gap: 14px; color: var(--navy); margin-bottom: 22px; }
.labs-logo { width: 78px; height: auto; display:block; filter: drop-shadow(0 10px 18px rgba(2,30,77,.16)); }
.brand-copy { display:flex; flex-direction:column; gap:5px; min-width:0; }
.brand-copy h1 { margin: 0; font-size: 16px; line-height: 1; letter-spacing: .08em; font-weight: 900; text-transform: uppercase; }
.brand-copy span { font-size: 10px; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; color: #607089; }
h1 { margin: 14px 0 8px; font-size: clamp(29px, 4vw, 42px); line-height: .92; letter-spacing: -0.055em; }
.subtitle { margin: 0 0 22px; color: #475569; line-height: 1.35; font-size: 15px; }
.state-card { display:grid; grid-template-columns: 1fr 175px; gap: 12px; align-items:end; margin: 0 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: 18px; background: rgba(2,30,77,.045); }
.state-card strong { display:block; font-size: 24px; line-height:1; letter-spacing:-.04em; }
.state-card .section-label { margin-bottom: 6px; }
.control-block { padding: 16px 0; border-top: 1px solid var(--line); }
.section-label { display:block; margin-bottom:10px; font-size: 11px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; color: #607089; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, button, select {
  font: inherit; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.72); color: var(--ink);
}
.chip { padding: 8px 11px; font-size: 13px; cursor:pointer; transition: .18s ease; }
.chip:hover, button:hover { transform: translateY(-1px); border-color: rgba(2,30,77,.35); }
.chip.active { background: var(--navy); color: white; border-color: var(--navy); box-shadow: 0 12px 24px rgba(2,30,77,.22); }
.two-col { display:grid; grid-template-columns: 1fr 115px; gap: 14px; align-items: end; }
select { width: 100%; padding: 10px 12px; border-radius: 14px; }
input[type="range"] { width: 100%; accent-color: var(--navy); }
.legend-ramp { height: 13px; border-radius: 999px; background: linear-gradient(90deg,#f97316,#fdba74,#fef3c7,#86efac,#15803d); border: 1px solid rgba(2,30,77,.12); }
.legend-labels { display:flex; justify-content:space-between; gap:12px; margin-top: 8px; color: #475569; font-size: 12px; }
.legend-title { font-weight: 800; margin-bottom: 8px; }
.source-card { margin-top: 8px; padding: 14px; border-radius: 18px; background: rgba(2,30,77,.055); border: 1px solid var(--line); color: #334155; font-size: 13px; line-height: 1.35; }
.source-card p { margin: 8px 0 0; }
.topbar { position:absolute; z-index:4; top: 22px; right: 22px; display:flex; gap: 10px; align-items:center; border-radius: 20px; padding: 10px; }
.stat { min-width: 140px; padding: 5px 12px; border-right:1px solid var(--line); }
.stat span { display:block; color: var(--muted); font-size: 11px; text-transform:uppercase; letter-spacing:.1em; font-weight:800; }
.stat strong { display:block; margin-top: 2px; font-size: 20px; letter-spacing:-.03em; }
button { cursor:pointer; padding: 10px 13px; font-weight: 750; }
.detail { position:absolute; z-index:6; right:22px; bottom:22px; width:min(420px, calc(100vw - 44px)); border-radius: 22px; padding: 18px; transform: translateY(0); }
#closeDetail { position:absolute; right:12px; top:12px; width:32px; height:32px; padding:0; }
.detail h2 { margin: 0 42px 2px 0; font-size: 23px; letter-spacing:-.035em; }
.detail .meta { color: var(--muted); margin: 0 0 14px; }
.detail-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.detail-grid div { padding: 11px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.58); }
.detail-grid span { display:block; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.detail-grid strong { display:block; margin-top:4px; font-size: 18px; }
.badge { display:inline-flex; margin-top: 12px; padding: 7px 10px; border-radius: 999px; background:#fef3c7; color:#7c2d12; font-weight:750; font-size:12px; }
.empty { color: var(--muted); margin: 8px 34px 8px 0; }
.maplibregl-popup-content { border-radius: 14px; box-shadow: 0 14px 32px rgba(2,30,77,.2); padding: 12px 14px; font-family: inherit; }
.popup-title { margin:0; font-weight:850; }
.popup-sub { margin:3px 0 0; color:#64748b; }
.fallback { position:absolute; z-index:20; inset:22px; border-radius:24px; padding:22px; overflow:auto; }
@media (max-width: 860px) {
  body { overflow:auto; }
  .dashboard { min-height: 100%; }
  .panel { left: 12px; right: 12px; top: 12px; bottom: auto; max-height: 48vh; }
  .topbar { left:12px; right:12px; top:auto; bottom: 12px; justify-content:space-between; }
  .detail { left: 12px; right: 12px; bottom: 92px; width:auto; }
}
