:root {
  --bg: #0f1115;
  --panel: #161a22;
  --text: #e6e8ec;
  --muted: #8a93a4;
  --accent: #4ea1ff;
  --hfp-mapped: #2bb673;
  --hfp-hard: #f0a13a;
  --air-matched: #3b82f6;
  --air-unmatched: #dc2626;
  --air-long: #6b7280;
  --border: #232936;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); }
body { display: grid; grid-template-columns: 400px 1fr; height: 100vh; }

#sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 18px 20px 24px;
}
#sidebar header h1 { font-size: 17px; margin: 0 0 4px; line-height: 1.3; }
#sidebar .sub { color: var(--muted); font-size: 12px; margin: 0 0 6px; }
#sidebar code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }

.counts { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 10px; margin-bottom: 12px; }
.counts h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 6px; }
.counts .disclaimer {
  font-size: 11px; line-height: 1.45; color: var(--muted);
  background: rgba(240,161,58,0.08); border-left: 2px solid var(--hfp-hard);
  padding: 6px 8px; margin: 4px 0 8px; border-radius: 0 4px 4px 0;
}
.counts .disclaimer strong { color: var(--text); }
.count-row { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.count-row.total { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 6px; }
.count-row strong { font-variant-numeric: tabular-nums; min-width: 56px; display: inline-block; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot-mapped       { background: var(--hfp-mapped); }
.dot-low          { background: var(--hfp-hard); }
.dot-air-matched  { background: var(--air-matched); }
.dot-air-unmatched{ background: var(--air-unmatched); }
.dot-air-long     { background: var(--air-long); }

.filters { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.filters h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 6px 0 4px; }
.filters label { font-size: 13px; }
.filters .field { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }
.filters select, .filters input[type=search] {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; font-size: 13px;
}
.filters input[type=checkbox] { accent-color: var(--accent); }

.legend { font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.legend h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); margin: 0 0 6px; }
.legend p { margin: 0 0 8px; line-height: 1.5; }
.legend strong { color: var(--text); }

#unmappable { margin-top: 12px; }
#unmappable h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text); margin: 12px 0 6px; }
.unmap-list { list-style: none; padding: 0; margin: 8px 0 0; max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.unmap-list li { padding: 6px 10px; font-size: 12px; border-bottom: 1px solid var(--border); }
.unmap-list li:last-child { border-bottom: none; }

footer { color: var(--muted); font-size: 11px; border-top: 1px solid var(--border); margin-top: 14px; padding-top: 10px; }
footer p { margin: 0 0 4px; }
footer a { color: var(--muted); }

#map { height: 100vh; }

/* Marker dots — different sizes/styles per layer so overlap is readable */
.m-dot {
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
.m-dot.mapped       { width: 14px; height: 14px; background: var(--hfp-mapped); }
.m-dot.hard         { width: 14px; height: 14px; background: var(--hfp-hard); border-style: dashed; }
.m-dot.air-matched  { width: 12px; height: 12px; background: var(--air-matched); opacity: 0.85; }
.m-dot.air-unmatched{ width: 12px; height: 12px; background: var(--air-unmatched); opacity: 0.9; }
.m-dot.air-long     { width: 12px; height: 12px; background: var(--air-long); opacity: 0.7; }

/* Popup */
.leaflet-popup-content-wrapper { background: var(--panel); color: var(--text); border-radius: 8px; }
.leaflet-popup-tip { background: var(--panel); }
.leaflet-popup-content { font-size: 13px; line-height: 1.45; margin: 10px 12px; min-width: 220px; }
.leaflet-popup-content h3 { margin: 4px 0; font-size: 14px; }
.leaflet-popup-content .meta { color: var(--muted); font-size: 12px; }
.leaflet-popup-content .badge {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
.badge-hfp           { background: rgba(43,182,115,0.18);  color: var(--hfp-mapped); }
.badge-air-matched   { background: rgba(59,130,246,0.18);  color: var(--air-matched); }
.badge-air-unmatched { background: rgba(220,38,38,0.18);   color: var(--air-unmatched); }
.badge-air-long      { background: rgba(107,114,128,0.18); color: var(--air-long); }
.leaflet-popup-content a { color: var(--accent); }

@media (max-width: 800px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  #sidebar { max-height: 50vh; border-right: none; border-bottom: 1px solid var(--border); }
  #map { height: 50vh; }
}
