/* ================================================================
   Self-hosted fonts — Inter + JetBrains Mono
   WHY: Keine Abhängigkeit von Google Fonts CDN — funktioniert offline,
        vermeidet externe Requests (Datenschutz, Performance).
        Inter-Dateien sind weight-range 400–800 identisch (variable font subsets).
================================================================ */

/* Inter — cyrillic-ext */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/inter-v20-cyrillic-ext.woff2') format('woff2');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* Inter — cyrillic */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/inter-v20-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* Inter — greek-ext */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/inter-v20-greek-ext.woff2') format('woff2');
    unicode-range: U+1F00-1FFF;
}
/* Inter — greek */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/inter-v20-greek.woff2') format('woff2');
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* Inter — vietnamese */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/inter-v20-vietnamese.woff2') format('woff2');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* Inter — latin-ext */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/inter-v20-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Inter — latin */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('../fonts/inter-v20-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* JetBrains Mono — cyrillic-ext */
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 700 800;
    font-display: swap;
    src: url('../fonts/jetbrainsmono-v24-700-cyrillic-ext.woff2') format('woff2');
    unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* JetBrains Mono — cyrillic */
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 700 800;
    font-display: swap;
    src: url('../fonts/jetbrainsmono-v24-700-cyrillic.woff2') format('woff2');
    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* JetBrains Mono — greek */
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 700 800;
    font-display: swap;
    src: url('../fonts/jetbrainsmono-v24-700-greek.woff2') format('woff2');
    unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* JetBrains Mono — vietnamese */
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 700 800;
    font-display: swap;
    src: url('../fonts/jetbrainsmono-v24-700-vietnamese.woff2') format('woff2');
    unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* JetBrains Mono — latin-ext */
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 700 800;
    font-display: swap;
    src: url('../fonts/jetbrainsmono-v24-700-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* JetBrains Mono — latin */
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 700 800;
    font-display: swap;
    src: url('../fonts/jetbrainsmono-v24-700-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ================================================================
   RallyTrack — Gemeinsames Design-System
   WHY: Einheitliches Look & Feel über alle Smartphone-Seiten.
        Alle Farben, Abstände und Komponenten an einem Ort definiert.
        Seitenspezifische Styles nur noch für echte Ausnahmen.
================================================================ */

/* --- Farb-Tokens --- */
:root {
    --color-bg:           #0a0e1a;
    --color-bg-dark:      #070a14;
    --color-surface:      #111827;
    --color-surface-alt:  #0e1728;
    --color-border:       rgba(100,160,255,.10);
    --color-border-muted: rgba(100,160,255,.06);
    --color-border-light: rgba(100,160,255,.18);
    --color-border-mid:   rgba(100,160,255,.25);

    --color-text:         #dde8ff;
    --color-text-muted:   #374766;
    /* WHY: #888 statt #666 — besserer Kontrast auf dunklem Hintergrund (WCAG AA) */
    --color-text-faint:   #888;

    --color-primary:      #e63946;
    --color-primary-dark: #c62828;
    --color-primary-bg:   #2a1520;

    --color-teal:         #00c8b4;
    --color-teal-dark:    #009e8e;
    --color-teal-light:   #4dd8cc;
    --color-orange:       #fb923c;
    --color-orange-dark:  #ea7316;
    --color-green:        #4ade80;
    --color-green-bright: #22c55e;

    /* WHY: Semantische Hintergrundfarben für Signalbanner.
       Zentral definiert damit live.html, detail.html etc. konsistent bleiben. */
    --color-danger-bg:    #3d0a0a;
    --color-warning-bg:   #3d2c0a;
    --color-success-bg:   #1b4332;
    --color-info-bg:      #1a2744;
    --color-info-accent:  #3d5a9e;
    --color-map-track:    #4d9de0;   /* helles Blau — Leaflet Route/Track + eigener Positionspunkt */

    /* WHY: Statusfarben für Zuordner / Statusboard — Material-nahe Signalfarben
       für ETA-Frische, AGT-Badges und UI-Aktionen (Auswahl, Warnungen). */
    --color-warning:        #ffc107;   /* gelb — ETA stale, enroute, Alerts */
    --color-warning-dark:   #b8860b;   /* dunkles Gelb — Lock-Request-Button */
    --color-warning-hover:  #d4a017;   /* Hover für --color-warning-dark */
    --color-green-bg:       #1b5e20;   /* dunkles Grün — AGT-fit Badge BG */
    --color-danger-dark-bg: #5e1b1b;   /* dunkles Rot — AGT-unfit Badge BG */
    --color-select:         #4fc3f7;   /* Auswahl-Blau — selektierte Sitze/Queue */
    --color-alert-warning:  #ff9800;   /* Orange — Alert-Rahmen Warnung */
    --color-alert-info:     #2196f3;   /* Blau — Alert-Rahmen Info */
    --color-bg-deeper:      #060c18;   /* Tiefstes Dunkel — Recompute/Detour-Bar */

    /* WHY: Semantic text colors for AGT badges and lock-banner states.
       Kept separate from main palette — these are "on-dark-badge" legibility tokens. */
    --color-agt-fit-text:       #81c784;   /* helles Grün — Text auf AGT-fit-Badge */
    --color-agt-unfit-text:     #e57373;   /* helles Rot — Text auf AGT-unfit-Badge */
    --color-alert-warning-text: #ffcc80;   /* helles Orange — Warnungs-Alert-Text */
    --color-alert-info-text:    #90caf9;   /* helles Blau — Info-Alert-Text */
    --color-danger-light:       #ffb3b3;   /* helles Rot — Lock-Banner "locked by other" */
    --color-text-light:         #ccc;      /* etwas heller als text-muted — btn-release */
    --color-primary-hover:      #e74c3c;   /* etwas heller als primary-dark — force-btn hover */
    --color-warning-text:       #ffe082;   /* helles Gelb — Lock-offered Banner Text */

    --radius-md:  12px;
    --radius-lg:  16px;

    /* WHY: Subtiler Schatten für Cards — gibt Tiefe ohne GPU-Last */
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-btn:  0 2px 4px rgba(0, 0, 0, 0.3);

    /* WHY: Mindest-Touch-Target 48px (Material Design) — wir gehen bewusst größer
       für Einsatz-Kontext (Handschuhe, Stress, Dunkelheit) */
    --touch-min:  52px;

    /* Navy Glow Erweiterungen */
    --color-border-glow:    rgba(100,160,255,.18);
    --color-text-label:     #8aa0c0;
    --color-primary-glow:   rgba(230,57,70,.35);
    --color-teal-glow:      rgba(0,200,180,.15);
    --radius-xl:            20px;
    --radius-pill:          20px;

    /* Spacing-Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    /* Typografie */
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
    --text-xs:   0.75rem;
    --text-sm:   0.875rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-4xl:  2.25rem;
    --text-5xl:  3rem;
}

/* --- Reset & Basis --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    /* WHY: Verhindert horizontales Scrollen durch versehentliche Überlänge */
    overflow-x: hidden;
}

/* --- Layout --- */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

/* --- Typografie --- */
h1, h2, h3 { color: var(--color-primary); }

h1 { font-size: 2rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

/* WHY: Abschnittsüberschriften mit Trennlinie — einheitliche Gliederung */
.section-heading {
    font-size: 1rem;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.4rem;
    margin-bottom: 0.8rem;
}

/* --- Buttons --- */

/* WHY: Basis-Button — Touch-optimiert, kein tap-highlight, großes Target */
.btn {
    display: block;
    width: 100%;
    min-height: var(--touch-min);
    padding: 0.9rem 1rem;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    text-align: center;
    line-height: 1.2;
    /* WHY: Schnelles Tap-Feedback (0.1s) — spürbar aber nicht blockierend */
    transition: background 0.1s, transform 0.1s, box-shadow 0.1s;
}
.btn:active { transform: scale(0.96); box-shadow: none; }
.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
}

/* Primär — roter CTA (Ich komme!, Einsatz starten, …) */
.btn-primary {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 4px 20px var(--color-primary-glow), 0 0 0 1px rgba(230,57,70,.2);
}
.btn-primary:active { background: var(--color-primary-dark); box-shadow: none; }

/* Sekundär — umrandeter Ghost-Button */
.btn-secondary {
    color: var(--color-text);
    background: var(--color-surface);
    border: 2px solid var(--color-primary);
}
.btn-secondary:active { background: var(--color-primary); }

/* Neutral — für Aktionen ohne Farbgewichtung */
.btn-neutral {
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}
.btn-neutral:active { background: var(--color-border); }

/* Farbvarianten für Event-Typen */
.btn-einsatz { background: var(--color-primary); color: #fff; }
.btn-einsatz:active { background: var(--color-primary-dark); }
.btn-uebung  { background: var(--color-orange); color: var(--color-bg); }
.btn-uebung:active { background: var(--color-orange-dark); }
.btn-treffen { background: var(--color-teal); color: #fff; }
.btn-treffen:active { background: var(--color-teal-dark); }

/* Ich-komme-Großbutton — extra groß für Einsatz-Erstreaktion */
.btn-hero {
    padding: 1.5rem;
    font-size: 1.8rem;
    border-radius: var(--radius-lg);
    margin: 0.5rem 0 1rem;
}

/* Kleiner Inline-Button (Zuordner, Export, …) */
.btn-sm {
    display: inline-block;
    width: auto;
    min-height: unset;
    padding: 0.4rem 0.8rem;
    font-size: 0.82rem;
    font-weight: bold;
    border-radius: var(--radius-sm);
    cursor: pointer;
    touch-action: manipulation;
    text-decoration: none;
    text-align: center;
}
.btn-sm.btn-neutral { border: 1px solid var(--color-border); }

/* --- Formular-Elemente --- */
.form-group {
    margin-bottom: 1.2rem;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--color-text-label);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 1.05rem;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    transition: border-color 0.15s;
}
.form-input::placeholder { color: var(--color-text-faint); }
.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* WHY: Eigenes Dropdown-Pfeil-Icon, da appearance:none nötig für Farb-Kontrolle */
.form-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23aaa' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* --- Card / Panel --- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    margin-bottom: 0.6rem;
    /* WHY: Subtiler Schatten — visuelle Hierarchie ohne Performance-Kosten */
    box-shadow: var(--shadow-card);
}

.card-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 0.2rem;
}

.card-value {
    font-size: 1.05rem;
    color: var(--color-text);
}

/* --- Badges / Tags --- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
}

.badge-einsatz { background: var(--color-primary);  color: #fff; }
.badge-uebung  { background: var(--color-orange);   color: var(--color-bg); }
.badge-treffen { background: var(--color-teal);     color: #fff; }
.badge-created  { background: var(--color-border);    color: var(--color-text-muted); }
.badge-active   { background: var(--color-teal);      color: #fff; }
.badge-departed { background: var(--color-orange);    color: var(--color-bg); }
.badge-closed   { background: var(--color-border);    color: var(--color-text-faint); }

/* --- Fahrzeug-Summary (Vehicle-Status-Block) --- */
.vehicle-summary {
    font-size: 0.82rem;
    color: var(--color-text-muted);
    padding: 0.5rem 0;
    border-top: 1px solid var(--color-border-muted);
    border-bottom: 1px solid var(--color-border-muted);
    margin-bottom: 0.5rem;
}
.vehicle-summary:empty { display: none; }
.vs-line  { padding: 0.15rem 0; }
.vs-ok    { color: var(--color-teal); }
.vs-warn  { color: var(--color-orange); }
.vs-eta   { color: var(--color-text-faint); font-style: italic; }
.vs-departed { opacity: 0.45; }
.vs-departed-badge { color: var(--color-primary); font-size: 0.85em; font-weight: bold; }
/* Crew-Zähler (Besetzung voll/teil/leer) — inline in vehicle summary JS */
.vs-crew  { color: var(--color-text-muted); }
/* WHY: num-* sind Farb-Marker für Zahlenwerte im JS-generierten HTML (crewNum()).
   Getrennt von vs-ok/vs-warn damit die Semantik klar bleibt:
   num-ok = Ziel erreicht (grün), num-warn = teilweise (orange), num-crit = nichts (rot) */
.num-ok   { color: var(--color-green); }
.num-warn { color: var(--color-orange); }
.num-crit { color: var(--color-primary); }

/* --- Need-Signal Banner --- */
.need-signal {
    display: none;
    padding: 0.65rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 0.5rem;
}
.need-signal.critical {
    display: block;
    background: var(--color-danger-bg);
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}
/* WHY: Nur animieren wenn kein Barrierefreiheits-Wunsch nach Bewegungsreduktion */
@media (prefers-reduced-motion: no-preference) {
    .need-signal.critical { animation: pulse 2s infinite; }
}
.need-signal.needed {
    display: block;
    background: var(--color-warning-bg);
    color: var(--color-orange);
}
/* WHY: covered = personal position is filled — positive confirmation (green) */
.need-signal.covered {
    display: block;
    background: var(--color-success-bg);
    color: var(--color-green);
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* --- Flash Messages --- */
.flash-msg {
    padding: 0.8rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    text-align: center;
}
.flash-info    { background: var(--color-surface); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.flash-warning { background: var(--color-warning-bg); color: var(--color-orange); border: 1px solid var(--color-border-light); }
.flash-error   { background: var(--color-danger-bg); color: #ff6b6b; border: 1px solid var(--color-primary-dark); }

/* --- Profil-Hinweis-Box --- */
.profile-hint {
    padding: 0.65rem 0.8rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--color-text-label);
    margin-top: 0.8rem;
}
.profile-hint strong { color: var(--color-primary); }
.profile-hint a      { color: var(--color-teal); text-decoration: none; }
.profile-hint a:hover { text-decoration: underline; }

/* --- Code-Eingabe (Event-Code) --- */
.code-section {
    margin-top: 2rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--color-border);
}
.code-section h3 {
    color: var(--color-text-label);
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
}
.code-input-row {
    display: flex;
    gap: 0.5rem;
}
.code-input {
    flex: 1;
    padding: 0.85rem 1rem;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    background: var(--color-surface);
    border: 2px solid var(--color-border-light);
    border-radius: var(--radius-md);
    color: var(--color-text);
    text-align: center;
}
.code-input:focus { outline: none; border-color: var(--color-primary); }

/* --- Navigations-Link (Führung / Zurück) --- */
.nav-link {
    display: block;
    padding: 0.75rem 0.5rem;
    color: var(--color-text-label);
    text-decoration: none;
    font-size: 0.9rem;
    text-align: center;
}
.nav-link:hover { color: var(--color-text); }

/* --- Event-Header (Badge + Code + Titel) --- */
.event-header {
    text-align: center;
    margin-bottom: 0.75rem;
}
.event-code {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-text);
    letter-spacing: 0.15em;
    margin: 0.3rem 0 0.2rem;
}
.event-title {
    color: var(--color-text-muted);
    font-size: 1.05rem;
}
.event-count {
    color: var(--color-text-faint);
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    text-align: left;
}

/* --- Qualifikation-Toggles (Profil) --- */
.qual-toggle {
    display: flex;
    align-items: center;
    padding: 0.8rem;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.qual-toggle.active {
    border-color: var(--color-primary);
    background: var(--color-primary-bg);
}
.qual-toggle input { display: none; }
.qual-check {
    width: 24px;
    height: 24px;
    border: 2px solid var(--color-border-light);
    border-radius: 4px;
    margin-right: 0.6rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.qual-toggle.active .qual-check {
    border-color: var(--color-primary);
    background: var(--color-primary);
}
.qual-toggle.active .qual-check::after {
    content: "✓";
    color: #fff;
    font-size: 0.9rem;
    font-weight: bold;
}
.qual-name  { font-size: 0.95rem; line-height: 1.2; }
.qual-short { font-size: 0.75rem; color: var(--color-text-muted); }
.qual-stack { display: flex; flex-direction: column; gap: 0.5rem; }

/* --- Monospace / Code --- */
.mono {
    font-family: monospace;
    letter-spacing: 0.1em;
}

/* --- Seitenlayout-Utilities --- */
/* WHY: Wiederkehrende Patterns aus index/detail/join/profile —
   zentral definiert statt per inline-style in jedem Template. */
.page-header {
    text-align: center;
    padding: 1.5rem 0 1rem;
}
.page-title {
    font-size: 2rem;
    color: var(--color-primary);
    margin-bottom: 0.3rem;
}
.page-subtitle {
    font-size: 1.05rem;
    color: var(--color-text-label);
    margin-bottom: 1.5rem;
}

/* --- Mobility-Auswahl (Join-Seite) --- */
.mobility-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-top: 0.5rem;
}
.mobility-btn {
    flex-direction: column;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    padding: 1rem 0.5rem;
}
.mobility-icon {
    font-size: 1.6rem;
    margin-bottom: 0.3rem;
}
.mobility-label {
    font-size: 0.9rem;
    font-weight: bold;
}

/* ── Navy Glow Komponenten ── */

.glow-card {
    background: linear-gradient(135deg, rgba(255,255,255,.06) 0%, rgba(255,255,255,.02) 100%);
    border: 1px solid var(--color-border-glow);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    position: relative;
    overflow: hidden;
}
.glow-card::before {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 100px; height: 100px;
    background: radial-gradient(circle, var(--color-teal-glow) 0%, transparent 70%);
    pointer-events: none;
}

.event-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    background: rgba(230,57,70,.10);
    border: 1px solid rgba(230,57,70,.30);
    border-radius: var(--radius-pill);
    padding: 3px 10px;
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.event-chip .chip-dot {
    width: 5px; height: 5px;
    background: var(--color-primary);
    border-radius: 50%;
}
@media (prefers-reduced-motion: no-preference) {
    .event-chip .chip-dot {
        animation: chip-pulse 1.4s ease-in-out infinite;
    }
}
@keyframes chip-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .25; }
}

.stat-pills {
    display: flex;
    gap: var(--space-2);
}
.stat-pill {
    flex: 1;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-2) var(--space-1);
    text-align: center;
}
.stat-pill-num {
    font-size: var(--text-xl);
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.stat-pill-label {
    font-size: var(--text-xs);
    color: var(--color-text-label);
    margin-top: 3px;
    font-weight: 500;
}

.person-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: rgba(255,255,255,.02);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: var(--space-2) var(--space-3);
}
.person-eta {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--color-text);
    line-height: 1;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    min-width: 52px;
    flex-shrink: 0;
}
.person-eta.arrived {
    font-size: var(--text-sm);
    color: var(--color-green);
}
/* WHY: Ausgerückt — gedimmt wie sb-table tr.arrived in status.html */
.person-row.departed {
    opacity: 0.5;
}
.person-eta .eta-unit {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    font-weight: 400;
}
/* WHY: Stale GPS-Fix — Countdown wird orange wie in status.html */
.live-countdown.eta-stale .eta-val,
.live-countdown.eta-stale .eta-unit {
    color: var(--color-orange);
}
.person-info { flex: 1; min-width: 0; }
.person-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.person-detail {
    font-size: var(--text-xs);
    color: var(--color-text-label);
    margin-top: 1px;
}

/* Topbar */
.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border);
}
.app-topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.icon-btn {
    width: 44px; height: 44px;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,.05);
    border: 1px solid var(--color-border-light);
    color: var(--color-text);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}
.icon-btn:active { background: rgba(255,255,255,.12); }
.icon-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.icon-btn.teal { background: rgba(0,200,180,.10); border-color: rgba(0,200,180,.3); }
/* WHY: active-Klasse zeigt TTS-Status an ohne textContent zu überschreiben (SVG-Icon) */
.icon-btn.teal.active { background: rgba(0,200,180,.25); border-color: var(--color-teal); color: var(--color-teal); }

/* Drawer Overlay */
.app-drawer-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 40;
    background: rgba(0,0,0,.5);
}
.app-drawer-overlay.open { display: block; }

/* Drawer Sheet — kommt von oben unter die Topbar */
/* WHY: Von oben einfahren ist natürlicher für Menüs die aus dem Hamburger-Button kommen —
   der Button sitzt oben rechts, das Menü folgt visuell von dort. Kein handle nötig. */
.app-drawer {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    background: var(--color-surface-alt);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    border-bottom: 1px solid var(--color-border-glow);
    padding: var(--space-3) var(--space-4) var(--space-4);
    transform: translateY(-100%);
    transition: transform 0.25s ease;
}
.app-drawer.open { transform: translateY(0); }
.drawer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}
.drawer-item {
    background: rgba(255,255,255,.03);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    display: flex; align-items: center; gap: var(--space-2);
    text-decoration: none; color: var(--color-text);
    font-size: var(--text-sm); font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s;
}
.drawer-item:active { background: rgba(255,255,255,.08); }
.drawer-item:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.drawer-item.danger {
    border-color: rgba(230,57,70,.25);
    background: rgba(230,57,70,.06);
    color: var(--color-primary);
}
.drawer-item svg { width: 20px; height: 20px; flex-shrink: 0; }

/* --- Reduced Motion --- */
/* WHY: Transitions deaktivieren wenn Nutzer Bewegungsreduktion wünscht */
@media (prefers-reduced-motion: reduce) {
    .btn,
    .form-input,
    .form-select,
    .qual-toggle {
        transition: none;
    }
    .event-chip .chip-dot { animation: none; }
    .app-drawer { transition: none; }
}

/* ================================================================
   Führung-Page — Station-Koordinate, Detour-Selector, Event-Actions
   WHY: Führung ist eine Admin-Seite hinter org-code — kompaktes Layout
        ohne Mobile-First-Constraint, aber designsystemkonform.
================================================================ */

/* WHY: Map for station coordinate — compact but usable */
#station-map {
    width: 100%;
    height: 200px;
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    border: 2px solid var(--color-border);
}
.coord-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.coord-input {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.9rem;
    font-family: monospace;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    text-align: center;
}
.coord-input:focus { outline: none; border-color: var(--color-primary); }
.station-hint {
    font-size: 0.75rem;
    color: var(--color-text-faint);
    margin-bottom: 0.5rem;
}
/* WHY: Detour-Selector — three preset buttons for quick selection */
.detour-selector { margin-bottom: 0.8rem; }
.detour-selector > label {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 0.35rem;
}
.detour-buttons { display: flex; gap: 0.4rem; }
.detour-btn {
    flex: 1;
    padding: 0.55rem 0.3rem;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: 0.82rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    line-height: 1.2;
}
.detour-btn small {
    display: block;
    font-weight: normal;
    font-size: 0.7rem;
    color: var(--color-text-muted);
}
.detour-btn.active {
    border-color: var(--color-primary);
    background: var(--color-primary-bg);
    color: #fff;
}
.detour-btn.active small { color: var(--color-primary); }
/* event list item actions */
.event-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.btn-close { background: var(--color-border-light); color: var(--color-text); }
.btn-close:active { background: var(--color-primary); }
.btn-export { background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-text-muted); }
.btn-export:active { background: var(--color-teal); color: #fff; }

/* ================================================================
   Statusboard — Fullscreen-Ansicht für Gerätehaus / Raspberry Pi / TV
   WHY: Statusboard ist eine Vollbild-Ansicht — eigenes Layout ausserhalb
        des normalen Mobile-First-Containers.
================================================================ */

/* WHY: Fullscreen dark theme optimized for Raspberry Pi / TV in Gerätehaus */
.statusboard {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.5rem;
    box-sizing: border-box;
}

/* --- Header bar --- */
.sb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: var(--color-bg);
    border-radius: var(--radius-md);
    margin-bottom: 0.8rem;
    flex-shrink: 0;
}
.sb-event-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: var(--text-base);
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.sb-event-badge.einsatz { background: var(--color-primary); color: #fff; }
.sb-event-badge.uebung { background: var(--color-orange); color: var(--color-bg); }
.sb-event-badge.treffen { background: var(--color-teal); color: #fff; }

.sb-event-status {
    font-size: var(--text-base);
    color: var(--color-text-muted);
}
.sb-event-title-hint {
    color: var(--color-text-muted);
    margin-left: 0.5rem;
}
.sb-event-status .status-active { color: var(--color-teal); font-weight: bold; }
.sb-event-status .status-departed { color: var(--color-orange); font-weight: bold; }
.sb-event-status .status-closed { color: var(--color-text-faint); }

.sb-clock {
    font-size: var(--text-2xl);
    color: var(--color-text);
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}
.sb-count {
    font-size: var(--text-2xl);
    color: var(--color-primary);
    font-weight: bold;
}
.sb-duration {
    font-size: var(--text-base);
    color: var(--color-text-faint);
    margin-left: 0.5rem;
    font-variant-numeric: tabular-nums;
}

/* --- Main body: map + table side by side --- */
.sb-body {
    display: flex;
    flex: 1;
    gap: 1rem;
    min-height: 0; /* WHY: allows flex children to scroll/fit */
}

/* WHY: 1/3 map, 2/3 table — gives map enough space to be useful */
.sb-map-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.sb-table-col {
    flex: 2;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* --- Map --- */
#sb-map {
    flex: 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-bg);
}

/* --- Vehicle bar --- */
.sb-vehicles {
    flex-shrink: 0;
    display: flex;
    gap: 0.6rem;
    padding: 0.4rem 0;
    overflow-x: auto;
    border-top: 1px solid var(--color-border-muted);
    margin-top: 0.4rem;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-muted) transparent;
}
.sb-vehicle-card {
    background: var(--color-bg);
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    min-width: 200px;
    flex-shrink: 0;
}
.sb-vehicle-name {
    font-weight: bold;
    color: var(--color-text);
    font-size: var(--text-sm);
    margin-bottom: 0.2rem;
}
.sb-vehicle-status {
    font-size: var(--text-xs);
    margin-bottom: 0.3rem;
}
.sb-vehicle-status.ready { color: var(--color-teal); }
.sb-vehicle-status.incomplete { color: var(--color-orange); }
.sb-seat-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sb-seat-list li {
    font-size: var(--text-xs);
    padding: 0.1rem 0;
    color: var(--color-text-muted);
}
.sb-seat-filled { color: var(--color-teal); }
.sb-seat-missing { color: var(--color-primary); font-style: italic; }
.sb-vehicle-summary {
    font-size: var(--text-xs);
    padding: 0.2rem 0;
    margin-top: 0.2rem;
    border-top: 1px solid var(--color-border-muted);
    color: var(--color-text-muted);
}
.sb-summary-ok { color: var(--color-teal); }
.sb-summary-warn { color: var(--color-orange); }
.sb-summary-crit { color: var(--color-primary); }
.sb-summary-eta { color: var(--color-text-faint); font-style: italic; }
.sb-depart-btn {
    display: inline-block;
    margin-top: 0.25rem;
    padding: 0.3rem 0.6rem;
    font-size: var(--text-xs);
    font-weight: bold;
    color: var(--color-text);
    background: var(--color-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    touch-action: manipulation;
}
.sb-depart-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.sb-depart-btn:active:not(:disabled) { opacity: 0.7; }
/* WHY: Departed status shown in primary color (red) to signal vehicle is gone */
.sb-departed-status { color: var(--color-primary); }
/* WHY: Empty-state row in participant table — centered, faint */
.sb-empty-row { text-align: center; color: var(--color-border-light); padding: 2rem; }
.sb-departed-label {
    display: inline-block;
    margin-top: 0.25rem;
    font-size: var(--text-xs);
    font-weight: bold;
    color: var(--color-primary);
}

/* --- Participant table --- */
.sb-table-wrap {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-muted) transparent;
}
.sb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-base);
}
.sb-table thead {
    position: sticky;
    top: 0;
    background: var(--color-bg-dark);
    z-index: 1;
}
.sb-table th {
    text-align: left;
    padding: 0.5rem 0.7rem;
    color: var(--color-text-label);
    font-weight: normal;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--color-border-muted);
}
.sb-table td {
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--color-border-muted);
    vertical-align: middle;
}
.sb-table tr:hover { background: var(--color-bg); }
.sb-table tr.arrived { opacity: 0.6; }

.sb-name {
    font-weight: bold;
    color: var(--color-text);
    font-size: var(--text-xl);
}
.sb-mobility-icon { font-size: var(--text-lg); text-align: center; }
.sb-mobility-label { color: var(--color-text-label); font-size: var(--text-xs); }
.sb-eta {
    /* WHY: TV board — ETA is the primary info, sized up so readable from across the room */
    font-size: var(--text-5xl);
    font-weight: 800;
    color: var(--color-teal);
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    line-height: 1;
}
.sb-eta-na { color: var(--color-border-light); }
/* WHY: Stale ETA — no fresh GPS fix for >30s, shown in yellow with "?" */
.sb-eta-stale { color: var(--color-orange) !important; }
.sb-distance { color: var(--color-text-label); font-size: var(--text-xs); font-weight: normal; }
.sb-agt { text-align: center; font-size: var(--text-sm); }
.agt-fit { color: var(--color-teal); font-weight: bold; }
.agt-not-fit { color: var(--color-primary); font-weight: bold; }
.sb-quals { font-size: var(--text-sm); color: var(--color-text-label); }
.sb-status-label { font-size: var(--text-sm); color: var(--color-text-label); }
.sb-status-label.arrived { color: var(--color-teal); }

/* --- Footer --- */
.sb-footer {
    flex-shrink: 0;
    text-align: center;
    padding: 0.4rem;
    color: var(--color-border-light);
    font-size: var(--text-xs);
}
.sb-footer .pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-teal);
    margin-right: 0.3rem;
    animation: pulse 2s infinite;
}

/* --- Responsive: portrait — map above table --- */
@media (max-width: 700px) {
    .sb-body { flex-direction: column; }
    /* WHY: map-col first in DOM → appears above table in column layout */
    .sb-map-col { flex: none; order: 1; }
    .sb-table-col { flex: none; order: 2; }
    /* WHY: explicit height + min-height required — flex:1 collapses to 0 in column direction.
       max() ensures at least 240px even on very small screens, scales up on larger mobiles. */
    #sb-map { height: max(240px, 35vh); min-height: 240px; flex: none; }
}

/* --- Leaflet map markers --- */
/* WHY: Station icon reuses CSS vars instead of inline style in JS DivIcon */
.sb-station-icon {
    background: var(--color-primary);
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text);
    font-size: 16px; /* WHY: px intentional — Leaflet divIcon pixel sizing */
    font-weight: bold;
    border: 2px solid var(--color-text);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
/* WHY: Participant pin wrapper — flex column centers bubble above label */
.sb-participant-pin {
    display: flex;
    flex-direction: column;
    align-items: center;
}
/* WHY: Marker bubble — dark bg, blue border matching mobility-route color */
.sb-participant-bubble {
    background: var(--color-bg);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px; /* WHY: px intentional — Leaflet divIcon pixel sizing */
    border: 2px solid var(--color-info-accent);
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

/* --- Leaflet marker label --- */
.sb-marker-label {
    background: rgba(13,13,26,0.85);
    border: 1px solid var(--color-border-muted);
    border-radius: 4px;
    color: var(--color-text);
    font-size: var(--text-xs);
    padding: 1px 4px;
    white-space: nowrap;
    margin-top: 2px;
    text-align: center;
}
.sb-marker-label.stale { color: var(--color-orange); }

/* ================================================================
   Live-View — fixer oberer Block + scrollbare Teilnehmerliste unten.
   WHY: Besatzungsstärke + Need-Signal immer sichtbar; Liste scrollt.
        max-width: 600px zentriert, volle Breite auf Mobile.
   NOTE: body { height: 100%; overflow: hidden } remains in live.html
         because it's a page-specific body override — cannot be scoped to
         a class selector, and must not affect other pages.
================================================================ */
.live-wrap {
    max-width: 600px;
    margin: 0 auto;
    /* WHY: Flex-Column damit fixed-top + scroll-bottom exakt funktioniert.
       overflow:hidden nur auf body — live-wrap selbst braucht kein overflow:hidden
       damit position:fixed Footer-Links korrekt klickbar bleiben. */
    display: flex;
    flex-direction: column;
    height: 100dvh; /* dvh = dynamic viewport height, korrekt auf Mobile */
}
/* Fixer oberer Bereich */
.live-fixed {
    flex-shrink: 0;
}
/* Scrollbare Teilnehmerliste */
.live-scroll {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-4); /* WHY: Footer entfernt, nur noch etwas Luft nach unten */
}

/* --- Kompakte Live-Topbar (ersetzt separate live-header Zeile) --- */
/* WHY: Alle Statusinformationen in die app-topbar integriert — spart eine
   Header-Zeile und gibt der Karte und dem Ride-Panel mehr vertikalen Platz. */
.live-topbar {
    /* WHY: Volle Breite statt max-width:600px — Topbar klebt am Rand */
    max-width: none;
    gap: var(--space-2);
}
.live-topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex: 1;
    min-width: 0;
    overflow: hidden;
}
.live-topbar-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    overflow: hidden;
}
/* WHY: Name + Mobilitäts-Icon unter dem Event-Chip — kleiner als Chip, klar lesbar */
.live-topbar-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}
.live-status-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    white-space: nowrap;
}
/* WHY: GPS-Badge Farbzustände — rot=kein GPS, gelb=Simulator, grün=aktiv */
.live-status-badge.gps-ok   { background: var(--color-success-bg); color: var(--color-green); }
.live-status-badge.gps-sim  { background: var(--color-warning-bg); color: var(--color-orange); }
.live-status-badge.gps-err  { background: var(--color-danger-bg); color: var(--color-primary); }
.live-event-code {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.live-duration {
    color: var(--color-orange);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* --- Sections (vertikal gestapelt) --- */
.live-section {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border-muted);
}
.live-section:last-child { border-bottom: none; }

/* --- Eigenes Profil --- */
.my-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.my-profile-icon {
    font-size: 2rem;
    flex-shrink: 0;
}
.my-profile-name {
    color: var(--color-text);
    font-size: 1.1rem;
    font-weight: bold;
}
.my-profile-mobility {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* --- Mitfahrt: Karte als normales Block-Element --- */
/* WHY: Karte NICHT fixed/overlay — normales Block-Element im Scroll-Flow.
   Leaflet braucht explizite px-Höhe (nicht %) um korrekt zu rendern. */
.ride-map-wrap {
    display: none;
    margin: 0;
}
.ride-map-wrap.active { display: block; }
#ride-map {
    width: 100%;
    border-radius: 0;
    background: var(--color-bg);
    /* WHY: overflow:hidden verhindert dass Leaflet-Tiles den Container aufblähen */
    overflow: hidden;
}
/* WHY: Kein !important — setRideMapHeight() setzt inline style.height wenn Mitfahrt aktiv,
 * das schlägt diese Regel. Im Normalzustand (kein inline height) greift die CSS-Regel.
 * Leaflet setzt container.style.height intern nur beim ersten Render und dann nicht
 * mehr — daher kein !important nötig für den Alltagsbetrieb. */
#ride-map.map-driver { height: min(60vw, 400px); }
#ride-map.map-rider  { height: min(40vw, 250px); }
/* --- Mitfahrt Panel --- */
.ride-panel {
    text-align: center;
    padding: 0.6rem 0.75rem;
    display: none;
}
.ride-panel.active {
    display: block;
    background: var(--color-info-bg);
    border-left: 3px solid var(--color-info-accent);
}
/* WHY: ride-title ist die Kernfrage (Mitfahrt-Anfrage) — prominent genug
   dass man sie beim Fahren auf einen Blick versteht. Teal = positive Aktion. */
.ride-panel .ride-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.3rem;
    color: var(--color-teal-light);
}
.ride-panel .ride-info {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}
.ride-panel .ride-timer {
    color: var(--color-orange);
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
}
/* WHY: ETA countdown shown below driver/rider accepted state */
#ride-eta-rider, #ride-eta-driver {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--color-teal);
    margin: 0.3rem 0;
}
.ride-panel .ride-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}
/* WHY: min-height 44px — Wurstfinger-kompatibel per CONCEPT.md */
.btn-ride-accept {
    padding: 0.65rem 1.5rem;
    min-height: 44px;
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    background: var(--color-teal);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    touch-action: manipulation;
    flex: 1;
    max-width: 160px;
    transition: background 0.1s, transform 0.1s;
}
.btn-ride-reject {
    padding: 0.65rem 1.5rem;
    min-height: 44px;
    font-size: 1rem;
    color: var(--color-text-faint);
    background: transparent;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    touch-action: manipulation;
    flex: 1;
    max-width: 160px;
    transition: background 0.1s, transform 0.1s;
}
.btn-ride-accept:active { opacity: 0.7; transform: scale(0.96); }
.btn-ride-reject:active { color: var(--color-primary); border-color: var(--color-primary); }
/* WHY: Umweg-Info ist die Ja/Nein-Entscheidungsgrundlage beim Mitfahrt-Angebot —
   groß und fett genug um beim Fahren mit einem Blick erfasst zu werden. */
.ride-detour-warn {
    color: var(--color-orange);
    font-size: 1rem;
    font-weight: 600;
    margin: 0.25rem 0;
}

/* --- Kameraden-Liste --- */
/* WHY: "(du)"-Markierung in Teilnehmerliste — eigene Person hervorheben */
.participant-self { color: var(--color-teal); }

/* --- Modal --- */
.live-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.live-dialog {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    min-width: 260px;
    text-align: center;
}
.live-dialog p { margin-bottom: 1rem; font-size: 1rem; }
.live-dialog-btns { display: flex; gap: 0.5rem; justify-content: center; }
.live-dialog-btns button {
    padding: 8px 20px;
    min-height: 44px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}
.live-dialog .btn-confirm-cancel { background: var(--color-primary); color: #fff; }
.live-dialog .btn-dismiss { background: var(--color-border); color: var(--color-text-muted); }

/* --- Simulator-Controls im Drawer --- */
.btn-sim {
    padding: 0.3rem 0.6rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border-light);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    min-height: 36px;
    min-width: 36px;
}
.btn-sim:active { background: var(--color-teal); color: #fff; }

/* --- Karten-Expansion (Task 7) --- */
/* WHY: Im Normalzustand ist die Karte ausgeblendet (ride-map-wrap.active steuert Sichtbarkeit).
   Der map-wrapper selbst bleibt immer im DOM, damit die expand/collapse-Logik funktioniert. */
.map-wrapper-collapsed {
    position: relative;
    height: 80px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--color-border-glow);
    margin: 0 var(--space-4) var(--space-3);
    transition: height 0.3s ease, border-radius 0.3s ease, margin 0.3s ease;
}
.map-wrapper-expanded {
    position: fixed !important;
    inset: 0 !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    z-index: 30;
}
.map-expand-hint {
    position: absolute; bottom: 6px; right: 8px; z-index: 5;
    background: rgba(10,14,26,.75);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm, 6px);
    padding: 4px 8px;
    min-height: 44px; min-width: 44px;
    display: flex; align-items: center; justify-content: center; gap: 4px;
    cursor: pointer; touch-action: manipulation;
    font-size: var(--text-xs); color: var(--color-text-label);
}
.map-overlay-top, .map-overlay-bottom {
    position: absolute; left: 0; right: 0; z-index: 10;
    display: none;
    padding: var(--space-3) var(--space-4);
}
.map-overlay-top {
    top: 0;
    background: linear-gradient(to bottom, rgba(10,14,26,.9) 0%, transparent 100%);
}
.map-overlay-bottom {
    bottom: 0;
    background: linear-gradient(to top, rgba(10,14,26,.95) 0%, transparent 100%);
    padding-bottom: var(--space-5);
}
.map-close-btn {
    background: rgba(10,14,26,.7);
    border: 1px solid var(--color-border-glow);
    border-radius: var(--radius-pill);
    padding: 4px 12px;
    min-height: 44px;
    display: inline-flex; align-items: center;
    font-size: var(--text-xs); color: var(--color-text-label);
    font-weight: 600; cursor: pointer; touch-action: manipulation;
}
.map-expand-hint:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.map-close-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
/* WHY: Wenn Karte vollbild ist, alle anderen UI-Elemente ausblenden —
   maximale Kartenfläche beim Fahren, nur minimale Overlays bleiben sichtbar. */
.map-is-expanded .app-topbar,
.map-is-expanded .glow-card,
.map-is-expanded .stat-pills,
.map-is-expanded .btn { display: none !important; }
.map-is-expanded .map-overlay-top { display: flex; align-items: center; justify-content: space-between; }
.map-is-expanded .map-overlay-bottom { display: flex; align-items: flex-end; justify-content: space-between; }
.map-is-expanded .map-expand-hint { display: none; }
/* WHY: Im expanded Zustand muss die Karte den gesamten wrapper füllen */
.map-wrapper-expanded .ride-map-wrap,
.map-wrapper-expanded #ride-map {
    width: 100% !important;
    height: 100% !important;
}
/* WHY: Im collapsed Zustand map-wrapper nur anzeigen wenn Mitfahrt aktiv (ride-map-wrap.active) */
.map-wrapper-collapsed:not(:has(.ride-map-wrap.active)) {
    display: none;
}

/* ================================================================
   Simulator (gpx_simulate) — Dev-Tool für GPS-Ping-Simulation
   WHY: Simulator ist nur im Dev-Kontext sichtbar (DEBUG=True).
        Kein Mobile-First — breites Layout für die Tabelle.
================================================================ */

/* WHY: Dev tool — full browser width, no mobile max-width constraint */
.sim-page-wrap { max-width: none; padding: 0.5rem 1rem; }
.sim-page { padding-top: 1rem; }
.sim-page > h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    text-align: center;
}
.dev-badge {
    display: inline-block;
    background: #f4a261;
    color: #1a1a2e;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 0.4rem;
}
.sim-event-info {
    text-align: center;
    color: #aaa;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* --- Toolbar --- */
.sim-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.6rem 0.8rem;
    background: #1a2744;
    border-radius: 8px;
    margin-bottom: 0.8rem;
}
.sim-toolbar button, .sim-toolbar select, .sim-toolbar input {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 5px;
    border: 1px solid #444;
    background: #16213e;
    color: #eee;
    cursor: pointer;
}
.sim-toolbar button:hover { background: #2a9d8f; }
.sim-toolbar button:active { opacity: 0.7; }
/* WHY: <a>-Links in der Toolbar sollen wie Buttons aussehen */
.sim-toolbar-link {
    display: inline-block;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 5px;
    border: 1px solid #444;
    background: #16213e;
    color: #eee;
    text-decoration: none;
}
.sim-toolbar-link:hover { background: #2a9d8f; color: #fff; }
.sim-toolbar .sep {
    width: 1px;
    height: 1.5rem;
    background: #444;
}
.sim-toolbar .add-group {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    margin-left: auto;
}
.sim-toolbar .add-group input[type="number"] {
    width: 3.5rem;
    text-align: center;
}
.speed-btn.active {
    background: #2a9d8f;
    border-color: #2a9d8f;
    font-weight: bold;
}

/* --- Table --- */
.sim-table-wrap {
    overflow-x: auto;
}
.sim-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.sim-table th, .sim-table td {
    padding: 0.45rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid #333;
}
.sim-table th {
    background: #1a2744;
    color: #aaa;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    position: sticky;
    top: 0;
    z-index: 2;
}
.sim-table tr:hover { background: #1a2744; }
.sim-table tr.running { border-left: 3px solid #2a9d8f; }
.sim-table tr.paused { border-left: 3px solid #f4a261; }
.sim-table tr.arrived { border-left: 3px solid #52b788; }

.sim-check { width: 1.1rem; height: 1.1rem; cursor: pointer; }

.sim-status {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: bold;
}
.sim-status.idle { color: #888; }
.sim-status.running { color: #2a9d8f; }
.sim-status.paused { color: #f4a261; }
.sim-status.arrived { color: #52b788; }
.sim-status.stopped { color: #e63946; }

/* --- Progress bar --- */
.sim-progress {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.sim-progress-bar {
    width: 80px;
    height: 8px;
    background: #333;
    border-radius: 4px;
    overflow: hidden;
}
.sim-progress-fill {
    height: 100%;
    background: #2a9d8f;
    border-radius: 4px;
    transition: width 0.3s;
}
.sim-progress-text {
    font-size: 0.75rem;
    color: #888;
    min-width: 3rem;
}

/* WHY: Icon-only sim action buttons — compact, no label needed */
.sim-act-btn {
    padding: 0.2rem 0.35rem;
    font-size: 0.85rem;
    border-radius: 4px;
    border: 1px solid #333;
    background: #16213e;
    color: #ccc;
    cursor: pointer;
    line-height: 1;
}
.sim-act-btn:hover { background: #2a9d8f; border-color: #2a9d8f; color: #fff; }
.sim-act-stop { border-color: #555; }
.sim-act-stop:hover { background: #c0392b; border-color: #c0392b; }
.sim-act-remove { border-color: #555; }
.sim-act-remove:hover { background: #c0392b; border-color: #c0392b; }
.sim-hijack-active { background: #e67e22; border-color: #e67e22; color: #fff; }
.sim-hijack-active:hover { background: #d35400; border-color: #d35400; }

.btn-open-client {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 4px;
    border: 1px solid #2a9d8f;
    background: transparent;
    color: #2a9d8f;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.btn-open-client:hover { background: #2a9d8f; color: #fff; }

/* WHY: Sticky actions column — always visible even when table overflows */
.sim-table th:last-child,
.sim-table td.actions-cell {
    position: sticky;
    right: 0;
    background: #1a1a2e;
    z-index: 1;
    box-shadow: -4px 0 8px rgba(0,0,0,0.3);
}
.sim-table th:last-child { background: #1a2744; }
.sim-table tr:hover td.actions-cell { background: #1a2744; }

/* --- Row expansion (route config) --- */
.sim-row-detail {
    display: none;
    background: #0f1a30;
}
.sim-row-detail.open { display: table-row; }
.sim-row-detail td {
    padding: 0.8rem;
}
.sim-detail-content {
    display: flex;
    gap: 1rem;
}
/* WHY: Map takes 2/3, controls take 1/3.
 * Map height matches the natural height of the controls column —
 * align-self:stretch + min-height:200px ensures it fills the row. */
.sim-detail-map {
    flex: 2;
    min-width: 0;
    min-height: 200px;
    align-self: stretch;
    border-radius: 6px;
    border: 1px solid #333;
}
.sim-detail-controls {
    flex: 1;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.sim-detail-controls label {
    color: #aaa;
    font-size: 0.8rem;
}
.sim-detail-controls input,
.sim-detail-controls select {
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 4px;
    border: 1px solid #444;
    background: #16213e;
    color: #eee;
}
.sim-detail-controls button {
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
    border-radius: 5px;
    border: 1px solid #444;
    background: #16213e;
    color: #eee;
    cursor: pointer;
}
.sim-detail-controls button:hover { background: #2a9d8f; }

/* --- Pool accordion --- */
.pool-accordion {
    margin-top: 1.5rem;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
}
.pool-accordion-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: #1a2744;
    cursor: pointer;
    user-select: none;
}
.pool-accordion-header:hover { background: #1f3058; }
.pool-accordion-header h2 {
    font-size: 1rem;
    margin: 0;
    color: #ccc;
    flex: 1;
}
.pool-accordion-header .pool-count {
    font-size: 0.8rem;
    color: #888;
}
.pool-accordion-header .arrow {
    color: #888;
    transition: transform 0.2s;
}
.pool-accordion.open .pool-accordion-header .arrow { transform: rotate(90deg); }
.pool-accordion-body {
    display: none;
    padding: 0;
}
.pool-accordion.open .pool-accordion-body { display: block; }
.pool-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
    padding: 0.5rem 0.8rem;
    background: #12203a;
    border-bottom: 1px solid #333;
}
.pool-toolbar button, .pool-toolbar input {
    padding: 0.3rem 0.5rem;
    font-size: 0.82rem;
    border-radius: 4px;
    border: 1px solid #444;
    background: #16213e;
    color: #eee;
    cursor: pointer;
}
.pool-toolbar button:hover { background: #2a9d8f; }
.pool-toolbar .add-group {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    margin-left: auto;
}
.pool-toolbar .add-group input[type="number"] {
    width: 3.2rem;
    text-align: center;
}
.pool-add-btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 4px;
    border: 1px solid #2a9d8f;
    background: transparent;
    color: #2a9d8f;
    cursor: pointer;
    white-space: nowrap;
}
.pool-add-btn:hover { background: #2a9d8f; color: #fff; }
/* WHY: Pool detail rows reuse sim-detail styling */

/* --- Waypoint mode --- */
.wp-toggle-active {
    background: #f4a261 !important;
    border-color: #f4a261 !important;
    color: #1a1a2e !important;
}
.sim-ride-badge {
    display: inline-block;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 0.3rem;
}
.sim-ride-badge.accepted { background: #264653; color: #2a9d8f; }
.sim-ride-badge.pending { background: #3d3520; color: #f4a261; }
.sim-detail-controls .wp-row {
    display: flex;
    gap: 0.3rem;
}

.sim-empty {
    text-align: center;
    color: #666;
    padding: 2rem 1rem;
    font-size: 1rem;
}
/* WHY: pre_join rows — visually distinct from active (running/paused) rows */
.sim-table tr.sim-prejoin-row { border-left: 3px solid #555; opacity: 0.85; }
.sim-table tr.sim-prejoin-row:hover { background: #1a2744; }
.sim-table tr.sim-prejoin-row td.actions-cell { background: #1a1a2e; }
.sim-table tr.sim-prejoin-row:hover td.actions-cell { background: #1a2744; }
.sim-status.prejoin { color: #888; }
.sim-status.cancelled { color: #e63946; }
.btn-join {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 4px;
    border: 1px solid #2a9d8f;
    background: #2a9d8f;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    font-weight: bold;
}
.btn-join:hover { background: #218f83; }

/* WHY: Inline qualification checkboxes in detail row */
.sim-qual-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.6rem;
}
.sim-qual-label {
    font-size: 0.8rem;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}
.sim-qual-label input[type="checkbox"] {
    margin: 0;
}
