:root {
    --color-primary: #104e8b;
    --color-primary-hover: #1565C0;
    --color-bg: #0e1117;
    --color-bg-card: #262730;
    --color-text: #e0e0e0;
    --color-text-muted: #ccc;
    --color-border: #3d3d4a;
    --color-link: #60b4ff;
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --footer-height: 38px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding-bottom: 48px; /* Platz für fixierte Fusszeile */
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    background: linear-gradient(160deg, #0f2c48 0%, #0c1420 75%, #05070a 100%) fixed;
    color: var(--color-text);
}

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

/* --- Topbar (nur mobil sichtbar, enthält Hamburger) --- */
.topbar {
    display: none;
    align-items: center;
    gap: 12px;
    height: var(--topbar-height);
    padding: 0 16px;
    background-color: var(--color-bg-card);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 200;
}

.topbar-brand { font-weight: 600; flex: 1; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.topbar-brand-short { display: none; }
.topbar-user {
    font-size: 0.85em;
    color: var(--color-text-muted);
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 1.1em;
    color: var(--color-text-muted);
    flex-shrink: 0;
}
.topbar-logout svg { width: 18px; height: 18px; }
.topbar-logout:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--color-link);
    text-decoration: none;
}

.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    margin: 0; /* überschreibt globale button-Regel (margin-top:22px), sonst hängt der Hamburger tiefer als Titel/E-Mail in der Topbar */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* nativer blauer Tap-Flash auf mobilen Browsern */
}
/* höhere Spezifität als button:hover, sonst bleibt der Button nach Touch-Tap blau "hängen" */
.hamburger:hover,
.hamburger:active {
    background: none;
    border-color: transparent;
}
.hamburger span {
    display: block;
    width: 100%; /* globale button-Regel setzt jetzt align-items:center, ohne explizite Breite würden die Balken auf 0 schrumpfen */
    height: 2px;
    background-color: var(--color-text);
    border-radius: 1px;
}

/* --- Sidebar (Desktop: fest links, Mobile: Off-Canvas) --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: var(--footer-height);
    width: var(--sidebar-width);
    background-color: var(--color-bg-card);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    z-index: 150;
}

.nav-list {
    list-style: none;
    margin: 0;
    padding: 12px 0;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-header {
    display: flex;
    justify-content: center;
    padding: 40px 16px 24px;
    flex-shrink: 0;
}
.sidebar-header img { max-height: 112px; width: auto; }

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95em;
    border-left: 3px solid transparent;
}

.nav-item a:hover {
    background-color: rgba(96, 180, 255, 0.1);
    color: var(--color-link);
}

.nav-item.active a {
    background-color: rgba(16, 78, 139, 0.35);
    border-left-color: var(--color-primary-hover);
    color: white;
    font-weight: 600;
}

.nav-icon { width: 1.3em; display: inline-flex; justify-content: center; align-items: center; }
.nav-icon svg { width: 1.1em; height: 1.1em; }

button svg,
.stButton svg { width: 16px; height: 16px; flex-shrink: 0; }
h1 svg, h2 svg, h3 svg, h4 svg { width: 1em; height: 1em; vertical-align: -0.15em; flex-shrink: 0; }
summary svg { width: 1em; height: 1em; vertical-align: -0.15em; flex-shrink: 0; }
/* Generischer Fallback für alle übrigen Icon-Einsatzorte (Buttons, Links, Fliesstext) -
   erkennt unsere Icons am gemeinsamen viewBox, ohne echte Fremd-SVGs zu beeinflussen. */
svg[viewBox="0 0 24 24"] { width: 1em; height: 1em; vertical-align: -0.15em; flex-shrink: 0; }

.sidebar-footer {
    padding: 10px 12px;
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.footer-settings-link,
.logout-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px;
    border-radius: 6px;
    color: var(--color-text-muted);
    font-size: 0.9em;
}
.footer-settings-link:hover,
.logout-link:hover {
    background-color: rgba(96, 180, 255, 0.1);
    color: var(--color-link);
    text-decoration: none;
}
.footer-settings-link.active { background-color: rgba(16, 78, 139, 0.35); color: white; font-weight: 600; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 140;
}

.content {
    margin-left: var(--sidebar-width);
    max-width: 1500px; /* war 1100px – begrenzte Tabellen unnötig, selbst auf breiten Desktop-Monitoren */
    padding: 32px 24px 32px 40px; /* mehr Abstand links zur Sidebar auf Desktop */
}

.content-full {
    margin-left: 0;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

/* --- Mobile: Sidebar wird Off-Canvas, Hamburger/Topbar sichtbar --- */
@media (max-width: 900px) {
    .topbar { display: flex; }

    /* Marke nimmt nur ihre Inhaltsbreite, damit die E-Mail den Rest des Platzes bekommt */
    .topbar-brand { flex: 0 0 auto; }
    .topbar-user { flex: 1 1 auto; max-width: none; min-width: 0; text-align: right; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s ease-in-out;
        top: 0;
        padding-top: var(--topbar-height);
    }
    .sidebar.open { transform: translateX(0); }

    .sidebar-overlay.visible { display: block; }

    .content {
        margin-left: 0;
        padding: 20px 16px;
    }
}

@media (max-width: 420px) {
    .topbar-brand-full { display: none; }
    .topbar-brand-short { display: inline; }
}

/* --- Login-Seite: zweigeteiltes Layout (Formular / Bild-Panel) --- */
body.login-page { padding-bottom: 0; }
body.login-page .content-full { margin: 0; max-width: none; padding: 0; }
body.login-page .content-full > .flash { margin: 20px 20px 0; }
body.login-page .footer { display: none; }

.login-page-wrapper {
    min-height: 100vh;
    display: flex;
}

.login-page-visual-panel {
    position: relative;
    flex: 1 1 50%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 48px;
    background: linear-gradient(160deg, #0b3a68 0%, #061a2e 100%);
    overflow: hidden;
}

.login-page-visual-media {
    max-width: 100%;
    max-height: 82vh;
    object-fit: contain;
    display: block;
}

.login-page-visual-fallback {
    align-self: center;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    max-width: 320px;
}
.login-page-visual-icon { font-size: 4em; display: block; margin-bottom: 16px; }
.login-page-visual-fallback p { font-size: 1.1em; line-height: 1.5; margin: 0; }

.ankuendigung-sprechblase {
    position: absolute;
    left: calc(50% - 47px);
    top: 56px;
    width: 260px;
    max-width: calc(100% - 64px);
    background: #fff;
    border-radius: 16px;
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.4;
    color: #212529;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.ankuendigung-sprechblase::after {
    content: "";
    position: absolute;
    left: 36px;
    bottom: -13px;
    width: 0;
    height: 0;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-top: 15px solid #fff;
    filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.12));
}
.ankuendigung-sprechblase.ohne-maskottchen { position: static; margin-top: auto; }
.ankuendigung-sprechblase.ohne-maskottchen::after { display: none; }

/* Auf Desktop soll der Wrapper keine eigene Box erzeugen, damit die Sprechblase weiterhin
   absolut relativ zum Visual-Panel positioniert bleibt; das Mobil-Logo bleibt dort versteckt. */
.login-page-mobile-header { display: contents; }
.login-page-logo-mobile { display: none; }

.login-page-form-panel {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px 88px;
    background-color: var(--color-bg);
    position: relative;
}

.login-page-form-inner { width: 100%; max-width: 360px; transform: translateY(-40px); }
.login-page-logo {
    max-height: 88px;
    width: auto;
    display: block;
    margin-bottom: 36px;
}
.login-page-title { margin: 0 0 8px; font-size: 1.7em; font-weight: 700; color: var(--color-text); }
.login-page-subtitle { margin: 0 0 28px; color: var(--color-text-muted); font-size: 0.95em; line-height: 1.5; }

.login-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-form label { margin-top: 10px; font-size: 0.9em; color: var(--color-text-muted); }

.login-form input {
    padding: 11px 12px;
    border-radius: 6px;
    border: 1px solid var(--color-border);
    background-color: #1c1e26;
    color: var(--color-text);
    font-size: 0.98em;
}
.login-form input:focus {
    outline: none;
    border-color: var(--color-primary-hover);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.25);
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    font-size: 0.9em;
    color: var(--color-text-muted);
    cursor: pointer;
}
.login-remember input { width: 16px; height: 16px; margin: 0; cursor: pointer; flex-shrink: 0; }

.login-form button,
button,
.stButton {
    margin-top: 22px;
    padding: 10px 16px;
    display: inline-flex; /* echtes Vertical-Centering statt Padding-Trick, damit Icon+Text auch mobil sauber mittig sitzen */
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.3;
    border: 1px solid var(--color-primary);
    border-radius: 6px;
    background-color: var(--color-primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.login-form button:hover,
button:hover {
    background-color: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

@media (max-width: 900px) {
    .login-page-wrapper { flex-direction: column; }
    .login-page-visual-panel {
        order: -1;
        flex: 0 0 auto;
        min-height: 220px;
        padding: 28px;
        justify-content: flex-start;
    }
    .login-page-visual-media { max-height: 32vh; }
    .login-page-form-panel { align-items: flex-start; padding: 32px 20px 40px; }
    .login-page-form-inner { transform: none; }
    .login-page-logo { display: none; }

    /* Sprechblase bleibt rechts (passt zum dunkleren Verlauf dort), nur weiter oben, Pfeil zeigt zum Maskottchen links. */
    .ankuendigung-sprechblase {
        position: absolute;
        left: auto;
        right: 16px;
        top: 32px;
        width: 165px;
        font-size: 12px;
        padding: 10px 14px;
    }
    .ankuendigung-sprechblase::after {
        left: -10px;
        right: auto;
        top: auto;
        bottom: 12px;
        border-left: none;
        border-right: 15px solid #fff;
        border-top: 10px solid transparent;
        border-bottom: 10px solid transparent;
    }
    /* Gleicher Abstand zum schwarzen Bereich wie das Maskottchen (padding-bottom des Panels). */
    .login-page-logo-mobile {
        display: block;
        position: absolute;
        left: auto;
        right: 32px;
        bottom: 28px;
        max-height: 68px;
        width: auto;
    }
}

.flash {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
    overflow: hidden;
    transition: opacity 0.4s ease, max-height 0.4s ease, margin 0.4s ease, padding 0.4s ease;
}
.flash.flash-ausblenden { opacity: 0; max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }

.flash-error { background-color: #4a1f1f; color: #ffb3b3; border: 1px solid #7a2e2e; }
.flash-success { background-color: #1f4a2b; color: #b3ffcb; border: 1px solid #2e7a45; }
/* Handlungshinweis (z.B. "Login-Konto noch anlegen") - bleibt bewusst stehen, siehe flash.js */
.flash-info { background-color: #1f2f4a; color: #a8c8ff; border: 1px solid #2e4a7a; }

.tab-list { line-height: 1.9; }

/* --- FullCalendar (Kalender-Tab): Dark-Theme-Overrides --- */
#fc-kalender { margin-top: 8px; }
.fc { --fc-border-color: var(--color-border); --fc-page-bg-color: transparent; --fc-neutral-bg-color: var(--color-bg-card); }
.fc, .fc .fc-toolbar-title, .fc .fc-col-header-cell-cushion, .fc .fc-daygrid-day-number, .fc .fc-list-day-text, .fc .fc-list-day-side-text {
    color: var(--color-text);
}
.fc .fc-button {
    background-color: var(--color-bg-card);
    border-color: var(--color-border);
    color: var(--color-text);
    box-shadow: none !important;
    text-transform: capitalize;
}
.fc .fc-button:hover { background-color: rgba(96, 180, 255, 0.15); border-color: var(--color-link); }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.fc .fc-button:disabled { opacity: 0.5; }
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--color-border); }
.fc .fc-daygrid-day.fc-day-today,
.fc .fc-timegrid-col.fc-day-today,
.fc .fc-list-day.fc-day-today { background-color: rgba(16, 78, 139, 0.25); }
.fc .fc-list-event:hover td { background-color: rgba(96, 180, 255, 0.1); }
.fc .fc-list-event-dot { border-color: #f0883e; }
.fc-event { background-color: var(--color-primary); border-color: var(--color-primary-hover); cursor: pointer; }
.fc .fc-list-empty { background-color: transparent; color: var(--color-text-muted); }
.fc .fc-scrollgrid { border-color: var(--color-border); }
@media (max-width: 700px) {
    .fc .fc-toolbar { flex-direction: column; gap: 8px; }
    .fc .fc-toolbar-chunk { display: flex; justify-content: center; }
}

.footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    background-color: var(--color-bg-card);
    color: var(--color-text-muted);
    text-align: center;
    padding: 8px 0;
    font-size: 0.85em; /* gleiche Grösse wie z.B. topbar-user (E-Mail) in der Navigation */
    border-top: 1px solid var(--color-border);
    z-index: 999;
}

.footer a { color: var(--color-link); }

/* --- Daten-Tabellen (Personen etc.) --- */
.data-table-wrapper {
    overflow-x: auto;
    margin-bottom: 24px;
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
    /* Schatten am linken/rechten Rand als Hinweis "hier geht's per Scroll weiter", nur sichtbar wenn tatsächlich mehr Inhalt da ist */
    background:
        linear-gradient(to right, var(--color-bg), var(--color-bg) 40%) left,
        linear-gradient(to left, var(--color-bg), var(--color-bg) 40%) right,
        linear-gradient(to right, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0)) left,
        linear-gradient(to left, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0)) right;
    background-repeat: no-repeat;
    background-color: var(--color-bg);
    background-size: 24px 100%, 24px 100%, 12px 100%, 12px 100%;
    background-attachment: local, local, scroll, scroll;
}
.data-table-wrapper::-webkit-scrollbar { height: 8px; }
.data-table-wrapper::-webkit-scrollbar-track { background: transparent; }
.data-table-wrapper::-webkit-scrollbar-thumb { background-color: var(--color-border); border-radius: 4px; }
.data-table-wrapper::-webkit-scrollbar-thumb:hover { background-color: var(--color-text-muted); }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92em;
}

.data-table th, .data-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    white-space: nowrap;
}

.data-table th { color: var(--color-text-muted); font-weight: 600; font-size: 0.82em; text-transform: uppercase; letter-spacing: 0.03em; background-color: var(--color-bg-card); }
.data-table tr:hover td { background-color: rgba(255, 255, 255, 0.03); }

/* Für Spalten mit potenziell langem Freitext (z.B. Beschreibung), damit die Zeile nicht die ganze Tabelle aufbläht */
.data-table td.wrap-text {
    white-space: normal;
    word-break: break-word;
    max-width: 320px;
}
/* Personen-Liste: E-Mail/Rollen sind oft die breitesten Spalten - enger begrenzen, damit auf
   Desktop kein horizontales Scrollen nötig ist. */
.personen-table td.wrap-text {
    max-width: 190px;
}

/* Trainingszeiten: pro Wochentag eine eigene <table> - ohne feste Breiten sizen sich Spalten
   unabhängig voneinander, wodurch die Aktions-Icons zwischen den Tabellen versetzt wirken.
   Nur auf Desktop - auf Mobile würde es die Karten-Ansicht (data-table-cards) zerstören. */
@media screen and (min-width: 901px) {
    .wochentraining-table { table-layout: fixed; }
    .wochentraining-table th:nth-child(1), .wochentraining-table td:nth-child(1) { width: 16%; }
    .wochentraining-table th:nth-child(2), .wochentraining-table td:nth-child(2) { width: 32%; }
    .wochentraining-table th:nth-child(3), .wochentraining-table td:nth-child(3) { width: 14%; }
    .wochentraining-table th:nth-child(4), .wochentraining-table td:nth-child(4) { width: 22%; }
    .wochentraining-table th:nth-child(5), .wochentraining-table td:nth-child(5) { width: 16%; }
    .wochentraining-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

.actions-cell {
    white-space: nowrap;
}
/* display:flex direkt auf dem <td> würde die Tabellenzelle "entzellen" (kein table-cell mehr) -
   dadurch ignoriert der Browser vertical-align:middle und die Buttons kleben oben, sobald die
   Zeile durch eine Nachbarspalte (z.B. lange Beschreibung) hoch wird. Daher inline-flex pro Kind. */
.actions-cell > a,
.actions-cell > form {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}
/* Eigene Regel für <details>: inline-flex direkt drauf würde auch die EIGENEN Kinder
   (summary + aufklappbares Formular) nebeneinander statt untereinander anordnen, daher
   zusätzlich flex-direction:column - so bleibt die Aufklapp-Optik erhalten, während das
   <details>-Element selbst inline neben dem Löschen-Button in der Zeile sitzt. */
.actions-cell > details {
    display: inline-flex;
    flex-direction: column;
    vertical-align: middle;
}
.actions-cell > * + * { margin-left: 8px; }

/* Numerische Spalten (Jahr, Zielwert, PB, SB etc.) rechtsbündig für bessere Vergleichbarkeit */
.data-table th.num, .data-table td.num { text-align: right; }

/* Sichtbare Gruppierung, wenn sich in einer sortierten Liste ein Gruppierungswert ändert (z.B. Jahr bei Jahreszielen) */
.data-table tr.year-divider td { border-top: 2px solid var(--color-border); }

.ziel-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.82em;
    font-weight: 600;
    white-space: nowrap;
}
.ziel-status svg { width: 14px; height: 14px; flex-shrink: 0; }
.ziel-status-ok { background-color: rgba(76, 175, 80, 0.18); color: #81c784; }
.ziel-status-open { background-color: rgba(255, 255, 255, 0.06); color: var(--color-text-muted); }

.btn-danger-link { color: #ff8080; }

.btn-table {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    box-sizing: border-box;
    margin: 0; /* überschreibt globale button-Regel (margin-top:22px), sonst rutscht der <button>-Löschen-Button gegenüber dem <a>-Bearbeiten-Link nach unten */
    padding: 0;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none !important;
    white-space: nowrap;
    vertical-align: middle;
}
.btn-table svg { width: 18px; height: 18px; display: block; flex-shrink: 0; }
.btn-table:hover, .btn-table:focus { text-decoration: none !important; }
.btn-table-open {
    background-color: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-table-open:hover { background-color: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn-table-secondary {
    background-color: transparent;
    color: var(--color-text);
    border-color: var(--color-border);
}
.btn-table-secondary:hover { border-color: var(--color-link); color: var(--color-link); }
.btn-table-danger {
    background-color: transparent;
    color: #ff8080;
    border-color: #ff8080;
}
.btn-table-danger:hover { background-color: #ff8080; color: #1a1a1a; }

/* --- Mobile Kartenansicht für Listen-Tabellen (opt-in via .data-table-cards, data-label via js/data-table-cards.js) --- */
/* Gleicher Breakpoint wie Sidebar/Topbar-Umschaltung, damit Tabellen nicht in der Zwischenbreite (Tablet) abgeschnitten wirken */
@media (max-width: 900px) {
    .data-table.data-table-cards thead { display: none; }
    .data-table.data-table-cards, .data-table.data-table-cards tbody { display: block; width: 100%; }
    .data-table.data-table-cards tr {
        display: block;
        background-color: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--color-border);
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 4px 14px;
    }
    /* Card hat schon einen eigenen Rahmen - die Desktop-Gruppierungslinie würde nur unschön mit dem ersten Feld kollidieren */
    .data-table.data-table-cards tr.year-divider td:first-child { border-top: none; }
    .data-table.data-table-cards tr:hover td { background-color: transparent; }
    .data-table.data-table-cards td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        padding: 9px 0;
        border-bottom: 1px solid var(--color-border);
        white-space: normal;
        text-align: right;
    }
    .data-table.data-table-cards td:last-child { border-bottom: none; }
    .data-table.data-table-cards td[colspan] { display: block; text-align: left; padding: 8px 0; }
    .data-table.data-table-cards td:not([data-label])::before { content: none; }
    .data-table.data-table-cards td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.78em;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: var(--color-text-muted);
        background-color: var(--color-bg-card);
        border-radius: 4px;
        padding: 3px 8px;
        text-align: left;
        margin-right: 12px;
        flex-shrink: 0;
    }
    .data-table.data-table-cards td.actions-cell { justify-content: flex-end; }
    /* Felder mit potenziell langem Wert (E-Mail, Rollen): die Desktop-Begrenzung auf 320px
       war die eigentliche Ursache für den hässlichen Umbruch mitten im Wort - auf der Karte
       ist meist genug Platz für eine Zeile, daher hier aufheben statt Label/Wert zu stapeln. */
    .data-table.data-table-cards td.wrap-text {
        max-width: none;
    }
    /* Der Scroll-Hinweis-Schatten (fester --color-bg) ist auf Mobile unnötig (keine
       horizontale Tabelle mehr) und sticht als Farbblock gegen den Seiten-Verlauf ab. */
    .data-table-wrapper { background: none; }
}

.form-card {
    max-width: 640px;
    padding: 20px 24px;
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    margin-bottom: 24px;
}

/* Collapsible-Pfeil: eigenes Icon statt native Marker, damit Abstand stimmt und umgebrochene Zeilen unter dem Text (nicht unter dem Pfeil) einrücken */
summary {
    list-style: none;
    display: flex;
    align-items: baseline; /* Pfeil an der Textgrundlinie statt oben ausgerichtet, sonst wirkt er bei Emoji/grösserer Schrift versetzt */
    gap: 12px;
    cursor: pointer;
}
summary::-webkit-details-marker { display: none; }
summary::before {
    content: "\25B6";
    display: inline-block;
    flex-shrink: 0;
    font-size: 0.85em;
    color: var(--color-text-muted);
    transition: transform 0.15s ease;
}
details[open] > summary::before { transform: rotate(90deg); }

@media (max-width: 900px) {
    summary { gap: 14px; }
    summary::before { font-size: 1.1em; }
}

.form-grid { display: flex; flex-direction: column; gap: 4px; }
.form-grid label { margin-top: 12px; font-size: 0.9em; color: var(--color-text-muted); }

.form-grid input[type="text"],
.form-grid input[type="email"],
.form-grid input[type="password"],
.form-grid input[type="date"],
.form-grid input[type="number"],
.form-grid textarea,
.form-grid select,
select {
    padding: 9px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    background-color: #1c1e26;
    color: var(--color-text);
    font-family: inherit;
}

.form-grid input[type="file"] { color: var(--color-text); }

input[type="file"]::file-selector-button {
    padding: 7px 14px 9px;
    line-height: 1.3;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-card);
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.9em;
    cursor: pointer;
    margin-right: 10px;
}
input[type="file"]::file-selector-button:hover { border-color: var(--color-link); color: var(--color-link); }

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
}

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.checkbox-row input { width: 16px; height: 16px; }

.role-checkboxes { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; }
.role-checkboxes label { display: flex; align-items: center; gap: 6px; font-size: 0.9em; color: var(--color-text); margin-top: 0; }

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
/* Mobile: kleinere Titel; der Header-Button rutscht als Ganzes unter den Titel,
   statt den h1 (Icon + Text) intern umbrechen zu lassen */
@media (max-width: 900px) {
    h1 { font-size: 1.65em; }
    .page-header { flex-wrap: wrap; gap: 4px 16px; }
}

.btn-secondary {
    display: inline-block;
    padding: 7px 14px 9px;
    line-height: 1.3;
    border-radius: 4px;
    border: 1px solid var(--color-border);
    background-color: transparent;
    color: var(--color-text);
}
.btn-secondary:hover { border-color: var(--color-link); color: var(--color-link); text-decoration: none; }
.btn-danger {
    display: inline-block;
    padding: 7px 14px 9px;
    line-height: 1.3;
    border-radius: 4px;
    border: 1px solid #ff8080;
    background-color: transparent;
    color: #ff8080;
    font-weight: 600;
    cursor: pointer;
}
.btn-danger:hover { background-color: #ff8080; color: #1a1a1a; }

/* --- Bestätigungs-Modal (Ersatz für native confirm()-Dialoge) --- */
.confirm-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}
.confirm-modal {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.confirm-modal p { margin: 0 0 20px; color: var(--color-text); font-size: 0.95em; }
.confirm-modal a { color: var(--color-link); }
.confirm-modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.confirm-modal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 16px;
    margin: 0; /* überschreibt globale button-Regel (margin-top:22px), sonst sitzt der <button>-Schliessen tiefer als der <a>-Google-Link */
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
}
.confirm-modal-btn.btn-table-secondary {
    background-color: transparent;
    color: var(--color-text);
    border-color: var(--color-border);
}
.confirm-modal-btn.btn-table-secondary:hover { border-color: var(--color-link); color: var(--color-link); }
.confirm-modal-btn.btn-table-danger {
    background-color: transparent;
    color: #ff8080;
    border-color: #ff8080;
}
.confirm-modal-btn.btn-table-danger:hover { background-color: #ff8080; color: #1a1a1a; }

/* --- Segmented-Nav: Ersatz für Radiobuttons/Selectbox-Umschalter (Submenü-Stil) --- */
.segmented-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.segmented-nav a {
    padding: 6px 14px 8px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.88em;
    white-space: nowrap;
    line-height: 1.3;
}
.segmented-nav a:hover { border-color: var(--color-link); color: var(--color-link); text-decoration: none; }
.segmented-nav a.active {
    background: linear-gradient(160deg, var(--color-primary-hover) 0%, var(--color-primary) 100%);
    border-color: var(--color-primary);
    color: white;
    font-weight: 600;
}

.field-group-label {
    font-size: 0.82em;
    color: var(--color-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* --- Chart.js Container (Auswertung: 1RM-/Leistungstest-Verlauf) --- */
.chart-wrapper { position: relative; height: 320px; margin-bottom: 8px; }
@media (max-width: 600px) {
    .chart-wrapper { height: 240px; }
}

.gruppe-table input[type="number"] { width: 90px; }
.gruppe-table select { padding: 6px; }

/* --- Gewicht-Auswahl in der Gruppen-Erfassung: Pills statt Dropdown (1 Klick statt 2) --- */
.gewicht-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.gewicht-pills input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.gewicht-pills label {
    padding: 6px 12px 8px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.88em;
    white-space: nowrap;
    line-height: 1.3;
    cursor: pointer;
    margin: 0;
}
.gewicht-pills label:hover { border-color: var(--color-link); color: var(--color-link); }
.gewicht-pills input[type="radio"]:checked + label {
    background: linear-gradient(160deg, var(--color-primary-hover) 0%, var(--color-primary) 100%);
    border-color: var(--color-primary);
    color: white;
    font-weight: 600;
}
.gewicht-pills input[type="radio"]:focus-visible + label { outline: 2px solid var(--color-link); outline-offset: 2px; }

/* --- Gruppen-Übersicht: farbige Zellen + sticky Namensspalte --- */
.gruppe-uebersicht-table { font-size: 0.85em; }
.gruppe-uebersicht-table th, .gruppe-uebersicht-table td { text-align: center; white-space: nowrap; }
.gruppe-uebersicht-table .sticky-col,
.gruppe-table .sticky-col {
    position: sticky;
    left: 0;
    background-color: var(--color-bg);
    text-align: left;
    font-weight: 600;
    z-index: 1;
}
.gruppe-uebersicht-table thead .sticky-col,
.gruppe-table thead .sticky-col { z-index: 2; background-color: var(--color-bg-card); }
/* .gruppe-table sitzt in einer .form-card (anderer Hintergrund als die Seite) */
.form-card .gruppe-table .sticky-col { background-color: var(--color-bg-card); }

.cell-met  { background-color: rgba(76, 175, 80, 0.25); color: #a5d6a7; font-weight: 700; }
.cell-ilv  { background-color: rgba(33, 150, 243, 0.2); color: #90caf9; }
.cell-near { background-color: rgba(255, 235, 59, 0.15); color: #fff59d; }
.cell-miss { background-color: rgba(255, 152, 0, 0.15); color: #ffcc80; }
.cell-empty, .cell-blank { color: var(--color-text-muted); }
.cell-no-lim { color: var(--color-text); }

.lim-lines { display: block; font-size: 0.78em; margin-top: 2px; }
.lim-lines .lim-ok { color: #81c784; font-weight: 600; }
.lim-lines .lim-ko { color: var(--color-text-muted); }
.lim-lines span { display: block; }

/* Mobile: Teamübersicht als Karten - eine Karte pro Person, Name als Kartentitel.
   Komplett leere Disziplinen (.cell-blank: kein Wert & keine Limite) werden ausgeblendet,
   sonst würde jede Karte ellenlang. */
@media (max-width: 900px) {
    .gruppe-uebersicht-table.data-table-cards td { padding-right: 10px; padding-left: 10px; }
    .gruppe-uebersicht-table.data-table-cards td.sticky-col {
        position: static;
        background-color: transparent;
        justify-content: flex-start;
        font-size: 1.05em;
        padding-left: 0;
    }
    .gruppe-uebersicht-table.data-table-cards td.sticky-col::before { content: none; }
    .gruppe-uebersicht-table.data-table-cards td.cell-blank { display: none; }
    .gruppe-uebersicht-table.data-table-cards .lim-lines { text-align: right; }
}

/* --- "Ziel erreicht"-Banner (Mein Profil, Jahresziele) --- */
@keyframes ptsZielPop {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1.0); opacity: 1; }
}
@keyframes ptsZielShine {
    0%   { transform: translateX(-120%) skewX(-20deg); }
    100% { transform: translateX(220%) skewX(-20deg); }
}
@keyframes ptsZielTrophyPop {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50%      { transform: scale(1.15) rotate(-6deg); }
}
@keyframes ptsConfettiBurst {
    0%   { transform: translate(0, 0) scale(0.6) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--x), var(--y)) scale(0.2) rotate(180deg); opacity: 0; }
}
.pts-ziel-banner {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: 999px;
    background: linear-gradient(120deg, #ffb300 0%, #43a047 55%, #2e7d32 100%);
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 16px rgba(46, 125, 50, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
    animation: ptsZielPop 0.5s cubic-bezier(.34, 1.56, .64, 1) both;
    margin: 4px 0 10px 0;
    overflow: hidden;
}
.pts-ziel-banner::before {
    content: "";
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 40%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: ptsZielShine 2.6s ease-in-out 0.4s infinite;
    pointer-events: none;
}
.pts-ziel-trophy {
    position: relative;
    z-index: 1;
    display: inline-flex;
    width: 22px;
    height: 22px;
    animation: ptsZielTrophyPop 1.6s ease-in-out infinite;
}
.pts-ziel-trophy svg { width: 100%; height: 100%; }
.pts-ziel-text { position: relative; z-index: 1; }
.pts-ziel-confetti { position: absolute; inset: 0; pointer-events: none; }
.pts-confetti-dot {
    position: absolute;
    top: 50%;
    left: 18%;
    width: 6px;
    height: 6px;
    border-radius: 2px;
    animation: ptsConfettiBurst 1.1s ease-out both;
}
.pts-confetti-dot-1 { --x: -18px; --y: -26px; background: #ffd54f; animation-delay: 0s; }
.pts-confetti-dot-2 { --x: 40px;  --y: -32px; background: #4fc3f7; animation-delay: 0.05s; }
.pts-confetti-dot-3 { --x: -26px; --y: 24px;  background: #f06292; animation-delay: 0.1s; }
.pts-confetti-dot-4 { --x: 52px;  --y: 22px;  background: #ba68c8; animation-delay: 0.15s; }
.pts-confetti-dot-5 { --x: 10px;  --y: -38px; background: #81c784; animation-delay: 0.2s; }
.pts-confetti-dot-6 { --x: 20px;  --y: 34px;  background: #ff8a65; animation-delay: 0.25s; }


