:root {
  --brand: #0f766e;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --moving: #16a34a;
  --stopped: #2563eb;
  --offline: #9ca3af;
  --warn: #d97706;
  --danger: #b91c1c;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(17, 24, 39, .12);
  --tint: color-mix(in srgb, var(--brand) 10%, #fff);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); font-size: 14px; line-height: 1.4; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 13px; margin: 24px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 1px; }
.muted { color: var(--muted); margin: 0; }
.hint { color: var(--muted); font-size: 12px; margin: 0; font-weight: 400; }
.empty { padding: 24px 12px; color: var(--muted); text-align: center; margin: 0; }
.notice { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; border-radius: 8px; padding: 10px 12px; margin: 0; }
.icon { width: 22px; height: 22px; }

/* ---------- Bausteine ---------- */

input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="date"], input[type="time"], select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
}
input:disabled { opacity: .5; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); font-weight: 600; text-decoration: none; color: var(--text);
}
.btn:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); }
.btn-small { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--brand); font-weight: 600; padding: 6px; align-self: center; }
.icon-btn { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--muted); padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--bg); color: var(--text); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; border: 0; padding: 0; margin: 0; min-width: 0; }
.field legend { padding: 0; margin-bottom: 6px; }
.field .check { font-weight: 400; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form-error, .form-note { margin: 0; }
.form-error { color: var(--danger); }
.form-note:not(.form-error) { color: #15803d; }
.check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.check input { width: auto; }
.range { display: flex; align-items: center; gap: 8px; color: var(--muted); }
input[type="range"] { width: 100%; accent-color: var(--brand); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  font-size: 13px; font-weight: 550;
}
.chips button.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.tabs { display: flex; gap: 16px; border-bottom: 1px solid var(--line); }
.tabs button {
  background: none; border: 0; padding: 10px 2px; color: var(--muted); font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--text); border-color: var(--brand); }

.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.chip-moving { background: color-mix(in srgb, var(--moving) 14%, #fff); color: #15803d; }
.chip-stopped { background: color-mix(in srgb, var(--stopped) 12%, #fff); color: #1d4ed8; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--offline); }
.dot-moving { background: var(--moving); box-shadow: 0 0 0 4px color-mix(in srgb, var(--moving) 20%, transparent); }
.dot-stopped { background: var(--stopped); }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tiles div { background: var(--bg); border-radius: 8px; padding: 10px 6px; text-align: center; }
.tiles strong { display: block; font-size: 15px; }
.tiles span { color: var(--muted); font-size: 12px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
td.row-actions { display: table-cell; text-align: right; white-space: nowrap; }
td.row-actions .btn { margin-left: 4px; }

.dialog { border: 0; border-radius: 16px; padding: 24px; width: min(440px, calc(100vw - 32px)); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(17, 24, 39, .45); }

.toasts {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 2000;
  display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: min(420px, calc(100vw - 32px));
}
.toast { background: #111827; color: #fff; padding: 12px 14px; border-radius: 10px; box-shadow: var(--shadow); }
.toast-warn { background: #92400e; }
.toast-error { background: var(--danger); }

/* ---------- Marke und Anmeldung ---------- */

.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; }
.brand-mark {
  width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
}
.brand-mark.has-logo { background: none; }
.brand-mark img { max-width: 100%; max-height: 100%; }

.login {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 16%, #fff), var(--bg) 60%);
}
.login-card { width: 100%; max-width: 400px; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 32px; }
.login-card h1 { font-size: 22px; margin-top: 24px; }
.demo-hint { font-size: 12px; text-align: center; }
.legal { margin: 20px 0 0; text-align: center; font-size: 12px; color: var(--muted); }
.legal:empty { display: none; }

/* ---------- Grundgerüst ---------- */

.app { height: 100%; display: grid; grid-template-columns: 84px 1fr; }
.nav {
  background: var(--panel); border-right: 1px solid var(--line); padding: 14px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 18px; min-height: 0;
}
.nav-items { display: flex; flex-direction: column; gap: 4px; width: 100%; flex: 1; }
.nav-items a {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 2px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
}
.nav-items a:hover { background: var(--bg); color: var(--text); }
.nav-items a.is-active { background: var(--tint); color: var(--brand); }
.badge {
  position: absolute; top: 4px; right: 12px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center;
}
.nav-foot { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.live-status { display: flex; align-items: center; gap: 5px; }
.live-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--offline); }
.live-status.is-live { color: var(--moving); }
.live-status.is-live i { background: var(--moving); }
.demo-flag { background: #111827; color: #fff; padding: 2px 8px; border-radius: 999px; }

.views { position: relative; min-width: 0; min-height: 0; }
.view { position: absolute; inset: 0; }

.split { height: 100%; display: grid; grid-template-columns: 360px 1fr; }
.panel { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel-head { padding: 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.panel-meta { color: var(--muted); font-size: 12px; }
.panel-body { padding: 16px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.panel-head input[type="search"] { background: var(--bg); }

.page { height: 100%; overflow-y: auto; padding: 28px 24px 60px; }
.page-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.page-inner > .card + .card { margin-top: 0; }
.page-wide { max-width: 1080px; }
.page-narrow { max-width: 520px; }
.filters { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 16px 0; }
.filters select { width: auto; min-width: 200px; }

/* ---------- Karte ---------- */

.map-wrap { position: relative; min-height: 0; z-index: 0; }
.map { position: absolute; inset: 0; }
.map-btn {
  position: absolute; top: 16px; left: 16px; z-index: 500; background: var(--panel);
  border: 0; border-radius: 8px; padding: 8px 12px; box-shadow: var(--shadow); font-weight: 550;
}
.map-hint {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 500; max-width: calc(100% - 32px);
  background: #111827; color: #fff; padding: 8px 14px; border-radius: 999px; font-size: 13px; text-align: center;
}

.veh-icon { background: none; border: 0; }
[data-view="karte"]:not(.is-zooming) .veh-icon.leaflet-marker-icon { transition: transform 1.2s linear; }
.veh {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--offline); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
.veh-moving { background: var(--moving); }
.veh-stopped { background: var(--stopped); }
.veh svg { width: 16px; height: 16px; fill: #fff; }
.veh i { width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.veh.is-selected { outline: 3px solid var(--brand); outline-offset: 2px; }
.veh-label {
  position: absolute; top: 37px; left: 50%; transform: translateX(-50%);
  background: #fff; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  white-space: nowrap; box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.point-pin {
  width: 28px; height: 28px; border-radius: 50%; background: var(--warn); color: #fff; font-weight: 700;
  display: grid; place-items: center; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}

.device-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.device {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px;
  border: 0; border-radius: 10px; background: none; text-align: left;
}
.device:hover { background: var(--bg); }
.device.is-selected { background: var(--tint); }
.device-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.device-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-sub, .device-time { color: var(--muted); font-size: 12px; }
.device-time { white-space: nowrap; }

.detail {
  position: absolute; top: 16px; right: 16px; width: 340px; max-height: calc(100% - 32px);
  z-index: 1001; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 16px 4px; }
.detail-head h2 { font-size: 17px; margin-bottom: 6px; }
.detail-body { padding: 12px 16px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.stats div { background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.stats dt { color: var(--muted); font-size: 12px; }
.stats dd { margin: 4px 0 0; font-weight: 650; font-size: 15px; }
.address { margin: 0; color: var(--muted); }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------- Fahrten ---------- */

.trips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.trip {
  width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px;
}
.trip:hover { border-color: color-mix(in srgb, var(--brand) 50%, var(--line)); }
.trip.is-active { border-color: var(--brand); background: var(--tint); }
.trip-time { font-weight: 600; }
.trip-meta, .trip-addr { color: var(--muted); font-size: 12px; }
.day-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 10px; }
.btn.is-active { border-color: var(--brand); background: var(--tint); color: var(--brand); }
.export { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--line); }

.player {
  position: absolute; left: 16px; right: 64px; bottom: 24px; z-index: 600; max-width: 640px; margin: 0 auto;
  background: var(--panel); border-radius: 999px; box-shadow: var(--shadow); padding: 8px 14px 8px 8px;
  display: flex; align-items: center; gap: 12px;
}
.player-btn { width: 38px; height: 38px; flex: none; border-radius: 50%; border: 0; background: var(--brand); color: #fff; font-size: 14px; }
.player-label { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; min-width: 118px; }
.player select { width: auto; padding: 6px 8px; }

/* ---------- Alarme ---------- */

.events { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.events li + li { border-top: 1px solid var(--line); }
.event { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: none; border: 0; text-align: left; }
.event:hover:not(:disabled) { background: var(--bg); }
.event:disabled { cursor: default; }
.event-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--stopped); }
.event-warn { background: var(--warn); }
.event-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.event-title { font-weight: 600; }
.event-text, .event-time { color: var(--muted); font-size: 13px; }
.event-time { white-space: nowrap; }

.rules { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.rule { padding: 14px 16px; }
.rule + .rule { border-top: 1px solid var(--line); }
.rule-text { display: flex; flex-direction: column; }
.rule-text span { color: var(--muted); font-size: 13px; }
.rule-options { display: flex; gap: 20px; flex-wrap: wrap; margin: 10px 0 0 56px; font-size: 13px; }
.switch { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { width: 42px; height: 24px; flex: none; border-radius: 12px; background: #d1d5db; position: relative; transition: background .15s; }
.switch-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
#alerts-rules { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.quiet { display: flex; flex-direction: column; gap: 10px; }
.quiet input { width: auto; }

/* ---------- Verwaltung und Konto ---------- */

.admin { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
#admin-customers { display: flex; flex-direction: column; gap: 12px; }
.facts { margin: 0 0 16px; display: flex; flex-direction: column; gap: 10px; }
.facts div { display: flex; justify-content: space-between; gap: 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; overflow-wrap: anywhere; }

.play-arrow {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.play-arrow svg { width: 18px; height: 18px; fill: #fff; transition: transform .15s linear; }

/* ---------- Berichte und Wartung ---------- */

.tiles-4 { grid-template-columns: repeat(4, 1fr); margin: 16px 0; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; }
.table td, .table th { white-space: nowrap; }
.table td:has([data-geo]), .table-cards td { white-space: normal; }

.reminders .card + .card { margin-top: 0; }
.reminders { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.reminder { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.reminder-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1 1 260px; }
.reminder-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.chip-overdue { background: #fee2e2; color: var(--danger); }
.chip-soon { background: #fef3c7; color: #92400e; }
.chip-ok { background: color-mix(in srgb, var(--moving) 14%, #fff); color: #15803d; }

.map-styles { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.leaflet-top .map-styles { flex-direction: column-reverse; }
/* Geöffnete Kartenauswahl liegt über der Detailkarte. */
.leaflet-control-container > div:has(.map-styles-menu:not([hidden])) { z-index: 1100; }
.map-styles-btn {
  width: 34px; height: 34px; display: grid; place-items: center; background: #fff; color: var(--text);
  border: 2px solid rgba(0, 0, 0, .2); border-radius: 4px; background-clip: padding-box; padding: 0;
}
.map-styles-btn .icon { width: 20px; height: 20px; }
.map-styles-menu {
  background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); padding: 6px;
  display: flex; flex-direction: column; gap: 2px; width: 230px; max-height: 60vh; overflow-y: auto;
}
.map-styles-menu button {
  display: flex; flex-direction: column; text-align: left; background: none; border: 0; border-radius: 8px;
  padding: 8px 10px; font-size: 13px;
}
.map-styles-menu button span { color: var(--muted); font-size: 11px; }
.map-styles-menu button:hover { background: var(--bg); }
.map-styles-menu button.is-active { background: var(--tint); color: var(--brand); }

/* ---------- Einstellungen ---------- */

.stack { display: flex; flex-direction: column; gap: 16px; }
.stack > .card + .card { margin-top: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 20px; }
.checks .check { align-items: flex-start; font-weight: 400; }
.checks .check input { margin-top: 3px; flex: none; }
.checks .is-missing { color: var(--muted); }
.saved { color: #15803d; font-weight: 600; font-size: 13px; }
.device-settings summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none;
}
.device-settings summary::-webkit-details-marker { display: none; }
.device-settings summary::before { content: '▸'; color: var(--muted); }
.device-settings[open] summary::before { content: '▾'; }
.device-settings summary strong { flex: 1; min-width: 0; }
.device-settings[open] summary { margin-bottom: 16px; }
.link-small { font-size: 12px; text-align: center; color: var(--muted); }
.hide-labels .veh-label { display: none; }

.panel-toggle, .nav-more, .more-sheet { display: none; }

/* ---------- Handy ---------- */

@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}

@media (max-width: 800px) {
  body { font-size: 15px; }
  /* 16px verhindert, dass iPhones beim Antippen eines Feldes hineinzoomen. */
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 44px; }
  .btn-small { min-height: 38px; padding: 6px 12px; font-size: 13px; }
  .chips button { min-height: 38px; padding: 6px 14px; }
  .tabs button { padding: 12px 2px; }

  /* Navigation als Leiste am unteren Rand */
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .nav {
    order: 2; flex-direction: row; gap: 0; border-right: 0; border-top: 1px solid var(--line);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .nav > .brand-mark, .nav-foot { display: none; }
  .nav-items { flex-direction: row; gap: 2px; }
  .nav-items a, .nav-more { flex: 1; min-height: 52px; padding: 7px 2px; justify-content: center; }
  .nav-items .nav-secondary { display: none; }
  .nav-more {
    display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0;
    border-radius: 10px; color: var(--muted); font-size: 11px; font-weight: 600;
  }
  .nav-more.is-active { background: var(--tint); color: var(--brand); }
  .badge { right: calc(50% - 24px); }
  .more-sheet {
    display: flex; flex-direction: column; gap: 2px; position: fixed; left: 8px; right: 8px;
    bottom: calc(68px + env(safe-area-inset-bottom)); z-index: 1500;
    background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); padding: 8px;
  }
  .more-sheet a {
    display: flex; align-items: center; gap: 14px; padding: 14px 12px; border-radius: 10px;
    color: var(--text); text-decoration: none; font-weight: 600;
  }
  .more-sheet a.is-active { background: var(--tint); color: var(--brand); }

  /* Karte oben, Liste als ausklappbares Blatt darunter */
  .split { display: flex; flex-direction: column; }
  .split .map-wrap { order: 1; flex: 1 1 auto; min-height: 0; }
  .split .panel {
    order: 2; flex: none; display: block; max-height: 58%; overflow-y: auto; position: relative; z-index: 1;
    border-right: 0; border-radius: 16px 16px 0 0; margin-top: -14px; box-shadow: 0 -4px 20px rgba(17, 24, 39, .12);
  }
  .panel-toggle {
    display: flex; justify-content: center; align-items: center; width: 100%; height: 26px;
    background: var(--panel); border: 0; position: sticky; top: 0; z-index: 2;
  }
  .panel-toggle span { width: 40px; height: 4px; border-radius: 2px; background: #d1d5db; }
  .panel-head { padding: 2px 16px 12px; }
  .panel-body, .device-list { overflow: visible; }
  .panel.is-collapsed .panel-head > *:not(h1),
  .panel.is-collapsed > *:not(.panel-toggle):not(.panel-head) { display: none; }
  .panel.is-collapsed .panel-head { border-bottom: 0; }

  .leaflet-control-zoom { display: none; }
  .map-styles-btn { width: 44px; height: 44px; border-radius: 10px; }
  .split .leaflet-bottom { bottom: 14px; }
  .map-btn { top: 12px; left: 12px; min-height: 40px; }
  .detail { top: auto; left: 8px; right: 8px; bottom: 22px; width: auto; max-height: calc(100% - 30px); }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stats div { padding: 8px 10px; }
  .stats dd { font-size: 14px; }
  .player { left: 8px; right: 8px; bottom: 22px; border-radius: 16px; flex-wrap: wrap; padding: 8px 12px 10px 8px; }
  .player input[type="range"] { order: 3; flex-basis: 100%; }
  .player-label { flex: 1; }

  /* Seiten */
  .page { padding: 16px 12px 32px; }
  .card { padding: 16px; }
  .admin { grid-template-columns: 1fr; }
  .tiles-4 { grid-template-columns: repeat(2, 1fr); }
  .filters { flex-direction: column; align-items: stretch; }
  .filters select { width: 100%; }
  .rule-options { margin-left: 0; }
  .card-head .row-actions, .reminder .row-actions { width: 100%; justify-content: flex-start; }
  .form-actions .btn { flex: 1; }
  .dialog { padding: 20px; }
  .toasts { top: calc(8px + env(safe-area-inset-top)); }

  /* Tabellen der Verwaltung als Karten */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; }
  .table-cards tr { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
  .table-cards td { border: 0; padding: 2px 0; }
  .table-cards td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .table-cards .cell-title { font-weight: 700; font-size: 15px; padding-bottom: 4px; }
  .table-cards td.row-actions { display: flex; justify-content: flex-start; padding-top: 8px; }
  .table-cards td.row-actions .btn { margin-left: 0; }
}

/* ---------- Druck (PDF-Export) ---------- */

#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; font-size: 11px; color: #000; }
  #print-area h1 { font-size: 18px; margin-bottom: 8px; }
  #print-area h2 { font-size: 13px; margin: 18px 0 6px; }
  #print-area table { width: 100%; border-collapse: collapse; }
  #print-area th, #print-area td { border: 1px solid #999; padding: 4px 6px; text-align: left; }
  #print-area th { background: #eee; }
  #print-area tfoot td { font-weight: 700; }
  .print-foot { margin-top: 16px; color: #555; }
}
