:root {
  --p90: #2b6cb0;
  --p50: #dd6b20;
  --ink: #1a202c;
  --muted: #4a5568;
  --panel: rgba(255, 255, 255, 0.95);
  --stale: #9b2c2c;
}

html, body {
  margin: 0;
  height: 100%;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}

#map { position: absolute; inset: 0; }

#panel-toggle {
  display: none;
  position: absolute;
  z-index: 1001;
  top: 12px;
  /* top-right, not top-left: Leaflet's default zoom control sits top-left
     and this would otherwise sit on top of it on narrow viewports. */
  right: 12px;
  font: inherit;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e0;
  background: var(--panel);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

#panel {
  position: absolute;
  z-index: 1000;
  top: 12px;
  left: 12px;
  width: 340px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}

#panel h1 { font-size: 15px; margin: 0 0 8px; }
#panel h1 small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; margin-top: 2px; }

label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
select { width: 100%; margin-bottom: 10px; font: inherit; padding: 4px; }

table { border-collapse: collapse; width: 100%; font-size: 12px; }
th, td { text-align: left; padding: 2px 6px 2px 0; vertical-align: top; }
th { font-weight: 600; color: var(--muted); white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }

.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend { margin: 8px 0 6px; font-size: 12px; }

.status { font-size: 12px; color: var(--muted); margin-bottom: 6px; min-height: 1em; }
.status.err { color: var(--stale); }

.stale {
  background: #fff5f5;
  border: 1px solid var(--stale);
  color: var(--stale);
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 12px;
  margin-bottom: 8px;
}

.caveat { margin-top: 10px; padding-top: 8px; border-top: 1px solid #e2e8f0; font-size: 11px; color: var(--muted); }
.caveat b { color: #9b2c2c; }
.caveat ul { margin: 5px 0 0; padding-left: 16px; }
.caveat li { margin-bottom: 4px; }
.caveat details { margin-top: 6px; }
.caveat summary { cursor: pointer; }

/* Mobile: the map still fills the viewport; the panel becomes a collapsible
   overlay toggled by a floating button instead of a fixed sidebar, so it
   never eats the whole screen on a phone. */
@media (max-width: 640px) {
  #panel-toggle { display: block; }
  #panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    max-height: 60vh;
    border-radius: 12px 12px 0 0;
  }
  #panel[hidden] { display: none; }
}
