* { box-sizing: border-box; }
html, body, #map { height: 100%; width: 100%; margin: 0; }
:root {
  --bg: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --panel: rgba(255,255,255,0.92);
  --shadow: 0 10px 30px rgba(2,6,23,0.12);
  --radius: 18px;
  --accent: #111827;
}
/* Map container */
#map { position: absolute; inset: 0; }

/* Floating panel */
.panel {
  position: absolute; top: 16px; left: 16px; z-index: 5;
  background: var(--panel);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 14px 10px 14px;
  width: clamp(280px, 30vw, 360px);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
}

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}

.year-nav { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.year-nav button {
  all: unset; cursor: pointer; font-size: 20px; line-height: 1;
  background: #f1f5f9; color: #0f172a;
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 8px; box-shadow: 0 2px 6px rgba(2,6,23,0.06);
}
.year-nav button:hover { background: #e2e8f0; }
#yearLabel { font-size: 16px; letter-spacing: 0.2px; }

.totals { font-size: 12px; color: var(--muted); }
.legend { display: grid; gap: 8px; }
.legend-row { display: flex; align-items: center; justify-content: space-between; }
.legend-left { display: flex; align-items: center; gap: 10px; }
.swatch {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.08);
}
.count { font-weight: 600; color: var(--accent); }

.note { margin-top: 6px; font-size: 11px; color: var(--muted); }

/* Popups */
.maplibregl-popup-content {
  border-radius: 12px !important;
  box-shadow: var(--shadow) !important;
  padding: 12px 14px !important;
  font: 13px/1.35 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: var(--text);
}
.maplibregl-popup-close-button { font-size: 16px; }

/* Cluster circles */
.cluster-circle { background: #0f172a; color: #fff; }

/* Responsive tweaks */
@media (max-width: 640px) {
  .panel { width: calc(100% - 24px); left: 12px; right: 12px; }
}