/* =========================================================
   Berlin District Explorer — Styles
   Dark-first glassmorphism design with Inter typography
   ========================================================= */

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Palette */
  --bg:            #0f1117;
  --bg-glass:      rgba(17, 19, 27, 0.82);
  --bg-glass-alt:  rgba(25, 28, 40, 0.88);
  --surface:       #1a1d2b;
  --surface-hover: #242838;
  --border:        rgba(255, 255, 255, 0.07);
  --border-bright: rgba(255, 255, 255, 0.14);
  --text:          #e4e6ef;
  --text-dim:      #8b8fa3;
  --text-muted:    #5a5e72;
  --accent:        #6c8cff;
  --accent-glow:   rgba(108, 140, 255, 0.25);

  /* Score colors */
  --score-low:  #ef4444;
  --score-mid:  #f59e0b;
  --score-high: #22c55e;

  /* Tier colors */
  --tier-s: #22c55e;
  --tier-a: #84cc16;
  --tier-b: #6c8cff;
  --tier-c: #f59e0b;
  --tier-low: #f59e0b;
  --hospital: #ec4899;

  /* Layout */
  --header-h: 56px;
  --sidebar-w: 420px;
  --radius: 12px;
  --radius-sm: 8px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------- Header ---------- */
#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.header-left h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}
.header-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 400;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Tier filter buttons */
.tier-filters {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: 8px;
  padding: 3px;
  border: 1px solid var(--border);
}
.tier-btn {
  padding: 5px 14px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  background: transparent;
  color: var(--text-dim);
}
.tier-btn:hover { color: var(--text); background: var(--surface-hover); }
.tier-btn.active { background: var(--accent); color: #fff; }
.tier-btn.tier-s.active { background: var(--tier-s); color: #0a1f0a; }
.tier-btn.tier-a.active { background: var(--tier-a); color: #0a1f0a; }
.tier-btn.tier-b.active { background: var(--tier-b); color: #fff; }
.tier-btn.tier-low.active { background: var(--tier-low); color: #1a1000; }

/* Icon buttons */
.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-bright); }
.icon-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Main layout ---------- */
#app-main {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0; bottom: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: var(--bg);
}

/* Override Leaflet attribution */
.leaflet-control-attribution {
  background: var(--bg-glass) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
  backdrop-filter: blur(10px) !important;
  border-top: 1px solid var(--border) !important;
}
.leaflet-control-attribution a { color: var(--text-dim) !important; }
.leaflet-control-zoom a {
  background: var(--bg-glass) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  backdrop-filter: blur(10px) !important;
}
.leaflet-control-zoom a:hover {
  background: var(--surface-hover) !important;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: absolute;
  top: 0; right: 0;
  width: var(--sidebar-w);
  height: 100%;
  background: var(--bg-glass-alt);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-left: 1px solid var(--border);
  transform: translateX(0);
  transition: transform 0.35s var(--ease), opacity 0.35s var(--ease);
  z-index: 800;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar.collapsed {
  transform: translateX(100%);
  opacity: 0;
  pointer-events: none;
}

.sidebar-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s var(--ease);
}
.sidebar-close:hover { background: var(--surface-hover); color: var(--text); }

.sidebar-content {
  padding: 24px;
}

.sidebar-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-muted);
  text-align: center;
  gap: 16px;
  font-size: 14px;
}

/* Sidebar district header */
.district-header {
  margin-bottom: 24px;
}
.district-header h2 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: 6px;
}
.district-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tier-badge.tier-S { background: rgba(34,197,94,0.18); color: var(--tier-s); border: 1px solid rgba(34,197,94,0.4); }
.tier-badge.tier-A { background: rgba(132,204,22,0.15); color: var(--tier-a); border: 1px solid rgba(132,204,22,0.3); }
.tier-badge.tier-B { background: rgba(108,140,255,0.15); color: var(--tier-b); border: 1px solid rgba(108,140,255,0.3); }
.tier-badge.tier-C { background: rgba(245,158,11,0.12); color: var(--tier-c); border: 1px solid rgba(245,158,11,0.25); }
.tier-badge.tier-low { background: rgba(245,158,11,0.12); color: var(--tier-low); border: 1px solid rgba(245,158,11,0.25); }
.tier-badge.tier-avoid { background: rgba(239,68,68,0.12); color: var(--score-low); border: 1px solid rgba(239,68,68,0.25); }

.overall-score {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
}
.score-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Radar chart */
.radar-container {
  display: flex;
  justify-content: center;
  margin: 20px 0 24px;
}
.radar-canvas {
  width: 240px;
  height: 240px;
}

/* Score bars */
.score-bars { margin-bottom: 24px; }
.score-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.score-label {
  width: 100px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  text-align: right;
  flex-shrink: 0;
}
.score-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s var(--ease);
}
.score-value {
  width: 24px;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  flex-shrink: 0;
}

/* Sections */
.sidebar-section {
  margin-bottom: 20px;
}
.sidebar-section h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* Kieze tags */
.kieze-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.kiez-tag {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: rgba(108,140,255,0.1);
  color: var(--accent);
  border: 1px solid rgba(108,140,255,0.2);
  transition: all 0.2s var(--ease);
}
.kiez-tag:hover {
  background: rgba(108,140,255,0.2);
}

/* Info text */
.info-text {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-dim);
}
.info-text strong { color: var(--text); font-weight: 600; }

.verdict-box {
  padding: 14px 16px;
  background: rgba(108,140,255,0.06);
  border: 1px solid rgba(108,140,255,0.15);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}

.warning-box {
  padding: 14px 16px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.15);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
  color: #fca5a5;
}

/* ---------- Overlay panels ---------- */
.overlay-panel {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  z-index: 900;
  transition: opacity 0.3s var(--ease);
}
.overlay-panel.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-panel-inner {
  width: 560px;
  max-width: 92vw;
  max-height: 85vh;
  background: var(--bg-glass-alt);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.overlay-header h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.overlay-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.overlay-close:hover { background: var(--surface-hover); color: var(--text); }

.overlay-body {
  padding: 24px;
  overflow-y: auto;
}

/* Framework table */
.framework-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.framework-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-bright);
}
.framework-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
}
.framework-table tr:last-child td { border-bottom: none; }
.weight-bar {
  display: inline-block;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 6px;
}
.framework-note {
  margin-top: 20px;
  padding: 14px 16px;
  background: rgba(245,158,11,0.06);
  border: 1px solid rgba(245,158,11,0.15);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
}

/* Checklist */
.checklist-items { list-style: none; }
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: rgba(255,255,255,0.02); }

.check-box {
  width: 20px; height: 20px;
  border: 2px solid var(--border-bright);
  border-radius: 5px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--ease);
}
.checklist-item.checked .check-box {
  background: var(--tier-a);
  border-color: var(--tier-a);
}
.check-icon {
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.checklist-item.checked .check-icon { opacity: 1; }

.check-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}
.checklist-item.checked .check-text {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
}
.check-text strong {
  color: var(--text);
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}
.checklist-item.checked .check-text strong {
  color: var(--text-muted);
}

/* ---------- Legend ---------- */
.legend {
  position: absolute;
  bottom: 28px;
  left: 16px;
  padding: 14px 18px;
  background: var(--bg-glass-alt);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 800;
  min-width: 180px;
}

.legend-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.legend-gradient {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--score-low), var(--score-mid), var(--score-high));
  margin-bottom: 4px;
}

.legend-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.legend-items {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
}
.legend-marker {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-marker.hotspot {
  background: var(--score-low);
  box-shadow: 0 0 6px rgba(239,68,68,0.5);
}
.legend-marker.office {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}
.legend-marker.tier-S { background: var(--tier-s); box-shadow: 0 0 6px rgba(34,197,94,0.45); }
.legend-marker.tier-A { background: var(--tier-a); box-shadow: 0 0 6px rgba(132,204,22,0.45); }
.legend-marker.tier-B { background: var(--tier-b); box-shadow: 0 0 6px rgba(108,140,255,0.45); }
.legend-marker.tier-C { background: var(--tier-c); box-shadow: 0 0 6px rgba(245,158,11,0.45); }
.legend-marker.hospital { background: var(--hospital); box-shadow: 0 0 6px rgba(236,72,153,0.5); }

/* ---------- Leaflet tooltip & popup overrides ---------- */
.district-tooltip {
  background: var(--bg-glass) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid var(--border-bright) !important;
  border-radius: 8px !important;
  color: var(--text) !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  padding: 6px 12px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4) !important;
}
.district-tooltip .tooltip-score {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 6px;
}
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
  border-color: transparent !important;
}

.hotspot-popup .leaflet-popup-content-wrapper {
  background: var(--bg-glass-alt) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(239,68,68,0.3) !important;
  border-radius: 10px !important;
  color: var(--text) !important;
  font-family: 'Inter', sans-serif !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
}
.hotspot-popup .leaflet-popup-tip { background: var(--bg-glass-alt) !important; }
.hotspot-popup .leaflet-popup-content {
  margin: 12px 16px !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
}
.hotspot-popup h4 {
  font-size: 14px;
  font-weight: 700;
  color: #fca5a5;
  margin-bottom: 4px;
}
.hotspot-popup p {
  color: var(--text-dim);
  font-size: 12px;
}

.office-popup .leaflet-popup-content-wrapper {
  background: var(--bg-glass-alt) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(108,140,255,0.3) !important;
  border-radius: 10px !important;
  color: var(--text) !important;
  font-family: 'Inter', sans-serif !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
}
.office-popup .leaflet-popup-tip { background: var(--bg-glass-alt) !important; }
.office-popup .leaflet-popup-content {
  margin: 12px 16px !important;
  font-size: 13px !important;
}

/* ---------- Scrollbar ---------- */
.sidebar::-webkit-scrollbar,
.overlay-body::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-track,
.overlay-body::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb,
.overlay-body::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover,
.overlay-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.15);
}

/* ---------- Comparison table (in sidebar) ---------- */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 6px;
}
.comparison-table th {
  text-align: left;
  font-weight: 600;
  padding: 6px 8px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-bright);
  font-size: 11px;
}
.comparison-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.comparison-table tr:last-child td { border-bottom: none; }
.comparison-table .dim-col { color: var(--text-dim); }

/* ---------- Mobile responsive ---------- */
@media (max-width: 768px) {
  :root {
    --sidebar-w: 100%;
    --header-h: 50px;
  }

  .header-left h1 { font-size: 15px; }
  .header-subtitle { display: none; }
  .tier-btn { padding: 4px 10px; font-size: 11px; }

  .sidebar {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    transform: translateY(0);
  }
  .sidebar.collapsed {
    transform: translateY(100%);
  }

  .legend {
    bottom: 12px;
    left: 8px;
    padding: 10px 14px;
    min-width: 150px;
  }

  .radar-canvas {
    width: 200px;
    height: 200px;
  }

  .overlay-panel-inner {
    max-height: 90vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
}

@media (max-width: 480px) {
  .tier-filters { display: none; }
}

/* =========================================================
   Combined-report additions: Kiez pins, hospital pins,
   shortlist panel, layer toggles, Kiez cards.
   ========================================================= */

/* ---- Kiez pin marker on the map ---- */
.kiez-pin {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--pin-color, var(--accent));
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.45), 0 4px 10px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 10px;
  color: #0a1f0a;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.kiez-pin:hover {
  transform: scale(1.18);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.45), 0 6px 18px rgba(0,0,0,0.55), 0 0 14px var(--pin-color, #fff);
  z-index: 1000 !important;
}
.tier-pin-B { color: #fff; }
.tier-pin-C { color: #1a1000; }
.kiez-pin-tier {
  pointer-events: none;
  line-height: 1;
}

/* ---- Hospital pin (cross) ---- */
.hospital-pin {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--hospital);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.45), 0 4px 10px rgba(0,0,0,0.35);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s var(--ease);
}
.hospital-pin.level-2 {
  background: #be185d;
  opacity: 0.85;
}
.hospital-pin:hover { transform: scale(1.18); }

/* ---- Office pin ---- */
.office-pin {
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.45), 0 0 14px rgba(108,140,255,0.7);
  position: relative;
}
.office-pin::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0.4;
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.5; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ---- Hotspot pin ---- */
.hotspot-pin {
  width: 14px;
  height: 14px;
  background: var(--score-low);
  border-radius: 50%;
  border: 2px solid rgba(239,68,68,0.45);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.45), 0 0 10px rgba(239,68,68,0.6);
  cursor: pointer;
}

/* ---- Kiez tooltip ---- */
.kiez-tooltip {
  background: var(--bg-glass) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid var(--border-bright) !important;
  border-radius: 8px !important;
  color: var(--text) !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 5px 10px !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
}

/* ---- Kiez popup ---- */
.kiez-popup-wrap .leaflet-popup-content-wrapper {
  background: var(--bg-glass-alt) !important;
  backdrop-filter: blur(16px) !important;
  border: 1px solid var(--border-bright) !important;
  border-radius: 12px !important;
  color: var(--text) !important;
  font-family: 'Inter', sans-serif !important;
  box-shadow: 0 12px 36px rgba(0,0,0,0.55) !important;
  padding: 0 !important;
}
.kiez-popup-wrap .leaflet-popup-tip { background: var(--bg-glass-alt) !important; }
.kiez-popup-wrap .leaflet-popup-content {
  margin: 14px 16px !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
}
.kiez-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.kiez-popup-header strong {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.kiez-popup-tier {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.kiez-popup-district {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.kiez-popup p {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0;
}

/* ---- Hospital popup ---- */
.hospital-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.hospital-popup-header strong {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.hospital-level {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(236,72,153,0.18);
  color: #fbcfe8;
  border: 1px solid rgba(236,72,153,0.4);
}
.hospital-level.level-2 {
  background: rgba(190,24,93,0.18);
  color: #f9a8d4;
  border-color: rgba(190,24,93,0.4);
}
.hospital-births {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.hospital-popup p {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0;
}

/* ---- Layer toggles (top-left, below header) ---- */
.layer-toggles {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--bg-glass-alt);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.layer-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}
.layer-toggle:hover { color: var(--text); }
.layer-toggle input { accent-color: var(--accent); cursor: pointer; }
.layer-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.layer-dot.kiez { background: var(--tier-s); box-shadow: 0 0 5px rgba(34,197,94,0.5); }
.layer-dot.hospital { background: var(--hospital); box-shadow: 0 0 5px rgba(236,72,153,0.5); }
.layer-dot.hotspot { background: var(--score-low); box-shadow: 0 0 5px rgba(239,68,68,0.5); }

/* ---- Sidebar Kiez cards (per district) ---- */
.kieze-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kiez-card {
  padding: 10px 12px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-bright);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.kiez-card:hover {
  background: rgba(255,255,255,0.06);
  transform: translateX(2px);
}
.kiez-card.kiez-tier-S { border-left-color: var(--tier-s); }
.kiez-card.kiez-tier-A { border-left-color: var(--tier-a); }
.kiez-card.kiez-tier-B { border-left-color: var(--tier-b); }
.kiez-card.kiez-tier-C { border-left-color: var(--tier-c); }
.kiez-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.kiez-card-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}
.kiez-card-tier {
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.kiez-card-note {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
}

/* ---- Placeholder hint ---- */
.placeholder-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Shortlist panel ---- */
.overlay-panel-wide {
  width: 720px;
}
.shortlist-tier {
  margin-bottom: 24px;
}
.shortlist-tier:last-child { margin-bottom: 0; }
.shortlist-tier-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tier-color, var(--text));
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.shortlist-tier-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tier-color, var(--accent));
  box-shadow: 0 0 8px var(--tier-color, var(--accent));
}
.shortlist-district {
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.shortlist-district-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.shortlist-district-name {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}
.shortlist-district-name:hover {
  color: var(--accent);
}
.shortlist-district-score {
  font-size: 14px;
  font-weight: 700;
}
.shortlist-kieze {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.shortlist-kiez {
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.shortlist-kiez:hover {
  background: rgba(255,255,255,0.08);
  transform: translateY(-1px);
}

/* ---- Animation ---- */
.animate-in {
  opacity: 0;
  transform: translateY(8px);
  animation: fadeUp 0.4s var(--ease) forwards;
}
@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Score-bar label width: needs more room for 'Russian-Speaking Anchor' ---- */
.score-label { width: 130px; }

@media (max-width: 768px) {
  .layer-toggles {
    top: 8px;
    left: 8px;
    padding: 8px 10px;
  }
  .overlay-panel-wide { width: 100%; }
  .score-label { width: 110px; font-size: 11px; }
}

/* ---- Transit lines ---- */
.layer-dot.transit {
  background: linear-gradient(90deg, #da4814 0%, #da4814 25%, #894e9e 25%, #894e9e 50%, #dd6ba6 50%, #dd6ba6 75%, #106e34 75%);
}
.icon-btn[aria-pressed="true"] {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.transit-legend {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  padding: 14px 16px;
  background: var(--bg-glass-alt);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  z-index: 700;
  box-shadow: 0 6px 28px rgba(0,0,0,0.45);
  width: 280px;
  max-height: calc(100vh - var(--header-h) - 40px);
  overflow-y: auto;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.transit-legend.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-8px);
}
.transit-legend-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.transit-legend-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.transit-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
}
.transit-line-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 20px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  border-radius: 4px;
  flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Transit popup styling */
.transit-popup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.transit-popup-type {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.transit-popup p {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.55;
  margin: 0;
}

@media (max-width: 768px) {
  .transit-legend {
    top: auto;
    bottom: 80px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
    transform: none;
    max-height: 50vh;
  }
  .transit-legend.hidden {
    transform: translateY(8px);
  }
  .transit-legend-item { font-size: 11px; }
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.animate-in {
  animation: fadeInUp 0.35s var(--ease) both;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px rgba(239,68,68,0.4); }
  50%      { box-shadow: 0 0 16px rgba(239,68,68,0.7); }
}
.hotspot-marker {
  animation: pulse-glow 2s ease-in-out infinite;
}
