/* ==========================================================================
   Leitstellen Manager – Oberfläche
   Dunkles Dashboard (Standard) und heller Modus über [data-theme]
   ========================================================================== */

:root {
  --bg: #0b1017;
  --bg-elev: #0f1620;
  --surface: #131b27;
  --surface-2: #182231;
  --surface-3: #1f2b3d;
  --hover: #1c2738;
  --border: #223047;
  --border-strong: #2e3f59;
  --text: #e6ecf3;
  --text-2: #a7b4c6;
  --text-3: #73849c;
  --accent: #e5484d;
  --accent-strong: #f0595e;
  --accent-soft: rgba(229, 72, 77, 0.14);
  --blue: #4c8dff;
  --blue-soft: rgba(76, 141, 255, 0.15);
  --green: #33b679;
  --green-soft: rgba(51, 182, 121, 0.15);
  --amber: #e2a42b;
  --amber-soft: rgba(226, 164, 43, 0.16);
  --orange: #f0803c;
  --orange-soft: rgba(240, 128, 60, 0.16);
  --violet: #9b85ff;
  --violet-soft: rgba(155, 133, 255, 0.16);
  --gray: #7b8aa1;
  --gray-soft: rgba(123, 138, 161, 0.16);
  --org-fw: #e5484d;
  --org-rd: #f0a03c;
  --org-pol: #4c8dff;
  --org-thw: #2eb3d6;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  --sidebar-w: 232px;
  --topbar-h: 60px;
  --focus: 0 0 0 3px rgba(76, 141, 255, 0.45);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #eef1f5;
  --bg-elev: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f5f7fa;
  --surface-3: #eaeef4;
  --hover: #eef2f7;
  --border: #dde3eb;
  --border-strong: #c9d2de;
  --text: #16202c;
  --text-2: #4a5a6e;
  --text-3: #74839a;
  --accent: #d63c42;
  --accent-strong: #c2343a;
  --accent-soft: rgba(214, 60, 66, 0.1);
  --blue: #2f6fe0;
  --blue-soft: rgba(47, 111, 224, 0.1);
  --green: #1f9a62;
  --green-soft: rgba(31, 154, 98, 0.12);
  --amber: #b07a0a;
  --amber-soft: rgba(176, 122, 10, 0.12);
  --orange: #c9601f;
  --orange-soft: rgba(201, 96, 31, 0.12);
  --violet: #6b55d9;
  --violet-soft: rgba(107, 85, 217, 0.12);
  --gray: #6b7a90;
  --gray-soft: rgba(107, 122, 144, 0.12);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.08);
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--blue);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
h4 { font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }

p { margin: 0 0 8px; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.muted { color: var(--text-2); }
.subtle { color: var(--text-3); font-size: 12px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.gap-lg { gap: 16px; }
.mt { margin-top: 12px; }
.mt-lg { margin-top: 20px; }
.mb { margin-bottom: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- Boot */
.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
}
.boot-logo img { animation: pulse 1.6s ease-in-out infinite; }
.boot-text { color: var(--text-2); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* ---------------------------------------------------------------- Shell */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.brand img { width: 30px; height: 30px; }
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--text-3); letter-spacing: 0.04em; text-transform: uppercase; }

.nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a.active {
  background: var(--surface-3);
  color: var(--text);
}
.nav a.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.nav a.active svg { color: var(--accent); }
.nav .nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.nav .nav-sep { height: 1px; background: var(--border); margin: 8px 6px; }
.nav a.tutorial-focus { box-shadow: inset 0 0 0 1px var(--amber); animation: glow 1.8s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { box-shadow: inset 0 0 0 1px var(--amber); }
  50% { box-shadow: inset 0 0 0 1px transparent; }
}

.sidebar-foot {
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-3);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .page-title { font-size: 16px; font-weight: 650; }
.topbar .spacer { flex: 1; }
.topbar .menu-toggle { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chip svg { color: var(--text-3); }
.chip.credits svg { color: var(--amber); }
.chip.coins svg { color: var(--violet); }
.chip.flash { animation: flash 0.9s ease-out; }
@keyframes flash {
  0% { border-color: var(--green); }
  100% { border-color: var(--border); }
}

.level-chip { min-width: 150px; }
.level-chip .lvl { color: var(--text-2); font-weight: 600; }
.level-chip .bar { flex: 1; min-width: 54px; }

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: var(--hover); }
.icon-btn .dot {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.user-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px 0 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
}
.user-btn:hover { background: var(--hover); }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--accent);
  flex: 0 0 auto;
}
.avatar.lg { width: 44px; height: 44px; border-radius: 10px; }

.view {
  padding: 20px;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}
.view.full { max-width: none; padding: 0; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.page-head p { margin: 4px 0 0; color: var(--text-2); }

/* ---------------------------------------------------------------- Dropdown */
.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(380px, calc(100vw - 24px));
  max-height: min(520px, calc(100vh - 90px));
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 60;
}
.dropdown-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.menu-list { padding: 6px; }
.menu-list button,
.menu-list a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.menu-list button:hover,
.menu-list a:hover { background: var(--hover); }

.notif {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.notif:hover { background: var(--hover); }
.notif.unread { background: color-mix(in srgb, var(--blue-soft) 60%, transparent); }
.notif .notif-icon { flex: 0 0 auto; margin-top: 2px; color: var(--text-3); }
.notif .notif-title { font-weight: 600; }
.notif .notif-text { color: var(--text-2); font-size: 13px; }
.notif .notif-time { color: var(--text-3); font-size: 11.5px; }

/* ---------------------------------------------------------------- Panels & Cards */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.grid.dash { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.panel-head h2 svg { color: var(--text-3); }
.panel-body { padding: 14px 16px; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--border); }

.kpi {
  position: relative;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.kpi .kpi-label { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.kpi .kpi-value { margin-top: 6px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { margin-top: 2px; font-size: 12px; color: var(--text-3); }
.kpi.accent { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.kpi.accent .kpi-value { color: var(--accent-strong); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-width: 0;
}
.card.clickable { cursor: pointer; transition: border-color 0.12s, background 0.12s; }
.card.clickable:hover { border-color: var(--border-strong); background: var(--surface-2); }

.empty {
  padding: 26px 16px;
  text-align: center;
  color: var(--text-3);
}
.empty svg { display: block; margin: 0 auto 8px; opacity: 0.6; }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
  text-decoration: none;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled,
.btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.success { background: var(--green); border-color: var(--green); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); color: var(--accent-strong); }
.btn.danger:hover { background: var(--accent-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: 12px; gap: 5px; }
.btn.block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; }

.btn-group { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.btn-group button {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.btn-group button:last-child { border-right: 0; }
.btn-group button.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  opacity: 0.8;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- Forms */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span,
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .error-text { font-size: 12.5px; color: var(--accent-strong); }
.input,
.select,
.textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  transition: border-color 0.12s;
}
.textarea { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; }
.input:focus,
.select:focus,
.textarea:focus { border-color: var(--blue); box-shadow: var(--focus); outline: none; }
.input.invalid { border-color: var(--accent); }
.input.sm, .select.sm { height: 32px; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .span-2 { grid-column: span 2; }

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex: 0 0 auto;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 11px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  transition: background 0.15s;
  cursor: pointer;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + span { background: var(--green); border-color: var(--green); }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + span { box-shadow: var(--focus); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.toolbar .input,
.toolbar .select { height: 34px; width: auto; min-width: 140px; }
.toolbar .search { min-width: 200px; flex: 1 1 200px; max-width: 320px; }

/* ---------------------------------------------------------------- Badges & Status */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--gray-soft);
  color: var(--text-2);
}
.badge.red { background: var(--accent-soft); color: var(--accent-strong); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.violet { background: var(--violet-soft); color: var(--violet); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); }
.badge.planned { background: transparent; border: 1px dashed var(--border-strong); color: var(--text-3); }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--gray); flex: 0 0 auto; }

.fms {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
  font-family: var(--mono);
  color: #fff;
  background: var(--gray);
  flex: 0 0 auto;
}

.st-available { --st: var(--green); }
.st-alarmed, .st-en_route { --st: var(--amber); }
.st-on_scene { --st: var(--accent); }
.st-finished { --st: var(--violet); }
.st-returning { --st: var(--blue); }
.st-out_of_service { --st: var(--gray); }
.st-not_ready { --st: #8a5a5c; }
.fms[class*="st-"],
.status-dot[class*="st-"] { background: var(--st); }

.ms-new { --ms: var(--accent); }
.ms-dispatched { --ms: var(--amber); }
.ms-on_scene { --ms: var(--orange); }
.ms-in_progress { --ms: var(--green); }

.org-fw { --org: var(--org-fw); }
.org-rd { --org: var(--org-rd); }
.org-pol { --org: var(--org-pol); }
.org-thw { --org: var(--org-thw); }
.org-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--org);
  background: color-mix(in srgb, var(--org) 15%, transparent);
}

.stars { color: var(--amber); letter-spacing: 1px; font-size: 12px; }
.stars .off { color: var(--border-strong); }

/* ---------------------------------------------------------------- Progress */
.bar {
  position: relative;
  height: 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar > i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 3px;
  background: var(--blue);
  transition: width 0.6s ease;
}
.bar.green > i { background: var(--green); }
.bar.red > i { background: var(--accent); }
.bar.amber > i { background: var(--amber); }
.bar.lg { height: 9px; border-radius: 5px; }

/* ---------------------------------------------------------------- Tables & Lists */
.table-wrap { overflow-x: auto; }
table.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  position: sticky;
  top: 0;
  padding: 9px 12px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th .sort-ind { margin-left: 4px; opacity: 0.7; }
.table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--hover); }
.table tr.clickable { cursor: pointer; }
.table tr.self td { background: var(--blue-soft); }
.table td.actions { text-align: right; white-space: nowrap; }

.list { display: flex; flex-direction: column; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.list-item:last-child { border-bottom: 0; }
.list-item.clickable { cursor: pointer; }
.list-item.clickable:hover { background: var(--hover); }

.mission-row .ms-bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--ms); flex: 0 0 auto; }
.mission-row .title { font-weight: 600; }
.mission-row .meta { color: var(--text-3); font-size: 12.5px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }

.event-line { display: flex; gap: 10px; padding: 7px 16px; font-size: 13px; border-bottom: 1px solid var(--border); }
.event-line:last-child { border-bottom: 0; }
.event-line time { color: var(--text-3); font-family: var(--mono); font-size: 12px; flex: 0 0 auto; padding-top: 1px; }

/* ---------------------------------------------------------------- Tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs button {
  padding: 9px 14px;
  border: 0;
  background: none;
  color: var(--text-2);
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------------- Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 8, 12, 0.6);
  animation: fadein 0.12s ease-out;
}
.modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: rise 0.14s ease-out;
}
.modal.wide { width: min(980px, 100%); }
.modal.medium { width: min(720px, 100%); }
.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 16px 18px; overflow: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
@keyframes fadein { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

/* ---------------------------------------------------------------- Toasts */
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toasts { z-index: 2100; }
.toast {
  display: flex;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--blue);
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: rise 0.18s ease-out;
  cursor: default;
}
.toast.clickable { cursor: pointer; }
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--accent); }
.toast.warn { border-left-color: var(--amber); }
.toast.mission { border-left-color: var(--accent); }
.toast .t-title { font-weight: 650; }
.toast .t-text { color: var(--text-2); font-size: 13px; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all 0.25s; }

/* ---------------------------------------------------------------- Banner */
.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--amber) 40%, var(--border));
  background: var(--amber-soft);
  color: var(--text);
  font-size: 13px;
}
.banner svg { color: var(--amber); flex: 0 0 auto; margin-top: 1px; }
.banner.info { border-color: color-mix(in srgb, var(--blue) 40%, var(--border)); background: var(--blue-soft); }
.banner.info svg { color: var(--blue); }
.banner.danger { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: var(--accent-soft); }
.banner.danger svg { color: var(--accent); }

/* ---------------------------------------------------------------- Welcome */
.welcome {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 480px);
}
.welcome-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px;
  background:
    radial-gradient(circle at 20% 15%, rgba(229, 72, 77, 0.10), transparent 40%),
    linear-gradient(180deg, var(--bg-elev), var(--bg));
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.welcome-hero .grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.35;
  mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
  pointer-events: none;
}
.welcome-hero > * { position: relative; }
.welcome-hero h1 { font-size: 38px; line-height: 1.12; letter-spacing: -0.025em; max-width: 560px; }
.welcome-hero .lead { margin-top: 14px; font-size: 16px; color: var(--text-2); max-width: 520px; }
.feature-list { display: grid; gap: 12px; margin-top: 28px; max-width: 520px; }
.feature { display: flex; gap: 12px; align-items: flex-start; }
.feature .f-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--accent);
  flex: 0 0 auto;
}
.feature strong { display: block; }
.feature span { color: var(--text-2); font-size: 13.5px; }
.radio-feed {
  margin-top: 32px;
  max-width: 520px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--mono);
  font-size: 12.5px;
}
.radio-feed div { padding: 7px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.radio-feed div:last-child { border-bottom: 0; }
.radio-feed b { color: var(--text); font-weight: 600; }
.welcome-side {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
  padding: 40px 36px;
}
.auth-card { padding: 22px; }

/* ---------------------------------------------------------------- Map */
.map-page {
  position: relative;
  height: calc(100vh - var(--topbar-h));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
}
.map-page .map { position: relative; min-height: 300px; }
.map-side {
  border-left: 1px solid var(--border);
  background: var(--bg-elev);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.map-side .list { overflow-y: auto; }
.map-el { position: absolute; inset: 0; background: var(--surface-2); }
.mini-map { height: 280px; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; background: var(--surface-2); }

.leaflet-container { font: 13px/1.4 var(--font); background: var(--surface-2); }
.leaflet-control-attribution { font-size: 10.5px; }
[data-theme="dark"] .leaflet-control-attribution { background: rgba(12, 17, 24, 0.75) !important; color: var(--text-2); }
[data-theme="dark"] .leaflet-control-attribution a { color: var(--blue); }
[data-theme="dark"] .leaflet-bar a { background: var(--surface); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .leaflet-bar a:hover { background: var(--hover); }
[data-theme="dark"] .leaflet-tile-pane.osm { filter: brightness(0.78) contrast(1.05) saturate(0.75); }
.leaflet-popup-content-wrapper,
.leaflet-popup-tip { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); box-shadow: var(--shadow); }
.leaflet-popup-content { margin: 10px 12px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-3); }

.map-overlay {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  font-size: 12.5px;
  min-width: 170px;
}
.map-overlay h4 { margin-bottom: 6px; }
.map-overlay .legend-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}
.map-overlay .legend-body { margin-top: 8px; }
.map-overlay.collapsed .legend-body { display: none; }
.map-overlay.collapsed .legend-toggle svg { transform: rotate(-90deg); }
.map-overlay .legend-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; color: var(--text-2); }
.map-notice {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  z-index: 500;
  max-width: calc(100% - 24px);
}

.mk {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: #fff;
  background: var(--org, var(--gray));
  border: 2px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}
.mk.construction { opacity: 0.6; border-style: dashed; }
.mk.leitstelle { background: #2a3a52; color: var(--accent); }
.mk-mission {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--ms, var(--accent));
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.mk-mission > span { transform: rotate(45deg); display: grid; place-items: center; color: #fff; }
.mk-mission.ms-new { animation: beacon 1.4s ease-in-out infinite; }
@keyframes beacon {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 72, 77, 0.6), 0 2px 8px rgba(0, 0, 0, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(229, 72, 77, 0), 0 2px 8px rgba(0, 0, 0, 0.5); }
}
.mk-veh {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--org, var(--gray));
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}
.mk-veh.st-returning { border-color: #9ec1ff; }
.mk-veh.st-on_scene { border-color: #ffd1d2; }
.mk-veh.theme-mono { background: #d6dbe3; border-color: #2a3442; }
.mk-veh.theme-night { background: #1f3b78; border-color: #9ec1ff; }
.mk-veh.theme-signal { background: #f2c230; border-color: #1c2430; }

/* ---------------------------------------------------------------- Mission modal */
.mission-head-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.req-table td, .req-table th { padding: 7px 10px; }
.req-ok { color: var(--green); }
.req-miss { color: var(--accent-strong); }
.req-coming { color: var(--amber); }
.alarm-list { max-height: 360px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.alarm-list .table th { background: var(--surface-2); }
.alarm-list tr.selected td { background: var(--accent-soft); }
.alarm-sticky {
  position: sticky;
  bottom: -16px;
  margin: 12px -18px -16px;
  padding: 12px 18px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.suit-needed { color: var(--green); font-weight: 600; }
.suit-staff { color: var(--blue); font-weight: 600; }
.suit-covered { color: var(--text-2); }
.suit-none { color: var(--text-3); }

/* ---------------------------------------------------------------- Tutorial */
.tutorial-card {
  position: fixed;
  left: calc(var(--sidebar-w) + 20px);
  bottom: 20px;
  z-index: 1120;
  width: min(380px, calc(100vw - 32px));
  padding: 16px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--amber) 50%, var(--border-strong));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  animation: rise 0.2s ease-out;
}
.tutorial-card.minimized { width: auto; padding: 4px; }
.tutorial-card .t-step { font-size: 11.5px; color: var(--amber); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.tutorial-card h3 { margin: 4px 0 6px; }
.tutorial-card p { color: var(--text-2); font-size: 13.5px; }

/* ---------------------------------------------------------------- Chat */
.chat { display: flex; flex-direction: column; height: 460px; }
.chat-log { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg .who { font-weight: 650; }
.chat-msg .when { color: var(--text-3); font-size: 11.5px; margin-left: 6px; }
.chat-msg .text { color: var(--text); white-space: pre-wrap; word-break: break-word; }
.chat-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }

/* ---------------------------------------------------------------- Shop */
.shop-item { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.shop-item .preview { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 12px; background: var(--surface-3); color: var(--accent); }

/* ---------------------------------------------------------------- Bars chart */
.hbar { display: grid; grid-template-columns: minmax(110px, 180px) 1fr 48px; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.hbar .bar { height: 8px; }

/* ---------------------------------------------------------------- Maintenance */
.fullscreen-note {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.fullscreen-note .panel { max-width: 520px; padding: 28px; text-align: center; }

/* ---------------------------------------------------------------- Fahrzeugsymbole */
.veh-icon {
  --vb: #d7262e;
  --vs: #ffffff;
  --vw: #cfe6ff;
  --vc: #d7262e;
  --vo: rgba(0, 0, 0, 0.42);
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  line-height: 0;
}
.veh-icon.org-rd { --vb: #f5f5f2; --vs: #ea6a12; --vc: #d7262e; --vo: rgba(0, 0, 0, 0.35); }
.veh-icon.org-pol { --vb: #e9eef4; --vs: #1f4fd1; --vo: rgba(0, 0, 0, 0.35); }
.veh-icon.org-thw { --vb: #1f4aa8; --vs: #ffffff; --vo: rgba(255, 255, 255, 0.55); }
.veh-icon.theme-mono { --vb: #d6dbe3; --vs: #2a3442; --vc: #2a3442; }
.veh-icon.theme-night { --vb: #1f3b78; --vs: #9ec1ff; --vc: #9ec1ff; --vo: rgba(255, 255, 255, 0.45); }
.veh-icon.theme-signal { --vb: #f2c230; --vs: #1c2430; --vc: #1c2430; }
.veh-svg { overflow: visible; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.55)); }
.veh-svg .vb { fill: var(--vb); stroke: rgba(0, 0, 0, 0.55); stroke-width: 0.7; }
.veh-svg .vs { fill: var(--vs); }
.veh-svg .vw { fill: var(--vw); }
.veh-svg .vc { fill: var(--vc); }
.veh-svg .vo { fill: none; stroke: var(--vo); }
.veh-svg .vk { fill: none; stroke: #f0b429; }
.veh-svg .vt { fill: #1b1f27; }
.veh-svg .vh { fill: #9aa3ae; }
.veh-svg .vl { fill: #3d8bff; }
.mk-vehicle .veh-svg .vl { animation: beaconlight 0.9s steps(2, jump-none) infinite; }
@keyframes beaconlight {
  0% { fill: #3d8bff; }
  100% { fill: #bcd6ff; }
}
.flip .veh-svg { transform: scaleX(-1); }
.veh-pip {
  position: absolute;
  top: -3px;
  left: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  background: var(--st, var(--gray));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.mk-vehicle { cursor: pointer; }
.legend-vehicles { gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Rechtliches */
.legal-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; }
.legal-links a { color: var(--text-2); }
.legal-links a:hover { color: var(--text); }
.legal-links.center { justify-content: center; }
.sidebar-legal { margin-bottom: 8px; font-size: 11.5px; gap: 2px 10px; }
.sidebar-legal a { color: var(--text-3); }
.dropdown-foot { padding: 10px 14px; border-top: 1px solid var(--border); }
.mobile-legal { display: none; }
.hero-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.legal-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.legal-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.legal-brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; text-decoration: none; }
.legal-brand:hover { text-decoration: none; }
.legal-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.legal-nav a { padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 600; font-size: 13.5px; }
.legal-nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.legal-nav a.active { background: var(--surface-3); color: var(--text); }
.legal { width: 100%; max-width: 820px; margin: 0 auto; padding: 28px 18px 40px; line-height: 1.65; }
.legal h1 { font-size: 28px; margin-bottom: 18px; }
.legal h2 { font-size: 18px; margin: 28px 0 8px; }
.legal p, .legal li { color: var(--text-2); }
.legal strong { color: var(--text); }
.legal ul { padding-left: 20px; margin: 0 0 10px; }
.legal li { margin-bottom: 4px; }
.legal .banner { margin-bottom: 16px; }
.legal-updated { margin-top: 32px; }
.legal-foot { padding: 0 18px 32px; max-width: 820px; width: 100%; margin: 0 auto; }

/* ---------------------------------------------------------------- Registrierung */
.pick-map { height: 280px; margin-top: 8px; }
.search-row { gap: 6px; }
.search-row .input { flex: 1; }
.place-results {
  display: flex;
  flex-direction: column;
  margin-top: 6px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
}
.place-result {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 13.5px;
}
.place-result:hover { background: var(--hover); }
.place-result svg { color: var(--accent); flex: 0 0 auto; margin-top: 2px; }
.place-attrib { padding: 6px 10px; font-size: 11px; }
.terms-check { align-items: flex-start; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.terms-check input { margin-top: 2px; flex: 0 0 auto; }

/* ---------------------------------------------------------------- Navigation (Tablet/Handy) */
.nav-short { display: none; }
.bottom-nav { display: none; }
.sheet-grip { display: none; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1200px) {
  .grid.dash { grid-template-columns: minmax(0, 1fr); }
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Karte: Einsatzliste als ausklappbares Bottom-Sheet unterhalb von 1024 px */
@media (max-width: 1023px) {
  .map-page { display: block; height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); }
  .map-page .map { position: absolute; inset: 0; }
  .map-side {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 600;
    max-height: 52px;
    border: 1px solid var(--border-strong);
    border-bottom: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
    transition: max-height 0.22s ease;
    overflow: hidden;
  }
  .map-side.open { max-height: 58%; }
  .map-side .sheet-head { position: relative; cursor: pointer; min-height: 52px; padding-top: 16px; }
  .sheet-grip { display: block; position: absolute; top: 6px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--border-strong); }
  .map-side .list { overflow-y: auto; }
  .map-page .map { z-index: 0; }
  .map-page .leaflet-bottom { bottom: 56px; transition: bottom 0.22s ease; }
  .map-page.sheet-open .leaflet-bottom { bottom: calc(58% + 6px); }
  body[data-route="karte"] .tutorial-card { bottom: auto; top: calc(var(--topbar-h) + 10px); }
}

/* Tablet: schmale Navigationsleiste mit Symbolen und Kurzbezeichnungen */
@media (min-width: 721px) and (max-width: 1100px) {
  :root { --sidebar-w: 84px; }
  .brand { justify-content: center; padding: 0; }
  .brand > div { display: none; }
  .nav { padding: 8px 6px; gap: 2px; }
  .nav a { flex-direction: column; gap: 3px; padding: 8px 2px 7px; text-align: center; font-size: 11px; line-height: 1.15; }
  .nav a .nav-label { display: none; }
  .nav a .nav-short { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav a.active::before { left: -6px; }
  .nav .nav-badge { position: absolute; top: 3px; right: 8px; margin: 0; min-width: 17px; line-height: 16px; font-size: 10px; padding: 0 4px; }
  .nav .nav-sep { margin: 6px 10px; }
  .sidebar-foot { display: none; }
  .tutorial-card { left: calc(var(--sidebar-w) + 16px); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .welcome { grid-template-columns: minmax(0, 1fr); }
  .welcome-hero { border-right: 0; border-bottom: 1px solid var(--border); padding: 32px 28px; }
  .welcome-hero h1 { font-size: 30px; }
  .radio-feed { display: none; }
  .welcome-side { padding: 28px; max-width: 640px; width: 100%; margin: 0 auto; }
  .modal.wide { width: min(980px, calc(100vw - 24px)); }
}

/* Handy */
@media (max-width: 720px) {
  :root { --bottom-nav-h: 60px; }
  .shell { grid-template-columns: minmax(0, 1fr); padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(290px, 86vw);
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 1200;
  }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1150;
    background: rgba(0, 0, 0, 0.5);
  }
  .nav a { padding: 11px 12px; }
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg-elev) 94%, transparent);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
  }
  .bottom-nav a,
  .bottom-nav button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: none;
    color: var(--text-3);
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
  }
  .bottom-nav a.active { color: var(--accent-strong); }
  .bottom-nav a.active::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 2px; border-radius: 0 0 2px 2px; background: var(--accent); }
  .bottom-nav .nav-badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10px; line-height: 16px; text-align: center; }

  .view { padding: 14px 12px; }
  .topbar { padding: 0 10px; gap: 6px; padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
  .topbar .menu-toggle { display: none; }
  .topbar .page-title { display: block; font-size: 15px; max-width: 32vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .level-chip { min-width: 0; }
  .level-chip .bar, .level-chip .subtle { display: none; }
  .chip { padding: 0 8px; height: 34px; font-size: 13px; }
  .user-btn { padding: 0 4px; }
  .user-btn .uname { display: none; }
  .page-head { margin-bottom: 12px; }
  .page-head h1 { font-size: 20px; }
  .page-head > .row { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; scrollbar-width: none; }
  .page-head > .row::-webkit-scrollbar { display: none; }
  .page-head > .row .btn { flex: 0 0 auto; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 11px 12px; }
  .kpi .kpi-value { font-size: 19px; }
  .kpi .kpi-sub { font-size: 11.5px; }
  .grid.cards { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .toolbar { gap: 6px; }
  .toolbar .input, .toolbar .select, .toolbar .search { min-width: 0; max-width: none; flex: 1 1 calc(50% - 6px); }
  .toolbar .search { flex-basis: 100%; }
  .hide-sm { display: none !important; }
  .table td, .table th { padding: 8px 9px; }
  .hbar { grid-template-columns: 100px 1fr 40px; }
  .panel-head { padding: 11px 12px; }
  .panel-body { padding: 12px; }
  .list-item { padding: 11px 12px; }
  /* Eingabefelder ≥16 px verhindern das automatische Zoomen auf iOS */
  .input, .select, .textarea { font-size: 16px; }

  /* Tabellen als Karten */
  .table.stack-mobile thead { display: none; }
  .table.stack-mobile, .table.stack-mobile tbody { display: block; }
  .table.stack-mobile tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2px 10px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
  }
  .table.stack-mobile td { display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none !important; min-width: 0; }
  .table.stack-mobile td.cell-check { grid-row: 1 / span 6; align-self: start; padding-top: 2px; }
  .table.stack-mobile td.cell-title { display: block; }
  .table.stack-mobile td[data-label]::before { content: attr(data-label); flex: 0 0 92px; color: var(--text-3); font-size: 12px; }
  .table.stack-mobile td[data-label].hide-sm { display: none !important; }

  /* Dialoge als Vollbild-Ansicht */
  .modal-backdrop { padding: 0; place-items: stretch; }
  .modal, .modal.wide, .modal.medium {
    width: 100%;
    max-height: none;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
  .modal-head { padding: calc(12px + env(safe-area-inset-top)) 14px 12px; position: sticky; top: 0; }
  .modal-body { padding: 14px; flex: 1; }
  .modal-foot { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 auto; }
  .alarm-sticky { bottom: -14px; margin: 12px -14px -14px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .alarm-sticky .subtle { display: none; }
  .alarm-list { max-height: none; }
  .mission-head-meta .badge { font-size: 11.5px; }

  .toasts { bottom: calc(var(--bottom-nav-h) + 10px + env(safe-area-inset-bottom)); right: 10px; left: 10px; width: auto; }
  .tutorial-card { left: 10px; right: 10px; width: auto; bottom: calc(var(--bottom-nav-h) + 10px + env(safe-area-inset-bottom)); padding: 12px 14px; }
  .tutorial-card.minimized { right: auto; }
  body[data-route="karte"] .tutorial-card { bottom: auto; top: calc(var(--topbar-h) + env(safe-area-inset-top) + 8px); }
  .dropdown { position: fixed; top: calc(var(--topbar-h) + env(safe-area-inset-top) + 4px); left: 8px; right: 8px; width: auto; max-height: calc(100dvh - var(--topbar-h) - var(--bottom-nav-h) - 24px); }

  .map-page { height: calc(100vh - var(--topbar-h) - var(--bottom-nav-h)); height: calc(100dvh - var(--topbar-h) - var(--bottom-nav-h) - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .map-side.open { max-height: 64%; }
  .map-page.sheet-open .leaflet-bottom { bottom: calc(64% + 6px); }
  .map-overlay { max-width: calc(100vw - 24px); }

  .welcome { grid-template-columns: minmax(0, 1fr); }
  .welcome-hero { border-right: 0; border-bottom: 1px solid var(--border); padding: calc(18px + env(safe-area-inset-top)) 16px 18px; gap: 10px; }
  .welcome-hero h1 { font-size: 23px; }
  .welcome-hero .lead { font-size: 14.5px; margin-top: 8px; }
  .welcome-hero .feature-list, .radio-feed, .hero-foot { display: none; }
  .welcome-side { padding: 16px 12px calc(28px + env(safe-area-inset-bottom)); }
  .auth-card { padding: 16px; }
  .mobile-legal { display: flex; }
  .pick-map { height: 240px; }

  .chat { height: calc(100dvh - 260px); min-height: 320px; }
  .legal { padding: 20px 14px 32px; }
  .legal h1 { font-size: 23px; }
  .legal-head { padding: 10px 12px; }
}

@media (max-width: 420px) {
  .chip.coins { display: none; }
  .topbar .page-title { display: none; }
  .bottom-nav a, .bottom-nav button { font-size: 10.5px; }
}

/* Touch-Geräte: größere Bedienflächen */
@media (pointer: coarse) {
  .btn { min-height: 40px; }
  .btn.sm { min-height: 36px; height: auto; }
  .btn.xs { min-height: 32px; height: auto; padding: 0 10px; }
  .icon-btn { width: 40px; height: 40px; }
  .check input { width: 20px; height: 20px; }
  .table input[type="checkbox"] { width: 20px; height: 20px; }
  .tabs button { padding: 11px 14px; }
  .btn-group button { height: 38px; }
  .leaflet-touch .leaflet-bar a { width: 36px; height: 36px; line-height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
