@charset "UTF-8";
.hidden { display: none !important; }

/* ============================================================
   DESIGN TOKENS — Bochum Smart City (nahmobi-matched)
   ============================================================ */
:root {
  /* Bochum brand colors */
  --cyan: #0AB4FF;
  --blue: #0F2864;
  --bochum-dark-blue: #0F2864;
  --orange: #F49100;

  /* Surface & text */
  --bg: #F6F6F6;
  --card-bg: #FFFFFF;
  --surface: #FAFAFA;
  --text: #1A1A1A;
  --text-secondary: #4a5568;
  --text-muted: #94A3B8;
  --line: #E2E8F0;

  /* Shadows */
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.14);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.10);

  /* Radii */
  --radius-card: 10px;
  --radius-control: 8px;
  --radius-pill: 999px;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Migration aliases (keeps old class names working) */
  --primary: var(--cyan);
  --primary-hover: #0099e0;
  --primary-light: rgba(0, 180, 255, 0.10);
  --radius: var(--radius-card);
  --radius-sm: var(--radius-control);
  --radius-xs: 6px;
  --radius-full: var(--radius-pill);
  --border: var(--line);
  --border-light: #f1f5f9;

  /* Provider colors — the single source of truth for map, legend, zones, and charts. */
  --provider-lime: #00DD00;
  --provider-voi: #F26961;
  --provider-dott: #009DDB;
  --provider-bolt: #2B8659;
  --provider-ryde: #8E5CC7;
  --provider-neutral: #9CA3AF;
  --provider-loading: #64748B;
  --lime: var(--provider-lime);
  --voi: var(--provider-voi);
  --dott: var(--provider-dott);
  --green: var(--provider-bolt);
  --bolt: var(--provider-bolt);
  --ryde: var(--provider-ryde);
  --yellow: #EAB308;
  --red: #EF4444;
}

/* ============================================================
   RESET / BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
  min-height: 100%;
  font-family: var(--font-sans); font-size: 16px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-sans); font-weight: 700; line-height: 1.25; }
a { color: var(--primary); text-decoration: none; }

/* Tabular numbers on all numeric values */
.kpi-value, .zone-count, .ranking-value, .stat-value, .hs-chip-num,
.hs-preview-rank, .hs-preview-stat, .hs-cmp-rank, .hs-cmp-stat,
.hs-cmp-delta, .overview-card-value, #live-list .zone-count,
#hotspots-list .zone-count, .chart-footer {
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   APP SHELL
   ============================================================ */
#app {
  display: flex;
  flex-direction: column; flex-direction: column; min-height: 100vh;
  max-width: 1440px; margin: 0 auto; padding: 0 16px;
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  position: sticky; top: 0; z-index: 1000;
  height: 70px; background: var(--cyan);
  border-bottom: 0; margin-bottom: 16px; flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  width: 100vw; margin-left: calc(-50vw + 50%);
}
.header-inner {
  height: 70px; max-width: 1440px; margin: 0 auto;
  padding: 0 24px; display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between; gap: 16px;
}
.header-left { display: flex;
  flex-direction: row; align-items: center; gap: 20px; }
.header-logo { height: 36px; width: auto; display: block; }
.header-inner h1 {
  font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em;
  color: #1A1A1A; white-space: nowrap;
}
.header-right { display: flex;
  flex-direction: row; align-items: center; gap: 10px; }
.header-meta { font-size: 0.8rem; color: #1A1A1A; display: flex;
  flex-direction: row; align-items: center; gap: 8px; white-space: nowrap; font-weight: 500; }
.header-loading { display: flex;
  flex-direction: column; align-items: center; gap: 6px; }
.last-updated { font-size: 0.8rem; color: #1A1A1A; font-weight: 500; }

/* Theme Toggle */
.theme-toggle {
  width: 36px; height: 36px; display: flex;
  flex-direction: column; align-items: center;
  justify-content: center; border: 0; border-radius: var(--radius-pill);
  background: rgba(26, 26, 26, 0.10); color: #1A1A1A;
  cursor: pointer; transition: background 0.15s;
}
.theme-toggle:hover { background: rgba(26, 26, 26, 0.18); }
.theme-icon { width: 20px; height: 20px; }

/* ============================================================
   KPI ROW
   ============================================================ */
#kpi-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px;
  margin-bottom: 16px;
}
.kpi-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  border: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.kpi-value {
  font-size: 1.6rem; font-weight: 700; line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.kpi-label {
  font-size: 0.7rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; margin-top: 2px;
}
.kpi-voi .kpi-value { color: var(--voi); }
.kpi-dott .kpi-value { color: var(--dott); }
.kpi-lime .kpi-value { color: var(--lime); }
.kpi-bolt .kpi-value { color: var(--bolt); }
.kpi-ryde .kpi-value { color: var(--ryde); }
.kpi-warn .kpi-value { color: var(--yellow); }

/* ============================================================
   TAB BAR — pill-shaped, nahmobi style
   ============================================================ */
.tab-bar {
  display: flex;
  flex-direction: column; gap: 6px; margin: 16px 0;
  padding: 0; background: transparent;
  width: max-content;
}
.tab {
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  padding: 8px 18px;
  font-size: 0.85rem; font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.tab:hover {
  background: rgba(0, 180, 255, 0.12);
  color: var(--text);
}
.tab.active {
  background: var(--cyan);
  color: #1A1A1A;
}

/* ============================================================
   MAP CONTAINER
   ============================================================ */
#map-container {
  position: relative;
  height: min(64vh, 680px);
  min-height: 420px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background: #ffffff;
}
#map { width: 100%; height: 100%; }
.leaflet-container { background: #f8fafc; font-family: var(--font-sans); }
.leaflet-pane { z-index: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Historical controls share the existing translucent map-panel language, but
   remain compact enough to leave the map and its native controls usable. */
.historical-controls { position: absolute; top: 52px; left: 16px; z-index: 500; width: min(330px, calc(100% - 32px)); padding: 13px; border: 1px solid rgba(10,180,255,.3); border-radius: 12px; background: rgba(255,255,255,.95); box-shadow: var(--shadow-card-hover); backdrop-filter: blur(8px); }
.historical-controls__heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.historical-controls__eyebrow { display: block; color: var(--blue); font-size: .61rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.historical-controls__count { padding: 3px 7px; border-radius: var(--radius-pill); background: rgba(10,180,255,.13); color: var(--blue); font-size: .7rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.historical-controls__fields { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 9px; }
.historical-controls label, .address-search label { color: var(--text-muted); font-size: .66rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.historical-controls input[type="date"], .address-search input { min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card-bg); color: var(--text); font: inherit; font-size: .76rem; }
.historical-controls input[type="range"] { width: 100%; accent-color: var(--cyan); }
.address-search { margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.address-search__row { display: flex; gap: 6px; margin-top: 4px; }
.address-search input { flex: 1; }
.address-search button { border: 0; border-radius: 6px; padding: 6px 9px; background: var(--cyan); color: #10213b; font: inherit; font-size: .74rem; font-weight: 750; cursor: pointer; }
.historical-controls__status, .address-search__status { min-height: 1.3em; margin-top: 8px; color: var(--text-secondary); font-size: .7rem; line-height: 1.35; }
.historical-controls__status.is-error, .address-search__status.is-error { color: var(--red); }
.historical-controls input:focus-visible, .address-search button:focus-visible { outline: 3px solid rgba(10,180,255,.35); outline-offset: 2px; }

/* One deliberately compact home for every map tool. It starts closed, leaving
   the map and Leaflet controls available until the user asks for a tool. */
.map-tools-toggle { position: absolute; z-index: 650; top: 16px; left: 52px; display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 11px; border: 1px solid rgba(15,40,100,.16); border-radius: var(--radius-control); background: rgba(255,255,255,.96); color: var(--blue); box-shadow: var(--shadow-card); font: inherit; font-size: .76rem; font-weight: 750; cursor: pointer; }
.map-tools-toggle svg { width: 16px; height: 16px; }
.map-tools-toggle:focus-visible { outline: 3px solid rgba(10,180,255,.4); outline-offset: 2px; }
.map-tools-panel { --map-tools-section-spacing: 16px; position: absolute; z-index: 650; top: 60px; left: 16px; width: min(360px, calc(100% - 32px)); max-height: calc(100% - 76px); overflow: auto; overscroll-behavior: contain; padding: 20px; border: 1px solid rgba(10,180,255,.32); border-radius: 14px; background: rgba(255,255,255,.96); box-shadow: 0 14px 34px rgba(15,40,100,.2); backdrop-filter: blur(10px); }
.map-tools-panel[hidden] { display: none; }
.map-tools-section, .map-tools-panel > .scooter-area-workspace, .map-tools-panel > #map-filters { position: static; width: 100%; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.map-tools-panel > * + * { margin-top: var(--map-tools-section-spacing); padding-top: var(--map-tools-section-spacing); border-top: 1px solid var(--line); }
#map-tools-panel > .map-tools-section + .map-tools-section { margin-top: 16px; padding-top: 16px; }
.map-tools-section__title { display: block; margin: 0; color: var(--blue); font-family: var(--font-sans); font-size: .76rem; line-height: 1.25; font-weight: 800; letter-spacing: 0; text-transform: none; }
.historical-controls { position: static; width: 100%; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; backdrop-filter: none; }
.address-search { margin: 0; padding: 0; border: 0; }
.map-tools-panel .historical-controls__heading { margin-bottom: 12px; }
.map-tools-panel .scooter-area-result__eyebrow { display: block; color: var(--text-muted); font-size: .72rem; font-weight: 750; letter-spacing: 0; text-transform: none; }
.map-tools-panel .historical-controls__fields { gap: 10px 12px; }
.map-tools-panel .historical-controls__status { margin-top: 14px; font-size: .76rem; }
.map-tools-panel .address-search__row { margin-top: 10px; }
.scooter-area-workspace { position: static; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.map-tools-panel .scooter-area-panel,
.map-tools-panel .scooter-area-result { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; backdrop-filter: none; }
.map-tools-panel > .scooter-area-workspace { background: transparent; border-radius: 0; }
.map-tools-panel > .scooter-area-workspace > .scooter-area-panel { padding: 18px; background: var(--surface); border-radius: var(--radius-control); }
.map-tools-panel .scooter-area-panel__hint { margin: 10px 0 16px; font-size: .78rem; }
.map-tools-panel .scooter-area-button--primary,
.map-tools-panel .address-search button { min-height: 40px; background: var(--cyan); color: #10213b; box-shadow: none; }
.map-tools-panel .scooter-area-button--clear { min-height: 40px; color: var(--text-secondary); }
.map-tools-panel .scooter-area-button--primary svg { width: 16px; height: 16px; }
.map-tools-panel .scooter-area-result { margin-top: 2px; padding-top: 0; border-top: 0; }
.map-tools-panel .scooter-area-result__header { padding: 0 0 10px; }
.map-tools-panel .scooter-area-result__content { padding: 12px 0 0; }
#map-filters { display: flex; gap: 12px; overflow: visible; }
.map-tools-panel .filter-group--export { padding-bottom: 0; }
.address-result-marker { background: transparent; border: 0; }
.address-result-marker__pin { display: grid; place-items: center; width: 30px; height: 30px; border: 3px solid #fff; border-radius: 50% 50% 50% 0; background: var(--orange); color: var(--blue); box-shadow: 0 3px 10px rgba(15,40,100,.32); font-size: .75rem; font-weight: 850; transform: rotate(-45deg); }
.address-result-marker__pin span { transform: rotate(45deg); }
[data-theme="dark"] .map-tools-toggle, [data-theme="dark"] .map-tools-panel { background: rgba(17,24,39,.97); border-color: rgba(10,180,255,.35); }

/* Shared hierarchy for the independent, right-hand legend. */
#map-filters { padding: 18px; gap: 0; }
#map-filters .filter-group { gap: 7px; padding: 18px 0 0; }
#map-filters .filter-group:first-child { padding-top: 0; }
#map-filters .filter-group + .filter-group { margin-top: 18px; border-top: 1px solid var(--line); }
#map-filters .filter-group-title { margin: 0 0 3px; color: var(--blue); font-size: .76rem; font-weight: 800; letter-spacing: 0; text-transform: none; }
#map-filters .filter-item { gap: 8px; font-size: .8rem; line-height: 1.35; }
#map-filters .filter-group--export { padding-bottom: 0; }

/* The legend remains a familiar, independent right-hand map panel. */
.map-legend-toggle { position: absolute; z-index: 650; top: 16px; right: 16px; display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 11px; border: 1px solid rgba(15,40,100,.16); border-radius: var(--radius-control); background: rgba(255,255,255,.96); color: var(--blue); box-shadow: var(--shadow-card); font: inherit; font-size: .76rem; font-weight: 750; cursor: pointer; }
.map-legend-toggle svg { width: 16px; height: 16px; }
.map-legend-toggle:focus-visible { outline: 3px solid rgba(10,180,255,.4); outline-offset: 2px; }
#map-filters { top: 60px; }
#map-filters[hidden] { display: none; }
[data-theme="dark"] .map-legend-toggle { background: rgba(17,24,39,.97); border-color: rgba(10,180,255,.35); }

/* ============================================================
   POLYGON ANALYSIS — persistent map-side workspace
   ============================================================ */
.scooter-area-workspace {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 500;
  width: min(328px, calc(100% - 32px));
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
}
.scooter-area-panel,
.scooter-area-result {
  border: 1px solid rgba(10, 180, 255, 0.32);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 34px rgba(15, 40, 100, 0.18);
  backdrop-filter: blur(12px);
}
.scooter-area-panel { padding: 14px; }
.scooter-area-panel__eyebrow,
.scooter-area-result__eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--blue);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.scooter-area-panel__eyebrow span {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cyan);
  color: var(--blue);
  font-size: 0.9rem;
  line-height: 1;
}
.scooter-area-panel__hint {
  margin: 7px 0 12px;
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.4;
}
.scooter-area-panel__actions { display: flex; align-items: center; gap: 8px; }
.scooter-area-button {
  min-height: 38px;
  border: 0;
  border-radius: var(--radius-control);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.scooter-area-button--primary {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 12px;
  background: var(--cyan);
  color: #10213b;
  box-shadow: 0 5px 12px rgba(10, 180, 255, 0.27);
}
.scooter-area-button--primary svg { width: 17px; height: 17px; }
.scooter-area-button--primary:hover { transform: translateY(-1px); box-shadow: 0 8px 16px rgba(10, 180, 255, 0.34); }
.scooter-area-button--clear { padding: 9px 10px; background: transparent; color: var(--text-secondary); }
.scooter-area-button--clear:hover:not(:disabled) { background: var(--surface); color: var(--text); }
.scooter-area-button:focus-visible,
.scooter-area-copy:focus-visible { outline: 3px solid rgba(10, 180, 255, 0.45); outline-offset: 2px; }
.scooter-area-button:disabled { cursor: not-allowed; opacity: 0.48; }
.scooter-area-panel.scooter-area-drawing,
#map.scooter-area-drawing ~ .scooter-area-workspace .scooter-area-panel {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(10, 180, 255, 0.16), 0 14px 34px rgba(15, 40, 100, 0.18);
}
.scooter-area-panel.scooter-area-drawing #scooter-area-draw,
#map.scooter-area-drawing ~ .scooter-area-workspace #scooter-area-draw,
#scooter-area-draw.active,
#scooter-area-draw[aria-pressed="true"] {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 5px 12px rgba(15, 40, 100, 0.28);
}
.scooter-area-panel.scooter-area-drawing #scooter-area-hint,
#map.scooter-area-drawing ~ .scooter-area-workspace #scooter-area-hint { color: var(--blue); font-weight: 650; }

.scooter-area-result {
  overflow: hidden;
}
.scooter-area-result[hidden] { display: none; }
.scooter-area-result__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
}
.scooter-area-result__header strong { display: block; margin-top: 1px; font-size: 0.92rem; }
.scooter-area-result__eyebrow { font-size: 0.58rem; }
.scooter-area-copy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card-bg);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}
.scooter-area-copy svg { width: 15px; height: 15px; }
.scooter-area-copy:hover:not(:disabled) { border-color: var(--cyan); background: rgba(10, 180, 255, 0.09); color: var(--blue); }
.scooter-area-copy:disabled { cursor: default; opacity: 0.48; }
.scooter-area-result__content { padding: 12px 14px 14px; }
.scooter-area-result__total {
  display: inline-block;
  margin-right: 5px;
  color: var(--blue);
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.scooter-area-result__label { color: var(--text-secondary); font-size: 0.76rem; font-weight: 650; }
.scooter-area-result__providers {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.72rem;
  line-height: 1.35;
}
.scooter-area-result__provider {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-secondary);
  font-size: 0.76rem;
}
.scooter-area-result__provider span:last-child {
  flex: 0 0 auto;
  color: var(--text);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.scooter-area-result__snapshot {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 0.66rem;
  line-height: 1.35;
}

/* ============================================================
   APP LOADING — shown while body has .app-loading.
   The state class is intentionally independent from application logic.
   ============================================================ */
.app-loading__overlay {
  position: fixed; inset: 0; z-index: 3000;
  display: grid; place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(7px);
  transition: opacity 260ms ease, visibility 260ms ease;
}
.app-loading__dialog {
  width: min(100%, 330px); padding: 28px 24px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center; background: var(--card-bg);
  border: 1px solid color-mix(in srgb, var(--cyan) 35%, var(--line));
  border-radius: 18px; box-shadow: 0 18px 55px rgba(15, 40, 100, 0.2);
}
.app-loading__spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(10, 180, 255, 0.18);
  border-top-color: var(--cyan); border-right-color: var(--blue);
  animation: app-loading-spin 1.65s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}
.app-loading__title { font-size: 1rem; font-weight: 750; color: var(--text); overflow-wrap: anywhere; }
.app-loading__duration { margin-top: -6px; font-size: 0.72rem; color: var(--text-muted); }
.app-loading__hint { font-size: 0.78rem; color: var(--text-secondary); overflow-wrap: anywhere; }
@keyframes app-loading-spin { to { transform: rotate(360deg); } }

body:not(.app-loading) .app-loading__overlay { opacity: 0; visibility: hidden; pointer-events: none; }
body:not(.app-loading) .app-loading__map-skeleton,
body:not(.app-loading) .app-loading__chart-skeleton,
body:not(.app-loading) .app-loading__provider-skeleton,
body:not(.app-loading) .app-loading__chip-skeleton,
body:not(.app-loading) .app-loading__list-skeleton { display: none; }

.app-loading__map-skeleton {
  position: absolute; inset: 0; z-index: 700; overflow: hidden;
  background: linear-gradient(135deg, #eef7fb 0%, #f9fcfd 48%, #e7f4fa 100%);
}
.app-loading__map-skeleton::before,
.app-loading__map-skeleton::after,
.app-loading__map-roads {
  content: ""; position: absolute; width: 130%; height: 16px;
  background: rgba(15, 40, 100, 0.07); border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 99px; transform: rotate(-17deg);
}
.app-loading__map-skeleton::before { top: 28%; left: -14%; }
.app-loading__map-skeleton::after { top: 67%; left: -10%; transform: rotate(22deg); }
.app-loading__map-roads { top: 48%; left: -12%; transform: rotate(64deg); }
.app-loading__map-marker { position: absolute; width: 13px; height: 13px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--cyan); box-shadow: 0 3px 8px rgba(15, 40, 100, 0.18); }
.app-loading__map-marker--one { top: 35%; left: 31%; }
.app-loading__map-marker--two { top: 58%; left: 55%; background: var(--orange); }
.app-loading__map-marker--three { top: 25%; left: 71%; background: var(--blue); }

.app-loading__provider-skeleton,
.app-loading__list-skeleton { border-radius: var(--radius-control); background: var(--surface); border: 1px solid var(--line); padding: 12px; }
.app-loading__provider-skeleton span,
.app-loading__list-skeleton span,
.app-loading__chip-skeleton { display: block; border-radius: var(--radius-pill); background: linear-gradient(100deg, var(--surface) 25%, rgba(10, 180, 255, 0.15) 45%, var(--surface) 65%); background-size: 220% 100%; animation: app-loading-shimmer 2.1s ease-in-out infinite; }
.app-loading__provider-skeleton span { height: 10px; margin-bottom: 10px; }
.app-loading__provider-skeleton span:nth-child(1) { width: 42%; height: 12px; }
.app-loading__provider-skeleton span:nth-child(3) { width: 68%; margin-bottom: 0; }
.app-loading__chip-skeleton { width: 108px; height: 28px; }
.app-loading__chip-skeleton--short { width: 76px; }
.app-loading__list-skeleton { display: grid; grid-template-columns: 26px 1fr 56px; gap: 10px; align-items: center; margin-bottom: 6px; }
.app-loading__list-skeleton span { height: 9px; }
.app-loading__list-skeleton span:first-child { width: 18px; height: 18px; }
@keyframes app-loading-shimmer { to { background-position: -120% 0; } }

.app-loading__chart-skeleton {
  position: absolute; z-index: 2; display: flex; align-items: end; gap: 7%;
  padding: 18px 6% 12px; pointer-events: none;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--card-bg) 70%, transparent), var(--card-bg));
}
.app-loading__chart-skeleton span {
  flex: 1; min-width: 12px; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(to top, rgba(10, 180, 255, 0.2), rgba(10, 180, 255, 0.07));
}
.app-loading__chart-skeleton span:nth-child(1) { height: 34%; }
.app-loading__chart-skeleton span:nth-child(2) { height: 63%; }
.app-loading__chart-skeleton span:nth-child(3) { height: 47%; }
.app-loading__chart-skeleton span:nth-child(4) { height: 78%; }
.app-loading__chart-skeleton span:nth-child(5) { height: 55%; }
#chart-container { position: relative; }
#chart-container > .app-loading__chart-skeleton { top: 68px; right: 20px; bottom: 38px; left: 20px; }
#hotspots-list { position: relative; }
#hotspots-list > .app-loading__chart-skeleton--timeline { top: 32px; right: 0; bottom: 0; left: 0; }

@media (max-width: 380px) {
  .app-loading__overlay { padding: 14px; }
  .app-loading__dialog { padding: 24px 18px 20px; }
}

/* ============================================================
   MAP FILTER PANEL
   ============================================================ */
#map-filters {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 500;
  width: min(280px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-card-hover);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 14px;
}
#map-filters .filter-group { display: flex; flex: 0 0 auto; flex-direction: column; gap: 4px; width: 100%; }
#map-filters .filter-group--violations { max-width: none; }
.filter-group-title {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.3px;
  color: var(--text-muted); margin-bottom: 2px; font-weight: 600;
}
.filter-group-title--subtle {
  color: var(--bochum-dark-blue); margin-top: 6px; padding-top: 8px;
  border-top: 1px solid rgba(15, 40, 100, 0.16);
}
#map-filters .filter-item {
  display: flex; flex-direction: row; align-items: center; gap: 6px;
  cursor: pointer; font-size: 0.82rem; font-weight: 500; color: var(--text-secondary);
}
#map-filters .legend-labels-mini { flex-direction: row; }
.filter-item input { accent-color: var(--cyan); width: 14px; height: 14px; cursor: pointer; }
.filter-item--loading .dot { animation: provider-dot-loading 0.9s ease-in-out infinite; }
.filter-item--error { color: var(--text-muted); }
.filter-item--error .dot { opacity: 0.3; }
@keyframes provider-dot-loading { 50% { opacity: 0.35; transform: scale(0.78); } }

/* Status dots */
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 4px rgba(0,0,0,0.15); }
.voi-dot { background: var(--voi); }
.dott-dot { background: var(--dott); }
.lime-dot { background: var(--lime); }
.bolt-dot { background: var(--bolt); }
.ryde-dot { background: var(--ryde); }
.grenze-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: #991b1b; }
.maske-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: rgba(15,40,100,0.25); border: 1px dashed #0F2864; }

.bolt-npz-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--bolt); }
.bolt-op-dot { background: var(--provider-bolt); opacity: 0.72; }
.zone-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; background: var(--provider-dott); opacity: 0.7; }
.npz-dot { background: var(--provider-dott); opacity: 0.42; }
.voi-op-dot { background: var(--provider-voi); opacity: 0.6; }
.voi-npz-dot { background: var(--provider-voi); opacity: 0.42; }
.ryde-op-dot { background: var(--provider-ryde); opacity: 0.6; }
.ryde-npz-dot { background: var(--provider-ryde); opacity: 0.42; }
.lime-op-dot { background: var(--provider-lime); opacity: 0.6; }
.lime-npz-dot { background: var(--provider-lime); opacity: 0.42; }
.municipal-parking-dot { background: var(--bochum-dark-blue); opacity: 0.92; }
.violation-npz-dot { background: var(--red); }
.violation-outside-dot { background: #f97316; }
.legend-labels-mini { display: flex;
  flex-direction: column; justify-content: space-between; font-size: 0.58rem; color: var(--text-muted); }

/* Export — Auswahl folgt beim Start dem sichtbaren Karten-Zustand. */
.filter-group--export { padding-top: 2px; border-top: 1px solid var(--line); }
.export-intro { color: var(--text-secondary); font-size: 0.72rem; line-height: 1.35; }
.export-selection { display: grid; gap: 4px; border: 0; min-width: 0; }
.export-selection legend { padding: 3px 0 1px; color: var(--text-muted); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.export-option { display: flex; align-items: center; gap: 6px; color: var(--text-secondary); cursor: pointer; font-size: 0.74rem; line-height: 1.25; }
.export-option input { width: 14px; height: 14px; flex: 0 0 auto; accent-color: var(--cyan); cursor: pointer; }
.export-selection-status { color: var(--text-muted); font-size: 0.68rem; font-variant-numeric: tabular-nums; }
.export-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.filter-export-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: var(--card-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.filter-export-btn svg { width: 14px; height: 14px; }
.filter-export-btn:hover { border-color: var(--primary); color: var(--text); }
.filter-export-btn:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.filter-export-btn:disabled { cursor: not-allowed; color: var(--text-muted); background: var(--surface); border-color: transparent; opacity: 0.7; }

/* ============================================================
   LIVE VIOLATIONS PANEL
   ============================================================ */
.live-summary { padding: 10px 12px; border: 1px solid rgba(239, 68, 68, 0.18); border-radius: var(--radius-control); margin-bottom: 10px; background: rgba(239, 68, 68, 0.045); }
.live-summary .stat-row { display: flex;
  flex-direction: row; justify-content: space-between; gap: 12px; padding: 2px 0; font-size: 0.8rem; }
.live-violations { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.provider-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); }
.provider-card-header { display: flex; flex-direction: row; align-items: center; gap: 8px; min-height: 42px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--card-bg); }
.provider-mark { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: #fff; font-size: 0.7rem; font-weight: 800; }
.provider-card-name { font-size: 0.8rem; font-weight: 750; letter-spacing: -0.01em; }
.provider-total { margin-left: auto; color: var(--red); font-size: 0.88rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.provider-total small { color: var(--text-muted); font-size: 0.62rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; }
.provider-card--voi .provider-mark { background: var(--voi); }
.provider-card--dott .provider-mark { background: var(--dott); }
.provider-card--lime .provider-mark { background: var(--lime); }
.provider-card--bolt .provider-mark { background: var(--bolt); }
.provider-card--ryde .provider-mark { background: var(--ryde); }
.provider-card-note { padding: 7px 10px 0; color: var(--text-muted); font-size: 0.67rem; line-height: 1.35; }
.provider-card-list { padding: 3px 10px 6px; }
.live-section-title {
  font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.3px;
  color: var(--text-muted); margin: 8px 0 4px;
}
.stale-warning {
  font-size: 0.72rem; color: #f97316; padding: 4px 8px;
  background: rgba(249,115,22,0.08); border-radius: 4px; margin-top: 4px;
}
#live-list .zone-item { display: flex;
  flex-direction: row; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border-light); }
#live-list .zone-item:last-child { border-bottom: 0; }
#live-list .zone-name { font-size: 0.82rem; color: var(--text-secondary); }
#live-list .zone-count { min-width: 22px; padding: 1px 6px; border-radius: var(--radius-pill); color: var(--red); background: rgba(239, 68, 68, 0.09); font-size: 0.78rem; font-weight: 750; text-align: center; font-variant-numeric: tabular-nums; }
#live-list .zone-type { font-size: 0.68rem; color: var(--text-muted); }
#hotspots-list .zone-item { display: flex;
  flex-direction: column; justify-content: space-between; align-items: center; padding: 3px 0; }
#hotspots-list .zone-name { font-size: 0.82rem; color: var(--text-secondary); }
#hotspots-list .zone-count { font-size: 0.85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
#hotspots-list .zone-type { font-size: 0.68rem; color: var(--text-muted); }
#hotspots-list { overflow: hidden; }
#violation-timeline-chart {
  display: block !important;
  width: 100% !important;
  height: 220px !important;
  max-height: 220px;
  margin-top: 4px;
}
#live-timestamp { font-size: 0.7rem; color: var(--text-muted); }
#hotspot-period {
  font-size: 0.72rem; padding: 2px 4px;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--bg); color: var(--text-secondary); cursor: pointer;
}
#hotspot-period:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* ============================================================
   SCOOTER MARKERS
   ============================================================ */
.leaflet-interactive.scooter-marker {
  transition: filter 0.18s ease, opacity 0.18s ease, stroke-width 0.18s ease;
}
.leaflet-interactive.scooter-marker--outside {
  filter: drop-shadow(0 0 4px rgba(249,115,22,0.42));
  animation: scooter-npz-pulse 1.8s ease-in-out infinite;
}
.leaflet-interactive.scooter-marker--npz {
  filter: drop-shadow(0 0 4px rgba(220,38,38,0.46));
  animation: scooter-npz-pulse 1.8s ease-in-out infinite;
}
.leaflet-interactive.scooter-marker--outside-bochum {
  filter: grayscale(1);
}
@keyframes scooter-npz-pulse {
  0%, 100% { filter: drop-shadow(0 0 4px rgba(220,38,38,0.38)); }
  50% { filter: drop-shadow(0 0 9px rgba(220,38,38,0.72)); }
}

/* ============================================================
   CHART PANEL
   ============================================================ */
.chart-panel {
  margin: 20px 0 24px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px;
  border: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.chart-panel:hover { box-shadow: var(--shadow-card-hover); }
.chart-panel[hidden] { display: none; }

/* ============================================================
   PANEL STATUS
   ============================================================ */
.panel-status {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  margin-bottom: 10px;
}
.panel-status--loading { background: var(--primary-light); color: var(--primary); }
.panel-status--error { background: rgba(239, 68, 68, 0.08); color: var(--red); }
.panel-status--empty { background: var(--surface); color: var(--text-muted); }

/* ============================================================
   CONTROL GROUP
   ============================================================ */
.control-group { display: flex;
  flex-direction: column; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.control-group label {
  font-size: 0.7rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.control-group select, .control-group button {
  padding: 7px 10px;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.control-group select:hover { border-color: var(--primary); }
.control-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.control-group button {
  background: var(--cyan);
  color: #1A1A1A;
  font-weight: 700;
  border: none;
}
.control-group button:hover { opacity: 0.88; }

/* ============================================================
   HOTSPOT LEGEND
   ============================================================ */
.legend { margin-top: 8px; }
.legend-title {
  font-size: 0.7rem; color: var(--text-muted); margin-bottom: 4px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.legend-gradient {
  height: 6px;
  background: linear-gradient(to right, #dbeafe, #fde68a, #fca5a5, #ef4444);
  border-radius: 3px;
}
.legend-labels { display: flex;
  flex-direction: column; justify-content: space-between; font-size: 0.65rem; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   ZONE LIST
   ============================================================ */
.zone-list { margin-top: 8px; }
.zone-list-header {
  display: flex;
  flex-direction: column; justify-content: space-between;
  font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase;
  font-weight: 600; letter-spacing: 0.04em;
  padding: 4px 0; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.zone-item {
  display: flex;
  flex-direction: column; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: 0.8rem; border-bottom: 1px solid var(--border-light);
}
.zone-item .zone-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zone-item .zone-count { font-weight: 600; margin-left: 8px; font-variant-numeric: tabular-nums; }
.zone-item .zone-type { font-size: 0.6rem; color: var(--text-muted); margin-left: 6px; }
.zone-summary {
  border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px;
  font-size: 0.78rem;
}
.zone-summary .stat-row { display: flex;
  flex-direction: column; justify-content: space-between; padding: 2px 0; }

/* ============================================================
   QUALITY GRID
   ============================================================ */
.quality-grid { display: flex;
  flex-direction: column; flex-direction: column; gap: 8px; font-size: 0.8rem; }
.quality-card {
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.quality-card h4 { font-size: 0.85rem; margin-bottom: 6px; }
.quality-card .stat-row { display: flex;
  flex-direction: column; justify-content: space-between; padding: 3px 0; }
.quality-card .stat-label { color: var(--text-muted); }
.quality-card .stat-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.ok { color: var(--green); }
.warn { color: var(--yellow); }
.err { color: var(--red); }

/* ============================================================
   CHART AREA
   ============================================================ */
#chart-container h3 { font-size: 1rem; font-weight: 700; }
.chart-header {
  display: flex;
  flex-direction: column; justify-content: space-between; align-items: center;
  margin-bottom: 12px; flex-wrap: wrap; gap: 8px;
}
.chart-controls { display: flex;
  flex-direction: column; gap: 8px; }
.chart-controls select {
  padding: 5px 10px;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chart-controls select:hover { border-color: var(--primary); }
.chart-controls select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
#timeseries-chart { max-height: 280px; }
.chart-footer {
  display: flex;
  flex-direction: column; justify-content: space-between;
  font-size: 0.7rem; color: var(--text-muted); margin-top: 10px;
  flex-wrap: wrap; gap: 4px;
  font-variant-numeric: tabular-nums;
}
.chart-footer a { color: var(--primary); text-decoration: none; }
.chart-footer a:hover { text-decoration: underline; }

/* ============================================================
   LEAFLET POPUP
   ============================================================ */
.leaflet-popup-content-wrapper { border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.leaflet-popup-content { font-size: 0.82rem; margin: 10px 14px; }

/* ============================================================
   FILTER SELECT (shared)
   ============================================================ */
.filter-select {
  font-size: 0.82rem; padding: 5px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card-bg); color: var(--text);
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-select:hover { border-color: var(--primary); }
.filter-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* ============================================================
   SPINNER (nahmobi-style)
   ============================================================ */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 28px; height: 28px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner--small { width: 16px; height: 16px; border-width: 2px; }

/* ============================================================
   E-SCOOTER HOTSPOT GRID
   ============================================================ */
#hs-panel { margin: 0 0 24px; }
.hs-header {
  display: flex;
  flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.hs-header h3 { font-size: 1rem; font-weight: 700; margin-right: auto; }
.hs-limit-select {
  font-size: 0.72rem; padding: 2px 4px;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: var(--bg); color: var(--text-secondary); cursor: pointer;
}

/* Mode tabs */
.hs-mode-bar {
  display: flex;
  flex-direction: row; gap: 0; margin-bottom: 14px;
  padding: 0 2px; border-bottom: 1px solid var(--line);
  width: 100%;
}
.hs-mode-btn {
  position: relative; border: 0; border-radius: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 9px 14px 10px;
  font-size: 0.78rem; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
  user-select: none;
}
.hs-mode-btn::after { content: ""; position: absolute; right: 14px; bottom: -1px; left: 14px; height: 3px; border-radius: 3px 3px 0 0; background: transparent; }
.hs-mode-btn:disabled { color: var(--text-muted); opacity: 0.55; cursor: not-allowed; }
.hs-mode-btn:hover:not(:disabled) { color: var(--blue); background: rgba(10, 180, 255, 0.06); }
.hs-mode-btn:focus-visible { outline: 3px solid var(--primary-light); outline-offset: -2px; }
.hs-mode-btn.active { color: var(--blue); background: transparent; }
.hs-mode-btn.active::after { background: var(--cyan); }

/* Summary chips */
.hs-chips { display: flex;
  flex-direction: row; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.hs-chip {
  background: rgba(0, 180, 255, 0.12);
  border: 0;
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 0.76rem;
  color: var(--text);
  font-weight: 500;
}
.hs-chip-num { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* Legend */
.hs-legend { margin-bottom: 10px; }
.hs-legend .legend-title {
  font-size: 0.65rem; color: var(--text-muted);
  text-transform: uppercase; margin-bottom: 3px;
  font-weight: 600; letter-spacing: 0.04em;
}
.hs-legend-gradient {
  height: 6px;
  background: linear-gradient(to right, #fef9c3, #fbbf24, #f97316, #dc2626, #991b1b);
  border-radius: 3px;
}

/* Preview list */
.hs-preview-header {
  font-size: 0.65rem; color: var(--text-muted);
  text-transform: uppercase; margin-bottom: 4px;
  font-weight: 600; letter-spacing: 0.04em;
}
.hs-preview-row {
  display: grid;
  grid-template-columns: 26px minmax(44px, 0.8fr) minmax(112px, 1.6fr) auto;
  grid-template-areas: "rank bar stat badge" "rank bar sub badge";
  align-items: center; column-gap: 10px; row-gap: 1px;
  margin-bottom: 5px; padding: 8px 9px; font-size: 0.78rem;
  border: 1px solid transparent; border-radius: var(--radius-control);
  cursor: default;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.hs-preview-row:hover { background: var(--surface); border-color: var(--line); transform: translateX(2px); }
.hs-preview-rank { grid-area: rank; font-weight: 800; font-size: 0.9rem; min-width: 18px; text-align: center; }
.hs-preview-bar { grid-area: bar; width: 100%; flex-shrink: 0; }
.hs-preview-fill { display: block; width: auto; height: 7px; border-radius: var(--radius-pill); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05); }
.hs-preview-stat { grid-area: stat; color: var(--text); font-weight: 600; min-width: 0; font-variant-numeric: tabular-nums; }
.hs-preview-stat strong { font-weight: 700; }
.hs-preview-sub { grid-area: sub; font-size: 0.68rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hs-preview-row .hs-badge { grid-area: badge; align-self: center; }

/* Compare mode */
.hs-group-title {
  font-size: 0.7rem; font-weight: 700; margin-bottom: 4px;
  padding: 4px 6px; border-radius: 4px;
}
.hs-gainers { background: rgba(118, 183, 41, 0.12); color: var(--green); }
.hs-losers { background: rgba(239, 68, 68, 0.12); color: var(--red); }
.hs-compare-row {
  display: flex;
  flex-direction: column; align-items: center; gap: 6px;
  padding: 3px 6px; font-size: 0.78rem;
  border-bottom: 1px solid var(--border-light);
}
.hs-cmp-rank { font-weight: 600; color: var(--text-muted); min-width: 18px; }
.hs-cmp-stat { flex: 1; font-variant-numeric: tabular-nums; }
.hs-cmp-sub { font-size: 0.65rem; color: var(--text-muted); margin-left: 4px; }
.hs-cmp-delta { font-weight: 600; text-align: right; min-width: 50px; font-variant-numeric: tabular-nums; }
.hs-delta-pos { color: var(--green); }
.hs-delta-neg { color: var(--red); }
.hs-compare-empty { font-size: 0.82rem; color: var(--text-muted); padding: 10px 0; text-align: center; }

/* Tooltip + rank label on map */
.hs-tooltip { font-size: 0.72rem; white-space: nowrap; }
.hs-rank-label {
  font-size: 0.65rem !important;
  font-weight: 700 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #fff !important;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* Sort toggle — pill-style */
.hs-sort-bar {
  display: flex;
  flex-direction: column; align-items: center; gap: 4px;
  margin-bottom: 8px; font-size: 0.75rem;
}
.hs-sort-label { font-size: 0.65rem; color: var(--text-muted); margin-right: 4px; }
.hs-sort-btn {
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(0, 180, 255, 0.12);
  color: var(--text);
  padding: 5px 14px;
  font-size: 0.72rem; font-weight: 700;
  cursor: pointer; transition: all 0.15s;
}
.hs-sort-btn:hover { background: rgba(0, 180, 255, 0.20); }
.hs-sort-btn.active { background: var(--cyan); color: #1A1A1A; }
.hs-map-btn:hover { opacity: 0.88; }

/* Classification badges */
.hs-badge {
  display: inline-block;
  font-size: 0.62rem; font-weight: 600;
  padding: 1px 6px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
.hs-badge--durchgang { background: rgba(244, 145, 0, 0.12); color: #c2410c; }
.hs-badge--gemischt { background: rgba(10, 180, 255, 0.12); color: var(--blue); }
.hs-badge--langzeit { background: rgba(118, 183, 41, 0.12); color: #15803d; }

/* Kennzahl analysis table */
.hs-analysis { margin-bottom: 10px; }
.hs-analysis-title {
  font-size: 0.65rem; color: var(--text-muted);
  text-transform: uppercase; margin-bottom: 4px;
  font-weight: 600; letter-spacing: 0.04em;
}
.hs-analysis-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.72rem;
}
.hs-analysis-table th {
  text-align: center; padding: 4px 6px;
  font-size: 0.6rem; color: var(--text-muted); text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  font-weight: 600; letter-spacing: 0.04em;
}
.hs-analysis-table td {
  text-align: center; padding: 3px 6px;
  border-bottom: 1px solid var(--border-light);
  font-variant-numeric: tabular-nums;
}
.hs-analysis-table .hs-at-label {
  text-align: left; color: var(--text-secondary);
  font-weight: 500; white-space: nowrap;
}
.hs-analysis-table tbody tr:hover { background: var(--surface); }

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer {
  margin-top: auto; padding: 24px 0;
  background: var(--cyan); border-top: 0;
  flex-shrink: 0;
  width: 100vw; margin-left: calc(-50vw + 50%);
}
.footer-inner { display: flex;
  flex-direction: column; flex-direction: column; align-items: center; gap: 10px; }
.footer-main { font-size: 0.85rem; color: #1A1A1A; text-align: center; }
.footer-brand { font-weight: 700; }
.footer-data { display: block; font-size: 0.78rem; margin-top: 2px; color: rgba(26, 26, 26, 0.75); }
.footer-links { margin-top: 4px; }
.footer-links a { color: #1A1A1A; font-size: 0.78rem; text-decoration: underline; }
.footer-links a:hover { color: rgba(26, 26, 26, 0.7); }

/* ============================================================
   DARK MODE
   ============================================================ */
[data-theme="dark"] {
  --bg: #0B1220;
  --card-bg: #111827;
  --surface: #1A2332;
  --text: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --line: rgba(148, 163, 184, 0.22);
  --border-light: rgba(148, 163, 184, 0.14);
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.35);
  --shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .app-header,
[data-theme="dark"] .app-footer {
  color: #1A1A1A;
}
[data-theme="dark"] .app-header h1,
[data-theme="dark"] .header-meta,
[data-theme="dark"] .last-updated,
[data-theme="dark"] .footer-main {
  color: #1A1A1A;
}

[data-theme="dark"] .theme-toggle {
  background: rgba(255, 255, 255, 0.15);
  color: #1A1A1A;
}
[data-theme="dark"] .theme-toggle:hover { background: rgba(255, 255, 255, 0.25); }

/* Subtle border on cards in dark mode (shadows less visible) */
[data-theme="dark"] .chart-panel,
[data-theme="dark"] .kpi-card,
[data-theme="dark"] #map-container,
[data-theme="dark"] #map-filters {
  border: 1px solid rgba(148, 163, 184, 0.14);
}

/* Leaflet dark mode */
[data-theme="dark"] .leaflet-tile {
  filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7);
}
[data-theme="dark"] .leaflet-container {
  background: #0B1220;
}
[data-theme="dark"] #map-container {
  background: #0B1220;
}
[data-theme="dark"] #map-filters {
  background: rgba(17, 24, 39, 0.95);
}
[data-theme="dark"] .scooter-area-panel,
[data-theme="dark"] .scooter-area-result {
  background: rgba(17, 24, 39, 0.94);
  border-color: rgba(10, 180, 255, 0.35);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
}
[data-theme="dark"] .scooter-area-panel__eyebrow,
[data-theme="dark"] .scooter-area-result__eyebrow,
[data-theme="dark"] .scooter-area-result__total { color: var(--cyan); }
[data-theme="dark"] .scooter-area-button--primary { color: #10213b; }
[data-theme="dark"] .scooter-area-copy { background: var(--surface); }
[data-theme="dark"] .historical-controls { background: rgba(17, 24, 39, .95); border-color: rgba(10,180,255,.35); }
[data-theme="dark"] .leaflet-popup-content-wrapper {
  background: var(--card-bg);
  color: var(--text);
}

/* Dark mode pill/button adjustments */
[data-theme="dark"] .tab.active,
[data-theme="dark"] .hs-mode-btn.active,
[data-theme="dark"] .hs-sort-btn.active,
[data-theme="dark"] .hs-map-btn,
[data-theme="dark"] .pill.active {
  color: #1A1A1A;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  #kpi-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  #app { padding: 0 12px; }
  .header-inner h1 { font-size: 1.15rem; }
  #kpi-row { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .kpi-card { padding: 10px 14px; }
  .kpi-value { font-size: 1.3rem; }
  .tab-bar { width: 100%; overflow-x: auto; }
  .tab { flex-shrink: 0; }
  #map-container {
    height: auto;
    min-height: 0;
    overflow: visible;
    background: transparent;
    box-shadow: none;
  }
  #map {
    height: 380px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
  }
  #map-filters {
    position: static;
    width: 100%;
    max-height: none;
    overflow: visible;
    margin: 8px 0 0;
    box-shadow: var(--shadow-card);
  }
  #map-filters[hidden] { display: none; }
  .historical-controls { position: static; width: 100%; margin: 8px 0 0; }
  .scooter-area-workspace {
    position: static;
    width: 100%;
    margin-top: 10px;
    flex-direction: column;
  }
  #chart-container { padding: 14px; }
}
@media (max-width: 640px) {
  .header-inner {
  flex-direction: row; padding: 0 16px; }
  .header-logo { height: 28px; }
  .header-inner h1 { font-size: 1rem; }
  .header-left { gap: 12px; }
  .hs-preview-row {
    grid-template-columns: 24px minmax(42px, 0.65fr) minmax(0, 1.5fr);
    grid-template-areas: "rank bar stat" "rank bar sub" "rank badge badge";
  }
  .hs-preview-row .hs-badge { justify-self: start; }
  #map { height: 320px; }
  .scooter-area-panel { padding: 11px; }
  .scooter-area-panel__hint { margin: 5px 0 9px; font-size: 0.72rem; }
  .scooter-area-result__header { padding: 10px 11px 8px; }
  .scooter-area-result__content { padding: 9px 11px 11px; }
  .scooter-area-result__total { font-size: 1.45rem; }
}
@media (max-width: 480px) {
  .header-inner {
  flex-direction: row; flex-wrap: wrap; gap: 4px; height: auto; padding: 8px 12px; }
  .app-header { height: auto; }
  .header-right { margin-left: auto; }
  #kpi-row { grid-template-columns: 1fr 1fr; }
  #map { height: 280px; }
}


/* Chart in Parkverstöße — Höhe begrenzen */
#hotspots-list { overflow: hidden; }
#violation-timeline-chart {
  display: block !important;
  width: 100% !important;
  height: 220px !important;
  max-height: 220px;
}

/* Der Markenlink im Footer darf die Footer-Farbe nicht verlieren:
   global gilt `a { color: var(--primary) }`, und Cyan auf Cyan waere
   unlesbar. */
.footer-main a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.footer-main a:hover { color: rgba(26, 26, 26, 0.7); }

/* Keep the right-side legend below its dedicated control on desktop; on small
   screens both follow the established static panel flow beneath the map. */
#map-container > #map-filters { top: 60px; width: min(264px, calc(100% - 32px)); max-height: calc(100% - 76px); overflow-y: auto; }
#map-tools-panel > .scooter-area-workspace { display: flex; flex-direction: column; }
#map-tools-panel > .scooter-area-workspace > .scooter-area-panel { padding: 0; background: transparent; border-radius: 0; }
#map-filters .filter-group.filter-group--export { position: sticky; bottom: 0; z-index: 1; margin-top: 12px; padding: 12px 0 0; background: var(--card-bg); box-shadow: 0 -8px 0 var(--card-bg); }
#map-container > #map-filters[hidden] { display: none; }
@media (max-width: 768px) {
  .map-legend-toggle { position: static; margin: 8px 0 0 auto; }
  #map-container > #map-filters { top: auto; width: 100%; max-height: none; overflow: visible; }
}
