:root {
    --blau: #174aa8;
    --blau-dunkel: #0f3378;
    --grau: #f4f5f7;
    --grau-dunkel: #6b7280;
    --rot: #c0392b;
    --border: #e2e4e8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--grau);
    color: #1f2937;
}

.topbar {
    background: var(--blau-dunkel);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.topbar-brand {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
}

.topbar h1 {
    margin: 0;
    font-size: 1.25rem;
}

.topbar h1 a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-toggle-checkbox {
    display: none;
}

.nav-toggle-label {
    display: none;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
}

.topbar nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    height: 36px;
    width: auto;
}

.logo-login {
    height: 90px;
    width: auto;
    margin-bottom: 0.5rem;
}

.topbar nav a {
    color: white;
    text-decoration: none;
    margin-left: 1.25rem;
    font-size: 0.9rem;
}

.topbar nav a:hover { text-decoration: underline; }

.angemeldet-als {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-left: 1.25rem;
    padding-left: 1.25rem;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
}

.content {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.login-box {
    max-width: 320px;
    margin: 4rem auto;
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    text-align: center;
}

.login-box h1 { margin-top: 0; font-size: 1.1rem; }

form label {
    display: block;
    margin-bottom: 1rem;
    text-align: left;
    font-size: 0.85rem;
    color: var(--grau-dunkel);
}

input, select, textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    margin-top: 0.3rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

button, .button-sekundaer {
    background: var(--blau);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-block;
}

button:hover { background: var(--blau-dunkel); }

.button-sekundaer {
    background: var(--grau-dunkel);
    margin-left: 0.5rem;
}

.spieler-formular .feld-gruppe {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.spieler-formular .aktionen { margin-top: 1rem; }

.suche {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.suche input { flex: 1; }
.suche a { font-size: 0.85rem; color: var(--grau-dunkel); }
.status-filter { width: auto; flex: 0 0 auto; }

table.spieler-tabelle {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.spieler-tabelle th, .spieler-tabelle td {
    padding: 0.7rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.spalte-nummer {
    width: 1%;
    white-space: nowrap;
    color: var(--grau-dunkel);
}

.spieler-tabelle th {
    background: #fafafa;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--grau-dunkel);
}

.aktionen a {
    margin-right: 0.6rem;
    font-size: 0.85rem;
    color: var(--blau-dunkel);
    text-decoration: none;
}

.aktionen a:hover { text-decoration: underline; }

.status {
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-aktiv { background: #e6edfa; color: var(--blau-dunkel); }
.status-interessent { background: #fff4d9; color: #92650a; }
.status-warteliste { background: #f3e8fd; color: #6b21a8; }
.status-inaktiv { background: #f1f1f1; color: var(--grau-dunkel); }

.schnupper-badge {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.1rem 0.45rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #fff4d9;
    color: #92650a;
    white-space: nowrap;
}

.schnupper-badge.schnupper-voll {
    background: #fdecea;
    color: var(--rot);
}

.leistung {
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.leistung-schwach { background: #fdecea; color: var(--rot); }
.leistung-mittel { background: #fff4d9; color: #92650a; }
.leistung-stark { background: #e3f7e9; color: #145a2b; }

.kader {
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.kader-gesetzt { background: #e3f7e9; color: #145a2b; }
.kader-absage { background: #fdecea; color: var(--rot); }
.kader-ueberlegen { background: #fff4d9; color: #92650a; }

.prio {
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.prio-niedrig { background: #f1f1f1; color: var(--grau-dunkel); }
.prio-mittel { background: #fff4d9; color: #92650a; }
.prio-hoch { background: #fdecea; color: var(--rot); }

.aufgabe-erledigt { text-decoration: line-through; color: var(--grau-dunkel); }

.aufgabe-beschreibung {
    font-size: 0.82rem;
    color: var(--grau-dunkel);
    margin-top: 0.25rem;
    font-weight: normal;
    text-decoration: none;
}

.aufgabe-ueberfaellig {
    color: var(--rot);
    font-weight: 600;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.dashboard-kachel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
}

.dashboard-kachel h3 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: var(--grau-dunkel);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dashboard-kachel .button-sekundaer {
    margin-top: auto;
    align-self: flex-start;
}

.dashboard-kachel-breit {
    grid-column: 1 / -1;
}

.dashboard-liste {
    list-style: none;
    margin: 0 0 1rem 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.dashboard-liste li {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.dashboard-liste-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.dashboard-liste-info span {
    font-size: 0.82rem;
    color: var(--grau-dunkel);
}

.balkendiagramm {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    height: 160px;
    padding: 0 0.5rem;
}

.balken-spalte {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    height: 100%;
}

.balken-wert {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--grau-dunkel);
    margin-bottom: 0.25rem;
}

.balken-huelle {
    width: 100%;
    max-width: 36px;
    height: 100px;
    display: flex;
    align-items: flex-end;
    background: #f4f5f7;
    border-radius: 4px;
    overflow: hidden;
}

.balken {
    width: 100%;
    background: var(--blau);
    border-radius: 4px 4px 0 0;
    min-height: 2px;
}

.balken-label {
    font-size: 0.72rem;
    color: var(--grau-dunkel);
    margin-top: 0.4rem;
}

.pdf-viewer {
    width: 100%;
    height: 80vh;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
}

.trainingsplan-bild {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    display: block;
}

.typ {
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.typ-training { background: #e6edfa; color: var(--blau-dunkel); }
.typ-turnier { background: #fdecea; color: var(--rot); }
.typ-spiel { background: #e3f7e9; color: #145a2b; }
.typ-sonstiges { background: #f1f1f1; color: var(--grau-dunkel); }

.naechster-termin {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--blau);
    flex-wrap: wrap;
}

.naechster-termin-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
}

.naechster-termin-info span {
    font-size: 0.9rem;
    color: var(--grau-dunkel);
}

.naechster-termin .button-sekundaer {
    margin-left: auto;
}

.filter-tabs {
    display: flex;
    gap: 0.4rem;
}

.filter-tabs a {
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--grau-dunkel);
    text-decoration: none;
    background: #eef0f3;
}

.filter-tabs a.aktiv {
    background: var(--blau);
    color: white;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.checkbox-label input { width: auto; margin: 0; }

.hinweis-klein {
    font-size: 0.8rem;
    color: var(--grau-dunkel);
    font-weight: normal;
    display: inline-block;
    margin-left: 0.3rem;
}

p.hinweis-klein {
    margin: 0 0 1rem 0;
    background: #f4f5f7;
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
}

.serie-symbol {
    font-size: 0.85rem;
}

.rollen-form { margin: 0; }
.rollen-form select { width: auto; padding: 0.3rem 0.5rem; font-size: 0.85rem; }

.anwesenheit-zusammenfassung {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 0.9rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.anwesenheit-radio {
    text-align: center;
}

.anwesenheit-radio input {
    width: 20px;
    height: 20px;
    margin: 0;
}

.hinweis {
    background: #e6edfa;
    color: var(--blau-dunkel);
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.kontakt-unterzeile {
    color: var(--grau-dunkel);
    margin-top: -0.5rem;
    margin-bottom: 1.5rem;
}

.kontakt-karte {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 1.5rem;
    max-width: 420px;
    margin-bottom: 1.5rem;
}

.kontakt-zeile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.kontakt-zeile:last-child { border-bottom: none; }

.kontakt-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--grau-dunkel);
}

.kontakt-zeile a {
    color: var(--blau-dunkel);
    text-decoration: none;
    font-weight: 600;
}

.kontakt-zeile a:hover { text-decoration: underline; }

.fehler {
    background: #fdecea;
    color: var(--rot);
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.miniatur {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.foto-hover {
    position: relative;
    display: inline-block;
}

.foto-gross {
    display: none;
    position: absolute;
    z-index: 50;
    top: 50%;
    left: 55px;
    transform: translateY(-50%);
    max-width: 260px;
    max-height: 260px;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 3px solid white;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    background: white;
}

.foto-hover:hover .foto-gross {
    display: block;
}

.miniatur-platzhalter {
    color: var(--grau-dunkel);
    font-size: 0.8rem;
}

.foto-vorschau {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.foto-vorschau img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.foto-loeschen-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--rot);
}

.foto-loeschen-label input { width: auto; }

.csv-button {
    margin-left: auto;
    white-space: nowrap;
    color: white !important;
}

.kasse-stand {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--blau);
    flex-wrap: wrap;
}

.kasse-stand-betrag {
    font-size: 2rem;
    font-weight: 700;
    color: #145a2b;
}

.kasse-stand-betrag.kasse-negativ {
    color: var(--rot);
}

.kasse-stand-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
}

.kasse-stand-info span {
    font-size: 0.9rem;
    color: var(--grau-dunkel);
}

.kasse-stand .button-sekundaer {
    margin-left: auto;
}

.kasse-typ {
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.kasse-typ-einnahme { background: #e3f7e9; color: #145a2b; }
.kasse-typ-ausgabe { background: #fdecea; color: var(--rot); }

.kasse-betrag-plus { color: #145a2b; font-weight: 600; white-space: nowrap; }
.kasse-betrag-minus { color: var(--rot); font-weight: 600; white-space: nowrap; }

@media (max-width: 600px) {
    .spieler-formular .feld-gruppe { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .topbar { padding: 0.85rem 1rem; }
    .topbar h1 { font-size: 1.05rem; }
    .logo { height: 30px; }

    .nav-toggle-label { display: block; }

    .topbar nav {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        margin-top: 0.85rem;
        gap: 0.15rem;
    }

    .nav-toggle-checkbox:checked ~ nav {
        display: flex;
    }

    .topbar nav a {
        margin-left: 0;
        padding: 0.6rem 0.25rem;
        width: 100%;
    }

    .angemeldet-als {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.3);
        padding-top: 0.6rem;
        margin-top: 0.4rem;
        width: 100%;
    }

    .content { padding: 0 1rem; margin: 1.25rem auto; }

    /* iOS zoomt beim Fokussieren von Feldern mit Schrift < 16px hinein - das verhindern wir hier */
    input, select, textarea, button, .button-sekundaer {
        font-size: 16px;
    }

    .suche { flex-direction: column; align-items: stretch; }
    .suche input, .status-filter { width: 100%; flex: none; }
    .csv-button { margin-left: 0; }
    .filter-tabs { width: 100%; }
    .filter-tabs a { flex: 1; text-align: center; }

    .naechster-termin { flex-direction: column; align-items: flex-start; }
    .naechster-termin .button-sekundaer { margin-left: 0; width: 100%; text-align: center; }

    .kasse-stand { flex-direction: column; align-items: flex-start; }
    .kasse-stand .button-sekundaer { margin-left: 0; width: 100%; text-align: center; }

    .kontakt-karte { max-width: none; }

    .foto-gross { display: none !important; }

    .aktionen a { display: inline-block; padding: 0.3rem 0; }

    /* Tabellen als gestapelte Karten statt Querscrollen */
    .spieler-tabelle, .spieler-tabelle thead, .spieler-tabelle tbody, .spieler-tabelle tr, .spieler-tabelle th, .spieler-tabelle td {
        display: block;
        width: 100%;
    }

    .spieler-tabelle thead { display: none; }

    .spieler-tabelle tr {
        margin-bottom: 0.9rem;
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 0.4rem 0.9rem;
    }

    .spieler-tabelle td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        padding: 0.55rem 0;
        text-align: right;
        border-bottom: 1px solid var(--border);
    }

    .spieler-tabelle td:last-child { border-bottom: none; }

    .spieler-tabelle td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--grau-dunkel);
        text-align: left;
        flex-shrink: 0;
    }

    .spieler-tabelle td.spalte-nummer,
    .spieler-tabelle td.spalte-ohne-label {
        display: none;
    }

    .spieler-tabelle td.aktionen {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
    }

    .spieler-tabelle td.aktionen::before { content: none; }

    .rollen-form { width: 100%; display: flex; justify-content: flex-end; }

    .login-box { margin: 1.5rem auto; max-width: none; width: calc(100% - 2rem); }

    /* Anwesenheits-Tabelle: Name als Überschrift, drei Radios kompakt nebeneinander statt gestapelt */
    .anwesenheit-tabelle tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        padding: 0.7rem 0.9rem;
    }

    .anwesenheit-tabelle td[data-label="Name"] {
        display: block;
        width: 100%;
        text-align: left;
        font-weight: 600;
        margin-bottom: 0.5rem;
        border-bottom: none;
        padding: 0;
    }

    .anwesenheit-tabelle td[data-label="Name"]::before { content: none; }

    .anwesenheit-tabelle td.anwesenheit-radio {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
        flex: 1;
        border-bottom: none;
        padding: 0;
    }

    .anwesenheit-tabelle td.anwesenheit-radio::before {
        content: attr(data-label);
        font-size: 0.68rem;
    }

    .balkendiagramm {
        overflow-x: auto;
        justify-content: flex-start;
    }

    .balken-spalte { flex: 0 0 44px; }

    .dashboard-kachel .button-sekundaer { width: 100%; text-align: center; }

    .pdf-viewer { height: 65vh; }
}
