/* Tokens und Basis aus den Mockups (.arness/prototypes/mockups/mockup.css) übernommen; nur, was die Hülle braucht. */
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 600; font-display: swap; src: url('fonts/barlow-semi-condensed-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Semi Condensed'; font-weight: 700; font-display: swap; src: url('fonts/barlow-semi-condensed-latin-700-normal.woff2') format('woff2'); }

/* Farben aus dem Design „Nachtinstrument“ (camper-os Prototyp, Runde 2): hell und dunkel.
   theme.js setzt [data-theme] je nach Wahl unter Mehr → Darstellung (System, Hell, Dunkel). */
:root {
  --bg: #f1f3f5; --surface: #ffffff; --surface-2: #f4f5f7; --ink: #1c2024; --ink-strong: #111417; --muted: #525a64; --label: #5a626c;
  --line: #e1e4e8; --line-strong: #c3c8ce; --skel: rgba(16, 24, 40, .08);
  --primary: #1c2024; --primary-ink: #ffffff;
  --brand: #1d7469; --brand-soft: rgba(29, 116, 105, .12);
  --red: #b3261e; --red-soft: #fdecea; --amber: #8a5d00; --amber-soft: #fdf3dc; --green: #1b7a3a; --green-soft: #e4f3e9; --blue: #2f679a; --grey-soft: #eceef1;
  --radius: 22px; --radius-sm: 12px; --radius-pill: 999px;
  --nav-h: 80px; --sidebar: 0px; --gutter: 16px; --tap: 44px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --font-display: 'Barlow Semi Condensed', system-ui, -apple-system, sans-serif;
  --cluster: #ffffff; --cluster-ink: #1c2024; --cluster-muted: #525a64; --cluster-line: #e1e4e8;
  --lamp-red: #d63b2b; --lamp-amber: #c48a00; --lamp-green: #22a04f; --lamp-off: #9aa1aa;
  --glass-bar: rgba(255, 255, 255, .84); --glass-rail: rgba(255, 255, 255, .65); --hair: rgba(0, 0, 0, .09); --bar-shadow: 0 10px 30px rgba(16, 24, 40, .12);
  --glow: radial-gradient(120% 60% at 50% -12%, rgba(29, 116, 105, .07), transparent 62%);
  --chart-1: #1d7469; --chart-2: #8a929c; --chart-fill: rgba(29, 116, 105, .10); --chart-band: rgba(29, 116, 105, .16);
  --map-land: #eef0ed; --map-water: #c9dde7; --map-road: #ffffff; --map-road-major: #f7f8f9; --map-green: #dfe8dc; --map-border: #9aa2ab; --map-label: #4d555e; --map-route: #1d7469; --rain: #6f9fc2;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e1012; --surface: #16191c; --surface-2: #1c2024; --ink: #e7e9ec; --ink-strong: #f4f5f7; --muted: #9ba3ad; --label: #8a929c;
  --line: #23272b; --line-strong: #363c43; --skel: rgba(255, 255, 255, .08);
  --primary: #e7e9ec; --primary-ink: #121417;
  --brand: #7cc3ba; --brand-soft: rgba(124, 195, 186, .16);
  --red: #ff8a7a; --red-soft: #3d1d1a; --amber: #f2c14e; --amber-soft: #3a3019; --green: #7ed99a; --green-soft: #18321f; --blue: #8fb9d8; --grey-soft: #23272b;
  --cluster: #16191c; --cluster-ink: #e7e9ec; --cluster-muted: #9ba3ad; --cluster-line: #23272b;
  --lamp-red: #ff7a68; --lamp-amber: #f5bf3c; --lamp-green: #6fd690; --lamp-off: #48505a;
  --glass-bar: rgba(28, 32, 36, .8); --glass-rail: rgba(14, 16, 18, .6); --hair: rgba(255, 255, 255, .08); --bar-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  --glow: radial-gradient(120% 60% at 50% -12%, rgba(124, 195, 186, .08), transparent 62%);
  --chart-1: #7cc3ba; --chart-2: #6c747e; --chart-fill: rgba(124, 195, 186, .12); --chart-band: rgba(124, 195, 186, .18);
  --map-land: #1b1f22; --map-water: #17262c; --map-road: #2a3035; --map-road-major: #353c42; --map-green: #1d2620; --map-border: #59616a; --map-label: #a3abb4; --map-route: #7cc3ba; --rain: #5b93bd;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--glow) no-repeat, var(--bg); color: var(--ink); font: 16px/1.5 -apple-system, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
h1 { font-family: var(--font-display); font-size: 2.125rem; font-weight: 700; margin: 0; line-height: 1.05; color: var(--ink-strong); }
h2 { font-size: 1rem; font-weight: 650; margin: 0; }
p { margin: 0; }
.muted { color: var(--muted); }
/* Versal-Label: kleine Überschrift über Karten und Abschnitten */
.label, .card h2, .section-title { font-size: .6875rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--label); }

/* Icons: einzelne Lucide-SVGs (web/icons/), als Maske eingefärbt mit currentColor */
.icon { display: inline-block; width: 24px; height: 24px; flex: none; background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.i-home { --icon: url('icons/home.svg'); }
.i-battery-charging { --icon: url('icons/battery-charging.svg'); }
.i-thermometer { --icon: url('icons/thermometer.svg'); }
.i-map-pin { --icon: url('icons/map-pin.svg'); }
.i-ellipsis { --icon: url('icons/ellipsis.svg'); }
.i-cloud { --icon: url('icons/cloud.svg'); }
.i-signal { --icon: url('icons/signal.svg'); }
.i-clock { --icon: url('icons/clock.svg'); }
.i-settings { --icon: url('icons/settings.svg'); }
.i-chevron-right { --icon: url('icons/chevron-right.svg'); }
.i-x { --icon: url('icons/x.svg'); }
.i-volume-x { --icon: url('icons/volume-x.svg'); }
.i-sliders-horizontal { --icon: url('icons/sliders-horizontal.svg'); }
.i-cpu { --icon: url('icons/cpu.svg'); }
.i-play { --icon: url('icons/play.svg'); }

/* Gerüst: am Handy schwebende Leiste unten (Daumenbereich), ab 768 px schmale Seitenleiste */
.shell { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); }
main { max-width: 1120px; margin: 0 auto; padding: max(var(--sp-4), env(safe-area-inset-top)) var(--gutter) 40px; }
main[hidden] { display: none; }
nav.tabs { position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); max-width: 460px; margin: 0 auto; height: 66px; padding: 6px;
  display: flex; gap: 2px; background: var(--glass-bar); -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
  border: 1px solid var(--hair); border-radius: 33px; box-shadow: var(--bar-shadow); z-index: 5; }
nav.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: var(--tap); border-radius: 27px;
  font-size: .6875rem; font-weight: 500; color: var(--label); text-decoration: none; -webkit-tap-highlight-color: transparent; }
nav.tabs a .icon { width: 22px; height: 22px; }
nav.tabs a[aria-current="page"] { background: var(--brand-soft); color: var(--ink-strong); font-weight: 650; }
nav.tabs a[aria-current="page"] .icon { color: var(--brand); }
nav.tabs a:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
nav.tabs .brand { display: none; }

@media (min-width: 768px) {
  :root { --sidebar: 96px; --gutter: 32px; --nav-h: 0px; }
  .shell { padding: 0 0 0 var(--sidebar); }
  nav.tabs { inset: 0 auto 0 0; right: auto; bottom: 0; margin: 0; max-width: none; width: var(--sidebar); height: auto; flex-direction: column; justify-content: flex-start; gap: 6px;
    padding: max(20px, env(safe-area-inset-top)) 10px 20px; border-radius: 0; border: 0; border-right: 1px solid var(--hair); background: var(--glass-rail); box-shadow: none; }
  nav.tabs a { flex: none; gap: 4px; min-height: 60px; border-radius: 16px; font-size: .6875rem; }
  nav.tabs .brand { display: grid; place-items: center; width: 40px; height: 40px; margin: 0 auto 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 0; }
  nav.tabs .brand i { width: 10px; height: 10px; border-radius: 50%; background: var(--lamp-green); box-shadow: 0 0 8px var(--lamp-green); font-size: 0; }
  main { padding-top: max(var(--sp-6), env(safe-area-inset-top)); }
}

.head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.head .stand { font-size: .6875rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--label); font-variant-numeric: tabular-nums; padding-bottom: 6px; }

/* Kombiinstrument: Gesamtstatus als Satz, darunter Kontrollleuchten */
.cluster { background: var(--cluster); color: var(--cluster-ink); border: 1px solid var(--cluster-line); border-radius: 20px; padding: 1.1rem 1.15rem 0; overflow: hidden; }
.cluster .status { display: flex; gap: .8rem; align-items: flex-start; padding-bottom: 1rem; }
.cluster .status .lamp { margin-top: .55rem; }
.cluster .status-text { flex: 1; min-width: 0; }
.cluster .status-line { font-family: var(--font-display); font-weight: 700; font-size: 1.85rem; line-height: 1.08; letter-spacing: .005em; }
.cluster .status-meta { color: var(--cluster-muted); font-size: .88rem; margin-top: .3rem; }
.lights { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0 -1.15rem; border-top: 1px solid var(--cluster-line); }
.light { padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4); min-width: 0; border-top: 1px solid var(--cluster-line); }
.light:nth-child(-n+2) { border-top: 0; }
.light:nth-child(even) { border-left: 1px solid var(--cluster-line); }
.light b { display: flex; align-items: center; gap: 9px; font-family: var(--font-display); font-size: 1.65rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.light small { font-size: 1rem; font-weight: 600; color: var(--cluster-muted); margin-left: -4px; }
.light > span { display: block; color: var(--cluster-muted); font-size: .78rem; line-height: 1.35; margin-top: 7px; }
.light .lbl { display: block; color: var(--cluster-ink); font-weight: 500; font-size: .82rem; }
.lamp { width: 10px; height: 10px; border-radius: 50%; background: var(--lamp-off); flex: none; }
.lamp.ok { background: var(--lamp-green); }
.lamp.hint { background: var(--lamp-amber); box-shadow: 0 0 0 3px rgba(245, 191, 60, .22), 0 0 12px var(--lamp-amber); }
.lamp.warn { background: var(--lamp-red); box-shadow: 0 0 0 3px rgba(255, 122, 104, .22), 0 0 12px var(--lamp-red); }
.light.hint b { color: var(--lamp-amber); }
.light.warn b { color: var(--lamp-red); }
.light.stale b { color: var(--cluster-muted); }
@media (min-width: 768px) {
  .cluster { padding: 1.4rem 1.5rem 0; }
  .cluster .status-line { font-size: 2.4rem; }
  .lights { grid-template-columns: repeat(4, 1fr); margin: 0 -1.5rem; }
  .light { border-top: 0; padding: var(--sp-4) var(--sp-3) var(--sp-4) var(--sp-5); }
  .light + .light { border-left: 1px solid var(--cluster-line); }
  .light b { font-size: 1.9rem; }
}

/* Karten */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-4); min-width: 0; margin-top: var(--sp-3); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: .55rem var(--sp-4); align-items: baseline; margin: 0; }
.kv dt { color: var(--muted); font-size: .92rem; }
.kv dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card h2 + .kv { margin-top: var(--sp-3); }
.note { font-size: .84rem; color: var(--muted); margin-top: var(--sp-2); }
.label-demo { position: fixed; top: calc(env(safe-area-inset-top) + 6px); right: 8px; font-size: .7rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; z-index: 9; }
.label-demo[hidden] { display: none; }

/* --- Ansichten (Schritt 5): Karten, Verläufe, Detail-Blatt; aus den Mockups (Entwurf 3) --- */
.grid { display: grid; gap: var(--sp-3); margin-top: var(--sp-3); }
.grid > .card { margin-top: 0; }
@media (min-width: 1000px) { .grid.three { grid-template-columns: 1.15fr 1fr 1fr; } .grid.two { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: span 2; } }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); min-height: 24px; }
.head-actions { display: flex; align-items: center; gap: var(--sp-2); }
.big { font-family: var(--font-display); font-weight: 700; font-size: 2.6rem; line-height: 1; font-variant-numeric: tabular-nums; }
.big small, .room .vals small { font-size: 1.15rem; color: var(--muted); font-weight: 600; margin-left: .15rem; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); margin: var(--sp-4) calc(-1 * var(--sp-4)) calc(-1 * var(--sp-4)); }
.trio > div { padding: var(--sp-3) var(--sp-4); min-width: 0; }
.trio > div + div { border-left: 1px solid var(--line); }
.trio b { display: block; font-family: var(--font-display); font-size: clamp(1.1rem, 4.6vw, 1.35rem); white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.trio span { font-size: .78rem; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; line-height: 1.5; padding: .1rem .55rem; border-radius: var(--radius-pill); background: var(--grey-soft); color: var(--muted); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge[hidden] { display: none; }
.badge.ok { background: var(--green-soft); color: var(--green); }
.badge.hint { background: var(--amber-soft); color: var(--amber); }
.badge.warn { background: var(--red-soft); color: var(--red); }
.badge.plain::before { display: none; }
.kv dt .badge { margin-left: .3rem; vertical-align: 1px; }
.old { color: var(--muted); }

.bar { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; margin: var(--sp-3) 0 var(--sp-2); }
.bar i { height: 10px; border-radius: 3px; background: var(--grey-soft); }
.bar i.on { background: var(--brand); }
.bar.hint i.on { background: var(--amber); }
.bar.warn i.on { background: var(--red); }

.seg[hidden] { display: none; }
.seg { display: inline-flex; background: var(--grey-soft); border-radius: var(--radius-sm); padding: 3px; gap: 2px; }
.seg button { position: relative; font: inherit; font-size: .84rem; font-weight: 500; border: 0; background: transparent; color: var(--muted); border-radius: 7px; min-height: 36px; padding: 0 .75rem; cursor: pointer; }
.seg button::after { content: ''; position: absolute; inset: -4px 0; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }

.chart { width: 100%; height: auto; display: block; margin-top: var(--sp-2); overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: system-ui, -apple-system, sans-serif; }
.chart .l1 { fill: none; stroke: var(--chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .l2 { fill: none; stroke: var(--chart-2); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .area { fill: var(--chart-fill); }
.chart .band { fill: var(--chart-band); }
.chart .zone { fill: var(--amber-soft); }
.chart .zone.warn { fill: var(--red-soft); }
.chart .now, .chart .dot { fill: var(--chart-1); }
.chart .zero { stroke: var(--line-strong); stroke-width: 1; }
.chart .bar-charge { fill: var(--chart-1); }
.chart .bar-discharge { fill: var(--chart-2); opacity: .55; }
.legend { display: flex; gap: 4px var(--sp-4); font-size: .8rem; color: var(--muted); margin-top: var(--sp-2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 2px; background: var(--chart-1); vertical-align: middle; margin-right: 6px; }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--chart-2) 0 3px, transparent 3px 6px); }
.legend i.zone { height: 8px; background: var(--amber-soft); border-radius: 2px; }
.legend i.zone.warn { background: var(--red-soft); }
.legend i.sq { width: 10px; height: 10px; border-radius: 2px; }
.legend i.sq.charge { background: var(--chart-1); }
.legend i.sq.discharge { background: var(--chart-2); opacity: .55; }
.legend [hidden] { display: none; }

.room { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--sp-3); align-items: baseline; }
.room .vals { font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.room .comfort { grid-column: 1 / -1; color: var(--muted); font-size: .9rem; margin-top: var(--sp-1); }
.age { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.coords { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; font-variant-numeric: tabular-nums; line-height: 1.2; }

/* Alles antippbar: Karten und Leuchten führen eine Ebene tiefer */
a.card, a.light { color: inherit; text-decoration: none; display: block; -webkit-tap-highlight-color: transparent; }
a.card { transition: background-color .12s; }
a.card:active { background: var(--surface-2); }
a.light:active { background: var(--surface-2); }
a.card:focus-visible, a.light:focus-visible, .seg button:focus-visible, .icon-btn:focus-visible, .chip:focus-visible, .rows a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.go { color: var(--muted); width: 18px; height: 18px; }

/* Kompakte Aktionen: sichtbar klein, Tippfläche 44 px */
.icon-btn, .chip { position: relative; }
.icon-btn::after, .chip::after { content: ''; position: absolute; inset: -6px; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--grey-soft); color: var(--ink); display: inline-grid; place-items: center; flex: none; cursor: pointer; }
.icon-btn .icon { width: 18px; height: 18px; }
.chip { font: inherit; font-size: .84rem; font-weight: 600; height: 32px; padding: 0 .8rem; border-radius: var(--radius-pill); border: 0; background: var(--grey-soft); color: var(--ink); display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; cursor: pointer; }
.chip .icon { width: 15px; height: 15px; }
.chip[hidden] { display: none; }
.chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }
.chips:not(:has(:not([hidden]))) { display: none; }

.section-title { margin: var(--sp-5) 0 var(--sp-2) var(--sp-1); }
.section-title[hidden], .note[hidden], [data-sheet-current][hidden], .stats-row[hidden] { display: none; }
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 var(--sp-4); }
.rows > a { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 56px; padding: var(--sp-2) 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.rows > :first-child { border-top: 0; }
.rows .t { font-weight: 500; }
.rows .s { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Detail-Blatt: am Handy von unten, ab 768 px als Seitenpanel */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(10, 12, 14, .42); z-index: 20; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 90dvh; overflow: auto; overscroll-behavior: contain; background: var(--surface); border-radius: 20px 20px 0 0; z-index: 21;
  padding: 8px var(--gutter) calc(24px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 32px rgba(16, 24, 40, .18); outline: none; }
.sheet[hidden], .sheet-backdrop[hidden] { display: none; }
.sheet .grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 0 auto 12px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); }
.sheet-head h2 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.sub { color: var(--muted); font-size: .92rem; margin-top: 4px; }
.sheet-value { display: flex; align-items: baseline; gap: .6rem; margin-top: var(--sp-3); flex-wrap: wrap; }
.sheet-seg { margin-top: var(--sp-4); }
.sheet .muted:empty { display: none; }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 12px; margin-top: var(--sp-3); }
.stats-row > div { padding: var(--sp-2) var(--sp-3); min-width: 0; }
.stats-row > div + div { border-left: 1px solid var(--line); }
.stats-row b { display: block; font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stats-row span { font-size: .76rem; color: var(--muted); }
@media (min-width: 768px) {
  .sheet { left: auto; top: 0; width: 440px; max-height: none; border-radius: 0; border-left: 1px solid var(--line); padding-top: var(--sp-5); box-shadow: -8px 0 32px rgba(16, 24, 40, .14); }
  .sheet .grabber { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .sheet:not([hidden]) { animation: sheet-in .18s ease-out; }
  @keyframes sheet-in { from { transform: translateY(24px); opacity: .4; } }
  @media (min-width: 768px) { @keyframes sheet-in { from { transform: translateX(24px); opacity: .4; } } }
}
.legend i.band { height: 8px; background: var(--chart-band); border-radius: 2px; }
.room .vals [data-num] + [data-num] { margin-left: .55rem; }

/* --- Einstellungen (UC-016): Listen, Schalter, Formulare, Rückgängig-Zeile --- */
.i-chevron-left { --icon: url('icons/chevron-left.svg'); }
.i-bell { --icon: url('icons/bell.svg'); }
.i-bell-off { --icon: url('icons/bell-off.svg'); }
.i-shield { --icon: url('icons/shield.svg'); }
.i-key-round { --icon: url('icons/key-round.svg'); }
.i-route { --icon: url('icons/route.svg'); }
.i-map { --icon: url('icons/map.svg'); }
.i-locate-fixed { --icon: url('icons/locate-fixed.svg'); }
[data-view][hidden] { display: none; }
.back { display: inline-flex; align-items: center; gap: .2rem; min-height: var(--tap); color: var(--brand); text-decoration: none; font-weight: 500; margin: -8px 0 2px -6px; }
.back .icon { width: 22px; height: 22px; }
.head + .sub { margin: calc(-1 * var(--sp-2)) 0 var(--sp-3); }
.rows > div { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 56px; padding: var(--sp-2) 0; border-top: 1px solid var(--line); }
.rows .val { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows .row-main { flex: 1; min-width: 0; color: inherit; text-decoration: none; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); min-height: 56px; }
.settings-list > div { gap: var(--sp-2); }
.toggles { display: flex; gap: var(--sp-3); flex: none; }
.toggle { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--muted); min-width: 52px; }
.state { font-size: .78rem; color: var(--muted); }
.state.custom { color: var(--brand); font-weight: 600; }

/* Schalter als echte Checkbox (Tastatur, VoiceOver) */
input.switch { appearance: none; -webkit-appearance: none; margin: 0; width: 46px; height: 28px; border-radius: 14px; background: var(--line-strong); position: relative; flex: none; cursor: pointer; transition: background-color .15s; }
input.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: left .15s; }
input.switch:checked { background: var(--brand); }
input.switch:checked::after { left: 20px; }
input.switch:disabled { opacity: .4; cursor: not-allowed; }
input.switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.form .fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-top: var(--sp-3); }
.form .fields.one { grid-template-columns: 1fr; }
.form .field { min-width: 0; }
.form label { display: block; font-size: .84rem; color: var(--muted); margin-bottom: 4px; }
.form input:not([type="checkbox"]) { width: 100%; height: 48px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem; padding: 0 .75rem; font-variant-numeric: tabular-nums; }
.form input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
.form input[aria-invalid="true"] { border-color: var(--red); }
.input-unit { position: relative; }
.input-unit input { padding-right: 3rem !important; }
.input-unit span { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.form .hint { font-size: .8rem; color: var(--muted); margin-top: 6px; line-height: 1.4; }
.form .hint .btn-link { position: relative; font: inherit; font-size: .8rem; color: var(--brand); font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; min-height: 0; }
.form .hint .btn-link::after { content: ''; position: absolute; inset: -12px -4px; }
.form .hint .btn-link[hidden] { display: none; }
.err { color: var(--red); font-size: .8rem; margin-top: 4px; min-height: 0; }
.err:empty { display: none; }
.std { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 var(--sp-2); font-size: .78rem; color: var(--muted); margin-top: 2px; min-height: 28px; }
.std button { position: relative; font: inherit; font-size: .8rem; color: var(--brand); font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; }
.std button::after { content: ''; position: absolute; inset: -10px -6px; }
.advanced { margin-top: var(--sp-4); border-top: 1px solid var(--line); padding-top: var(--sp-2); }
.advanced summary { min-height: var(--tap); display: flex; align-items: center; gap: .35rem; font-weight: 600; cursor: pointer; color: var(--muted); list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: ''; width: 18px; height: 18px; background: currentColor; -webkit-mask: url('icons/chevron-right.svg') center / contain no-repeat; mask: url('icons/chevron-right.svg') center / contain no-repeat; transition: transform .15s; }
.advanced[open] summary::before { transform: rotate(90deg); }
.preview { margin-top: var(--sp-4); padding: var(--sp-3); border-radius: var(--radius-sm); background: var(--surface-2); font-size: .9rem; }
.preview:empty { display: none; }
.form-error { margin-top: var(--sp-3); color: var(--red); font-size: .9rem; }
.form-error[hidden] { display: none; }
.form-error button { margin: var(--sp-2) var(--sp-2) 0 0; }
.check { display: flex !important; align-items: center; gap: .6rem; min-height: var(--tap); color: var(--ink) !important; font-size: .95rem !important; margin-top: var(--sp-3); }
.check input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }
.actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-4); }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--radius-sm); min-height: var(--tap); padding: 0 1rem; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.danger { color: var(--red); margin-left: auto; }
.btn[hidden] { display: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sheet .chips { margin-top: var(--sp-3); }

.toast { position: fixed; left: var(--gutter); right: var(--gutter); bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); z-index: 30; display: flex; align-items: center; gap: var(--sp-3);
  background: var(--primary); color: var(--primary-ink); border-radius: 12px; padding: .5rem .5rem .5rem 1rem; box-shadow: 0 8px 24px rgba(16, 24, 40, .22); max-width: 520px; margin: 0 auto; }
.toast[hidden] { display: none; }
.toast > span { flex: 1; font-size: .92rem; }
.toast-btn { font: inherit; font-weight: 600; color: var(--primary-ink); background: rgba(255, 255, 255, .14); border: 0; border-radius: 8px; min-height: 36px; padding: 0 .8rem; cursor: pointer; }
.toast .icon-btn { background: transparent; color: var(--primary-ink); }
:root[data-theme="dark"] .toast-btn { background: rgba(0, 0, 0, .1); }
@media (min-width: 768px) { .toast { left: calc(var(--sidebar) + var(--gutter)); bottom: 16px; } }
main[data-screen="einstellungen"] > section, main[data-screen="mehr"] > * { max-width: 760px; }

/* --- Mitteilungen (UC-009, UC-011, UC-012) --- */
.cluster .pill { position: relative; font: inherit; font-size: .8rem; font-weight: 600; color: var(--cluster-ink); background: var(--grey-soft); border: 0; border-radius: var(--radius-pill);
  height: 32px; padding: 0 .75rem; display: inline-flex; align-items: center; gap: .4rem; margin-top: .6rem; cursor: pointer; }
.cluster .pill::after { content: ''; position: absolute; inset: -6px; }
.cluster .pill .icon { width: 14px; height: 14px; }
.cluster .pill[hidden] { display: none; }
.light .muted-icon { width: 14px; height: 14px; color: var(--cluster-muted); margin-left: 2px; }
.action-sheet { border: 0; padding: var(--sp-4) var(--gutter) calc(var(--sp-4) + env(safe-area-inset-bottom)); width: 100%; max-width: 440px; margin: auto auto 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--ink); box-shadow: 0 -8px 32px rgba(16, 24, 40, .2); }
.action-sheet::backdrop { background: rgba(10, 12, 14, .42); }
.action-sheet h2 { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; }
.dialog-actions { display: grid; gap: var(--sp-2); margin-top: var(--sp-4); }
.dialog-actions .btn { width: 100%; }
.btn.plain { border-color: transparent; background: transparent; color: var(--muted); }
@media (min-width: 768px) { .action-sheet { margin: auto; border-radius: var(--radius); } }
.rows > div .btn-link { position: relative; font: inherit; font-size: .9rem; color: var(--brand); font-weight: 600; background: none; border: 0; cursor: pointer; padding: 0 .2rem; min-height: var(--tap); }
.kv.wrap dd { white-space: normal; }
.kv dd { min-width: 0; overflow-wrap: anywhere; }
code { font-size: .85em; background: var(--grey-soft); border-radius: 4px; padding: 0 .25em; }

/* --- Unterwegs: Karte, Zähler, Fahrten (UC-004, UC-020) --- */
.map { position: relative; border-radius: 12px; overflow: hidden; background: var(--map-land); aspect-ratio: 16 / 11; margin: calc(-1 * var(--sp-2)) calc(-1 * var(--sp-2)) var(--sp-3); }
@media (min-width: 768px) { .map { aspect-ratio: 21 / 9; } }
.map .maplibregl-map { position: absolute; inset: 0; }
.map-chip { position: absolute; left: 10px; top: 10px; z-index: 2; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); font-size: .8rem; font-weight: 600; padding: .2rem .7rem; box-shadow: 0 1px 3px rgba(16, 24, 40, .1); }
.map-fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: var(--sp-4); color: var(--muted); font-size: .9rem; }
.map-fallback[hidden] { display: none; }
.map-filter { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin-bottom: var(--sp-2); font-size: .9rem; font-weight: 600; }
.map-filter[hidden] { display: none; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.trio.flat { margin: 0 calc(-1 * var(--sp-4)); border-top: 0; }
.card-head .link { font-size: .86rem; color: var(--brand); text-decoration: none; font-weight: 500; min-height: var(--tap); display: inline-flex; align-items: center; }
.list > a { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-2) 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.list > a:first-child { border-top: 0; }
.list > a[aria-current="true"] .t { color: var(--brand); }
.list .t { font-weight: 600; }
.list .s { font-size: .84rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* --- Anmeldung und Konten (UC-013, UC-014, UC-015) --- */
body.gate nav.tabs, body.gate .label-demo { display: none; }
body.gate .shell { padding: 0; }
.gate-box { max-width: 420px; margin: 0 auto; padding-top: max(env(safe-area-inset-top), var(--sp-6)); }
.gate-box h1 { font-size: 1.8rem; margin-bottom: var(--sp-2); }
.gate-brand { display: flex; align-items: center; gap: .55rem; font-weight: 650; margin: 0 0 var(--sp-4) var(--sp-1); }
.gate-brand i { width: 26px; height: 26px; border-radius: 7px; background: var(--cluster); display: grid; place-items: center; color: var(--lamp-green); font-style: normal; font-size: .8rem; }
.gate-box a { color: var(--brand); }
.btn.wide { width: 100%; }
/* Passkey (Anmeldung, Bestätigen): Knopf mit Schlüssel, darunter „oder mit Name und Passwort“ */
.btn.pk { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); }
.btn.pk .icon { width: 20px; height: 20px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .84rem; margin: var(--sp-4) 0 var(--sp-1); }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
[data-passkey-login][hidden], [data-passkey-card][hidden], [data-passkey-list][hidden], [data-passkey-add-row][hidden], [data-fresh-passkey][hidden], [data-fresh-password][hidden] { display: none; }
body[data-rolle="ansehen"] [data-nur-verwalten] { display: none !important; }
.account-row { flex-wrap: wrap; }
.row-actions { display: flex; flex-wrap: wrap; gap: 0 var(--sp-3); }
.invite { border-color: var(--brand); }
.invite h2 { margin-bottom: var(--sp-3); }
.invite .t { font-weight: 600; margin-top: var(--sp-3); }
.invite-grid { display: grid; grid-template-columns: 140px 1fr; gap: var(--sp-4); align-items: start; }
@media (max-width: 420px) { .invite-grid { grid-template-columns: 1fr; } .invite-grid .qr { max-width: 180px; } }
.qr { background: #fff; border-radius: var(--radius-sm); padding: 6px; border: 1px solid var(--line); }
.qr svg { width: 100%; height: auto; display: block; }
.invite-seg { margin-bottom: var(--sp-3); }
.invite-login { margin-top: var(--sp-2); grid-template-columns: max-content minmax(0, 1fr); column-gap: var(--sp-3); align-items: baseline; }
.invite-login dd { text-align: left; white-space: normal; overflow-wrap: anywhere; }
.invite .invite-login dd.mono:not(.big-mono) { font-size: 1.05rem; }
.invite-login dt { white-space: nowrap; }
.guest-card { margin-bottom: var(--sp-3); }
.guest-card .mono, .invite .mono:not(.big-mono) { font-size: .82rem; }
.guest-card .mono { word-break: break-all; }
.invite .mono { word-break: break-all; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.big-mono { font-size: 1.35rem; font-weight: 600; letter-spacing: .02em; margin-top: var(--sp-1); }
.kv.log dt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.kv.log dd { text-align: left; font-weight: 500; }

/* --- Ereignisse und Punktauswahl im Verlauf (UC-002 BR-8, UC-009 BR-14) --- */
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: grid; grid-template-columns: 4.6rem 1fr; gap: var(--sp-2); padding: var(--sp-2) 0; border-top: 1px solid var(--line); font-size: .9rem; }
.events li:first-child { border-top: 0; }
.events time { color: var(--muted); font-variant-numeric: tabular-nums; }
.readout { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); }
.readout[hidden] { display: none; }
.readout-text { flex: 1; text-align: center; font-size: .9rem; font-variant-numeric: tabular-nums; }
.chart.selectable { touch-action: pan-y; cursor: crosshair; }
.chart .cursor { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; opacity: .55; }
.chart .cursor-dot { fill: var(--surface); stroke: var(--chart-1); stroke-width: 2.5; }

/* --- Wetter (UC-007) --- */
.weather-now { display: flex; align-items: baseline; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.weather-text { color: var(--muted); font-size: 1rem; }
.hours { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(52px, 1fr); gap: 2px; text-align: center; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--sp-2)); padding: 0 var(--sp-2); }
.hours::-webkit-scrollbar { display: none; }
.hours > div { padding: var(--sp-2) 0; }
.hours .t { font-size: .78rem; color: var(--muted); }
.hours .v { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.hours .r { height: 28px; display: flex; align-items: flex-end; justify-content: center; }
.hours .r i { width: 14px; border-radius: 3px 3px 0 0; background: var(--rain); min-height: 2px; }
.hours .p { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.hours.compact { grid-auto-columns: 1fr; overflow: hidden; }
.days { list-style: none; margin: 0; padding: 0; }
.days li { display: grid; grid-template-columns: 5rem 1fr auto; align-items: center; gap: var(--sp-3); min-height: 52px; border-top: 1px solid var(--line); font-size: .92rem; }
.days li:first-child { border-top: 0; }
.days .tt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.days .tt span { color: var(--muted); }
@media (max-width: 559px) {
  .days li { grid-template-columns: 1fr auto; grid-template-areas: "d tt" "x x"; row-gap: 2px; padding: var(--sp-2) 0; }
  .days li .d { grid-area: d; font-weight: 600; }
  .days li .tt { grid-area: tt; }
  .days li .muted { grid-area: x; font-size: .85rem; }
}
.map.radar { aspect-ratio: 4 / 3; margin: 0 0 var(--sp-2); }
@media (min-width: 768px) { .map.radar { aspect-ratio: 4 / 3; } }

/* --- Reisetagebuch (UC-005) --- */
main[data-screen="unterwegs"]:not([data-view]) .reise-only, main[data-screen="unterwegs"][data-view=""] .reise-only { display: none; }
main[data-screen="unterwegs"][data-view="reisen"] .jetzt-only, main[data-screen="unterwegs"][data-view="reise"] .jetzt-only, main[data-screen="unterwegs"][data-view="fahrt"] .jetzt-only { display: none !important; }
main[data-screen="unterwegs"][data-view="karte"] .not-karte { display: none !important; }
main[data-screen="unterwegs"]:not([data-view="karte"]) .karte-only { display: none !important; }
[data-unterwegs-view][hidden] { display: none; }
.badge.live { background: var(--brand-soft); color: var(--brand); }
.rows .drive-row { flex-wrap: wrap; }

/* --- Neue Geräte und weitere Werte (UC-022) --- */
.dev-values { list-style: none; margin: 0; padding: 0; }
.dev-value { border-top: 1px solid var(--line); padding: var(--sp-3) 0; }
.dev-value:first-child { border-top: 0; }
.dev-value .check { align-items: flex-start; margin-top: 0; }
.dev-value .check span { display: flex; flex-direction: column; }
.dev-value .t { font-weight: 600; }
.dev-value .s { font-size: .84rem; color: var(--muted); }
.form select, .dev-value select { width: 100%; height: 48px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; padding: 0 .6rem; }
.dev-value input:not([type="checkbox"]) { width: 100%; height: 48px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit; padding: 0 .75rem; }
.dev-value .fields { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin-top: var(--sp-2); }
.dev-value label:not(.check) { display: block; font-size: .84rem; color: var(--muted); margin-bottom: 4px; }
.dev-card { margin-top: var(--sp-3); }
pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--sp-3); overflow-x: auto; font-size: .82rem; line-height: 1.45; white-space: pre; }
.steps { margin: 0; padding-left: 1.2rem; display: grid; gap: var(--sp-2); }
.rows.plain { border: 0; padding: 0; background: transparent; }
.rows.plain > a, .rows.plain > div { min-height: 48px; }
.extra-card[hidden] { display: none; }

/* --- Zähler-Diagnose (UC-006, Offen-Liste) --- */
.counter-grid { display: grid; gap: var(--sp-4); margin-top: var(--sp-3); }
@media (min-width: 768px) { .counter-grid { grid-template-columns: 1fr 1fr; } }
.counter-grid table { width: 100%; border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums; }
.counter-grid th, .counter-grid td { text-align: right; padding: .3rem .2rem; border-top: 1px solid var(--line); }
.counter-grid th:first-child, .counter-grid td:first-child { text-align: left; }
.counter-grid caption { text-align: left; font-weight: 600; padding-bottom: var(--sp-1); }
.counter-grid small { display: block; color: var(--muted); }

/* --- Systemzustand (UC-017) --- */
.sys-cluster { margin-bottom: var(--sp-3); padding-bottom: .2rem; }
.sys-cluster .status-line { font-size: 1.6rem; }
.sys-rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 var(--sp-4); }
.sys-rows details { border-top: 1px solid var(--line); }
.sys-rows details:first-child { border-top: 0; }
.sys-rows summary { list-style: none; display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-2) 0; cursor: pointer; }
.sys-rows summary::-webkit-details-marker { display: none; }
.sys-rows summary .t { font-weight: 600; flex: 1; }
.sys-rows .body { padding: 0 0 var(--sp-3); font-size: .92rem; }
.sys-rows .body .step { margin-top: var(--sp-2); color: var(--ink); font-weight: 500; }
.sys-rows .body .step::before { content: '→ '; color: var(--muted); }

/* --- Darstellung (Mehr): Farbschema je Gerät --- */
.theme-row[data-demo-row] { flex-wrap: nowrap; }
.theme-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; min-height: 56px; padding: var(--sp-2) 0; }

/* --- Übersicht (Design „Nachtinstrument“, Stufe 2) --- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.kicker { font-size: .6875rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--label); margin-bottom: 4px; min-height: 1em; }
.lamp.info { background: var(--blue); }
.lamp.ok { box-shadow: 0 0 8px rgba(111, 214, 144, .55); }
@media (prefers-reduced-motion: no-preference) {
  .hero[data-level~="warn"] .lamp, .hero[data-level~="hint"] .lamp { animation: lamp-pulse 2s ease-in-out infinite; }
  @keyframes lamp-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .55; transform: scale(.82); } }
}

.hero { display: flex; gap: 14px; align-items: flex-start; margin: var(--sp-2) 0 var(--sp-4); }
.hero > .lamp { width: 14px; height: 14px; margin-top: 15px; }
.hero .status-text { flex: 1; min-width: 0; }
.hero .status-line { font-family: var(--font-display); font-weight: 700; font-size: 2.5rem; line-height: 1.02; color: var(--ink-strong); text-wrap: balance; }
.hero[data-level~="warn"] .status-line { color: var(--red); }
.hero .status-meta { color: var(--muted); font-size: .875rem; margin-top: 6px; }
.hero .status-meta:empty { display: none; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-3); }
.hero-actions:not(:has(:not([hidden]))) { display: none; }
.pill { position: relative; font: inherit; font-size: .875rem; font-weight: 600; height: 40px; padding: 0 1rem; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; gap: .45rem; text-decoration: none; cursor: pointer; }
.pill .icon { width: 17px; height: 17px; }
.pill.accent { background: var(--brand); border-color: var(--brand); color: var(--primary-ink); }
:root[data-theme="dark"] .pill.accent { color: #0e1012; }
.hero[data-level~="warn"] .pill.accent { background: var(--red-soft); border-color: transparent; color: var(--red); }
.pill[hidden] { display: none; }
.pill:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.ov-grid { display: grid; gap: var(--sp-3); }
.ov-grid .card { margin-top: 0; }
a.card.battery { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-4); align-items: center; padding: 18px; }
.ring { position: relative; width: 148px; height: 148px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring-track { stroke: var(--grey-soft); }
.ring-value { stroke: var(--brand); stroke-dasharray: 0 100; transition: stroke-dasharray .6s ease; }
.ring-value.hint { stroke: var(--lamp-amber); }
.ring-value.warn { stroke: var(--lamp-red); }
.ring-value.stale { stroke: var(--lamp-off); }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-center b { font-family: var(--font-display); font-weight: 700; font-size: 3.1rem; line-height: .95; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.ring-center small { font-size: 1.1rem; color: var(--muted); margin-left: 2px; }
.ring-center .label { margin-top: 6px; }
.ring-facts { margin: 0; display: grid; gap: 10px; min-width: 0; }
.ring-facts dt { margin-bottom: 1px; }
.ring-facts dd { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; line-height: 1.1; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.ring-facts dd.pos { color: var(--brand); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
a.card.tile { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-height: 104px; }
.tile-top { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.tile-top .lamp { width: 8px; height: 8px; }
.tile b { font-family: var(--font-display); font-weight: 700; font-size: 2.125rem; line-height: 1; color: var(--ink-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile b small { font-size: .95rem; color: var(--muted); font-weight: 600; margin-left: 3px; }
.tile .s { font-size: .8125rem; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.tile.hint { border-color: var(--lamp-amber); }
.tile.hint b { color: var(--amber); }
.tile.warn { border-color: var(--lamp-red); }
.tile.warn b { color: var(--red); }
.tile.stale b { color: var(--muted); }

.events-card { margin-top: var(--sp-3); }
.events-card .card-head { margin-bottom: var(--sp-1); }
.events-card .events li { grid-template-columns: 3.4rem 1fr; }

/* Schnellaktionen im Daumenbereich (nur Handy) */
.quick { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); display: flex; justify-content: center; gap: var(--sp-2); z-index: 4; pointer-events: none; }
.quick .pill { pointer-events: auto; background: var(--glass-bar); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border-color: var(--hair); box-shadow: var(--bar-shadow); }
.quick .pill.accent { background: var(--brand); border-color: var(--brand); }
main[data-screen="uebersicht"] { padding-bottom: 72px; }

@media (min-width: 768px) {
  .quick { display: none; }
  main[data-screen="uebersicht"] { padding-bottom: 40px; }
  .ov-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: stretch; }
  a.card.battery { padding: 24px; justify-content: start; gap: 32px; }
  .ring { width: 168px; height: 168px; }
  .hero .status-line { font-size: 2.75rem; }
}

/* --- Energie (Stufe 3) --- */
a.card.battery-big { display: grid; place-items: center; padding: 22px 16px; }
.ring.big { width: 264px; height: 264px; max-width: 76vw; max-height: 76vw; }
.ring.big circle { stroke-width: 7; }
.ring.big .ring-center { gap: 2px; }
.ring.big .ring-center b { font-size: 5.6rem; }
.ring.big .ring-center small { font-size: 1.6rem; }
.ring-ah { font-size: .875rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.state-chip { justify-self: center; display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: .8125rem; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--grey-soft); color: var(--muted); }
.state-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state-chip.pos { background: var(--green-soft); color: var(--green); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0; overflow: hidden; }
.facts > div { padding: 12px 14px; min-width: 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.facts > div:nth-child(-n+3) { border-top: 0; }
.facts > div:not(:nth-child(3n+1)) { border-left: 1px solid var(--line); }
.facts b { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; line-height: 1.05; color: var(--ink-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.facts b.pos, .ring-facts dd.pos { color: var(--brand); }
.stand-small { font-size: .75rem; color: var(--label); font-variant-numeric: tabular-nums; }
.charge-row { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); }
.charge-row .t { font-weight: 600; }
.charge-row .s { font-size: .8125rem; color: var(--muted); }
.charge-val { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.charge-val b { font-family: var(--font-display); font-weight: 700; font-size: 1.45rem; color: var(--ink-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.booster-row { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.booster-row .charge-val b { font-size: 1.1rem; }
.booster-row .charge-val b.pos { color: var(--green); }
.ble-key { margin: var(--sp-2) 0 var(--sp-3); padding: var(--sp-3); border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.ble-key input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
@media (min-width: 768px) {
  main[data-screen="energie"]:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--sp-3); align-content: start; }
  main[data-screen="energie"] > .head, main[data-screen="energie"] > .grid, main[data-screen="energie"] > section.card:not(.facts):not(.charge-card) { grid-column: 1 / -1; }
  main[data-screen="energie"] > .card { margin-top: 0; }
  a.card.battery-big { grid-row: span 2; }
  .facts b { font-size: 1.6rem; }
}

/* --- Klima und Detail-Blätter (Stufe 4) --- */
.state-chip.hint { background: var(--amber-soft); color: var(--amber); }
.state-chip.warn { background: var(--red-soft); color: var(--red); }
.room-card .card-head .state-chip { margin-top: 0; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); margin: 2px 0 var(--sp-2); }
.duo > div { display: flex; flex-direction: column; gap: 2px; }
.duo b { font-family: var(--font-display); font-weight: 700; font-size: 3.4rem; line-height: 1; color: var(--ink-strong); font-variant-numeric: tabular-nums; white-space: nowrap; }
.duo b small { font-size: 1.2rem; color: var(--muted); font-weight: 600; }
.value-lg { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; line-height: 1.1; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.value-lg .muted-val { color: var(--muted); font-size: 1.35rem; margin-left: 6px; }
.small { font-size: .8125rem; }
main[data-screen="klima"] .grid .card-head .badge { margin-left: auto; }

/* Detail-Blatt im Stil des Designs: großer Wert, Zustand als Chip, Kennzahlen mit Versal-Labels */
.sheet { background: var(--surface); border-radius: 28px 28px 0 0; border-top: 1px solid var(--hair); }
.sheet-head h2 { font-size: 1.75rem; color: var(--ink-strong); }
.sheet-value .big { font-size: 4.5rem; color: var(--ink-strong); }
.sheet-value .big small { font-size: 1.5rem; }
.sheet-value .badge { font-size: .8125rem; padding: 3px 10px; }
.stats-row { border-radius: 16px; }
.stats-row > div { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; }
.stats-row b { font-size: 1.35rem; color: var(--ink-strong); }
.sheet-actions { margin-top: var(--sp-4) !important; }
.sheet-actions .pill { height: 44px; }
.sheet .chart.selectable { margin-top: var(--sp-3); }
@media (min-width: 768px) {
  .sheet { border-radius: 0; border-top: 0; }
}

/* --- Unterwegs, Karte, Reisen, Fahrt (Stufe 5) --- */
.head .sub { margin-top: 4px; }
.travel-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); margin: -4px 0 var(--sp-3); flex-wrap: wrap; }
.travel-line { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; line-height: 1.15; color: var(--ink-strong); }
.map-card { padding: 10px; }
.map-card .map { margin: 0; border-radius: 16px; }
.place { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; padding: 12px 6px 4px; }
.place b { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--ink-strong); }
.place .s { font-size: .8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.place-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.pill[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--ink-strong); }
.pill.danger { color: var(--red); }
.pill-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
main[data-screen="unterwegs"][data-view="karte"] .map { aspect-ratio: auto; height: min(62vh, 640px); }
.map-card .map-filter { padding: 10px 6px 2px; margin: 0; }
.facts.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.facts.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts.four > div:nth-child(-n+3) { border-top: 1px solid var(--line); }
.facts.four > div:nth-child(-n+2) { border-top: 0; }
.facts.four > div { border-left: 0; }
.facts.four > div:nth-child(even) { border-left: 1px solid var(--line); }
.drive-times { display: flex; justify-content: space-between; font-size: .8125rem; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }
[data-drive-trip-row] { margin-top: var(--sp-3); border-top: 1px solid var(--line); }
.note:empty { display: none; }
@media (min-width: 768px) {
  .facts.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .facts.four > div { border-top: 0 !important; }
  .facts.four > div + div { border-left: 1px solid var(--line); }
}
.chart.hidden-chart { display: none; }

/* --- Verbindung und SIM-Karten (Stufe 6) --- */
.sims { display: grid; gap: var(--sp-3); }
.sims .card { margin-top: 0; }
.sim-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.sim-line b { font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.sim-line .s { font-size: .875rem; color: var(--muted); }
.sim-line.roam { margin-top: var(--sp-3); }
.sim-line.roam .t { font-weight: 600; font-size: .875rem; }
.meter { height: 8px; border-radius: 4px; background: var(--grey-soft); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 4px; transition: width .4s ease; }
.meter.hint i { background: var(--lamp-amber); }
.meter.warn i { background: var(--lamp-red); }
.sim-form { margin-top: var(--sp-3); border-top: 1px solid var(--line); padding-top: var(--sp-2); }
.sim-form .actions { margin-top: var(--sp-2); }
.counter-card summary { list-style: none; cursor: pointer; min-height: var(--tap); display: flex; align-items: center; }
.counter-card summary::-webkit-details-marker { display: none; }
@media (min-width: 768px) { .sims { grid-template-columns: 1fr 1fr; } }
a.sim-card { color: inherit; text-decoration: none; display: block; }

/* SIM-Detail: Verbrauch pro Tag */
.sim-forecast { margin-top: var(--sp-3); font-size: .9rem; }
.sim-forecast:empty { display: none; }
.day-card .card-head { margin-bottom: var(--sp-2); }
.day-readout { font-size: .95rem; font-weight: 600; color: var(--ink-strong); font-variant-numeric: tabular-nums; min-height: 1.4em; margin-bottom: var(--sp-2); }
.day-chart { touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.dc-plot { position: relative; height: 168px; margin-right: 2.6rem; }
.dc-grid { position: absolute; left: 0; right: -2.6rem; border-top: 1px dashed var(--line-strong); pointer-events: none; }
.dc-grid.top { top: 0; }
.dc-grid.mid { top: 50%; border-top-color: var(--line); }
.dc-grid b { position: absolute; right: 0; top: -.55rem; font-size: .72rem; font-weight: 500; color: var(--muted); background: var(--surface); padding-left: 4px; font-variant-numeric: tabular-nums; }
.dc-plot::after { content: ''; position: absolute; left: 0; right: -2.6rem; bottom: 0; border-top: 1px solid var(--line-strong); }
.dc-bars { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; }
.dc-bar { flex: 1 1 0; min-width: 0; height: 100%; border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer; display: block; border-radius: 4px 4px 0 0; position: relative; }
.dc-bar:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.dc-col { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; height: var(--h); min-height: 2px; border-radius: 3px 3px 0 0; overflow: hidden; background: var(--brand); opacity: .55; transition: opacity .12s ease; }
.dc-col .roam { flex: 0 0 var(--r); background: var(--blue); }
.dc-col .home { flex: 1 1 auto; }
.dc-bar.sel .dc-col, .dc-bars:not(:has(.sel)) .dc-col { opacity: 1; }
.dc-bar.sel::before { content: ''; position: absolute; inset: 0 -1px; background: var(--brand-soft); border-radius: 4px 4px 0 0; z-index: -1; }
.dc-bar.gap .dc-col { height: 100%; background: repeating-linear-gradient(-45deg, transparent 0 3px, var(--line) 3px 5px); opacity: 1; }
.dc-bar.gap .dc-col i { display: none; }
.dc-axis { position: relative; height: 1.4rem; margin-right: 2.6rem; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dc-axis span { position: absolute; top: 4px; transform: translateX(-50%); white-space: nowrap; }
.dc-axis span.first { transform: none; left: 0; }
.dc-axis span.last { transform: translateX(-100%); left: 100%; }
.day-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: var(--sp-2); font-size: .8rem; color: var(--muted); }
.day-legend span { display: inline-flex; align-items: center; gap: 6px; }
.day-legend .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--brand); }
.day-legend .sw.roam { background: var(--blue); }
.day-legend .sw.gap { background: repeating-linear-gradient(-45deg, transparent 0 2px, var(--line-strong) 2px 4px); border: 1px solid var(--line); }
.sim-detail .actions { margin-top: var(--sp-2); }
.facts .fact-sub { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.facts .fact-sub:empty { display: none; }
.sim-detail .sim-form { margin-top: 0; border-top: 0; padding-top: 0; }
@media (min-width: 1000px) {
  .sim-detail:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); column-gap: var(--sp-3); align-items: start; }
  .sim-detail > * { grid-column: 1; }
  .sim-detail > .day-card { grid-column: 2; grid-row: 1 / span 4; }
  .sim-detail > .note { grid-column: 1 / -1; }
  .dc-plot { height: 240px; }
}

/* --- Mehr und Einstellungen (Stufe 7): Knöpfe, Felder, Listen im Stil des Designs --- */
.btn { border-radius: 14px; border-color: var(--line); background: var(--surface); min-height: 46px; padding: 0 1.1rem; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #ffffff; }
:root[data-theme="dark"] .btn.primary { color: #0e1012; }
.btn.danger { border-color: var(--line); }
.form input:not([type="checkbox"]), .form select, .dev-value input:not([type="checkbox"]), .dev-value select { background: var(--surface-2); border-color: var(--line); border-radius: 12px; }
:root[data-theme="dark"] .form input:not([type="checkbox"]), :root[data-theme="dark"] .form select { background: #121417; }
.form label { color: var(--label); font-size: .8125rem; font-weight: 600; }
.rows, .sys-rows { border-radius: var(--radius); }
.rows > a .t, .sys-rows summary .t { font-weight: 600; }
.rows > a:active { background: var(--surface-2); }
.sys-hero { margin-bottom: var(--sp-4); }
.sys-hero .status-line { font-size: 2rem; }
.hero[data-level~="warn"] .status-line { color: var(--red); }
.version-line { text-align: center; margin-top: var(--sp-5); }
.preview { border: 1px solid var(--line); border-radius: 14px; }
.toggle input.switch { margin-top: 2px; }
.action-sheet { border-radius: 28px 28px 0 0; }
@media (min-width: 768px) { .action-sheet { border-radius: var(--radius); } }

/* ---------- Laden: Platzhalter (app.js, SKELETON) ----------
   Solange eine Quelle lädt, ersetzt ein grauer Balken den Wert. Er erscheint erst nach 150 ms, damit bei
   schneller Antwort (WLAN im Camper) nichts flackert; der Text darunter ist sofort unsichtbar. */
:is(body[data-laden~="live"] [data-skel~="live"],
body[data-laden~="verbindung"] [data-skel~="verbindung"],
body[data-laden~="wetter"] [data-skel~="wetter"],
body[data-laden~="unterwegs"] [data-skel~="unterwegs"],
body[data-laden~="energie"] [data-skel~="energie"],
body[data-laden~="ereignisse"] [data-skel~="ereignisse"],
body[data-laden~="ansicht"] [data-skel~="ansicht"]) {
  color: transparent !important;
  border-radius: 6px;
  width: fit-content;
  min-width: 3.5rem;
  max-width: 100%;
  min-height: 1em;
  animation: skel-in .2s ease-out .15s both;
  pointer-events: none;
}
:is(body[data-laden~="live"] [data-skel~="live"],
body[data-laden~="verbindung"] [data-skel~="verbindung"],
body[data-laden~="wetter"] [data-skel~="wetter"],
body[data-laden~="unterwegs"] [data-skel~="unterwegs"],
body[data-laden~="energie"] [data-skel~="energie"],
body[data-laden~="ereignisse"] [data-skel~="ereignisse"],
body[data-laden~="ansicht"] [data-skel~="ansicht"]) * { visibility: hidden; }
:is(body[data-laden~="live"] [data-skel~="live"],
body[data-laden~="verbindung"] [data-skel~="verbindung"],
body[data-laden~="wetter"] [data-skel~="wetter"],
body[data-laden~="unterwegs"] [data-skel~="unterwegs"],
body[data-laden~="energie"] [data-skel~="energie"],
body[data-laden~="ereignisse"] [data-skel~="ereignisse"],
body[data-laden~="ansicht"] [data-skel~="ansicht"]):is(span, b, small, em, strong) { display: inline-block; vertical-align: middle; }
:is(body[data-laden~="live"] [data-skel~="live"],
body[data-laden~="verbindung"] [data-skel~="verbindung"],
body[data-laden~="wetter"] [data-skel~="wetter"],
body[data-laden~="unterwegs"] [data-skel~="unterwegs"],
body[data-laden~="energie"] [data-skel~="energie"],
body[data-laden~="ereignisse"] [data-skel~="ereignisse"],
body[data-laden~="ansicht"] [data-skel~="ansicht"]):is(dd) { margin-left: auto; }
:is(body[data-laden~="live"] [data-skel~="live"],
body[data-laden~="verbindung"] [data-skel~="verbindung"],
body[data-laden~="wetter"] [data-skel~="wetter"],
body[data-laden~="unterwegs"] [data-skel~="unterwegs"],
body[data-laden~="energie"] [data-skel~="energie"],
body[data-laden~="ereignisse"] [data-skel~="ereignisse"],
body[data-laden~="ansicht"] [data-skel~="ansicht"])[data-skel-liste] { width: auto; min-width: 0; height: 4.5rem; overflow: hidden; }
body[data-laden~="live"] .ring-center small { visibility: hidden; }
body[data-laden~="live"] [data-ring-value] { min-width: 1.5em; }
@keyframes skel-in { from { background-color: transparent; } to { background-color: var(--skel); } }
@keyframes skel-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: no-preference) {
  :is(body[data-laden~="live"] [data-skel~="live"],
body[data-laden~="verbindung"] [data-skel~="verbindung"],
body[data-laden~="wetter"] [data-skel~="wetter"],
body[data-laden~="unterwegs"] [data-skel~="unterwegs"],
body[data-laden~="energie"] [data-skel~="energie"],
body[data-laden~="ereignisse"] [data-skel~="ereignisse"],
body[data-laden~="ansicht"] [data-skel~="ansicht"]) { animation: skel-in .2s ease-out .15s both, skel-pulse 1.6s ease-in-out .35s infinite; }
}

/* ---------- Startbildschirm (boot.js) ----------
   Immer dunkel wie der Startbildschirm von iOS davor (manifest background_color), damit nichts aufblitzt. */
.boot { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 24px; background: #0e1012; color: #e7e9ec; text-align: center; transition: opacity .3s ease; }
.boot[data-state="aus"] { opacity: 0; pointer-events: none; }
.boot-scene { width: min(260px, 70vw); margin-bottom: 18px; overflow: hidden; }
.boot-van { display: block; width: 100%; height: auto; }
.van-shell { fill: #d6c4a0; }
.van-stripe { fill: #b9a47e; }
.van-line { fill: none; stroke: #a8926c; stroke-width: 1.2; }
.van-glass { fill: #1b1f24; }
.van-bumper { fill: #3a3f45; }
.van-light { fill: #f2e6b3; }
.van-tail { fill: #c4473a; }
.van-solar { fill: #2b3440; }
.van-fan { fill: #9aa3ab; }
.van-arch { fill: #0e1012; }
.van-mirror { fill: #2a2f35; }
.van-tyre { fill: #15181b; stroke: #2a2f35; stroke-width: 2; }
.van-hub { fill: #9aa3ab; }
.van-spokes { fill: none; stroke: #4a5058; stroke-width: 1.6; stroke-linecap: round; }
.van-road { fill: none; stroke: #3a4047; stroke-width: 2; stroke-dasharray: 14 12; stroke-linecap: round; }
.boot-name { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: .02em; }
.boot-text { margin: 0; max-width: 30ch; min-height: 2.8em; font-size: .9rem; line-height: 1.4; color: #9ba3ad; }
@media (prefers-reduced-motion: no-preference) {
  .van-spin { transform-box: fill-box; transform-origin: center; animation: van-spin .7s linear infinite; }
  .van-body { animation: van-bob .45s ease-in-out infinite alternate; }
  .van-road { animation: van-road .55s linear infinite; }
}
@keyframes van-spin { to { transform: rotate(360deg); } }
@keyframes van-bob { to { transform: translateY(.8px); } }
@keyframes van-road { to { stroke-dashoffset: 26; } }

/* Verlaufskurve, deren Daten noch laden (drawOne) */
svg.chart[data-laedt] { min-height: 70px; border-radius: 8px; animation: skel-in .2s ease-out .15s both; }
@media (prefers-reduced-motion: no-preference) {
  svg.chart[data-laedt] { animation: skel-in .2s ease-out .15s both, skel-pulse 1.6s ease-in-out .35s infinite; }
}

/* Ladebalken oben, solange etwas zum ersten Mal lädt (dieselben Quellen wie die Platzhalter) */
.loadbar { position: fixed; top: env(safe-area-inset-top, 0px); left: 0; right: 0; height: 2px; z-index: 90; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity .2s ease; }
.loadbar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--brand); opacity: .55; }
body[data-laden]:not([data-laden=""]) .loadbar { opacity: 1; transition-delay: .3s; }
@media (prefers-reduced-motion: no-preference) {
  .loadbar::after { width: 35%; opacity: 1; border-radius: 2px; animation: loadbar 1.1s ease-in-out infinite; }
}
@keyframes loadbar { from { transform: translateX(-100%); } to { transform: translateX(290%); } }

/* Knopf, dessen Änderung gerade unterwegs ist (auth-ui.js, apiFetch): kleiner Ladekreis hinter der Beschriftung */
button[aria-busy="true"] { cursor: progress; }
button[aria-busy="true"]:disabled { opacity: .85; }
button[aria-busy="true"]::after { content: ""; display: inline-block; width: .9em; height: .9em; margin-left: .5em; vertical-align: -.12em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; }
@media (prefers-reduced-motion: no-preference) {
  button[aria-busy="true"]::after { animation: busy-spin .7s linear infinite; }
}
@keyframes busy-spin { to { transform: rotate(360deg); } }

/* Standheizung (UC-023) auf der Klima-Seite */
.heater-modes { display: flex; width: 100%; margin: var(--sp-2) 0 var(--sp-3); }
.heater-modes button { flex: 1; min-height: 44px; padding: 0 .4rem; }
.heater-modes button small { color: var(--label); font-weight: 500; font-variant-numeric: tabular-nums; }
.heater-modes button:disabled { opacity: .5; cursor: not-allowed; }
.heater-line { margin: 0; font-weight: 600; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.heater-card .note { margin-top: var(--sp-2); }
.heater-card .link { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--brand); text-decoration: none; font-weight: 500; font-size: .86rem; }
@media (max-width: 559px) {
  .heater-modes button { display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; min-height: 52px; }
  .heater-modes button small { font-size: .75rem; }
}

/* ---------- Touch (gestures.js und Rückmeldung beim Tippen) ---------- */
/* Kein Doppeltipp-Zoom auf Bedienelementen, eigenes Feedback statt grauem iOS-Blitz */
button, a, summary, label, .seg button, [role="button"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
@media (hover: none) {
  .btn, .pill, .chip, .icon-btn, .seg button, .toast-btn, .btn-link { transition: transform .08s ease, background-color .08s ease; }
  .btn:active, .pill:active, .chip:active, .icon-btn:active, .toast-btn:active { transform: scale(.97); }
  .btn.primary:active, .pill.accent:active { filter: brightness(.92); }
  .seg button:active:not([aria-pressed="true"]) { background: var(--surface-2); }
  .btn-link:active { opacity: .6; }
  button:disabled:active, .btn:disabled:active { transform: none; filter: none; }
}
/* Runde Schließen-Knöpfe sind 34 px; die Tippfläche ist 44 px */
.icon-btn { position: relative; }
.icon-btn::after { content: ""; position: absolute; inset: -5px; }

/* Detailblatt offen: Hintergrund scrollt nicht mit (iOS) */
html:has(.sheet:not([hidden])) { overflow: hidden; }
.sheet-backdrop { touch-action: none; }
.sheet { touch-action: pan-y; }

/* Hereingleiten: Blatt von unten (Handy) bzw. von rechts (iPad), Abfragen von unten, Hintergrund blendet ein */
@media (prefers-reduced-motion: no-preference) {
  .sheet:not([hidden]) { animation: sheet-up .26s cubic-bezier(.2, .8, .2, 1); }
  .sheet-backdrop:not([hidden]) { animation: fade-in .2s ease; }
  dialog.action-sheet[open] { animation: sheet-up .24s cubic-bezier(.2, .8, .2, 1); }
  @media (min-width: 768px) {
    .sheet:not([hidden]) { animation-name: sheet-left; }
    dialog.action-sheet[open] { animation: fade-in .18s ease; }
  }
}
@keyframes sheet-up { from { transform: translate3d(0, 100%, 0); } }
@keyframes sheet-left { from { transform: translate3d(100%, 0, 0); } }
@keyframes fade-in { from { opacity: 0; } }

/* Stundenleiste (Wetter): rastet beim Wischen auf ganze Stunden ein und gibt den Wisch nicht an die Seite weiter */
.hours { scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.hours > * { scroll-snap-align: start; }

/* ---------- Bewegungsalarm (UC-025) ---------- */
.alarm-card[hidden] { display: none; }
.alarm-card { padding: 14px 16px; }
.alarm-card.armed { border-color: color-mix(in srgb, var(--brand) 55%, var(--line)); background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); }
.alarm-card.alert { padding: var(--sp-4); border-color: var(--red); background: color-mix(in srgb, var(--red-soft) 55%, var(--surface)); }
.alarm-row { display: flex; align-items: center; gap: 12px; min-height: var(--tap); }
.alarm-row .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--grey-soft); color: var(--muted); flex: none; }
.alarm-card.armed .ic { background: var(--brand); color: var(--primary-ink); }
.alarm-card.alert .ic { background: var(--red-soft); color: var(--red); }
.alarm-row .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.alarm-row .t { font-weight: 650; color: var(--ink-strong); }
.alarm-card.alert .t { color: var(--red); font-weight: 700; }
.alarm-row .s { font-size: .84rem; color: var(--muted); line-height: 1.35; }
.alarm-card.armed .s { color: var(--ink); }
.alarm-card .wide { width: 100%; margin-top: var(--sp-3); }
.alarm-card .alarm-sens { position: relative; display: inline-flex; align-items: center; min-height: 32px; margin: 2px 0 -6px 48px; padding: 0; border: 0; background: none; font: inherit; font-size: .82rem; font-weight: 500; color: var(--brand); cursor: pointer; }
.alarm-card .alarm-sens::after { content: ''; position: absolute; inset: -6px -8px; }
.sens-actions .btn { flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; min-height: 56px; text-align: left; }
.sens-actions .btn small { font-weight: 400; color: var(--muted); font-size: .82rem; }
.sens-actions .btn[aria-current="true"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.sens-actions .btn.plain { min-height: var(--tap); align-items: center; }
/* Schalter: größere Tippfläche (44 px), ohne die Karte drumherum schaltbar zu machen */
.alarm-row .switch::before { content: ''; position: absolute; inset: -8px -6px; }

/* ---------- Ausrichten (Wasserwaage) ---------- */
:root { --van: #ffffff; --van-line: #8a929c; --van-glass: #dfe6ec; --wheel: #2a2f35; --solar: #c9d3dc; }
:root[data-theme="dark"] { --van: #2a2f35; --van-line: #6c747e; --van-glass: #3a4450; --wheel: #0b0c0d; --solar: #39414a; }
.level-card { display: grid; gap: var(--sp-3); }
.level-card .state-chip { justify-self: start; }
.level-headline { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; line-height: 1.12; color: var(--ink-strong); margin: 0; text-wrap: balance; }
.van-top { width: 100%; max-width: 380px; height: auto; justify-self: center; display: block; }
.van-top text { font-family: system-ui, -apple-system, sans-serif; }
.v-body { fill: var(--van); stroke: var(--van-line); stroke-width: 2; }
.v-glass { fill: var(--van-glass); stroke: var(--van-line); stroke-width: 1.2; }
.v-solar { fill: var(--solar); stroke: var(--van-line); stroke-width: 1; }
.v-line { stroke: var(--van-line); stroke-width: 1.2; fill: none; }
.v-wheel { fill: var(--wheel); }
.van-top .dir { fill: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.lift .pill-bg { stroke-width: 1.5; fill: var(--surface-2); stroke: var(--line-strong); }
.lift text { fill: var(--muted); }
.lift .pill-num { font-family: var(--font-display); font-weight: 700; font-size: 22px; }
.lift .pill-cap { font-size: 11px; font-weight: 600; }
.lift.l0 .pill-bg { fill: var(--green-soft); stroke: var(--green); } .lift.l0 text { fill: var(--green); }
.lift.l1 .pill-bg { fill: var(--amber-soft); stroke: var(--amber); } .lift.l1 text { fill: var(--amber); }
.lift.l2 .pill-bg { fill: var(--red-soft); stroke: var(--red); } .lift.l2 text { fill: var(--red); }
.lift.top .pill-bg { stroke-width: 3; }
.level-facts { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.level-facts > div { display: grid; gap: 2px; }
.level-facts > div + div { border-left: 1px solid var(--line); padding-left: var(--sp-4); }
.level-facts b { font-family: var(--font-display); font-weight: 700; font-size: 1.65rem; line-height: 1; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.level-facts .s { font-size: .85rem; color: var(--muted); }
.round-btn { width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--ink); }
.mini-level { width: 56px; height: 56px; flex: none; }
.mini-level .ring { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.mini-level .ring.tol { stroke: var(--green); stroke-dasharray: 3 3; }
.mini-level .cross { stroke: var(--line-strong); stroke-width: 1; }
.mini-level .bubble { fill: var(--brand-soft); stroke: var(--brand); stroke-width: 2.5; }
.arrive { position: relative; margin-bottom: var(--sp-3); }
.arrive[hidden] { display: none; }
.card.arrive-card { display: flex; flex-direction: row; align-items: center; gap: var(--sp-3); border-color: var(--amber); padding-right: 52px; }
.arrive.ok .arrive-card { border-color: var(--green); }
.arrive-t { display: grid; gap: 2px; min-width: 0; }
.arrive-t b { font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; line-height: 1.1; color: var(--ink-strong); }
.arrive-t .s { font-size: .85rem; color: var(--muted); }
.arrive-x { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: var(--tap); height: var(--tap); border: 0; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; border-radius: 50%; }
.level-mini-row { display: flex; align-items: center; gap: var(--sp-3); }
.level-mini-row > div { display: grid; gap: 2px; }
.level-mini-row b { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; color: var(--ink-strong); }
.level-mini-row .s { font-size: .85rem; color: var(--muted); }
.switch-list { display: grid; gap: 0; padding-block: var(--sp-2); }
.form .switch-row, .switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 56px; padding: var(--sp-2) 0; cursor: pointer; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-row > span { display: grid; gap: 2px; min-width: 0; }
.switch-row .t { font-weight: 600; color: var(--ink); }
.switch-row .s { font-size: .8rem; color: var(--muted); line-height: 1.35; }
@media (max-width: 430px) { .quick { gap: 5px; } .quick .pill { padding-inline: 9px; gap: 4px; font-size: .8125rem; } }
/* Ruhe-Anzeige: solange es wackelt, gilt der letzte ruhige Stand und ist blass */
.level-card.unsteady .lift, .level-card.unsteady .level-facts b { opacity: .45; transition: opacity .3s; }
.level-card .lift, .level-card .level-facts b { transition: opacity .3s; }
.state-chip.wait::before { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .state-chip.wait::before { animation: none; } }
