/* Wochenspielplan — Stylesheet
   Mobile-first, eigenständig (keine Frameworks). */

* { box-sizing: border-box; }

:root {
    --bg: #f4f3ee;
    --surface: #ffffff;
    --border: #d8d6cc;
    --border-soft: #ebe9e0;
    --text: #1a1a17;
    --text-muted: #6b6a64;
    --text-soft: #93918a;

    --heim-bg: #eaf3de;
    --heim-strong: #639922;
    --heim-text: #173404;
    --heim-pill-bg: #c0dd97;

    --aus-bg: #f1efe8;
    --aus-strong: #888780;
    --aus-text: #2c2c2a;
    --aus-pill-bg: #d3d1c7;

    --konflikt-bg: #fcebeb;
    --konflikt-strong: #a32d2d;
    --konflikt-text: #501313;

    --info-bg: #e6f1fb;
    --info-strong: #185fa5;
    --info-text: #0c447c;

    --success-bg: #eaf3de;
    --success-text: #173404;

    --error-bg: #fcebeb;
    --error-text: #501313;

    --radius: 8px;
    --radius-lg: 12px;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
}

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

/* ===== Topbar ===== */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
}
.brand-logo { font-size: 22px; }
.brand-logo-img {
    height: 36px;
    width: auto;
    display: block;
    flex-shrink: 0;
}
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 600; font-size: 16px; }
.brand-sub  { color: var(--text-muted); font-size: 12px; }
.topnav { display: flex; gap: 4px; }
.topnav a {
    padding: 6px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
}
.topnav a.aktiv {
    background: var(--bg);
    color: var(--text);
    font-weight: 500;
}
.topnav a:hover { background: var(--bg); text-decoration: none; }

/* Abmelden-Button in der Topnav — sieht aus wie ein Nav-Link */
.topnav-logout { display: inline; margin: 0; }
.topnav-logout button {
    padding: 6px 12px;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.topnav-logout button:hover { background: var(--bg); color: var(--text); }

/* Burger-Button — nur mobil sichtbar (siehe Media-Query) */
.burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 38px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}
.burger span {
    display: block;
    width: 20px;
    height: 2px;
    margin: 0 auto;
    background: var(--text);
    border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
}
.burger.aktiv span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.aktiv span:nth-child(2) { opacity: 0; }
.burger.aktiv span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Auth-Seiten (Login, Passwort ändern) */
.auth-card { max-width: 420px; margin: 32px auto; }
.auth-info { color: var(--text-muted); font-size: 14px; line-height: 1.5; margin-bottom: 16px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 500; }
.auth-form input { font-size: 16px; }
.auth-zurueck { margin-top: 16px; font-size: 13px; }

/* ===== Layout ===== */
.page {
    max-width: 880px;
    margin: 16px auto;
    padding: 0 16px 32px;
}
.page-foot {
    max-width: 880px;
    margin: 24px auto;
    padding: 0 16px 24px;
    color: var(--text-soft);
    font-size: 12px;
    text-align: center;
}

.flash {
    max-width: 880px;
    margin: 12px auto 0;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
}
.flash-success { background: var(--success-bg); color: var(--success-text); }
.flash-error   { background: var(--error-bg);   color: var(--error-text); }

/* ===== Wochenplan-Header ===== */
.wp-head {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}
.wp-title { font-size: 21px; font-weight: 600; margin: 0; line-height: 1.2; }
.wp-title-kw {
    color: var(--text-muted);
    font-weight: 700;
    white-space: nowrap;
}
.wp-sub { font-size: 14px; color: var(--text-muted); margin: 3px 0 0; font-weight: 500; }

/* Navigation als eigene Zeile unter dem Titel */
.wp-week-nav {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 14px;
}
.wp-week-nav a {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    text-align: center;
}
/* Pfeile breiter, „aktuelle Woche" füllt den verfügbaren Raum dazwischen.
   NUR Desktop (ab 601px) — mobil würden 3x110px die Leiste überlaufen lassen. */
@media (min-width: 601px) {
    .wp-week-nav a:not(.wp-week-druck) { min-width: 110px; }
}
.wp-week-nav .wp-week-today { flex: 1 1 auto; }
.wp-week-nav a:hover { background: var(--bg); text-decoration: none; }
.wp-week-today { font-weight: 500; }

/* Statistik + Drucken-Block am Seitenende */
.wp-foot {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.wp-foot-stats { font-size: 13px; color: var(--text-muted); }
.wp-foot-stats strong { color: var(--text); font-weight: 700; }
.wp-foot .wp-stats {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    text-align: left;
}
/* Drucken-Button unten standardmäßig versteckt — nur auf Mobile sichtbar */
.wp-week-druck-bottom { display: none; }

.wp-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
    margin: 10px 0 16px;
}
.wp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wp-legend .dot {
    width: 12px; height: 12px;
    border-radius: 3px;
}
.dot-heim     { background: var(--heim-pill-bg); }
.dot-aus      { background: var(--aus-pill-bg); }
.dot-konflikt { background: #f7c1c1; }

.hinweis {
    background: var(--info-bg);
    color: var(--info-text);
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}

/* ===== Tagesblock + Zeile ===== */
.wp-day { margin-top: 12px; }
.wp-day-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 6px 0 8px;
    border-bottom: 1px solid var(--border-soft);
    margin-bottom: 8px;
}
.wp-day-name { font-size: 15px; font-weight: 600; }
.wp-day-date { font-size: 13px; color: var(--text-muted); }

.wp-row {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius);
    margin-bottom: 4px;
    border: 1px solid transparent;
}
.wp-row-heim { background: var(--heim-bg); }
.wp-row-aus  { background: var(--surface); border-color: var(--border-soft); }
.wp-row-konflikt { border: 1px solid var(--konflikt-strong); background: var(--konflikt-bg); }
.wp-row-abgesagt { opacity: 0.55; text-decoration: line-through; }
/* Vergangene Spiele dezent abblenden (aber nicht durchstreichen) */
.wp-row-vergangen { opacity: 0.42; }
.wp-row-vergangen.wp-row-abgesagt { opacity: 0.3; }

.wp-time {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.wp-team { font-size: 14px; min-width: 0; }
.wp-team b { font-weight: 600; }
.wp-vs {
    color: var(--text-muted);
    font-size: 13px;
    display: block;
    margin-top: 2px;
    overflow-wrap: anywhere;
}
.wp-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    text-align: right;
    min-width: 0;
}
.wp-badge {
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.wp-badge-heim     { background: var(--heim-pill-bg); color: var(--heim-text); }
.wp-badge-aus      { background: var(--aus-pill-bg);  color: var(--aus-text); }
.wp-badge-abgesagt { background: var(--konflikt-strong); color: white; }
.wp-badge-halle    { background: #d6e7f5; color: #0c447c; }
.wp-badge-football { background: #6b4423; color: #fff4e8; }
.wp-badge-belegung { background: #5b4b8a; color: #efe9fb; }
.wp-ganztags { font-size: 11px; font-weight: 600; color: var(--text-muted); }
.wp-spielform {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    background: #fff0d6;
    color: #8a4f00;
    border-radius: 3px;
    margin-left: 4px;
    vertical-align: 1px;
    letter-spacing: 0.3px;
}
.wp-platz {
    color: var(--text-muted);
    font-size: 11px;
    max-width: 200px;
    overflow-wrap: anywhere;
}
/* Farbige Platz-Pille — gleicher Stil wie der aktive Gelände-Filter-Button.
   Greift via inline style="--p-farbe: #..."; ohne Variable bleibt Default-Grau. */
.wp-platz-pille {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--p-farbe, #d8d6cc);
    color: var(--text);
    border: 1px solid rgba(0,0,0,0.25);
    max-width: 100%;
    overflow-wrap: anywhere;
    line-height: 1.35;
    text-decoration: none;
}

/* Auswärts-Pille mit aufklappbarer Adresse.
   <details>-Element, dessen <summary> wie eine normale Pille gerendert wird —
   Klick öffnet die Adresse darunter. */
.wp-platz-details {
    display: inline-block;
    max-width: 100%;
}
.wp-platz-details > summary {
    cursor: pointer;
    list-style: none;            /* Disclosure-Pfeil verbergen */
    user-select: none;
}
.wp-platz-details > summary::-webkit-details-marker { display: none; }
.wp-platz-details > summary::marker { display: none; content: ''; }
.wp-platz-pille-aus::after {
    content: ' ▾';
    font-size: 9px;
    color: var(--text-muted);
    vertical-align: 1px;
    margin-left: 2px;
}
.wp-platz-details[open] > summary .wp-platz-pille-aus::after,
.wp-platz-details[open] > .wp-platz-pille-aus::after {
    content: ' ▴';
}
.wp-platz-adresse {
    margin-top: 6px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: 6px;
    line-height: 1.4;
    border: 1px solid var(--border-soft);
}

/* Eigenständiger Farbpunkt (Plätze-Liste, Bearbeiten-Form) */
.platz-farbpunkt {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.15);
    vertical-align: -1px;
    margin-right: 6px;
}

.wp-warn {
    background: var(--konflikt-bg);
    color: var(--konflikt-text);
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 6px;
}

.wp-stats {
    margin-top: 24px;
    padding-top: 12px;
    border-top: 1px solid var(--border-soft);
    font-size: 12px;
    color: var(--text-soft);
    text-align: right;
}

/* ===== Einstellungen / Karten ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 16px;
}
.card h2 {
    margin: 0 0 12px;
    font-size: 16px;
    font-weight: 600;
}
h1 { font-size: 22px; font-weight: 600; margin: 8px 0 16px; }

.card label {
    display: block;
    margin: 12px 0;
    font-size: 14px;
}
.card label input[type="text"] {
    display: block;
    width: 100%;
    max-width: 480px;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
}
.card label input[type="text"]:focus {
    outline: none;
    border-color: var(--info-strong);
    box-shadow: 0 0 0 3px rgba(24,95,165,0.15);
}
.card .hilfe {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
}
.card .cb { font-size: 13px; color: var(--text-muted); display:inline-flex; align-items:center; gap:6px; margin:0; }

.card label select {
    display: block;
    width: 100%;
    max-width: 480px;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: white;
}
.card label select:focus,
.card label input[type="number"]:focus {
    outline: none;
    border-color: var(--info-strong);
    box-shadow: 0 0 0 3px rgba(24,95,165,0.15);
}
.card label input[type="number"] {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
}
.card .cb { font-size: 13px; color: var(--text-muted); display:inline-flex; align-items:center; gap:6px; margin:0; }

button {
    background: var(--info-strong);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
}
button:hover { background: var(--info-text); }

.btn-primary {
    display: inline-block;
    background: var(--info-strong);
    color: white;
    padding: 8px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}
.btn-primary:hover { background: var(--info-text); text-decoration: none; }
.btn-link {
    color: var(--text-muted);
    padding: 8px 4px;
    text-decoration: none;
    font-size: 14px;
}
.btn-link:hover { color: var(--text); text-decoration: underline; }
.btn-link-danger {
    background: none;
    border: none;
    color: var(--konflikt-strong);
    cursor: pointer;
    padding: 0;
    font-size: 13px;
    text-decoration: underline;
}
.btn-link-danger:hover { background: none; color: var(--konflikt-text); }

.status-aktiv {
    background: var(--heim-pill-bg);
    color: var(--heim-text);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}
.status-inaktiv {
    background: var(--aus-pill-bg);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}
.text-soft { color: var(--text-soft); }
.liste-inaktiv td { opacity: 0.55; }
.kasten-info {
    background: var(--bg);
    padding: 10px 12px;
    border-radius: var(--radius);
}

.wp-platz-link {
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
    color: var(--text-muted);
}
.wp-platz-link:hover { color: var(--info-text); text-decoration: none; }
.wp-platz-leer { font-style: italic; color: var(--info-strong); }

.liste {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.liste th, .liste td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-soft);
    text-align: left;
}
.liste th { font-weight: 600; color: var(--text-muted); }
.liste .r { text-align: right; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.small { font-size: 12px; color: var(--text-muted); }
code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
}

/* ===== Mobile ===== */
/* ===========================================================================
   MOBILE-OPTIMIERUNG
   Drei Breakpoints:
   - 700px: Tablet/kleinerer Desktop — Pakete kompakter
   - 600px: Standard-Smartphone — Layout-Umbauten
   - 380px: Schmales Smartphone (iPhone SE etc.) — kleinste Einheit
   =========================================================================== */

@media (max-width: 700px) {
    .page { padding: 0 12px 24px; }
    .topbar-inner { padding: 8px 12px; }
}

@media (max-width: 600px) {
    /* ----- Topbar: schlank, ohne Untertitel ----- */
    .topbar-inner {
        flex-wrap: nowrap;
        gap: 8px;
        padding: 6px 10px;
    }
    .brand-sub { display: none; }
    .brand-logo-img { height: 24px; }
    .brand { gap: 7px; min-width: 0; flex-shrink: 1; }
    .brand-text { min-width: 0; overflow: hidden; }
    .brand-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    /* ----- Hauptnavigation: Burger-Dropdown ----- */
    .burger { display: flex; }
    .topnav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 2px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: 0 8px 16px rgba(0,0,0,0.08);
        padding: 8px 10px 12px;
        z-index: 20;
    }
    .topnav.offen { display: flex; }
    .topnav a {
        padding: 13px 12px;
        font-size: 16px;
        border-radius: 8px;
        white-space: nowrap;
    }
    .topnav-logout { display: block; }
    .topnav-logout button {
        width: 100%;
        text-align: left;
        padding: 13px 12px;
        font-size: 16px;
        margin-top: 2px;
    }

    /* ----- Wochen-Header: kompakt ----- */
    .wp-head {
        padding-bottom: 8px;
        margin-bottom: 10px;
    }
    .wp-title { font-size: 16px; line-height: 1.2; }
    .wp-sub { font-size: 12px; margin-top: 1px; }

    /* ----- Wochen-Navigation -----
       Grid mit 1fr in der Mitte füllt die Containerbreite exakt aus und rechnet
       den gap korrekt ein -> kein Überlauf, kein Rest rechts. Der (mobil
       ausgeblendete) Druck-Top-Button wird explizit aus dem Grid genommen. */
    .wp-week-nav {
        display: grid;
        grid-template-columns: 42px 1fr 42px;
        gap: 5px;
        margin-bottom: 12px;
    }
    .wp-week-nav > .wp-week-arrow {
        width: auto;
        min-width: 0;
        max-width: none;
    }
    .wp-week-nav > .wp-week-today {
        min-width: 0;
        width: auto;
        max-width: none;
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    /* Druck-Top-Button mobil komplett aus dem Grid nehmen (sonst Phantom-Zelle) */
    .wp-week-nav > .wp-week-druck-top {
        display: none !important;
    }
    .wp-week-nav a {
        min-height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
        padding: 4px;
    }
    /* Drucken-Button oben auf Mobile ausblenden — kommt unten wieder.
       Wichtig: .wp-week-nav ist ein 3-Spalten-Grid. display:none allein lässt in
       manchen mobilen Browsern einen schmalen Grid-Rest stehen, daher zusätzlich
       komplett aus Fluss und Größe nehmen. */
    .wp-week-druck-top {
        display: none !important;
        width: 0;
        height: 0;
        padding: 0;
        margin: 0;
        border: 0;
        overflow: hidden;
        visibility: hidden;
    }

    /* Drucken-Button unten auf Mobile sichtbar, volle Breite, sauber zentriert */
    .wp-week-druck-bottom {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        width: 100%;
        align-self: stretch;
        box-sizing: border-box;
        padding: 11px;
        font-size: 14px;
        margin: 0 !important;
        text-align: center;
    }
    .wp-foot {
        margin-top: 16px;
        padding-top: 14px;
    }

    /* ----- Gelände-Filter: kompakt, alle in wenigen Zeilen ----- */
    .gelaende-filter {
        flex-wrap: wrap;
        padding: 7px 8px;
        gap: 4px;
    }
    .gelaende-filter-btn {
        padding: 4px 8px;
        font-size: 12px;
        gap: 4px;
    }
    .gelaende-filter-btn[style*="--g-farbe"]::before {
        width: 9px;
        height: 9px;
    }

    /* ----- Wochenplan-Zeile: zweispaltig Zeit/Inhalt, Meta unter Team ----- */
    .wp-row {
        grid-template-columns: 44px 1fr;
        gap: 8px;
        padding: 10px;
    }
    .wp-time { font-size: 14px; }
    .wp-team { font-size: 14px; line-height: 1.35; }
    .wp-vs { font-size: 12px; margin-top: 3px; }

    .wp-meta {
        grid-column: 2;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 6px;
        justify-content: flex-start;
        text-align: left;
        margin-top: 4px;
    }
    .wp-platz, .wp-platz-pille { max-width: none; font-size: 11px; }
    .wp-platz-pille { padding: 3px 10px; }
    .wp-badge { font-size: 10px; padding: 2px 8px; }
    .wp-spielform { font-size: 10px; padding: 1px 5px; }

    /* ----- Datums-Header kleiner ----- */
    .wp-day-name { font-size: 14px; }
    .wp-day-date { font-size: 12px; }

    /* ----- Sub-Nav (Einstellungen): mobil als vertikale iOS-Liste ----- */
    .subnav {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        border-bottom: none;
        margin-bottom: 16px;
    }
    .subnav-titel { font-size: 19px; padding-bottom: 12px; }
    .subnav-tabs {
        flex-direction: column;
        width: 100%;
        margin-left: 0;
        gap: 0;
        background: white;
        border: 1px solid var(--border);
        border-radius: 12px;
        overflow: hidden;
    }
    .subnav-tabs a {
        flex: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
        padding: 14px 16px;
        min-height: 50px;
        font-size: 16px;
        font-weight: 500;
        border: none;
        border-bottom: 1px solid var(--border-soft);
        border-radius: 0;
        margin-bottom: 0;
        background: white;
        color: var(--text);
    }
    .subnav-tabs a::after {
        content: "›";
        color: var(--text-soft);
        font-size: 20px;
        font-weight: 400;
        line-height: 1;
    }
    .subnav-tabs a:last-child { border-bottom: none; }
    .subnav-tabs a.aktiv {
        background: var(--info-bg);
        color: var(--info-text);
        font-weight: 700;
        border-color: var(--border-soft);
    }
    .subnav-tabs a.aktiv::after {
        content: "✓";
        color: var(--info-text);
        font-weight: 700;
    }
    .unternav a {
        flex: 1;
        text-align: center;
        padding: 12px 8px;
        min-height: 44px;
        font-size: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* ----- Listen-Tabellen: kompakter ----- */
    .liste { font-size: 13px; }
    .liste th, .liste td { padding: 8px 6px; }
    /* Sekundäre Spalten (Spielklasse / Adresse / Reihenfolge) auf Mobile ausblenden */
    .liste th:nth-child(3), .liste td:nth-child(3) { display: none; }
    .liste th:nth-child(4), .liste td:nth-child(4) { display: none; }

    /* ----- Formulare: bessere Touch-Größen ----- */
    input[type="text"], input[type="number"], input[type="search"],
    input[type="email"], input[type="url"], input[type="password"],
    select, textarea {
        font-size: 16px;  /* verhindert iOS-Auto-Zoom beim Fokussieren */
        min-height: 40px;
    }
    button, .btn-primary, .btn-link {
        min-height: 40px;
        font-size: 14px;
    }

    /* ----- Drucken-Button im PDF-View ausblenden — gibt's nur am Desktop ----- */
    .druck-aktion { width: 100%; flex-direction: column; gap: 6px; }
    .druck-aktion a, .druck-aktion button { width: 100%; }

    /* ----- Modal: füllt Mobile-Screen besser ----- */
    dialog.modal {
        margin: 0;
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        border-radius: 8px 8px 0 0;
        position: fixed;
        bottom: 0;
        top: auto;
    }
}

@media (max-width: 380px) {
    /* iPhone SE und kleiner: noch kompakter */
    .page { padding: 0 8px 20px; }
    .topbar-inner { padding: 5px 8px; gap: 5px; }
    .brand-logo-img { height: 22px; }
    .brand-name { font-size: 13px; }

    .wp-title { font-size: 14px; }
    .wp-sub { font-size: 11px; }

    .wp-row {
        grid-template-columns: 38px 1fr;
        gap: 6px;
        padding: 8px;
    }
    .wp-time { font-size: 13px; }
    .gelaende-filter-btn { padding: 3px 7px; font-size: 11px; }
    .gelaende-filter { gap: 3px; padding: 6px 7px; }
}

/* Vereinssuche in Einstellungen */
.verein-suche { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px dashed var(--border); }
.suche-status { font-size: 13px; color: var(--text-muted); margin: 8px 0; min-height: 18px; }
.suche-treffer { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.treffer-card {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: inherit;
    transition: background 0.1s, border-color 0.1s;
}
.treffer-card:hover { background: var(--heim-pill-bg); border-color: var(--info-strong); }
.treffer-card img {
    width: 36px; height: 36px;
    object-fit: contain;
    flex-shrink: 0;
}
.treffer-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.treffer-meta b { font-weight: 600; color: var(--text); }
.treffer-id { font-family: monospace; font-size: 11px; color: var(--text-muted); }

.aktuelles-wappen {
    display: flex; align-items: center; gap: 10px;
    margin: 8px 0 16px 0;
    padding: 8px;
    background: var(--bg);
    border-radius: var(--radius);
    max-width: 220px;
}
.aktuelles-wappen img { width: 48px; height: 48px; object-fit: contain; }

/* Sync-Ladebalken */
.sync-progress {
    margin: 16px 0 0 0;
    padding: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.sync-bar {
    background: white;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    height: 12px;
    margin: 0 0 10px 0;
    position: relative;
}
.sync-bar-fill {
    background: linear-gradient(90deg, var(--info-strong), var(--info-text));
    height: 100%;
    width: 0%;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 999px;
}
.sync-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}
.sync-detail {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
    min-height: 14px;
}

/* Gelände-Anzeige */
.farb-kachel {
    display: inline-block;
    width: 18px; height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,.1);
    vertical-align: middle;
}
.platz-gruppe { margin-bottom: 16px; }
.wp-gelaende-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(0,0,0,.75);
    border: 1px solid rgba(0,0,0,.08);
    margin-right: 6px;
}

/* Gelände-Farben in Plätze-Übersicht und Wochenplan */
.gelaende-farbe {
    display: inline-block;
    width: 22px; height: 14px;
    border: 1px solid var(--border);
    border-radius: 3px;
    vertical-align: middle;
}
.gruppe-trenner td {
    padding: 8px 10px;
    font-size: 13px;
    border-top: 2px solid var(--border);
}
.wp-row-gelaende {
    /* Hintergrund wird inline gesetzt; Border-Radius bleibt erhalten */
}
.wp-row-gelaende .wp-platz,
.wp-row-gelaende .wp-vs {
    color: var(--text);
}

/* Sub-Navigation (Tabs unter Hauptmenü) */
.subnav {
    margin: 0 0 20px 0;
    border-bottom: 1px solid var(--border);
}
.subnav-titel {
    margin: 0 0 12px 0;
    font-size: 22px;
}
.subnav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}
.subnav-tabs a {
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    background: var(--bg);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: -1px;
}
.subnav-tabs a:hover {
    background: white;
    color: var(--text);
}
.subnav-tabs a.aktiv {
    background: white;
    color: var(--text);
    border-color: var(--border);
    border-bottom: 1px solid white;
    position: relative;
    z-index: 1;
}

/* Sekundär-Umschalter (z.B. Gelände/Plätze unter „Spielorte") */
.unternav {
    display: flex;
    gap: 6px;
    margin: 0 0 20px 0;
    flex-wrap: wrap;
}
.unternav a {
    padding: 6px 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.unternav a:hover { color: var(--text); }
.unternav a.aktiv {
    background: var(--info-bg);
    color: var(--info-text);
    border-color: var(--info-bg);
}

/* Gelände-Filter-Buttons im Wochenplan */
.gelaende-filter {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0 0 16px 0;
    padding: 8px 10px;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.gelaende-filter-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
    margin-right: 4px;
}
.gelaende-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    background: white;
    border: 1.5px solid var(--border);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: transform 0.05s ease;
}
.gelaende-filter-btn:hover {
    border-color: var(--text-muted);
    transform: translateY(-1px);
}
.gelaende-filter-btn[style*="--g-farbe"]::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--g-farbe);
    border: 1px solid rgba(0,0,0,0.15);
    flex-shrink: 0;
}
.gelaende-filter-btn.aktiv {
    background: var(--text);
    color: white;
    border-color: var(--text);
}
.gelaende-filter-btn.aktiv[style*="--g-farbe"] {
    background: var(--g-farbe);
    color: var(--text);
    border-color: rgba(0,0,0,0.4);
    font-weight: 700;
}
.gelaende-filter-btn.aktiv[style*="--g-farbe"]::before {
    background: white;
    border-color: rgba(0,0,0,0.3);
}

/* Drucken/Teilen-Button in der Wochen-Navigation */
.wp-week-druck {
    display: inline-block;
    margin-left: 8px;
    background: #1a1a17 !important;
    color: #ffffff !important;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none !important;
    border: 1px solid #1a1a17;
    line-height: 1.2;
}
.wp-week-druck:hover {
    background: #000 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    transform: translateY(-1px);
}
.wp-week-druck:visited {
    color: #ffffff !important;
}

/* Sync-Banner: zeigt aktiven Hintergrund-Sync */
.sync-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #fff3cd;
    border-bottom: 2px solid #f0ad4e;
    color: #856404;
    font-size: 14px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.sync-banner[hidden] { display: none; }
.sync-banner[data-phase="fertig"] {
    background: #d4edda;
    border-bottom-color: #198754;
    color: #0f5132;
}

.sync-banner-spinner {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: sync-spin 0.9s linear infinite;
}
.sync-banner[data-phase="fertig"] .sync-banner-spinner {
    animation: none;
    border: none;
    background: currentColor;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M6.5 11.5L3 8l1-1 2.5 2.5L12 4l1 1z"/></svg>') center/contain no-repeat;
    -webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M6.5 11.5L3 8l1-1 2.5 2.5L12 4l1 1z"/></svg>') center/contain no-repeat;
}
@keyframes sync-spin {
    to { transform: rotate(360deg); }
}

.sync-banner-text {
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}
.sync-banner-text b { font-weight: 600; }
.sync-banner-detail {
    color: inherit;
    opacity: 0.85;
    font-size: 13px;
}

.sync-banner-reload {
    padding: 5px 12px;
    border: 1px solid currentColor;
    background: white;
    color: inherit;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    flex-shrink: 0;
}
.sync-banner-reload:hover { background: rgba(255,255,255,0.7); }
.sync-banner-reload[hidden] { display: none; }

@media (max-width: 600px) {
    .sync-banner { padding: 8px 12px; font-size: 13px; }
    .sync-banner-detail { font-size: 12px; flex-basis: 100%; }
    .sync-banner-reload { font-size: 12px; padding: 4px 10px; }
}

/* Modal-Dialog (für Wartungs-Aktionen) */
dialog.modal {
    padding: 0;
    border: none;
    border-radius: 8px;
    max-width: 500px;
    width: 92vw;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    background: white;
}
dialog.modal::backdrop {
    background: rgba(0,0,0,0.4);
}
/* Fallback für ältere Browser ohne <dialog>-Support */
dialog.modal:not([open]) { display: none; }
dialog.modal.modal-offen {
    display: block;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
}

.modal-form {
    padding: 20px 24px;
    margin: 0;
}
.modal-form h3 {
    margin-bottom: 8px;
    font-size: 18px;
}
.modal-form p {
    margin: 4px 0;
    font-size: 14px;
}
.modal-form ul li {
    font-size: 13px;
    margin: 2px 0;
}

.modal-aktionen {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

/* ===== Einfaches Overlay-Modal (Sync-Nachfrage) ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
    background: white;
    border-radius: 10px;
    padding: 22px 24px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 12px 44px rgba(0,0,0,0.25);
}
.modal-box h3 { margin: 0 0 10px; font-size: 18px; }
.modal-box p { margin: 0; color: var(--text-muted); line-height: 1.5; }
.modal-box .modal-aktionen { margin-top: 20px; }
.btn-sekundaer {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-sekundaer:hover { background: var(--bg); }

/* ===== Zugriffszähler (Einstellungen) ===== */
.zugriff-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.zugriff-kachel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 10px;
    text-align: center;
}
.zugriff-zahl {
    display: block;
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
}
.zugriff-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
.zugriff-chart {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 90px;
    margin-top: 10px;
    padding-top: 4px;
}
.zugriff-bar-wrap {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    min-width: 0;
}
.zugriff-bar {
    width: 70%;
    max-width: 22px;
    background: var(--heim-strong, #639922);
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height .3s ease;
}
.zugriff-bar.heute { background: #1d9e75; }
.zugriff-bar-wrap { text-decoration: none; cursor: pointer; }
.zugriff-bar-wrap:hover .zugriff-bar { opacity: .8; }
.zugriff-bar-tag {
    font-size: 10px;
    color: var(--text-soft, #999);
    margin-top: 3px;
}

/* Doppel-Metrik in den Kacheln: Aufrufe + Personen */
.zugriff-metrik { margin-top: 8px; }
.zugriff-einheit { display: block; font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.zugriff-zahl.klein { font-size: 20px; }
.zugriff-zahl.xl { font-size: 40px; }
.zugriff-kachel.gross { padding: 22px 16px; }
.zugriff-grid.zwei { grid-template-columns: repeat(2, 1fr); }

/* Tages-Navigation (Detailseite) */
.tag-nav { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 620px) {
    .zugriff-grid { grid-template-columns: repeat(2, 1fr); }
    .zugriff-zahl { font-size: 22px; }
    .zugriff-zahl.xl { font-size: 34px; }
    .zugriff-grid.zwei { grid-template-columns: 1fr; }
    .tag-nav a, .tag-nav span { flex: 1; text-align: center; }
}

/* Status-Kacheln (Spielplan & Sync) */
.status-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 0 16px 0;
}
.status-kachel {
    flex: 1 1 140px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.status-zahl { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.1; }
.status-label { font-size: 13px; color: var(--text-muted); }

/* Wartung: Aktions-Reihe + Reparatur-Block */
.aktions-reihe {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.reparatur { margin-top: 16px; border-top: 1px solid var(--border-soft); padding-top: 4px; }
.reparatur > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    padding: 8px 0;
    color: var(--text-muted);
}
.reparatur-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-top: 1px solid var(--border-soft);
}
.reparatur-block:first-of-type { border-top: none; }
.reparatur-block > div { flex: 1; min-width: 0; }
.reparatur-block .hilfe { margin: 4px 0 0 0; }
.reparatur-block form { flex-shrink: 0; }

@media (max-width: 600px) {
    .aktions-reihe { flex-direction: column; align-items: stretch; }
    .aktions-reihe a { text-align: center; }
    .reparatur-block { flex-direction: column; align-items: stretch; }
    .reparatur-block form button { width: 100%; }
}

/* Tabellen auf Mobile horizontal scrollbar machen, statt Layout zu sprengen */
.tabelle-scroll { width: 100%; }
@media (max-width: 600px) {
    .tabelle-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -4px;
    }
    .tabelle-scroll .liste { min-width: 460px; }
    /* In scrollbaren Tabellen keine Spalten ausblenden — man kann ja wischen */
    .tabelle-scroll .liste th:nth-child(3), .tabelle-scroll .liste td:nth-child(3),
    .tabelle-scroll .liste th:nth-child(4), .tabelle-scroll .liste td:nth-child(4) { display: table-cell; }
}

/* ============ PWA: Install-Eintrag, Banner, iOS-Hinweis ============ */
.pwa-install { color: var(--info-strong); font-weight: 600; }
.pwa-install[hidden] { display: none !important; }

.pwa-banner {
    position: fixed;
    left: 12px; right: 12px; bottom: 12px;
    max-width: 520px; margin: 0 auto;
    z-index: 60;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 10px 34px rgba(0,0,0,0.18);
    padding: 14px 16px;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    transform: translateY(160%);
    opacity: 0;
    transition: transform .26s ease, opacity .26s ease;
}
.pwa-banner.sichtbar { transform: translateY(0); opacity: 1; }
.pwa-banner-text { display: flex; flex-direction: column; min-width: 0; }
.pwa-banner-text b { font-size: 15px; color: var(--text); }
.pwa-banner-text span { font-size: 13px; color: var(--text-muted); }
.pwa-banner-btns { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.pwa-btn-spaeter {
    background: transparent; border: none; color: var(--text-muted);
    padding: 9px 10px; font-size: 14px; cursor: pointer; border-radius: 8px;
}
.pwa-btn-spaeter:hover { background: var(--bg); color: var(--text); }
.pwa-btn-install {
    background: var(--info-strong); color: #fff; border: none;
    border-radius: 9px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
}
@media (max-width: 440px) {
    .pwa-banner { flex-direction: column; align-items: stretch; gap: 10px; }
    .pwa-banner-btns { justify-content: flex-end; }
    .pwa-btn-install { flex: 1; }
}

.pwa-ios-overlay {
    position: fixed; inset: 0; z-index: 70;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 16px;
}
.pwa-ios-box {
    background: var(--surface); border-radius: 16px;
    padding: 22px 20px; max-width: 380px; width: 100%;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.pwa-ios-box h3 { margin: 0 0 10px; font-size: 17px; }
.pwa-ios-box p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--text); }
.pwa-ios-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border: 1.5px solid var(--info-strong); color: var(--info-strong);
    border-radius: 5px; font-weight: 700; vertical-align: -5px;
}
.pwa-ios-ok {
    margin-top: 16px; width: 100%;
    background: var(--info-strong); color: #fff; border: none;
    border-radius: 10px; padding: 12px; font-size: 15px; font-weight: 600; cursor: pointer;
}
@media (min-width: 560px) { .pwa-ios-overlay { align-items: center; } }
