:root {
  --bg: #ffffff;
  --panel: #fbfaf7;
  --ink: #1f2328;
  --muted: #6b6f76;
  --line: #e4e1da;
  --accent: #b8860b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
body { display: flex; }
#sidebar { width: 310px; flex: none; height: 100%; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 16px 40px; }
#map { flex: 1; height: 100%; }
h1 { font-size: 18px; margin: 0 0 4px; }
h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 6px; }
.sub { margin: 0; color: var(--muted); }
.warn { color: #a0522d; }
.controls label { display: block; margin: 10px 0; font-weight: 600; }
.controls select, .controls input[type=range] { display: block; width: 100%; margin-top: 4px; }
label.check, .layer label, .metric label { font-weight: 400; display: flex; gap: 6px; align-items: center; cursor: pointer; padding: 2px 0; }
.layer .note { color: var(--muted); font-size: 11px; margin: -1px 0 3px 22px; }
.swatch { width: 12px; height: 12px; border-radius: 3px; flex: none; display: inline-block; border: 1px solid rgba(0,0,0,.15); }
.swatch.dot { border-radius: 50%; }
.swatch.ln { height: 3px; border-radius: 0; border: none; }

#legend { position: absolute; left: 326px; bottom: 28px; background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; min-width: 200px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
#legend .title { font-weight: 600; margin-bottom: 4px; }
#legend .row { display: flex; align-items: center; gap: 6px; font-size: 11px; }
#legend .ramp { display: flex; }
#legend .ramp span { flex: 1; height: 10px; }
#legend .ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); }

#info { position: absolute; right: 12px; top: 12px; width: 330px; max-height: calc(100% - 24px); overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
#info.hidden { display: none; }
#info h3 { margin: 0 0 2px; font-size: 16px; }
#info table { width: 100%; border-collapse: collapse; margin-top: 6px; }
#info td { padding: 2px 0; border-bottom: 1px solid #f0eee9; }
#info td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
#info h4 { margin: 12px 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#infoClose { position: absolute; right: 8px; top: 6px; border: none; background: none; font-size: 18px; cursor: pointer; color: var(--muted); }

.maplibregl-popup-content { font: 12px/1.4 system-ui, sans-serif; padding: 8px 10px; }
.maplibregl-popup-content b { font-size: 13px; }
.maplibregl-popup-content table td:last-child { text-align: right; padding-left: 10px; }

@media (max-width: 720px) {
  body { flex-direction: column; }
  #sidebar { width: 100%; height: 42%; border-right: none; border-bottom: 1px solid var(--line); }
  #legend { left: 16px; bottom: 16px; }
  #info { width: calc(100% - 32px); right: 16px; }
}

.real-toggle { background: #eef6ee; border: 1px solid #cfe5cf; border-radius: 6px; padding: 5px 8px !important; }
.real-toggle .hint { color: var(--muted); font-size: 11px; }
.layer.disabled, .metric.disabled { opacity: .4; }
.layer.disabled label, .metric.disabled label { cursor: not-allowed; }
