/* ==========================================================================
   halle-crime.de – Karten-App
   Designsystem (Redesign 2026-06-28):
   - Karte randlos als unterste Ebene; Bedienelemente schweben als wenige
     Glasflächen darüber (Header, Seitenpanel/Sheet, Info-Panel, Leaflet).
   - Eine Bedienvokabel: Segmented Controls (.chips) + Listenzeilen + 2 Button-
     Rollen (primär/sekundär). Konzentrische Radius-Skala statt Radien-Mix.
   - Farbe kodiert die Ober-Gruppe (4 Anker aus categories.py), die Glyphe die
     Kategorie. Keine Verläufe, kein Glow, keine Deko-Emojis.
   - Fallbacks: ohne backdrop-filter (und bei reduzierter Transparenz) werden
     die Glasflächen opak – Funktion vor Effekt.
   ========================================================================== */

:root {
  /* Radius-Skala (konzentrisch: innen = außen − Abstand) */
  --r-lg: 16px;   /* schwebende Panels, Header, Sheets */
  --r-md: 12px;   /* Karten, Popups, Disclosures */
  --r-sm: 9px;    /* Buttons, Eingaben, Segmented-Container */
  --r-xs: 6px;    /* Segmente, kleine Flächen */

  /* Typo-Skala */
  --fs-l: 1.0625rem;  /* 17 – Titel */
  --fs-m: 0.9375rem;  /* 15 – Inhalt */
  --fs-s: 0.8125rem;  /* 13 – Bedienelemente, Meta */
  --fs-xs: 0.75rem;   /* 12 – Fußnoten (Minimum) */

  /* Farben */
  --text: #1c2733;
  --muted: #5a6b7b;
  --accent: #0b6fb8;
  --accent-strong: #0a5f9e;  /* Text auf getönten Akzent-Flächen (AA ≥ 4.5:1) */
  --border: rgba(18, 32, 44, 0.12);
  --fill: rgba(18, 32, 44, 0.06);      /* stille Flächen (Segmented-Grund) */
  --surface: #ffffff;                   /* opake Flächen in Panels */

  /* Glas-Material */
  --glass-bg: rgba(249, 251, 253, 0.78);
  --glass-bg-strong: rgba(252, 253, 255, 0.94); /* Popups: Lesbarkeit zuerst */
  --glass-brd: rgba(255, 255, 255, 0.55);
  --glass-edge: rgba(12, 30, 46, 0.14);
  --glass-blur: saturate(1.8) blur(18px);
  --shadow-float: 0 12px 34px rgba(8, 22, 36, 0.16), 0 1px 2px rgba(8, 22, 36, 0.10);
  --shadow-raise: 0 1px 4px rgba(8, 22, 36, 0.18);

  --sidebar-w: 332px;
  --top-offset: 74px;  /* Oberkante schwebender Elemente unter dem Header */
}

* { box-sizing: border-box; }

/* Sichtbarer Fokus für Tastatur-Bedienung */
button:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

html { height: 100%; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  position: relative;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: #dfe5ea;
}

/* --- Glasflächen (eine Materialdefinition für alle schwebenden Elemente) --- */
.app-header, .sidebar, .stats-panel, .empty-hint, .haeufung-banner {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-brd);
  box-shadow: 0 0 0 0.5px var(--glass-edge), var(--shadow-float);
}
/* Ohne backdrop-filter (alte Browser) oder bei reduzierter Transparenz: opak */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .app-header, .sidebar, .stats-panel, .empty-hint, .haeufung-banner {
    background: #f5f7f9;
  }
}
@media (prefers-reduced-transparency: reduce) {
  .app-header, .sidebar, .stats-panel, .empty-hint, .haeufung-banner {
    -webkit-backdrop-filter: none; backdrop-filter: none;
    background: #f5f7f9;
  }
}

/* --- Header: schwebende Glasleiste --- */
.app-header {
  position: absolute; top: 10px; left: 10px; right: 10px; z-index: 1100;
  display: flex; align-items: center; gap: 14px;
  min-height: 54px; padding: 8px 10px 8px 18px;
  border-radius: var(--r-lg);
}
.app-header .title { min-width: 0; }
.app-header .title h1 {
  font-size: var(--fs-l); font-weight: 650; letter-spacing: -0.01em;
  margin: 0; line-height: 1.25; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.app-header .meta {
  margin-left: auto; display: flex; align-items: center; gap: 12px;
}
.badge { font-size: var(--fs-s); font-weight: 600; }
.badge-btn {
  border: 1px solid rgba(11, 111, 184, 0.25);
  background: rgba(11, 111, 184, 0.10);
  color: var(--accent-strong); cursor: pointer; font-family: inherit;
  padding: 6px 14px; min-height: 36px; border-radius: 999px;
  white-space: nowrap;
}
.badge-btn:hover { background: rgba(11, 111, 184, 0.18); }
.updated { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }

.sidebar-toggle {
  display: none;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: var(--r-sm);
  padding: 8px 14px; font-size: var(--fs-s); font-weight: 600; cursor: pointer;
}

/* --- Ebenen: Karte randlos, Panels schweben --- */
.layout { position: absolute; inset: 0; }
.map-wrap { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; width: auto; height: auto; background: #dfe5ea; }

/* Leaflet-Bedienelemente unter Header / neben Panel positionieren */
.leaflet-top.leaflet-left { top: var(--top-offset); left: calc(var(--sidebar-w) + 22px); }

/* --- Seitenpanel (Desktop: schwebendes Glas; Mobil: Bottom-Sheet) --- */
.sidebar {
  position: absolute; left: 10px; top: var(--top-offset); bottom: 10px;
  width: var(--sidebar-w); z-index: 1050;
  border-radius: var(--r-lg);
  overflow-y: auto; overscroll-behavior: contain;
  padding: 16px 16px 10px;
  scrollbar-width: thin; scrollbar-color: rgba(90, 107, 123, 0.35) transparent;
}

.filter-group { margin-bottom: 18px; }
.filter-label {
  display: block; font-size: var(--fs-s); font-weight: 600;
  color: var(--muted); margin-bottom: 8px;
}
.filter-head { display: flex; justify-content: space-between; align-items: baseline; }

#search {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: var(--fs-m); font-family: inherit;
  background: var(--surface); color: var(--text); min-height: 40px;
}
#search::placeholder { color: var(--muted); }
#search:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* --- Segmented Control (Zeitraum, Darstellung, Tabs, Statistik-Modus) --- */
.chips {
  display: flex; gap: 2px; padding: 3px;
  background: var(--fill); border-radius: var(--r-sm);
}
.chip {
  flex: 1 1 0; min-width: 0; border: 0; background: transparent;
  color: var(--muted); font-family: inherit; font-size: var(--fs-s);
  font-weight: 600; min-height: 34px; padding: 0 4px;
  border-radius: var(--r-xs); cursor: pointer; white-space: nowrap;
}
.chip:hover { color: var(--text); }
.chip.active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-raise);
}

/* --- Disclosures (Umkreis, Hinweise) --- */
.disclosure {
  margin-bottom: 18px; background: var(--fill); border-radius: var(--r-md);
}
.disclosure summary {
  list-style: none; display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; min-height: 42px;
  font-size: var(--fs-s); font-weight: 600; color: var(--text);
  cursor: pointer; user-select: none; border-radius: var(--r-md);
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after {
  content: "›"; color: var(--muted); font-size: 1.05rem; line-height: 1;
  transform: rotate(90deg); transition: transform 0.15s ease;
}
.disclosure[open] summary::after { transform: rotate(-90deg); }
.disclosure-body { padding: 2px 14px 14px; }
.disclosure-quiet { background: transparent; border: 1px solid var(--border); }

.cat-actions { display: flex; gap: 12px; }
.link-btn {
  background: none; border: 0; color: var(--accent); cursor: pointer;
  font-family: inherit; font-size: var(--fs-s); padding: 4px 0;
}

/* --- Kategorien-Liste --- */
.category-list { list-style: none; margin: 0; padding: 0; }
.cat-group { margin-bottom: 8px; }
.cat-group:last-child { margin-bottom: 0; }
/* Gruppenkopf als klare Kopfzeile: bündige Fläche, großer Chevron RECHTS
   (iOS-Muster; UI-Feedback 2026-07-10 – vorher wirkte der Kopf eingerückt) */
.cat-group-head {
  display: flex; align-items: center; gap: 10px;
  min-height: 42px; padding: 4px 4px 4px 12px;
  background: var(--fill); border-radius: var(--r-sm);
}
.cat-arrow {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  width: 36px; height: 36px; padding: 0; flex: 0 0 auto; margin-left: 2px;
  border-radius: var(--r-xs); display: flex; align-items: center; justify-content: center;
}
.cat-arrow:hover { background: rgba(120, 130, 140, 0.18); color: var(--text); }
.cat-arrow svg { width: 17px; height: 17px; transition: transform 0.15s ease; transform: rotate(90deg); }
.cat-arrow[aria-expanded="false"] svg { transform: rotate(0deg); }
.cat-group-name { flex: 1; font-weight: 600; font-size: var(--fs-m); cursor: pointer; user-select: none; }
.cat-sub { list-style: none; margin: 6px 0 2px; padding: 0 0 0 14px; }
.cat-sub li {
  display: flex; align-items: center; gap: 10px; padding: 6px 6px;
  min-height: 36px; border-radius: var(--r-xs); cursor: pointer; user-select: none;
}
.cat-sub li:hover { background: var(--fill); }
.category-list input { margin: 0; accent-color: var(--accent); }
.legend-pin {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; line-height: 1;
}
.cat-name { flex: 1; font-size: var(--fs-m); }
.cat-count { font-size: var(--fs-s); color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- Buttons: sekundär (Flächen) & primär (Akzent) --- */
.stats-btn {
  width: 100%; min-height: 42px; padding: 10px 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--r-sm); cursor: pointer;
  font-family: inherit; font-size: var(--fs-s); font-weight: 600;
}
.stats-btn:hover { background: var(--fill); }
a.stats-btn { display: block; text-align: center; text-decoration: none; }
.panel-buttons { display: flex; flex-direction: column; gap: 8px; }

.disclaimer { font-size: var(--fs-xs); color: var(--muted); line-height: 1.55; }
.disclaimer p { margin: 8px 0; }
.disclaimer a { color: var(--accent); }
.footer-links {
  margin: 14px 0 6px; font-size: var(--fs-xs); font-weight: 600;
  color: var(--muted); text-align: center; line-height: 1.8;
}
.footer-links a { color: var(--accent); text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

/* --- Karten-Pins & Cluster --- */
.leaflet-div-icon.pin-wrap { background: transparent; border: 0; }
.pin {
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; line-height: 1;
}

/* Cluster: eine ruhige Farbe, Größe bleibt der Mengen-Indikator
   (überschreibt die grün/gelben markercluster-Defaults) */
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
  background-color: rgba(11, 61, 98, 0.22);
}
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
  background-color: rgba(11, 61, 98, 0.92);
  color: #fff; font-family: inherit; font-weight: 600;
}

/* --- Leaflet-Bedienelemente im gleichen Material --- */
.leaflet-bar {
  border: 1px solid var(--glass-brd); border-radius: var(--r-sm);
  box-shadow: 0 0 0 0.5px var(--glass-edge), var(--shadow-float);
  overflow: hidden;
}
.leaflet-bar a {
  width: 38px; height: 38px; line-height: 38px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  color: var(--text); border-bottom: 1px solid var(--glass-edge);
  font-size: 18px;
}
.leaflet-bar a:hover { background: rgba(255, 255, 255, 0.92); }
.leaflet-control-attribution {
  background: var(--glass-bg) !important;
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-radius: var(--r-xs); margin: 6px; padding: 2px 8px;
  font-size: 0.6875rem; color: var(--muted) !important;
  box-shadow: 0 0 0 0.5px var(--glass-edge);
}
.leaflet-control-attribution a { color: var(--accent) !important; }

/* --- Popup --- */
.leaflet-popup-content-wrapper {
  border-radius: var(--r-md); background: var(--glass-bg-strong);
  color: var(--text); box-shadow: 0 0 0 0.5px var(--glass-edge), var(--shadow-float);
}
.leaflet-popup-tip { background: var(--glass-bg-strong); }
.leaflet-popup-content { margin: 13px 15px; line-height: 1.45; color: var(--text); }
.popup-cat {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 700; color: #fff;
  padding: 3px 9px; border-radius: 999px; margin-bottom: 7px;
}
.popup-headline { font-weight: 700; font-size: 0.98rem; margin: 0 0 4px; }
.popup-meta { font-size: var(--fs-s); color: var(--muted); margin: 0 0 6px; }
.popup-approx {
  font-size: var(--fs-xs); color: #8a5f00; background: rgba(217, 138, 0, 0.10);
  border: 1px solid rgba(217, 138, 0, 0.30); border-radius: var(--r-xs);
  padding: 5px 8px; margin: 0 0 8px; line-height: 1.4;
}
.popup-summary { font-size: 0.875rem; margin: 0 0 8px; }
.popup-link { font-size: var(--fs-s); }
.popup-link a { color: var(--accent); }

/* --- Leerzustand --- */
.empty-hint {
  position: absolute; top: calc(var(--top-offset) + 6px); left: 50%;
  transform: translateX(-50%);
  border-radius: var(--r-md); padding: 12px 16px;
  font-size: 0.875rem; z-index: 1000;
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  text-align: center; max-width: calc(100% - 32px);
}
.empty-hint[hidden] { display: none; }
.empty-btn {
  border: 0; background: var(--accent); color: #fff; font: inherit;
  font-size: var(--fs-s); font-weight: 600; padding: 8px 16px;
  border-radius: var(--r-sm); cursor: pointer; min-height: 36px;
}
.empty-btn:hover { filter: brightness(1.08); }

/* --- Info-Panel (Liste | Bericht | Statistik) --- */
.stats-panel {
  position: absolute; top: var(--top-offset); right: 10px; width: 372px;
  /* -34px unten: OSM-Attribution (Lizenzpflicht) bleibt unter dem Panel sichtbar */
  max-width: calc(100% - 20px); max-height: calc(100% - var(--top-offset) - 34px);
  overflow-y: auto; overscroll-behavior: contain;
  border-radius: var(--r-lg); padding: 14px 16px; z-index: 1200;
}
.stats-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stats-close {
  background: none; border: 0; font-size: 1rem; cursor: pointer;
  color: var(--muted); padding: 8px 10px; border-radius: var(--r-xs);
}
.stats-close:hover { background: var(--fill); }

/* Tabs = Segmented */
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--fill); border-radius: var(--r-sm); }
.tab {
  border: 0; background: transparent; color: var(--muted); font: inherit;
  font-size: var(--fs-s); font-weight: 600; padding: 6px 14px; min-height: 32px;
  border-radius: var(--r-xs); cursor: pointer;
}
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-raise); }
.tab-pane { margin-top: 8px; }

/* Bottom-Sheet-Bausteine (nur mobil) */
.sheet-head { display: none; align-items: center; justify-content: center; position: relative; padding: 2px 0 10px; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: rgba(90, 107, 123, 0.35); }
.sheet-close {
  position: absolute; right: 0; top: -4px; background: none; border: 0;
  font-size: 1.05rem; color: var(--muted); cursor: pointer; padding: 8px 10px;
}

.stats-note { font-size: var(--fs-xs); color: var(--muted); margin: 6px 0 10px; }
.stats-panel h4 { margin: 16px 0 8px; font-size: var(--fs-s); }
.stats-list { list-style: none; margin: 0; padding: 0; }
.stats-list li { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: var(--fs-s); }
.bar-label { flex: 0 0 42%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { flex: 1; height: 7px; background: var(--fill); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar-val { flex: 0 0 auto; min-width: 24px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.stats-empty { color: var(--muted); }

.stats-subhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 16px 0 8px; }
.stats-subhead h4 { margin: 0; }
.seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--fill); border-radius: var(--r-xs); flex: 0 0 auto; }
.seg-btn {
  border: 0; background: transparent; color: var(--muted); font: inherit;
  font-size: 0.72rem; font-weight: 600; padding: 4px 9px; cursor: pointer;
  white-space: nowrap; border-radius: 4px;
}
.seg-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-raise); }
.stats-foot { font-size: var(--fs-xs); color: var(--muted); line-height: 1.5; margin: 8px 0 2px; }
.stats-foot a { color: var(--accent); }
.stats-foot .flag, .bar-label .flag { color: #c0392b; font-weight: 700; }

/* --- Ereignis-/Ergebnislisten --- */
.event-list { list-style: none; margin: 0; padding: 0; }
.event-item {
  display: flex; gap: 10px; padding: 10px 4px; cursor: pointer;
  border-bottom: 1px solid var(--border); border-radius: var(--r-xs);
}
.event-item:hover { background: var(--fill); }
.event-emoji {
  width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; line-height: 1;
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.event-body { flex: 1; min-width: 0; }
.event-headline { font-size: 0.875rem; font-weight: 600; margin: 0 0 2px; }
.event-meta { font-size: var(--fs-xs); color: var(--muted); }
.event-empty { color: var(--muted); padding: 10px 2px; }
.event-item.event-unmapped { opacity: 0.72; }
.event-item.event-unmapped .event-emoji { filter: grayscale(1); }
.event-item.event-offtime { opacity: 0.82; }
.event-flag {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.02em;
  vertical-align: 1px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px;
}
#unmapped-section { margin-top: 14px; padding-top: 10px; border-top: 2px solid var(--border); }
#unmapped-meta { font-weight: 600; }
.unmapped-hint { font-size: var(--fs-xs); color: var(--muted); margin: 8px 2px 0; line-height: 1.5; }

/* --- Häufungs-Hinweis (neutraler Karten-Toast unten) --- */
.haeufung-banner {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 1000; display: flex; align-items: flex-start; gap: 10px;
  width: min(460px, calc(100% - 24px));
  border-left: 4px solid #d98a00;
  border-radius: var(--r-md); padding: 12px 12px 12px 14px;
  font-size: 0.875rem;
}
.haeufung-banner[hidden] { display: none; }
.haeufung-icon {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  /* dunkler als der Rand (#d98a00): weißes "!" braucht ≥3:1 Kontrast */
  background: #b87400; color: #fff; font-weight: 800; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}
.haeufung-body { flex: 1; min-width: 0; }
.haeufung-text { margin: 0 0 8px; line-height: 1.4; }
.haeufung-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.haeufung-btn {
  border: 0; background: var(--accent); color: #fff; font: inherit;
  font-size: var(--fs-s); font-weight: 600; padding: 7px 12px;
  border-radius: var(--r-sm); cursor: pointer; min-height: 34px;
}
.haeufung-btn:hover { filter: brightness(1.08); }
.haeufung-btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.haeufung-info { font-size: var(--fs-xs); color: var(--muted); }
.haeufung-close {
  flex: 0 0 auto; background: none; border: 0; color: var(--muted);
  font-size: 0.95rem; cursor: pointer; padding: 4px 6px; border-radius: var(--r-xs);
}
.haeufung-close:hover { background: var(--fill); }

/* --- Umkreissuche --- */
.umkreis-row { display: flex; gap: 6px; }
#umkreis-address {
  flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--r-sm); font-size: var(--fs-m); font-family: inherit;
  background: var(--surface); color: var(--text); min-height: 40px;
}
#umkreis-address::placeholder { color: var(--muted); }
#umkreis-address:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.umkreis-go {
  flex: 0 0 auto; border: 0; background: var(--accent);
  color: #fff; font-family: inherit; font-size: var(--fs-s); font-weight: 600;
  padding: 0 16px; border-radius: var(--r-sm); cursor: pointer; min-height: 40px;
}
.umkreis-go:hover { filter: brightness(1.08); }
.umkreis-locate {
  width: 100%; margin-top: 8px; min-height: 40px; padding: 8px 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: var(--r-sm); cursor: pointer;
  font-family: inherit; font-size: var(--fs-s); font-weight: 600;
}
.umkreis-locate:hover { background: var(--fill); }
.umkreis-radius { margin-top: 12px; font-size: var(--fs-s); color: var(--muted); }
.umkreis-radius label { display: block; margin-bottom: 4px; }
.umkreis-radius strong { color: var(--text); font-variant-numeric: tabular-nums; }
#umkreis-range { width: 100%; accent-color: var(--accent); }
.umkreis-status { font-size: var(--fs-s); color: var(--muted); margin: 10px 0 0; }
.umkreis-status.error { color: #c0392b; }
#umkreis-result { margin-top: 12px; }
.umkreis-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 11px 13px; font-size: var(--fs-s); line-height: 1.5; margin-bottom: 10px;
}
.umkreis-card .uk-head { font-weight: 700; font-size: 0.875rem; margin: 0 0 4px; }
.umkreis-card p { margin: 0 0 6px; }
.umkreis-card p:last-child { margin-bottom: 0; }
.umkreis-card .uk-caveat { font-size: var(--fs-xs); color: var(--muted); }
.umkreis-card a { color: var(--accent); }
.umkreis-dist {
  display: inline-block; margin-left: 6px; font-size: var(--fs-xs); color: var(--accent);
  font-weight: 600; font-variant-numeric: tabular-nums;
}
.umkreis-attrib { font-size: var(--fs-xs); color: var(--muted); margin: 10px 0 0; line-height: 1.45; }
.leaflet-div-icon.umkreis-center { background: transparent; border: 0; }
.umkreis-center-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(11, 111, 184, 0.5), 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* --- Touch-Geräte: Klickziele ≥ 44 px (HIG) --- */
@media (pointer: coarse) {
  .chip { min-height: 44px; }
  .tab { min-height: 40px; }
  .cat-sub li { min-height: 44px; }
  .cat-arrow { width: 44px; height: 44px; }
  .badge-btn { min-height: 40px; }
  .stats-btn { min-height: 46px; }
  .disclosure summary { min-height: 46px; }
  .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; }
  #search, #umkreis-address, .umkreis-go, .umkreis-locate { min-height: 44px; }
}

/* --- Mobil --- */
@media (max-width: 760px) {
  :root { --top-offset: 104px; }
  .sidebar-toggle { display: block; order: 2; }
  .app-header {
    top: 8px; left: 8px; right: 8px;
    flex-wrap: wrap; padding: 8px 12px; gap: 4px 10px; min-height: 0;
  }
  .app-header .title { flex: 1 1 auto; min-width: 0; }
  .app-header .title h1 { font-size: 0.98rem; }
  .app-header .meta {
    order: 3; flex: 1 1 100%; flex-direction: row;
    justify-content: space-between; align-items: center;
    margin-left: 0; gap: 8px;
  }
  .badge-btn { font-size: var(--fs-xs); min-height: 34px; }
  .updated { font-size: 0.6875rem; }

  /* Leaflet-Zoom links unter dem Header (kein Panel im Weg) */
  .leaflet-top.leaflet-left { top: var(--top-offset); left: 0; }

  /* Filter als Bottom-Sheet: Karte bleibt sichtbar */
  .sheet-head { display: flex; }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: auto; height: 62dvh; z-index: 1150;
    border-radius: 18px 18px 0 0; border-bottom: 0;
    transform: translateY(105%); transition: transform 0.25s ease;
    padding-top: 8px;
  }
  .sidebar.open { transform: translateY(0); }

  /* Info-Panel ebenfalls als Bottom-Sheet */
  .stats-panel {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: auto; max-width: none; max-height: 64dvh;
    border-radius: 18px 18px 0 0; border-bottom: 0;
  }

  /* Overlays (UX-Audit 2026-07-09): Zoom links freihalten,
     OSM-Attribution unter dem Banner sichtbar lassen */
  .empty-hint { left: auto; right: 8px; transform: none; max-width: calc(100% - 64px); }
  .haeufung-banner { bottom: 34px; }
}

/* --- Desktop: schwebende Hinweise an der FREIEN Kartenfläche ausrichten ---
   (nicht am Viewport – sonst rutschen sie unter Sidebar/Zoom/Info-Panel;
   Kollisionsrechnung: UX-Audit 2026-07-09. Anker: Sidebar endet bei 342 px,
   Zoom bei 394 px, offenes Info-Panel beginnt bei 100% − 382 px.) */
@media (min-width: 761px) {
  .empty-hint {
    left: calc(406px + (100% - 406px - 10px) / 2);
    max-width: min(480px, calc(100% - 406px - 26px));
  }
  .haeufung-banner {
    left: calc(354px + (100% - 354px - 12px) / 2);
    width: min(460px, max(240px, calc(100% - 378px)));
  }
  body.info-open .empty-hint {
    left: calc(406px + (100% - 406px - 392px) / 2);
    max-width: min(480px, max(220px, calc(100% - 406px - 408px)));
  }
  body.info-open .haeufung-banner {
    left: calc(354px + (100% - 354px - 392px) / 2);
    width: min(460px, max(240px, calc(100% - 354px - 404px)));
  }
}

/* --- Dark Mode --- */
@media (prefers-color-scheme: dark) {
  :root {
    --text: #e7eaed;
    --muted: #9aa6b1;
    --accent: #58a9e8;
    --accent-strong: #58a9e8;  /* auf dunklem Tint bereits ≥ 4.5:1 */
    --border: rgba(235, 242, 248, 0.14);
    --fill: rgba(235, 242, 248, 0.08);
    --surface: #232b33;

    --glass-bg: rgba(18, 23, 29, 0.72);
    --glass-bg-strong: rgba(22, 28, 34, 0.95);
    --glass-brd: rgba(255, 255, 255, 0.10);
    --glass-edge: rgba(0, 0, 0, 0.55);
    --shadow-float: 0 12px 36px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-raise: 0 1px 4px rgba(0, 0, 0, 0.5);
  }
  body { background: #14181d; }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .app-header, .sidebar, .stats-panel, .empty-hint, .haeufung-banner { background: #171d23; }
  }
  @media (prefers-reduced-transparency: reduce) {
    .app-header, .sidebar, .stats-panel, .empty-hint, .haeufung-banner { background: #171d23; }
  }

  .badge-btn { background: rgba(88, 169, 232, 0.14); border-color: rgba(88, 169, 232, 0.35); }
  .badge-btn:hover { background: rgba(88, 169, 232, 0.24); }
  .chip.active, .tab.active, .seg-btn.active { background: #35404b; color: #fff; }
  .empty-btn, .umkreis-go, .haeufung-btn { color: #0a1722; }
  .haeufung-btn.ghost { color: var(--accent); }
  .umkreis-center-dot { border-color: #1b232b; }

  /* Kartenkacheln abdunkeln – entsättigt statt bunt-invertiert (ruhiger) */
  .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) saturate(0.55) brightness(0.92) contrast(0.92);
  }
  #map { background: #14181d; }

  .leaflet-bar a { background: var(--glass-bg); color: var(--text); }
  .leaflet-bar a:hover { background: rgba(40, 48, 57, 0.92); }
  .leaflet-popup-close-button { color: var(--muted) !important; }
  .popup-approx { background: rgba(217, 138, 0, 0.12); color: #e6c074; border-color: rgba(217, 138, 0, 0.35); }
  .marker-cluster-small, .marker-cluster-medium, .marker-cluster-large {
    background-color: rgba(88, 169, 232, 0.20);
  }
  .marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div {
    background-color: rgba(30, 76, 112, 0.95); color: #eaf3fb;
  }
}
