/* Battery Bandits, Oberfläche "Cupertino Spatial Telemetry".
   Idee: Warmes Papier statt kaltem Grau, die Farben des Waschbär-Logos (Kohle, Kupfer, Bernstein) als Markenakzent,
   Apple-Systemfarben nur für Status. Große Überschriften in Bricolage Grotesque, alles andere in Geist.
   Schwebende Glas-Inseln statt einer Kopfleiste, ein Satz statt einer Kennzahlen-Wand, Bewegung mit Federkurve.
   Aufbau: 1 Schriften, 2 Token, 3 Grundlagen, 4 Shell und Inseln, 5 Bausteine, 6 Übersicht, 7 Gerät, 8 Karte,
   9 Wartung und Postfach, 10 Optionen, 11 Überlagerungen, 12 Anmeldung, 13 Bewegung, 14 Schmale Bildschirme. */

/* ---------- 1. Schriften (lokal, SIL Open Font License) ---------- */

@font-face {
  font-family: "Geist"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 200 800; font-stretch: 75% 100%; font-display: swap;
  src: url("/fonts/bricolage-grotesque-latin-opsz-normal.woff2") format("woff2");
}

/* Registrierte Zahl: Damit kann CSS eine ganze Zahl hochzählen lassen, ohne JavaScript. */
@property --shown { syntax: "<integer>"; inherits: true; initial-value: 0; }

/* ---------- 2. Token ---------- */

:root {
  color-scheme: light;
  --bg: #f4f2ee; --bg-2: #ebe8e2; --surface: #ffffff; --surface-2: #faf9f7; --hover: rgba(26, 24, 22, 0.045);
  --fill: rgba(26, 24, 22, 0.06); --fill-2: rgba(26, 24, 22, 0.1); --fill-3: rgba(26, 24, 22, 0.2);
  --line: rgba(26, 24, 22, 0.08); --line-2: rgba(26, 24, 22, 0.14);
  --text: #1a1816; --text-2: #5f5a54; --text-3: #8c867e;
  --accent: #b4661c; --accent-fg: #9a5413; --accent-tint: #f6e9d9; --accent-ring: rgba(180, 102, 28, 0.32); --on-accent: #ffffff;
  --ink: #1a1816; --on-ink: #f6f3ee;
  --ok: #34c759; --warn: #ff9500; --crit: #ff3b30; --off: #8e8e93;
  --ok-fg: #1b7f3b; --warn-fg: #a35c00; --crit-fg: #c4261c; --off-fg: #5c5c61;
  --ok-tint: #e2f6e8; --warn-tint: #fff0d9; --crit-tint: #ffe4e1; --off-tint: #eceae6;
  --crit-solid: #e5342a;
  --glass: rgba(255, 255, 255, 0.72); --glass-line: rgba(26, 24, 22, 0.08); --blur: saturate(180%) blur(24px);
  --spot-bg: #1a1816; --spot-text: #f6f3ee; --spot-muted: #a9a29a; --spot-line: rgba(246, 243, 238, 0.14);
  --sh-1: 0 1px 2px rgba(26, 24, 22, 0.05), 0 10px 28px -14px rgba(26, 24, 22, 0.14);
  --sh-2: 0 2px 4px rgba(26, 24, 22, 0.05), 0 28px 56px -24px rgba(26, 24, 22, 0.28);
  --sh-island: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 10px 36px -10px rgba(26, 24, 22, 0.2);
  --overlay: rgba(26, 24, 22, 0.34);
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 26px; --r-pill: 999px;
  --bw: 1px; --row: 68px; --gap: 20px; --fs: 15px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: linear(0, 0.22 2.1%, 1.11 8.6%, 1.26 11.4%, 1.3 13.8%, 1.28 16%, 1.23 18.4%, 1.13 22.5%, 1.03 27%, 0.985 31%, 0.974 34.3%, 0.989 40%, 1.005 47%, 1);
  --t-fast: 140ms; --t-base: 240ms; --t-slow: 420ms;
  --font: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, sans-serif;
  --display: "Bricolage Grotesque", "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c0b0a; --bg-2: #141210; --surface: #161412; --surface-2: #1d1a17; --hover: rgba(246, 243, 238, 0.05);
    --fill: rgba(246, 243, 238, 0.07); --fill-2: rgba(246, 243, 238, 0.11); --fill-3: rgba(246, 243, 238, 0.22);
    --line: rgba(246, 243, 238, 0.08); --line-2: rgba(246, 243, 238, 0.14);
    --text: #f6f3ee; --text-2: #a9a29a; --text-3: #716b64;
    --accent: #e3a55b; --accent-fg: #efb877; --accent-tint: #2a2015; --accent-ring: rgba(227, 165, 91, 0.4); --on-accent: #1a1816;
    --ink: #f6f3ee; --on-ink: #1a1816;
    --ok: #30d158; --warn: #ff9f0a; --crit: #ff453a; --off: #8e8e93;
    --ok-fg: #5dd57e; --warn-fg: #ffb340; --crit-fg: #ff7066; --off-fg: #a9a29a;
    --ok-tint: #10291a; --warn-tint: #33250a; --crit-tint: #381613; --off-tint: #221f1c;
    --crit-solid: #ff453a;
    --glass: rgba(22, 20, 18, 0.7); --glass-line: rgba(246, 243, 238, 0.1);
    --spot-bg: #221e1a; --spot-line: rgba(246, 243, 238, 0.1);
    --sh-1: 0 0 0 0.5px rgba(246, 243, 238, 0.05), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
    --sh-2: 0 0 0 0.5px rgba(246, 243, 238, 0.07), 0 32px 64px -24px rgba(0, 0, 0, 0.85);
    --sh-island: 0 1px 0 rgba(246, 243, 238, 0.06) inset, 0 12px 40px -10px rgba(0, 0, 0, 0.8);
    --overlay: rgba(0, 0, 0, 0.58);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0b0a; --bg-2: #141210; --surface: #161412; --surface-2: #1d1a17; --hover: rgba(246, 243, 238, 0.05);
  --fill: rgba(246, 243, 238, 0.07); --fill-2: rgba(246, 243, 238, 0.11); --fill-3: rgba(246, 243, 238, 0.22);
  --line: rgba(246, 243, 238, 0.08); --line-2: rgba(246, 243, 238, 0.14);
  --text: #f6f3ee; --text-2: #a9a29a; --text-3: #716b64;
  --accent: #e3a55b; --accent-fg: #efb877; --accent-tint: #2a2015; --accent-ring: rgba(227, 165, 91, 0.4); --on-accent: #1a1816;
  --ink: #f6f3ee; --on-ink: #1a1816;
  --ok: #30d158; --warn: #ff9f0a; --crit: #ff453a; --off: #8e8e93;
  --ok-fg: #5dd57e; --warn-fg: #ffb340; --crit-fg: #ff7066; --off-fg: #a9a29a;
  --ok-tint: #10291a; --warn-tint: #33250a; --crit-tint: #381613; --off-tint: #221f1c;
  --crit-solid: #ff453a;
  --glass: rgba(22, 20, 18, 0.7); --glass-line: rgba(246, 243, 238, 0.1);
  --spot-bg: #221e1a; --spot-line: rgba(246, 243, 238, 0.1);
  --sh-1: 0 0 0 0.5px rgba(246, 243, 238, 0.05), 0 10px 28px -14px rgba(0, 0, 0, 0.7);
  --sh-2: 0 0 0 0.5px rgba(246, 243, 238, 0.07), 0 32px 64px -24px rgba(0, 0, 0, 0.85);
  --sh-island: 0 1px 0 rgba(246, 243, 238, 0.06) inset, 0 12px 40px -10px rgba(0, 0, 0, 0.8);
  --overlay: rgba(0, 0, 0, 0.58);
}

/* Hoher Kontrast: reine Farben, kräftige Rahmen, keine Schatten, Tönungen oder Unschärfe. Für Sonnenlicht. */
:root[data-contrast="high"] {
  --bg: #ffffff; --bg-2: #ffffff; --surface: #ffffff; --surface-2: #ffffff; --hover: #e6e6e6;
  --fill: #e6e6e6; --fill-2: #cccccc; --fill-3: #767676;
  --line: #000000; --line-2: #000000;
  --text: #000000; --text-2: #000000; --text-3: #000000;
  --accent: #0000c8; --accent-fg: #0000c8; --accent-tint: #ffffff; --accent-ring: #0000c8; --on-accent: #ffffff;
  --ink: #000000; --on-ink: #ffffff;
  --ok: #00733a; --warn: #a14a00; --crit: #c80000; --off: #333333;
  --ok-fg: #00552b; --warn-fg: #7a3800; --crit-fg: #a00000; --off-fg: #000000;
  --ok-tint: #ffffff; --warn-tint: #ffffff; --crit-tint: #ffffff; --off-tint: #ffffff;
  --crit-solid: #c80000;
  --glass: #ffffff; --glass-line: #000000; --blur: none;
  --spot-bg: #000000; --spot-text: #ffffff; --spot-muted: #ffffff; --spot-line: #ffffff;
  --sh-1: none; --sh-2: none; --sh-island: none; --overlay: rgba(0, 0, 0, 0.75);
  --bw: 2px;
}
@media (prefers-color-scheme: dark) {
  :root[data-contrast="high"]:not([data-theme="light"]) {
    --bg: #000000; --bg-2: #000000; --surface: #000000; --surface-2: #000000; --hover: #262626;
    --fill: #262626; --fill-2: #404040; --fill-3: #8c8c8c;
    --line: #ffffff; --line-2: #ffffff;
    --text: #ffffff; --text-2: #ffffff; --text-3: #ffffff;
    --accent: #6ea8ff; --accent-fg: #9cc3ff; --accent-tint: #000000; --accent-ring: #6ea8ff; --on-accent: #000000;
    --ink: #ffffff; --on-ink: #000000;
    --ok: #00e676; --warn: #ffc400; --crit: #ff5252; --off: #d0d0d0;
    --ok-fg: #00e676; --warn-fg: #ffc400; --crit-fg: #ff7b7b; --off-fg: #ffffff;
    --ok-tint: #000000; --warn-tint: #000000; --crit-tint: #000000; --off-tint: #000000;
    --crit-solid: #d32f2f;
    --glass: #000000; --glass-line: #ffffff;
    --spot-bg: #000000; --spot-text: #ffffff;
  }
}
:root[data-contrast="high"][data-theme="dark"] {
  --bg: #000000; --bg-2: #000000; --surface: #000000; --surface-2: #000000; --hover: #262626;
  --fill: #262626; --fill-2: #404040; --fill-3: #8c8c8c;
  --line: #ffffff; --line-2: #ffffff;
  --text: #ffffff; --text-2: #ffffff; --text-3: #ffffff;
  --accent: #6ea8ff; --accent-fg: #9cc3ff; --accent-tint: #000000; --accent-ring: #6ea8ff; --on-accent: #000000;
  --ink: #ffffff; --on-ink: #000000;
  --ok: #00e676; --warn: #ffc400; --crit: #ff5252; --off: #d0d0d0;
  --ok-fg: #00e676; --warn-fg: #ffc400; --crit-fg: #ff7b7b; --off-fg: #ffffff;
  --ok-tint: #000000; --warn-tint: #000000; --crit-tint: #000000; --off-tint: #000000;
  --crit-solid: #d32f2f;
  --glass: #000000; --glass-line: #ffffff;
  --spot-bg: #000000; --spot-text: #ffffff;
}

/* Dichte: Kompakt zeigt die ganze Flotte auf einen Blick. */
:root[data-density="compact"] { --row: 46px; --gap: 12px; --fs: 14px; }

/* ---------- 3. Grundlagen ---------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); font: 400 var(--fs) / 1.5 var(--font); letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; overflow: hidden;
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
h1 { font: 600 26px / 1.15 var(--display); letter-spacing: -0.03em; font-variation-settings: "opsz" 48; }
h2 { font: 600 15px / 1.3 var(--font); letter-spacing: -0.01em; color: var(--text); }
h3 { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 18px 0 8px; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
a { color: var(--accent-fg); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--accent-ring); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.sub { color: var(--text-2); margin-top: 6px; }
.empty, .calm { padding: 28px 22px; color: var(--text-2); }
.empty-state { display: grid; gap: 14px; justify-items: start; padding: 28px 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font: 600 12px / 1 var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3);
}

/* Zahlen: dieselbe Schrift mit tabellarischen Ziffern. Nichts verschiebt sich, wenn ein neuer Messwert eintrifft. */
.mono-num, .mono, .tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; letter-spacing: -0.01em; }
kbd { font: 500 11px / 1 var(--font); padding: 4px 6px; border-radius: 6px; color: var(--text-3); background: var(--fill); }

/* Icons: einfarbige Inline-SVGs, Strichstärke 1,75 */
.icon { display: inline-flex; }
.icon svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; flex: none; }

/* ---------- 4. Shell und Inseln ---------- */

.shell { position: relative; height: 100dvh; overflow: hidden; background: var(--bg); }
.stage { position: absolute; inset: 0; display: flex; flex-direction: column; min-height: 0; }
.view {
  flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; align-items: center;
  padding: 104px clamp(16px, 4.4vw, 64px) 72px; scroll-padding-top: 96px;
}
.view > * { width: 100%; max-width: 1360px; }
.view-head { margin-bottom: 28px; }

.topbar {
  position: absolute; z-index: 60; inset: 14px 16px auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  pointer-events: none; view-transition-name: topbar;
}
.island {
  pointer-events: auto; display: flex; align-items: center; gap: 6px; height: 52px; padding: 0 10px; border-radius: var(--r-pill);
  background: var(--glass); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: var(--bw) solid var(--glass-line); box-shadow: var(--sh-island);
}
.island-brand { justify-self: start; border-width: var(--bw); gap: 10px; padding: 0 18px 0 10px; color: var(--text); transition: transform var(--t-base) var(--spring); }
.island-brand:hover { transform: scale(1.02); }
.island-brand:active { transform: scale(0.97); }
.logo { display: block; width: 30px; height: 30px; }
.wordmark { font: 600 17px / 1 var(--display); letter-spacing: -0.03em; font-variation-settings: "opsz" 24; white-space: nowrap; }
.island-tools { justify-self: end; gap: 10px; padding: 0 8px 0 14px; }

/* Navigation: segmentierte Kapsel, ein Kissen gleitet mit Federkurve zum aktiven Eintrag */
.tb-nav { --seg: 124px; position: relative; display: grid; grid-template-columns: repeat(5, var(--seg)); gap: 0; padding: 5px; }
.tb-nav::before {
  content: ""; position: absolute; top: 5px; bottom: 5px; left: 5px; width: var(--seg); border-radius: var(--r-pill); background: var(--ink);
  transform: translateX(calc(var(--i, 0) * var(--seg))); transition: transform var(--t-slow) var(--spring), opacity var(--t-base) var(--ease);
}
.tb-nav.no-active::before { opacity: 0; }
.tb-link {
  position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 42px; padding: 0 10px; border: 0;
  border-radius: var(--r-pill); background: transparent; color: var(--text-2); font-weight: 500; white-space: nowrap; transition: color var(--t-base) var(--ease);
}
.tb-link:hover { color: var(--text); }
.tb-link.is-active { color: var(--on-ink); }
.tb-link .icon svg { transition: transform var(--t-base) var(--spring); }
.tb-link:active .icon svg { transform: scale(0.84); }
.badge {
  min-width: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--fill-2); color: var(--text); font: 600 11px / 20px var(--font); text-align: center; letter-spacing: 0;
}
.tb-link.is-active .badge { background: rgba(255, 255, 255, 0.22); color: var(--on-ink); }
.badge.crit { background: var(--crit-solid); color: #fff; }
.badge.accent { background: var(--accent); color: var(--on-accent); }

.tb-palette {
  display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 8px 0 12px; border: 0; border-radius: var(--r-pill); background: var(--fill);
  color: var(--text-2); transition: background var(--t-fast) var(--ease);
}
.tb-palette:hover { background: var(--fill-2); color: var(--text); }
.tb-palette kbd { background: transparent; }
.live { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--off); display: inline-block; flex: none; }
.live.is-on .live-dot, .live-dot.is-on { background: var(--ok); animation: live-pulse 2.6s ease-out infinite; }
.tb-user { display: flex; align-items: center; gap: 8px; }
.tb-user-name { font-weight: 500; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font: 600 12px / 1 var(--font); letter-spacing: 0;
}
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--text-2);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-base) var(--spring);
}
.icon-btn:hover { background: var(--fill); color: var(--text); }
.icon-btn:active { transform: scale(0.88); }

.banner {
  display: flex; gap: 10px; align-items: flex-start; margin: 82px 32px 0; padding: 14px 18px; background: var(--crit-tint); border-radius: var(--r-lg); color: var(--crit-fg);
}
.banner span { color: var(--text); }
.banner + .view { padding-top: 24px; }
.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 200; transform: translateX(-50%); padding: 13px 22px; max-width: 92vw; border-radius: var(--r-pill);
  background: var(--ink); color: var(--on-ink); font-weight: 500; box-shadow: var(--sh-2); animation: toast-in var(--t-slow) var(--spring);
}

/* ---------- 5. Bausteine ---------- */

.surface { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-1); border: var(--bw) solid var(--line); }
.surface-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; padding: 14px 24px; border-bottom: var(--bw) solid var(--line); }
.surface-body { padding: 22px 24px; }
.surface-pad { padding: 26px; }
.surface-pad > h2 { margin-bottom: 6px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 24px 8px; }
.section-head h2 { font: 600 22px / 1.1 var(--display); letter-spacing: -0.03em; font-variation-settings: "opsz" 36; }
.count-pill { padding: 3px 12px; border-radius: var(--r-pill); background: var(--fill); color: var(--text-2); font-size: 13px; font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border: 0; border-radius: var(--r-pill);
  background: var(--fill); color: var(--text); font-weight: 500; white-space: nowrap; text-decoration: none;
  transition: background var(--t-fast) var(--ease), transform var(--t-base) var(--spring), filter var(--t-fast) var(--ease), opacity var(--t-fast) var(--ease);
}
.btn:hover { background: var(--fill-2); text-decoration: none; }
.btn:active { transform: scale(0.95); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover { background: var(--ink); filter: brightness(1.18); }
.btn-danger { background: var(--crit-solid); color: #fff; }
.btn-danger:hover { background: var(--crit-solid); filter: brightness(1.08); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--fill); color: var(--text); }
:root[data-contrast="high"] .btn { border: var(--bw) solid var(--line); }
.btn-sm { height: 32px; padding: 0 14px; font-size: 14px; }
.btn-lg { height: 54px; padding: 0 30px; font-size: 17px; font-weight: 600; }
.btn-icon { width: 40px; padding: 0; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.planned { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--ok-fg); }
.link { padding: 0; border: 0; background: none; color: var(--accent-fg); font: inherit; cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.back { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--text-2); font-weight: 500; transition: background var(--t-fast) var(--ease); }
.back:hover { background: var(--fill); color: var(--text); }

input[type="text"], input[type="search"], input[type="password"], input[type="date"], select, textarea {
  height: 40px; padding: 0 14px; background: var(--surface-2); border: var(--bw) solid var(--line-2); border-radius: var(--r-md); color: var(--text);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); background: var(--surface); }
textarea { height: auto; padding: 10px 14px; width: 100%; resize: vertical; min-height: 84px; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
select { padding-right: 30px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--text-2); }
.form { display: grid; gap: 18px; margin-top: 18px; max-width: 460px; }
.form-error { margin: 0; color: var(--crit-fg); font-weight: 600; }
.check { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; }

/* Schalter im iOS-Stil: reines CSS auf der Checkbox, der Griff dehnt sich beim Drücken */
.check input[type="checkbox"], .lab-row input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 46px; height: 28px; margin: 0; border: 0; border-radius: var(--r-pill);
  background: var(--fill-3); cursor: pointer; transition: background var(--t-base) var(--ease);
}
.check input[type="checkbox"]::before, .lab-row input[type="checkbox"]::before {
  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, 0.3); transition: transform var(--t-base) var(--spring), width var(--t-fast) var(--ease);
}
.check input[type="checkbox"]:checked, .lab-row input[type="checkbox"]:checked { background: var(--ok); }
.check input[type="checkbox"]:active::before, .lab-row input[type="checkbox"]:active::before { width: 29px; }
.check input[type="checkbox"]:checked::before, .lab-row input[type="checkbox"]:checked::before { transform: translateX(18px); }
.check input[type="checkbox"]:checked:active::before, .lab-row input[type="checkbox"]:checked:active::before { transform: translateX(13px); }

/* Status und Herkunft als Pillen */
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.dot.normal { background: var(--ok); }
.dot.warning { background: var(--warn); }
.dot.critical { background: var(--crit); }
.dot.offline { box-sizing: border-box; background: transparent; border: 1.5px solid var(--off); }
.dot.solid { background: var(--text); }
.dot.pale { background: var(--text); opacity: 0.4; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 10px; border-radius: var(--r-pill); background: var(--fill); color: var(--text-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.status:has(.dot.normal) { background: var(--ok-tint); color: var(--ok-fg); }
.status:has(.dot.warning) { background: var(--warn-tint); color: var(--warn-fg); }
.status:has(.dot.critical) { background: var(--crit-tint); color: var(--crit-fg); }
.status:has(.dot.offline) { background: var(--off-tint); color: var(--off-fg); }
:root[data-contrast="high"] .status, :root[data-contrast="high"] .origin { border: var(--bw) solid currentColor; }
.origin { display: inline-block; padding: 2px 10px; border-radius: var(--r-pill); background: var(--fill); color: var(--text-2); font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.origin.dozent { background: var(--accent-tint); color: var(--accent-fg); }
.origin.prio-high { background: var(--crit-tint); color: var(--crit-fg); }
.origin.prio-low { background: transparent; color: var(--text-3); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: var(--fill);
  font-size: 14px; font-weight: 500; color: var(--text-2);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-base) var(--spring);
}
.chip:hover { background: var(--fill-2); color: var(--text); }
.chip:active { transform: scale(0.94); }
.chip.is-active { background: var(--ink); color: var(--on-ink); }
.chip.is-active .dot { box-shadow: 0 0 0 1.5px var(--on-ink); }
.chip-n { opacity: 0.6; font-size: 13px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--fill); }
.seg-btn {
  height: 32px; padding: 0 16px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: background var(--t-base) var(--ease), color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease), transform var(--t-base) var(--spring);
}
.seg-btn:hover { color: var(--text); }
.seg-btn:active { transform: scale(0.95); }
.seg-btn.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(26, 24, 22, 0.18), 0 0 0 0.5px rgba(26, 24, 22, 0.05); }
:root[data-theme="dark"] .seg-btn.is-active { background: var(--fill-3); box-shadow: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg-btn.is-active { background: var(--fill-3); box-shadow: none; } }
:root[data-contrast="high"] .seg-btn.is-active { background: var(--ink); color: var(--on-ink); }
.tabs { display: inline-flex; gap: 2px; padding: 4px; margin-bottom: 24px; border-radius: var(--r-pill); background: var(--fill); }
.tabs .seg-btn { height: 38px; padding: 0 24px; font-size: 15px; }
.star { display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-3); transition: color var(--t-fast) var(--ease), transform var(--t-base) var(--spring); }
.star:hover { color: var(--warn); }
.star:active { transform: scale(0.7); }
.star .icon svg { width: 16px; height: 16px; }
.star.on { color: var(--warn); }
.star.on .icon svg { fill: currentColor; }
.note { color: var(--text-2); }
.late { color: var(--crit-fg); font-weight: 600; }
.kv-list { display: grid; margin: 14px 0; border-radius: var(--r-md); background: var(--fill); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: var(--bw) solid var(--line); }
.kv:first-child { border-top: 0; }
.kv dt { color: var(--text-2); }
.kv dd { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- 6. Übersicht ---------- */

.hero { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 28px; align-items: end; margin-bottom: 40px; }
.hero-main { display: grid; gap: 18px; align-content: end; }
.hero-title {
  font: 600 clamp(44px, 6.6vw, 96px) / 0.98 var(--display); letter-spacing: -0.05em; font-variation-settings: "opsz" 96; text-wrap: balance;
}
.hero-words { display: inline; }
.count { padding: 0; border-radius: 0; background: none; font: inherit; color: var(--accent); font-weight: inherit; }
.count::after { counter-reset: c var(--shown); content: counter(c) "\00a0"; font-variant-numeric: tabular-nums; }
.count.is-hidden { display: none; }
.hero .lead { font-size: clamp(17px, 1.6vw, 21px); line-height: 1.4; color: var(--text-2); max-width: 36em; letter-spacing: -0.014em; }

.spotlight {
  display: grid; align-content: start; gap: 4px; padding: 26px 28px 24px; border-radius: var(--r-xl); background: var(--spot-bg); color: var(--spot-text);
  box-shadow: var(--sh-2); border: var(--bw) solid var(--spot-line);
}
.spotlight .eyebrow { color: var(--spot-muted); margin-bottom: 10px; }
.spotlight .muted { color: var(--spot-muted); }
.spot-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.spot-id { font: 600 20px / 1 var(--display); letter-spacing: -0.03em; color: var(--spot-text); }
.spotlight .status { background: rgba(246, 243, 238, 0.1); color: var(--spot-text); }
.spotlight .status:has(.dot.critical) { background: rgba(255, 69, 58, 0.2); color: #ff8a82; }
.spotlight .status:has(.dot.warning) { background: rgba(255, 159, 10, 0.2); color: #ffc15c; }
.spot-big { font: 600 clamp(48px, 5.4vw, 80px) / 1 var(--display); letter-spacing: -0.05em; font-variation-settings: "opsz" 96; margin-top: 18px; }
.spotlight .btn-primary { background: var(--spot-text); color: var(--spot-bg); }
.spotlight .btn-ghost { color: var(--spot-muted); }
.spotlight .btn-ghost:hover { background: rgba(246, 243, 238, 0.1); color: var(--spot-text); }
.spotlight .planned { color: #7fe3a0; }

/* Die Flotte als Reihe von Säulen: Höhe ist der Ladestand, Farbe ist der Status */
.fleet { margin-bottom: 40px; }
.fleet-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-bottom: 16px; }
.fleet-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.legend-item { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.fleet-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(46px, 1fr); gap: 8px; height: 132px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 0; }
.fleet-strip::-webkit-scrollbar { display: none; }
.fleet-cell { --c: var(--off); display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 0; border: 0; background: none; color: var(--text-2); }
.fleet-cell.st-normal { --c: var(--ok); } .fleet-cell.st-warning { --c: var(--warn); } .fleet-cell.st-critical { --c: var(--crit); } .fleet-cell.st-offline { --c: var(--off); }
.fleet-bar { position: relative; flex: 1; display: flex; align-items: flex-end; overflow: hidden; border-radius: 14px; background: var(--fill); transition: transform var(--t-base) var(--spring); }
.fleet-cell:hover .fleet-bar { transform: translateY(-4px); }
.fleet-cell:active .fleet-bar { transform: scale(0.94); }
.fleet-fill { display: block; width: 100%; min-height: 6px; border-radius: 14px; background: var(--c); transition: height 0.9s var(--spring); }
.fleet-cell.st-offline .fleet-fill { background: repeating-linear-gradient(135deg, var(--off) 0 4px, transparent 4px 8px); opacity: 0.55; }
.fleet-id { font-size: 11px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.workspace { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); gap: var(--gap); align-items: start; }
.col-todo { position: sticky; top: 92px; display: flex; flex-direction: column; gap: var(--gap); max-height: calc(100dvh - 112px); overflow: auto; scrollbar-width: none; }
.col-todo::-webkit-scrollbar { display: none; }
.todo, .session-log, .col-list { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--sh-1); border: var(--bw) solid var(--line); }
.todo-list { list-style: none; padding: 4px 12px 14px; }
.todo-row { --c: var(--off); position: relative; display: grid; gap: 6px; padding: 16px 14px 16px 22px; border-radius: var(--r-lg); transition: background var(--t-fast) var(--ease); }
.todo-row::before { content: ""; position: absolute; left: 8px; top: 18px; bottom: 18px; width: 4px; border-radius: 2px; background: var(--c); }
.todo-row.critical { --c: var(--crit); } .todo-row.warning { --c: var(--warn); }
.todo-row:hover { background: var(--hover); }
.todo-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.todo-id { font: 600 19px / 1.1 var(--display); letter-spacing: -0.03em; color: var(--text); }
.todo-detail { font-size: 14px; color: var(--text-2); }
.todo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 4px; }
.session-log .act-row { margin: 0 24px; }
.act-row { display: flex; gap: 14px; padding: 8px 0; font-size: 14px; }
.act-row .muted { min-width: 84px; }
.session-log .calm { padding-top: 6px; }

.toolbar { display: grid; gap: 14px; padding: 8px 24px 20px; border-bottom: var(--bw) solid var(--line); }
.toolbar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.search { position: relative; display: block; flex: 1 1 220px; min-width: 180px; }
.search .icon { position: absolute; left: 14px; top: 11px; color: var(--text-3); pointer-events: none; }
.search input { width: 100%; padding-left: 42px; border-radius: var(--r-pill); }
.sort select { border-radius: var(--r-pill); }
.count-text { font-size: 14px; color: var(--text-2); }

.col-list { container-type: inline-size; overflow-x: auto; scrollbar-width: thin; }
@container (max-width: 1060px) { .devices .c-trend { display: none; } }
@container (max-width: 860px) { .devices .c-fc { display: none; } }
@container (max-width: 700px) { .devices .c-seen { display: none; } }
.devices { width: 100%; border-collapse: separate; border-spacing: 0; }
.devices thead th { height: 44px; padding: 0 12px; font-size: 13px; font-weight: 500; color: var(--text-3); text-align: left; white-space: nowrap; border-bottom: var(--bw) solid var(--line); }
.devices th.num, .devices td.mono-num { text-align: right; }
.devices tbody td { height: var(--row); padding: 8px 12px; white-space: nowrap; border-bottom: var(--bw) solid var(--line); transition: background var(--t-fast) var(--ease); }
.devices tbody td:first-child { padding-left: 24px; }
.devices tbody td:last-child { padding-right: 24px; }
.devices tbody tr:last-child td { border-bottom: 0; }
.devices tr.row { cursor: pointer; }
.devices tr.row:hover td { background: var(--hover); }
.devices tr.row:hover .c-go { color: var(--text); transform: translateX(2px); }
.devices tr.row:focus-visible { outline-offset: -3px; }
.c-go { width: 40px; color: var(--text-3); }
.c-go .icon { transition: transform var(--t-base) var(--spring); }
.dev-cell { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.dev-line { display: flex; align-items: center; gap: 8px; }
.dev-meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
:root[data-density="compact"] .dev-cell { flex-direction: row; align-items: center; gap: 12px; }
.dev-id { font: 600 18px / 1.1 var(--display); letter-spacing: -0.03em; }
.dev-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; font-size: 13px; color: var(--text-2); }
.soc { display: flex; align-items: center; gap: 12px; }
.bar { width: 60px; height: 8px; border-radius: var(--r-pill); background: var(--fill); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--r-pill); background: var(--ok); transition: width 0.9s var(--spring); }
.st-warning .bar-fill { background: var(--warn); } .st-critical .bar-fill { background: var(--crit); } .st-offline .bar-fill { background: var(--off); }
.soc-ring { flex: none; }
.soc-ring .ring-bg { stroke: var(--fill-2); stroke-width: 4; }
.soc-ring .ring-fg { stroke: var(--ok); stroke-width: 4; stroke-linecap: round; transition: stroke-dasharray 0.9s var(--spring); }
.st-warning .soc-ring .ring-fg { stroke: var(--warn); } .st-critical .soc-ring .ring-fg { stroke: var(--crit); } .st-offline .soc-ring .ring-fg { stroke: var(--off); }
.stack { display: flex; flex-direction: column; gap: 1px; }
.stack-main { font-weight: 600; }
.stack-sub { font-size: 13px; color: var(--text-3); }
.spark { display: block; }
.spark path { stroke: var(--accent); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 7. Gerät (Seite und Blatt) ---------- */

.device { display: flex; flex-direction: column; gap: 28px; }
.device-head { display: grid; gap: 14px; justify-items: start; }
.device-title { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.device-id { font: 600 clamp(44px, 6vw, 84px) / 0.98 var(--display); letter-spacing: -0.05em; font-variation-settings: "opsz" 96; }
.device-sentence { font-size: clamp(17px, 1.6vw, 21px); color: var(--text-2); letter-spacing: -0.014em; }
.device-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.device-panel .device-id { font-size: 44px; }
.diag { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 18px 22px; border-radius: var(--r-lg); background: var(--off-tint); }
.diag strong { white-space: nowrap; }
.diag.crit { background: var(--crit-tint); } .diag.crit strong { color: var(--crit-fg); }
.diag.warn { background: var(--warn-tint); } .diag.warn strong { color: var(--warn-fg); }
.diag.off strong { color: var(--off-fg); }
:root[data-contrast="high"] .diag { border: var(--bw) solid currentColor; }

.vitals { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 36px; align-items: center; padding: 28px 32px; border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--sh-1); border: var(--bw) solid var(--line); }
.vital-ring { --c: var(--ok); position: relative; display: grid; place-items: center; width: 200px; height: 200px; }
.vital-ring.st-warning { --c: var(--warn); } .vital-ring.st-critical { --c: var(--crit); } .vital-ring.st-offline { --c: var(--off); }
.big-ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.big-ring .ring-bg { stroke: var(--fill-2); stroke-width: 7; }
.big-ring .ring-fg { stroke: var(--c); stroke-width: 7; stroke-linecap: round; transition: stroke-dasharray 1.1s var(--spring); }
.vital-center { display: grid; justify-items: center; gap: 2px; text-align: center; }
.vital-value { font: 600 36px / 1 var(--display); letter-spacing: -0.04em; }
.vital-label { font-size: 13px; color: var(--text-3); }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 24px 32px; }
.figure { display: grid; gap: 4px; align-content: start; min-width: 0; }
.figure-label { font-size: 13px; font-weight: 500; color: var(--text-3); }
.figure-value { font: 600 22px / 1.15 var(--display); letter-spacing: -0.03em; overflow-wrap: anywhere; }
.figure-hint { font-size: 13px; color: var(--text-3); }

.device-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: var(--gap); align-items: start; }
.device-side { display: flex; flex-direction: column; gap: var(--gap); }
.chart-wrap { position: relative; }
.chart { display: block; width: 100%; height: auto; touch-action: pan-y; cursor: crosshair; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font: 500 10.5px var(--font); }
.area-stop.top { stop-color: var(--accent); stop-opacity: 0.28; }
.area-stop.bottom { stop-color: var(--accent); stop-opacity: 0; }
:root[data-contrast="high"] .area-stop.top { stop-opacity: 0; }
.chart .soc-line { stroke: var(--accent); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.chart .forecast-line { stroke: var(--accent); stroke-width: 1.75; stroke-dasharray: 5 6; stroke-linecap: round; opacity: 0.7; }
.chart .threshold { stroke: var(--crit); stroke-width: 1; stroke-dasharray: 3 5; opacity: 0.8; }
.chart .threshold.warn { stroke: var(--warn); }
.chart .threshold-label { fill: var(--crit-fg); font: 600 10.5px var(--font); }
.chart .threshold-label.warn { fill: var(--warn-fg); }
.chart .cross { stroke: var(--text-3); stroke-width: 1; }
.chart .cross-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 3; }
.chart-tip {
  position: absolute; top: 6px; z-index: 2; display: grid; gap: 1px; padding: 8px 12px; border-radius: var(--r-md); pointer-events: none; transform: translateX(14px);
  background: var(--ink); color: var(--on-ink); font-size: 12px; box-shadow: var(--sh-2);
}
.chart-tip.is-left { transform: translateX(calc(-100% - 14px)); }
.chart-tip strong { font-size: 16px; }
.legend { font-size: 13px; color: var(--text-3); margin-top: 8px; }
.forecast-text { margin-top: 14px; color: var(--text-2); }

.log { list-style: none; padding: 0; }
.log li { display: flex; flex-wrap: wrap; gap: 2px 16px; padding: 12px 0; border-top: var(--bw) solid var(--line); font-size: 14px; }
.log li:first-child { border-top: 0; }
.log-time { min-width: 140px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.scrim { position: fixed; inset: 0; z-index: 80; background: var(--overlay); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in var(--t-base) var(--ease); }
.drawer {
  position: fixed; top: 12px; right: 12px; bottom: 12px; z-index: 90; width: min(760px, calc(100% - 24px)); overflow: auto; padding: 60px 28px 32px;
  background: color-mix(in srgb, var(--bg) 84%, transparent); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-radius: 30px; box-shadow: var(--sh-2); border: var(--bw) solid var(--glass-line); animation: slide-in-right var(--t-slow) var(--spring);
}
.drawer-close { position: absolute; top: 16px; right: 16px; }
.device-panel .device-grid, .device-panel .vitals { grid-template-columns: minmax(0, 1fr); }
.device-panel .vitals { justify-items: center; text-align: center; }
.device-panel .figures { justify-items: start; text-align: left; width: 100%; }

/* ---------- 8. Karte ---------- */

.view-map { position: relative; padding: 0; display: block; overflow: hidden; }
.view-map > * { max-width: none; width: auto; }
.map { position: absolute; inset: 0; z-index: 0; background: var(--bg); }
.map-float { position: absolute; z-index: 500; }
.map-filters { top: 92px; left: 16px; width: 360px; display: grid; gap: 14px; padding: 18px; max-height: calc(100% - 108px); overflow: auto; box-shadow: var(--sh-2); border-radius: var(--r-xl); }
.map-filters input[type="search"] { width: 100%; }
.range-row { display: grid; gap: 8px; font-size: 14px; color: var(--text-2); }
.map-list-panel { top: 92px; right: 16px; width: 330px; max-height: calc(100% - 180px); display: none; flex-direction: column; overflow: hidden; box-shadow: var(--sh-2); border-radius: var(--r-xl); }
.map-list-panel.is-open { display: flex; }
.map-list { list-style: none; padding: 8px; overflow: auto; }
.map-row { display: flex; align-items: center; border-radius: var(--r-md); }
.map-item { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: var(--r-md); background: none; text-align: left; transition: background var(--t-fast) var(--ease); }
.map-item:hover { background: var(--hover); }
.map-item.is-active { background: var(--accent-tint); }
.map-item-id { font: 600 16px var(--display); letter-spacing: -0.02em; }
.map-details { padding: 4px 8px; font-size: 14px; }
.map-legend { left: 16px; bottom: 32px; display: flex; flex-wrap: wrap; gap: 4px 18px; padding: 12px 20px; border-radius: var(--r-pill); font-size: 13px; max-width: calc(100% - 32px); box-shadow: var(--sh-2); }
.map.leaflet-container { font: inherit; background: var(--bg); }
.leaflet-control-attribution { font-size: 10px; border-radius: 10px 0 0 0; }
.leaflet-bar { border: 0 !important; border-radius: var(--r-md) !important; box-shadow: var(--sh-2) !important; overflow: hidden; }
.leaflet-bar a { border-bottom-color: var(--line) !important; }
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%); } }

/* ---------- 9. Wartung und Postfach ---------- */

.tasks { list-style: none; padding: 8px 12px 14px; }
.task-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 18px 14px; border-radius: var(--r-lg); transition: background var(--t-fast) var(--ease); }
.task-row:hover { background: var(--hover); }
.ticket-main { flex: 1 1 320px; min-width: 0; display: grid; gap: 8px; padding: 0; border: 0; background: none; color: inherit; text-align: left; }
.ticket-main:hover .ticket-title strong { color: var(--accent-fg); }
.ticket-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ticket-title strong { font: 600 19px var(--display); letter-spacing: -0.03em; }
.ticket-meta { display: flex; flex-wrap: wrap; gap: 2px 18px; font-size: 14px; color: var(--text-2); }
.ticket-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; justify-content: flex-end; }
.tasks + h3, .surface > h3 { padding: 0 24px; }

.tour-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0; }
.tour-all { margin-bottom: 8px; }
.active-stop { display: grid; gap: 14px; margin: 20px 0; padding: 26px; border-radius: var(--r-xl); background: var(--spot-bg); color: var(--spot-text); }
.active-stop .muted { color: var(--spot-muted); }
.active-stop .btn { background: rgba(246, 243, 238, 0.12); color: var(--spot-text); }
.active-stop .btn-primary { background: var(--spot-text); color: var(--spot-bg); }
.active-label { font: 600 12px / 1 var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--spot-muted); }
.active-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; }
.active-id { font: 600 clamp(32px, 4vw, 52px) / 1 var(--display); letter-spacing: -0.045em; color: var(--spot-text); }
.active-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.tour-sum { margin: 18px 0 6px; font-weight: 600; }
.tour-list { list-style: none; counter-reset: stop; padding: 0; }
.tour-stop { counter-increment: stop; position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px; padding: 14px 0 14px 52px; border-top: var(--bw) solid var(--line); }
.tour-stop:first-child { border-top: 0; }
.tour-stop::before {
  content: counter(stop); position: absolute; left: 0; top: 11px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--fill);
  font: 600 13px var(--font); color: var(--text-2);
}
.tour-stop.urgent::before { background: var(--crit-tint); color: var(--crit-fg); }
.tour-km { margin-left: auto; }

.inbox-list { list-style: none; padding: 8px 12px 14px; }
.inbox-row { border-radius: var(--r-lg); transition: background var(--t-fast) var(--ease); }
.inbox-row:hover { background: var(--hover); }
.inbox-main { display: flex; align-items: center; gap: 16px; padding: 16px 14px; }
.inbox-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: transparent; transition: background var(--t-base) var(--ease); }
.inbox-row.unread .inbox-dot { background: var(--accent); }
.inbox-row.unread .inbox-text { font-weight: 600; }
.inbox-text { flex: 1; min-width: 0; padding: 0; border: 0; background: none; text-align: left; overflow-wrap: anywhere; }
.inbox-time { flex: none; font-size: 13px; white-space: nowrap; }

.comments { list-style: none; padding: 0; display: grid; gap: 8px; max-height: 260px; overflow: auto; }
.comments li { display: grid; gap: 3px; padding: 12px 16px; border-radius: var(--r-md); background: var(--fill); }
.comment-head { display: flex; gap: 10px; align-items: baseline; font-size: 13px; }
.comment-body { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- 10. Optionen ---------- */

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: var(--gap); align-items: start; margin-bottom: var(--gap); }
.notify-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.lab-actions { display: flex; gap: 10px; margin: 16px 0; }
.lab-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 0 36px; }
.lab-row { border-top: var(--bw) solid var(--line); }
.lab-row label { display: flex; align-items: flex-start; gap: 16px; padding: 16px 0; cursor: pointer; }
.lab-row input { margin-top: 1px; }
.lab-text { display: grid; gap: 2px; }
.lab-text .muted { font-size: 14px; }

/* ---------- 11. Überlagerungen ---------- */

.modal-scrim { z-index: 100; }
.modal {
  position: fixed; top: 50%; left: 50%; z-index: 110; transform: translate(-50%, -50%); width: min(560px, 94vw); max-height: 90dvh; overflow: auto; padding: 30px;
  background: var(--surface); border-radius: 28px; box-shadow: var(--sh-2); border: var(--bw) solid var(--line); animation: modal-in var(--t-slow) var(--spring);
}
.modal h2 { font: 600 26px / 1.1 var(--display); letter-spacing: -0.035em; font-variation-settings: "opsz" 36; }
.modal-text { margin: 16px 0 4px; line-height: 1.55; }
.modal-sub { margin: 22px 0 8px; }
.modal-field { margin: 16px 0 0; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.modal-grid .modal-field { margin: 0; }
.modal select, .modal input[type="date"] { width: 100%; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 26px; }

.palette {
  position: fixed; top: 13vh; left: 50%; z-index: 120; transform: translateX(-50%); width: min(620px, 94vw); max-height: 70dvh; overflow: auto;
  background: var(--surface); border-radius: 26px; box-shadow: var(--sh-2); border: var(--bw) solid var(--line); animation: drop-in var(--t-base) var(--spring);
}
.palette.help { padding: 26px; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 0 22px; height: 64px; border-bottom: var(--bw) solid var(--line); color: var(--text-3); }
.palette-input input { flex: 1; height: 100%; border: 0; background: transparent; padding: 0; font-size: 18px; color: var(--text); box-shadow: none; }
.palette-input input:focus-visible { box-shadow: none; background: transparent; }
.palette-list { list-style: none; padding: 10px; }
.palette-item { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; border-radius: var(--r-md); cursor: pointer; transition: background 80ms var(--ease); }
.palette-item.is-active { background: var(--ink); color: var(--on-ink); }
.palette-item.is-active .muted { color: var(--on-ink); opacity: 0.7; }
.palette-empty { padding: 14px; }

/* ---------- 12. Anmeldung ---------- */

.auth-page { height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr); background: var(--bg); overflow: auto; }
.auth-brand { display: flex; flex-direction: column; justify-content: space-between; gap: 40px; padding: clamp(28px, 5vw, 72px); background: var(--spot-bg); color: var(--spot-text); }
.auth-mark { display: flex; align-items: center; gap: 12px; }
.auth-mark .logo { width: 44px; height: 44px; }
.auth-mark .wordmark { font-size: 22px; }
.auth-claim { font: 600 clamp(48px, 7vw, 104px) / 0.96 var(--display); letter-spacing: -0.055em; font-variation-settings: "opsz" 96; max-width: 8em; text-wrap: balance; }
.auth-note { color: var(--spot-muted); font-size: 18px; max-width: 26em; }
.auth-card { align-self: center; justify-self: center; width: min(420px, calc(100% - 48px)); display: grid; gap: 20px; padding: 8px 0; animation: pop-in var(--t-slow) var(--spring); }
.auth-head h1 { font-size: 34px; }
.auth-card .field input { width: 100%; height: 50px; font-size: 16px; }
.auth-submit { width: 100%; }
.auth-hint { font-size: 13px; color: var(--text-3); }

/* ---------- 13. Bewegung ---------- */

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in-right { from { opacity: 0; transform: translateX(48px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, -46%) scale(0.94); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes drop-in { from { opacity: 0; transform: translate(-50%, -14px) scale(0.97); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 20px) scale(0.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes count-in { from { --shown: 0; } }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Die Zahl im Satz zählt beim Erscheinen von 0 hoch und gleitet bei späteren Änderungen zum neuen Stand. */
.count { --shown: var(--n, 0); animation: count-in 1.2s var(--ease) backwards; transition: --shown 0.9s var(--ease); }

/* Beim Laden bauen sich die Blöcke nacheinander auf (nur Elemente, die einmal entstehen und nicht neu gezeichnet werden) */
.view-home .hero-main { animation: rise 0.8s var(--ease) backwards; }
.view-home .spotlight { animation: rise 0.8s 0.12s var(--ease) backwards; }
.view-home .fleet { animation: rise 0.8s 0.22s var(--ease) backwards; }
.view-home .workspace { animation: rise 0.8s 0.32s var(--ease) backwards; }
.view-device .device-head { animation: rise 0.7s var(--ease) backwards; }
.view-device .vitals { animation: rise 0.7s 0.1s var(--ease) backwards; }
.view-device .device-grid { animation: rise 0.7s 0.2s var(--ease) backwards; }
.view:not(.view-home):not(.view-device):not(.view-map) { animation: view-in 0.5s var(--ease) backwards; }

/* Seitenwechsel als weiche Überblendung (View Transitions API). Die Inseln bleiben dabei stehen. */
::view-transition-group(topbar) { animation-duration: 0s; }
::view-transition-old(root) { animation: vt-out 200ms var(--ease) both; }
::view-transition-new(root) { animation: vt-in 460ms var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px) scale(0.995); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(16px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- 14. Schmale Bildschirme ---------- */

@media (max-width: 1180px) {
  .tb-nav { --seg: 54px; }
  .tb-nav .tb-label { display: none; }
  .tb-nav .badge { position: absolute; top: 2px; right: 2px; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; }
  .tb-palette kbd, .live-text, .tb-user-name { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .col-todo { position: static; max-height: none; overflow: visible; }
  .device-grid { grid-template-columns: minmax(0, 1fr); }
  .vitals { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .figures { justify-items: start; text-align: left; width: 100%; }
}

/* Handy: Navigation als schwebende Kapsel unten, Geräteliste als Karten, große Tippflächen */
@media (max-width: 767px) {
  .topbar { inset: 10px 10px auto; grid-template-columns: auto 1fr; }
  .island { height: 48px; }
  .island-brand { padding: 0 14px 0 8px; }
  .wordmark { font-size: 16px; }
  .island-tools { gap: 4px; }
  .tb-nav {
    --seg: calc((100vw - 52px) / 5); position: fixed; z-index: 70; left: 16px; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom, 0)); top: auto;
    grid-template-columns: repeat(5, 1fr); height: 64px; padding: 5px; justify-self: stretch;
  }
  .tb-nav::before { width: calc((100% - 10px) / 5); transform: translateX(calc(var(--i, 0) * 100%)); }
  .tb-link { flex-direction: column; gap: 2px; height: 54px; padding: 0; font-size: 11px; }
  .tb-nav .tb-label { display: inline; }
  .tb-nav .badge { position: absolute; top: 2px; left: 52%; right: auto; }
  .view { padding: 76px 16px 112px; }
  .banner { margin: 68px 16px 0; }
  .view-head { margin-bottom: 18px; }
  h1 { font-size: 24px; }
  .hero { margin-bottom: 28px; }
  .hero-title { font-size: clamp(40px, 12vw, 56px); }
  .spotlight { padding: 22px; }
  .fleet { margin-bottom: 28px; }
  .fleet-strip { height: 112px; grid-auto-columns: 52px; }
  .section-head { padding: 18px 18px 6px; }
  .toolbar { padding: 8px 18px 16px; }
  .search { flex: 1 1 100%; }

  .devices, .devices tbody, .devices tr, .devices td { display: block; width: 100%; }
  .devices thead { display: none; }
  .devices tbody { display: grid; gap: 10px; padding: 4px 12px 14px; }
  .devices tr.row { position: relative; padding: 16px 18px 12px; border-radius: var(--r-lg); background: var(--surface-2); border: var(--bw) solid var(--line); }
  .devices tbody td, .devices tbody td.mono-num { height: auto; padding: 4px 0; border: 0; display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 10px; align-items: center; text-align: left; white-space: normal; }
  .devices tbody td:first-child, .devices tbody td:last-child { padding-left: 0; padding-right: 0; }
  .devices .c-trend, .devices .c-fc, .devices .c-seen { display: grid !important; }
  .devices tbody td::before { content: attr(data-label); font-size: 13px; color: var(--text-3); }
  .devices tbody td.c-dev { grid-template-columns: minmax(0, 1fr); padding-bottom: 8px; }
  .devices tbody td.c-dev::before, .devices tbody td.c-go { display: none; }

  .drawer { top: 0; right: 0; bottom: 0; width: 100%; border-radius: 0; padding: 64px 18px 32px; }
  .vitals { padding: 22px 18px; gap: 24px; }
  .vital-ring { width: 176px; height: 176px; }
  .modal { padding: 24px; border-radius: 24px; }
  .modal-grid { grid-template-columns: 1fr; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; height: 40px; }
  .chip { min-height: 44px; }
  .btn-lg, .active-actions .btn { width: 100%; min-height: 54px; }
  .active-actions { flex-direction: column; }
  .ticket-actions { width: 100%; justify-content: flex-start; margin-left: 0; }
  .toast { bottom: 96px; }

  .map-filters { top: 68px; left: 10px; right: 10px; width: auto; max-height: 42%; }
  .map-list-panel { top: auto; left: 10px; right: 10px; bottom: 96px; width: auto; max-height: 36%; }
  .map-legend { display: none; }
  .inbox-main { flex-wrap: wrap; }
  .inbox-time { width: 100%; padding-left: 26px; }

  .auth-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .auth-brand { gap: 24px; padding: 28px 24px 32px; }
  .auth-claim { font-size: clamp(40px, 13vw, 60px); }
  .auth-note { font-size: 16px; }
  .auth-card { align-self: start; padding: 24px 0 40px; }
}

@media (max-width: 360px) {
  .view { padding: 72px 12px 108px; }
  .wordmark { display: none; }
  .figures { grid-template-columns: minmax(0, 1fr); }
  .cell { flex-basis: 140px; }
}
