/* Patrick Hand SC — handgezeichnete Schul-Typografie (selbst-gehostet, DSGVO-konform) */
@font-face {
    font-family: 'Patrick Hand SC';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/patrick-hand-sc-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Patrick Hand SC';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/patrick-hand-sc-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    /* Schul-CI: Rot + Grau (gs-elkenbreder-weg.de) */
    --primary: #e40000;
    --primary-dark: #b00000;
    --accent: #a6c02a;            /* Sekundär: Lime-Grün der Schule */
    --bg: #fafafa;
    --card: #fff;
    --border: #e5e5e5;
    --text: #313131;              /* Schul-CI Dunkelgrau */
    --muted: #6b7280;
    --ok: #16a34a;
    --warn: #dc2626;
    --info: #2563eb;
    --success-bg: #dcfce7;
    --warn-bg: #fee2e2;
    --info-bg: #dbeafe;
    --radius: 12px;
    --font-display: 'Patrick Hand SC', 'Comic Sans MS', cursive;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    /* Mobile Safety-Net: verhindert horizontalen Scroll, wenn
       eine einzelne Komponente ueber den Viewport ragt (z. B. lange
       Anwesenheits-Tabelle, breite input/file-Buttons). */
    overflow-x: hidden;
}

a { color: var(--primary); }

/* Topbar */
.topbar {
    background: var(--primary);
    color: #fff;
    padding: 0;
    padding-top: env(safe-area-inset-top, 0);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.brand {
    color: #fff;
    text-decoration: none;
    font-weight: 400;
    font-size: 1.4rem;
    font-family: var(--font-display);
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.brand-logo {
    height: 36px;
    width: 36px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    padding: 3px;
    flex-shrink: 0;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}
.user-name { font-weight: 600; }
.user-role { opacity: 0.7; font-size: 0.8em; }
.logout-form { margin: 0; }
.btn-link {
    background: transparent;
    border: 0;
    color: #fff;
    text-decoration: underline;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font: inherit;
}

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

/* Desktop: breitere Layouts für Tabellen ohne horizontalen Scroll */
@media (min-width: 1024px) {
    .topbar-inner { max-width: 1200px; }
    .container    { max-width: 1200px; }
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.card-narrow { max-width: 420px; margin-left: auto; margin-right: auto; }
.card h1 { margin: 0 0 0.5rem; font-size: 1.75rem; color: var(--primary); font-family: var(--font-display); font-weight: 400; letter-spacing: 0.01em; }
.card h2 { margin: 0 0 0.75rem; font-size: 1.35rem; color: var(--primary); font-family: var(--font-display); font-weight: 400; letter-spacing: 0.01em; }
.card .muted { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.75rem; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.field-hint  { font-size: 0.78rem; color: #6b7280; font-weight: 400; line-height: 1.35; margin-top: 0.15rem; }

/* Checkbox-Felder: Checkbox links, Label rechts daneben (statt .field stacked column).
   Wird in eltern_edit.php für ist_lehrkraft, beitrag_pausiert, reminders_enabled verwendet. */
.field-checkbox {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0;
    cursor: pointer;
}
.field-checkbox input[type="checkbox"] {
    width: 1.05rem;
    height: 1.05rem;
    margin-top: 0.18rem;
    flex: 0 0 auto;
    cursor: pointer;
}
.field-checkbox > span {
    line-height: 1.4;
    flex: 1 1 auto;
}
.field input {
    font: inherit;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.15s;
}
.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(228, 0, 0, 0.15);
}

/* Buttons */
.btn {
    display: inline-block;
    font: inherit;
    font-weight: 600;
    padding: 0.7rem 1.2rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.15s, transform 0.05s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); }

/* Flash messages */
.flash {
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    border: 1px solid transparent;
}
.flash-error   { background: var(--warn-bg);    color: var(--warn); border-color: #fca5a5; }
.flash-info    { background: var(--info-bg);    color: var(--info); border-color: #93c5fd; }
.flash-success { background: var(--success-bg); color: var(--ok);   border-color: #86efac; }

/* Key-Value listing */
.kv {
    display: grid;
    grid-template-columns: minmax(110px, auto) 1fr;
    gap: 0.4rem 1rem;
    margin: 0;
    font-size: 0.92rem;
}
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

code {
    background: #f1f5f9;
    padding: 0.05rem 0.4rem;
    border-radius: 4px;
    font-size: 0.88em;
}

/* Module-Sektionen — gruppiert nach Tagesgeschäft / Vorstand / Verwaltung / System */
.module-section { padding-top: 0.9rem; padding-bottom: 1rem; }
.module-section-head { margin-bottom: 0.7rem; }
.module-section-head h2 { margin: 0 0 0.15rem; font-size: 1.15rem; }
.module-section-head .muted { margin: 0; font-size: 0.85rem; }

/* Modules */
.module-grid {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
}
.module-tile {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 0.6rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    transition: transform 0.1s, box-shadow 0.1s;
    min-height: 5rem;
    justify-content: center;
}
.module-tile-disabled {
    opacity: 0.6;
}
.module-emoji { font-size: 1.6rem; line-height: 1; }
.module-name  {
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.2;
    /* Lange deutsche Komposita (z. B. „Mitgliederversammlung") müssen
       in der Kachel umbrechen statt am Rand abgeschnitten zu werden. */
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}
/* Legacy-Fallback (falls module-status irgendwo noch gerendert wird) */
.module-status {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Module tiles as clickable links */
.module-tile-link {
    color: var(--text);
    text-decoration: none;
    cursor: pointer;
}
.module-tile-link:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

/* Breadcrumbs */
.crumbs {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }

/* Data lists (mobile-first list rendering instead of tables) */
.data-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px solid var(--border);
}
.data-list-item {
    border-bottom: 1px solid var(--border);
}
.data-list-link,
.data-list-static {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.7rem 0.25rem;
    color: var(--text);
    text-decoration: none;
}
.data-list-link:hover {
    background: #f8fafc;
}
.data-list-title {
    font-weight: 600;
    font-size: 0.95rem;
}
.data-list-meta {
    color: var(--muted);
    font-size: 0.85rem;
}

/* Filter tabs */
.filter-tabs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin: 0 0 0.75rem;
}
.filter-tab {
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
}
.filter-tab.is-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* Bullets list */
.bullets {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text);
}
.bullets li { margin: 0.2rem 0; font-size: 0.92rem; }

/* Form helpers */
.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 480px) {
    .form-row { grid-template-columns: 1fr 1fr; }
}
.field select,
.field textarea {
    font: inherit;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    transition: border-color 0.15s;
    resize: vertical;
}
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(228, 0, 0, 0.15);
}

/* PWA Install-Banner */
.install-banner {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.85rem;
    padding-top: calc(env(safe-area-inset-top, 0) + 0.55rem);
    background: var(--primary-dark);
    color: #fff;
    font-size: 0.88rem;
    box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}
.install-banner.is-hidden { display: none; }
.install-banner-text { flex: 1; }
.install-banner-btn {
    font: inherit;
    font-weight: 600;
    background: #fff;
    color: var(--primary-dark);
    border: 0;
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
}
.install-banner-close {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
}

/* Footer */
.footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 2rem 1rem 1.5rem;
}
.footer-inner a { color: var(--muted); }

/* ──────────────────────────────────────────────────────────────────
 * Feedback-Modul: Floating-Button, Modal, Status-Badges
 * ────────────────────────────────────────────────────────────────── */

.feedback-fab {
    position: fixed;
    right: calc(env(safe-area-inset-right, 0) + 1rem);
    bottom: calc(env(safe-area-inset-bottom, 0) + 1rem);
    z-index: 30;
    background: var(--primary);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 0.7rem 1.1rem;
    font: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s, transform 0.05s;
}
.feedback-fab:hover  { background: var(--primary-dark); }
.feedback-fab:active { transform: scale(0.97); }
@media (max-width: 480px) {
    .feedback-fab        { padding: 0.7rem 0.85rem; }
    .feedback-fab-text   { display: none; }
}

.feedback-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.feedback-modal-backdrop[hidden] { display: none; }
body.feedback-modal-open { overflow: hidden; }

.feedback-modal {
    background: var(--card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25);
    padding: 1rem 1.25rem 1.25rem;
}
.feedback-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.feedback-modal-header h2 {
    margin: 0;
    color: var(--primary);
    font-size: 1.15rem;
}
.feedback-modal-close {
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}
.feedback-modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.5rem;
}
.feedback-message-box { margin: 0; }

@media (max-width: 480px) {
    .feedback-modal-backdrop { padding: 0; align-items: stretch; }
    .feedback-modal {
        max-width: none;
        max-height: 100vh;
        border-radius: 0;
        padding-top: calc(env(safe-area-inset-top, 0) + 1rem);
        padding-bottom: calc(env(safe-area-inset-bottom, 0) + 1rem);
    }
}

.feedback-message {
    white-space: pre-wrap;
    word-break: break-word;
    font: inherit;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    margin: 0;
}
.feedback-screenshot {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: block;
}

.status-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid transparent;
    vertical-align: middle;
}
.status-badge-neu             { background: var(--info-bg);    color: var(--info);    border-color: #93c5fd; }
.status-badge-in_bearbeitung  { background: #fef3c7;           color: #b45309;        border-color: #fcd34d; }
.status-badge-erledigt        { background: var(--success-bg); color: var(--ok);      border-color: #86efac; }
.status-badge-feiertag        { background: #fef9e7;           color: #92400e;        border-color: #fbbf24; }
.status-badge-sitzung         { background: #ede9fe;           color: #6d28d9;        border-color: #c4b5fd; }
.status-badge-schulferien     { background: #ccfbf1;           color: #0f766e;        border-color: #5eead4; }
.status-badge-wontfix         { background: #f3f4f6;           color: var(--muted);   border-color: var(--border); }

/* Projekt-/Antrags-Status (Modul Projects) */
.status-badge-entwurf         { background: #f3f4f6;           color: var(--muted);   border-color: var(--border); }
.status-badge-eingereicht     { background: var(--info-bg);    color: var(--info);    border-color: #93c5fd; }
.status-badge-pruefung        { background: #fef3c7;           color: #b45309;        border-color: #fcd34d; }
.status-badge-warten          { background: #fde68a;           color: #92400e;        border-color: #f59e0b; }
.status-badge-positiv         { background: var(--success-bg); color: var(--ok);      border-color: #86efac; }
.status-badge-negativ         { background: #fee2e2;           color: #b91c1c;        border-color: #fca5a5; }
.status-badge-abgeschlossen   { background: #e0e7ff;           color: #3730a3;        border-color: #a5b4fc; }

.filter-tab-count {
    opacity: 0.75;
    font-size: 0.8em;
    margin-left: 0.15rem;
}

.module-tile-badge {
    display: inline-block;
    margin-top: 0.15rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--warn);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* Beitrags-Vorschlags-Buttons + Fieldset (eltern_new/_edit) */
.form-fieldset {
    margin: 1rem 0;
    padding: 0.85rem 1rem 1rem;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 0.5rem;
    background: #fafafa;
}
.form-fieldset > legend {
    padding: 0 0.4rem;
    font-weight: 600;
    color: var(--text, #111);
}
.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}
.btn-suggest {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    background: #fff;
    border: 1px solid var(--border, #d1d5db);
    border-radius: 0.4rem;
    cursor: pointer;
}
.btn-suggest:hover {
    border-color: var(--primary, #e40000);
    color: var(--primary, #e40000);
}

/* Impersonation-Banner — sichtbar oben, ganze Breite, lebhafte Warn-Farbe */
.impersonation-banner {
    background: #fff7e6;
    border-bottom: 2px solid #f0a500;
    color: #6b3e00;
    padding: 0.6rem 1rem;
    font-size: 0.92rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    position: sticky;
    top: 0;
    z-index: 50;
}
.impersonation-banner-icon { font-size: 1.2rem; }
.impersonation-banner-text { flex: 1 1 auto; min-width: 200px; }
.impersonation-banner-form { margin: 0; flex: 0 0 auto; }
.impersonation-banner-btn {
    background: #6b3e00;
    color: #fff;
    border: none;
    padding: 0.45rem 0.9rem;
    border-radius: 0.35rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.88rem;
}
.impersonation-banner-btn:hover { background: #4a2a00; }

/* ───────── Mitglieder-Übersicht ───────── */
.filter-bar {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: end;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
    width: 100%;
}
.filter-bar .field { flex: 1 1 160px; gap: 0.2rem; margin: 0; min-width: 0; }
.filter-bar select,
.filter-bar input[type="search"] {
    width: 100%;
    padding: 0.45rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    background: #fff;
    font-size: 0.9rem;
    box-sizing: border-box;
}
.filter-bar-actions { display: flex; align-items: end; gap: 0.4rem; flex: 0 0 auto; }
.filter-bar-actions .btn { padding: 0.5rem 0.95rem; font-size: 0.88rem; }

/* ───────── Mitglieder-Sub-Nav (Eltern/Kinder/Klassen/Rollover als Tabs) ───────── */
.members-subnav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.5rem 0;
    margin: 0 0 0.6rem;
    border-bottom: 1px solid var(--border);
}
.members-subnav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.15rem;
    flex: 1 1 auto;
}
.members-subnav-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.subnav-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.85rem;
    color: var(--muted);
    text-decoration: none;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.12s;
}
.subnav-tab:hover {
    background: #f1f5f9;
    color: var(--text);
}
.subnav-tab.is-active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}
.subnav-tab.is-active:hover { background: var(--primary-dark); }
.subnav-tab.subnav-tab-muted {
    font-size: 0.82rem;
    color: #94a3b8;
    margin-left: 0.4rem;
}
.subnav-tab.subnav-tab-muted:hover { color: var(--muted); background: transparent; }

/* Export-Dropdown (PDF / Excel) im Sub-Nav */
.export-menu {
    position: relative;
    display: inline-block;
}
.export-toggle {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    font-weight: 500;
}
.export-toggle:hover { border-color: var(--primary); color: var(--primary); }
.export-dropdown {
    position: absolute;
    top: calc(100% + 0.3rem);
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    min-width: 10rem;
    z-index: 30;
    overflow: hidden;
}
.export-dropdown[hidden] { display: none; }
.export-item {
    display: block;
    padding: 0.55rem 0.85rem;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid #f1f5f9;
}
.export-item:last-child { border-bottom: none; }
.export-item:hover { background: #f8fafc; color: var(--primary); }

/* Wrapper sorgt für stabile Gradient-Anker (rechts:0 würde sonst an die
   Scroll-Content-Kante binden statt an die sichtbare Viewport-Kante des Scroll-Containers) */
.table-scroll-wrap {
    position: relative;
}
.table-scroll-wrap::before,
.table-scroll-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1.4rem;
    pointer-events: none;
    z-index: 2;
    opacity: 0.85;
}
.table-scroll-wrap::before {
    left: 0;
    background: linear-gradient(to right, rgba(255,255,255,0.95), transparent);
}
.table-scroll-wrap::after {
    right: 0;
    background: linear-gradient(to left, rgba(255,255,255,0.95), transparent);
}
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.member-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    min-width: 980px;
}
.member-table th,
.member-table td {
    padding: 0.55rem 0.45rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
.member-table th {
    background: #f1f5f9;
    font-weight: 600;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.member-table td.num,
.member-table th.num { text-align: right; white-space: nowrap; }
.member-table tr.row-deleted   { opacity: 0.5; background: #fafafa; }
.member-table tr.row-cancelled { background: #fff7e6; }
.member-table tr.row-paused    { background: #f3f4ff; }
.member-table tr:hover { background: #fafbfc; }

.member-name {
    color: var(--text);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.member-name:hover strong { color: var(--primary); }
.member-name small { font-size: 0.78rem; color: var(--muted); }

.sort-link { color: inherit; text-decoration: none; }
.sort-link small { font-size: 0.7em; opacity: 0.55; }
.sort-link:hover { color: var(--primary); }

/* Ampel */
.ampel {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: help;
    white-space: nowrap;
}
.ampel-gruen     { background: #d1fae5; color: #065f46; }
.ampel-gelb      { background: #fef3c7; color: #92400e; }
.ampel-rot       { background: #fee2e2; color: #991b1b; }
.ampel-unbekannt { background: #e5e7eb; color: #4b5563; }

/* Match-Badge (Inbox / CSV-Match-Status). Gleiche Farbpalette wie .ampel-*,
   aber eigene Klassen, da match_status semantisch nicht identisch mit der
   Mitglieder-Ampel ist (transit-Fall, kein 'rot'). */
.match-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.95rem;
    line-height: 1;
    font-weight: 600;
    cursor: help;
    text-decoration: none;
    white-space: nowrap;
}
a.match-badge:hover { filter: brightness(0.95); text-decoration: none; }
.match-badge-green   { background: #d1fae5; color: #065f46; }
.match-badge-yellow  { background: #fef3c7; color: #92400e; }
.match-badge-grey    { background: #e5e7eb; color: #4b5563; }
.match-badge-transit { background: #dbeafe; color: #1e3a8a; }

/* Status-Badges */
.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-active   { background: #dcfce7; color: #14532d; }
.badge-paused   { background: #ddd6fe; color: #4c1d95; }
.badge-inactive { background: #e5e7eb; color: #4b5563; }

/* Inline-Form-Buttons in Tabelle */
.inline-form { margin: 0; display: inline; }
.inline-form-beitrag { margin: 0; display: flex; gap: 0.25rem; align-items: center; }
.inline-form-beitrag input {
    width: 90px;
    padding: 0.25rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    font-size: 0.85rem;
    text-align: right;
    background: #fff;
}
.inline-save {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    padding: 0.2rem 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
}
.inline-save:hover { background: #fafbfc; border-color: var(--primary); }
.inline-select {
    padding: 0.25rem 0.35rem;
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    background: #fff;
    font-size: 0.82rem;
}
.toggle-btn {
    background: transparent;
    border: 1px solid var(--border);
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}
.toggle-btn.is-on  { background: #d1fae5; border-color: #6ee7b7; color: #065f46; }
.toggle-btn.is-off { color: var(--muted); }
.toggle-btn:hover  { border-color: var(--primary); }

/* ───────── Permissions-Matrix ───────── */
.permission-matrix {
    position: relative;
    /* overflow-x NUR auf Mobile — auf Desktop wuerde es den sticky-Y-Header
       blockieren (sticky bricht, sobald ein Ancestor overflow non-visible hat).
       720px min-width passt auf Desktops ohne Scroll. */
}
@media (max-width: 1023px) {
    .permission-matrix {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}
.permission-matrix .member-table {
    /* Schmaler dank rotierter Header — pro Rollen-Spalte nur ~36px statt 100px.
       Bei 13 Rollen + Permission-Spalte passt das jetzt auf normale Desktops. */
    min-width: 720px;
}
.permission-matrix th.role-col {
    text-align: center;
    width: 36px;
    min-width: 36px;
    max-width: 36px;
    height: 170px;            /* Platz fuer den rotierten Header-Text */
    vertical-align: bottom;
    padding: 0.4rem 0 0.5rem 0;
}
.permission-matrix th.role-col .role-col-name {
    /* writing-mode dreht Text 90 Grad. Mit transform rotate(180deg) liest
       man von unten nach oben — das ist die gewohnte Lese-Richtung fuer
       Matrix-Tabellen (links unten -> rechts oben). */
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: inline-block;
    line-height: 1.1;
    white-space: nowrap;
    text-align: left;
    font-weight: 600;
}
.permission-matrix th.role-col .role-col-name br,
.permission-matrix th.role-col .role-col-name small {
    /* "(immer alle)"-Hinweis bei Admin: in vertical-mode stoerend, ausblenden.
       Titel-Tooltip + visueller Status (Checkmark statt Checkbox) reichen. */
    display: none;
}
.permission-matrix td.num {
    width: 36px;
    min-width: 36px;
    text-align: center;
}
.permission-matrix td.num input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

/* Erste Spalte (Permission-Name + Beschreibung) bleibt fix beim H-Scrollen.
   Die Hintergrundfarben spiegeln die jeweiligen Tabellen-States, damit sich
   beim Drüberscrollen kein "Loch" auftut. Box-Shadow rechts erzeugt einen
   dezenten Trenner zur scrollenden Rest-Tabelle. */
.permission-matrix .member-table th:first-child,
.permission-matrix .member-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    box-shadow: 1px 0 0 #e2e8f0;
}
.permission-matrix .member-table thead th:first-child {
    background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
    z-index: 3;
}

/* Sticky-Header beim vertikalen Scrollen — nur Desktop (>=1024px).
   Auf Mobile bleibt der Header normal mitscrollend, weil der rotierte
   170px-Block sonst zu viel Bildschirmflaeche schluckt.
   top: 56px = unter der gesticky Topbar (z-index:10) — der Header rutscht
   beim Scrollen also bis dorthin und bleibt dann sichtbar.

   BROWSER-QUIRK: position: sticky auf <th> funktioniert nicht mit
   border-collapse: collapse. Daher override auf 'separate' + Border-
   Workaround via box-shadow statt border-bottom. */
@media (min-width: 1024px) {
    .permission-matrix .member-table {
        border-collapse: separate;
        border-spacing: 0;
    }
    .permission-matrix .member-table th,
    .permission-matrix .member-table td {
        /* border-bottom-Effekt nachbauen, weil collapse aus ist */
        border-bottom: 1px solid var(--border);
    }
    .permission-matrix .member-table thead th {
        position: sticky;
        top: 56px;
        background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
        z-index: 4;
        /* Schatten nach unten als optische Trennung zum scrollenden tbody */
        box-shadow: 0 1px 0 #e2e8f0;
    }
    .permission-matrix .member-table thead th:first-child {
        /* Ecke oben-links: muss sowohl horizontal (left:0) als auch vertikal
           (top:56px) sticky sein. z-index hoeher als andere thead-th, damit
           beim H-Scroll die Rollen-Header darunter durchziehen. */
        z-index: 5;
    }
}
.permission-matrix .member-table tbody tr:nth-child(even) td:first-child {
    background: #fafbfc;
}
.permission-matrix .member-table tbody tr:hover td:first-child {
    background: #fef2f2;
}

/* Save-Button pro Modul-Card. Sitzt am Ende jedes <form>, gefolgt von
   einem dezenten Hinweis-Satz. */
.permission-module-footer {
    margin-top: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}
.permission-module-footer .btn {
    font-size: 0.9rem;
}
.permission-module-footer small {
    flex: 1 1 200px;
    min-width: 0;
}

/* ───────── Status-Page ───────── */
.status-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.status-hero-icon { font-size: 2.5rem; }
.status-hero-text { flex: 1 1 200px; min-width: 0; }
.status-hero-text h1 { margin: 0 0 0.2rem; }
.status-hero-text p { margin: 0; }
.status-hero-action {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.status-hero-ok    { border-left: 5px solid #16a34a; }
.status-hero-warn  { border-left: 5px solid #f59e0b; }
.status-hero-error { border-left: 5px solid #dc2626; }

.status-checks {
    list-style: none;
    margin: 0;
    padding: 0;
}
.status-check {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.7rem 0.4rem;
    border-bottom: 1px solid var(--border);
}
.status-check:last-child { border-bottom: none; }
.status-check-icon { font-size: 1.4rem; flex: 0 0 auto; }
.status-check-body { flex: 1 1 auto; min-width: 0; }
.status-check-title { margin: 0 0 0.15rem; font-size: 1rem; }
.status-check-detail { margin: 0; font-size: 0.88rem; color: var(--muted); word-break: break-word; }
.status-check-pill {
    flex: 0 0 auto;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    align-self: center;
}
.status-ok    .status-check-pill { background: #d1fae5; color: #065f46; }
.status-warn  .status-check-pill { background: #fef3c7; color: #92400e; }
.status-error .status-check-pill { background: #fee2e2; color: #991b1b; }

.quick-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.6rem;
}
.quick-check-tile {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.85rem 0.7rem;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.15rem;
    transition: transform 0.1s, box-shadow 0.1s;
}
.quick-check-tile:hover {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}
.quick-check-emoji { font-size: 1.6rem; }

/* ───────── Releases-Page ───────── */
.release-current {
    background: linear-gradient(135deg, #fef3c7 0%, #fff 60%);
    border-left: 5px solid var(--primary);
}
.release-badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    background: var(--primary);
    color: #fff;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}
.release-sha {
    font-family: ui-monospace, monospace;
    background: #1f2937;
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 0.3rem;
    font-size: 0.92rem;
    text-decoration: none;
}
.release-sha:hover { background: var(--primary); color: #fff; }
.release-msg { margin: 0.5rem 0; font-size: 1.05rem; line-height: 1.4; }
.release-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.release-item {
    padding: 0.7rem 0.4rem;
    border-bottom: 1px solid var(--border);
}
.release-item:last-child { border-bottom: none; }
.release-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.release-item .release-msg { margin: 0.3rem 0 0.1rem; font-size: 0.95rem; }
.release-time { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }

/* ───────── Mobile-First Optimierung (Phase 16) ───────── */
@media (max-width: 640px) {
    /* Tabellen: Mobile bricht aus Container-Padding aus für mehr Sichtbarkeit
       (Gradient-Hints sind global, siehe oben) */
    .table-scroll {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    /* Tabelle Member: kleinere Padding für mehr Spalten in Sicht */
    .member-table th,
    .member-table td {
        padding: 0.4rem 0.35rem;
        font-size: 0.8rem;
    }

    /* Filter-Bar: Felder stapeln statt nebeneinander */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
        padding: 0.55rem;
    }
    .filter-bar .field { flex: 1 1 auto; }
    .filter-bar-actions { flex-direction: row; }
    .filter-bar-actions .btn { flex: 1 1 auto; }

    /* Topbar: User-Chip kompakter */
    .topbar-inner {
        padding: 0.7rem 0.7rem;
        gap: 0.5rem;
    }
    .brand { font-size: 1.15rem; }
    .brand-text { display: none; }
    .user-chip {
        gap: 0.3rem;
        font-size: 0.8rem;
    }
    .user-chip .user-name {
        max-width: 14ch;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Module-Tiles: 2 pro Zeile */
    .module-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .module-tile { padding: 0.7rem 0.5rem; }
    .module-emoji { font-size: 1.5rem; }
    .module-name { font-size: 0.85rem; }

    /* Forms: Container-Padding kleiner */
    .container { padding: 0.6rem; }
    .card { padding: 0.7rem 0.85rem; }
    .card h1 { font-size: 1.45rem; }
    .card h2 { font-size: 1.15rem; }

    /* Touch-Targets: Buttons etwas größer */
    .btn { padding: 0.55rem 0.85rem; min-height: 40px; }
    .btn-link { padding: 0.4rem 0.6rem; min-height: 36px; }

    /* Permissions-Matrix: nur die ersten 3 Rollen sichtbar, Rest scrollen */
    .permission-matrix .member-table { min-width: 700px; }

    /* Impersonation-Banner Stack */
    .impersonation-banner {
        flex-direction: column;
        align-items: flex-start;
        font-size: 0.85rem;
    }
    .impersonation-banner-btn { width: 100%; }

    /* Status-Hero kompakter */
    .status-hero { gap: 0.5rem; padding: 0.85rem; }
    .status-hero-icon { font-size: 1.8rem; }
    .status-check-pill { font-size: 0.7rem; padding: 0.1rem 0.4rem; }

    /* Quick-Check-Tiles: 2 pro Zeile */
    .quick-check-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Tablet 641-960px: Tabellen breiter, aber 3-spaltige Tile-Grids */
@media (min-width: 641px) and (max-width: 960px) {
    .module-grid { grid-template-columns: repeat(3, 1fr); }
    .quick-check-grid { grid-template-columns: repeat(3, 1fr); }
    .member-table th,
    .member-table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.85rem;
    }
}

/* ───────── Antrags-Submit: 2 alternative SL-Pfade ───────── */
.sl-pfade {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 0.85rem;
    align-items: stretch;
    margin: 0.6rem 0;
}
.sl-pfad {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    padding: 0.85rem 1rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sl-pfad h4 { margin: 0; font-size: 1.05rem; color: var(--text); }
.sl-pfad p { margin: 0; }
.sl-pfad .btn { margin-top: auto; }
.sl-pfad-trenner {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-style: italic;
    font-size: 0.9rem;
    padding: 0 0.3rem;
}

@media (max-width: 700px) {
    .sl-pfade {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .sl-pfad-trenner { padding: 0.2rem 0; }
}

.sl-info-block {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    padding: 0.6rem 0.85rem;
    border-radius: 0.4rem;
    margin: 0.5rem 0 0.85rem;
    font-size: 0.92rem;
}
.sl-info-block small { display: block; margin-top: 0.2rem; }

/* ───────── Mitglieder-Übersicht — Redesign Phase 19a ───────── */
.members-header { padding-top: 0.85rem; padding-bottom: 0.85rem; }
.members-header h1 { font-size: 1.5rem; }
.members-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    flex-wrap: wrap;
}
.count-pill {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 0.05rem 0.55rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85em;
    margin-right: 0.2rem;
}
.btn-compact { padding: 0.5rem 0.95rem; font-size: 0.92rem; }

/* Tabellen-Header neutral (statt rot) */
.member-table thead th {
    background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
    color: #475569;
    font-weight: 600;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 2px solid #cbd5e1;
    padding: 0.6rem 0.55rem;
    vertical-align: middle;
    white-space: nowrap;
}
.member-table .sort-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.member-table .sort-link small {
    font-size: 0.85em;
    opacity: 0.4;
    font-weight: 400;
}
.member-table .sort-link:hover { color: var(--primary); }
.member-table .sort-link:hover small { opacity: 1; }

/* Tabellen-Zellen-Vertikalmitte + Zebra */
.member-table tbody tr {
    transition: background 0.1s;
}
.member-table tbody tr:nth-child(even) { background: #fafbfc; }
.member-table tbody tr:hover { background: #fef2f2; }
.member-table tbody td {
    padding: 0.5rem 0.55rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
}

/* Name-Zelle */
.cell-member { min-width: 200px; }
.member-name {
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    line-height: 1.25;
}
.member-fullname {
    font-weight: 600;
    color: #1f2937;
}
.member-name:hover .member-fullname { color: var(--primary); }
.member-email {
    font-size: 0.78rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}

/* Lehrer-Pill (state toggle) */
.cell-lehrer { text-align: center; }
.pill-toggle {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.12s;
}
.pill-toggle:hover { border-color: var(--primary); color: var(--text); }
.pill-toggle.is-on {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #78350f;
    font-weight: 600;
}

/* Beitrag-Inline-Edit (cleaner) */
.cell-beitrag { min-width: 130px; }
.inline-edit-beitrag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
}
.beitrag-input-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.beitrag-input-wrap input {
    width: 80px;
    padding: 0.3rem 1.4rem 0.3rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 0.3rem;
    background: transparent;
    font-size: 0.88rem;
    text-align: right;
    transition: all 0.12s;
}
.beitrag-input-wrap input:hover { background: #fff; border-color: #cbd5e1; }
.beitrag-input-wrap input:focus {
    outline: none;
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(228,0,0,0.1);
}
.beitrag-suffix {
    position: absolute;
    right: 0.45rem;
    color: var(--muted);
    font-size: 0.85rem;
    pointer-events: none;
}
.inline-save-icon {
    background: var(--primary);
    color: #fff;
    border: 0;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.12s;
}
.inline-edit-beitrag:hover .inline-save-icon,
.inline-edit-beitrag:focus-within .inline-save-icon,
.member-table tbody tr:hover .inline-save-icon { opacity: 1; }
.inline-save-icon:hover { background: var(--primary-dark); }

/* Zahlungsart-Select */
.cell-zahlung { min-width: 140px; }
.inline-select {
    width: 100%;
    padding: 0.3rem 0.4rem;
    border: 1px solid transparent;
    border-radius: 0.3rem;
    background: transparent;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.12s;
}
.inline-select:hover { background: #fff; border-color: #cbd5e1; }
.inline-select:focus { outline: none; background: #fff; border-color: var(--primary); }

/* Datums-Zellen */
.cell-date {
    font-variant-numeric: tabular-nums;
    color: #475569;
    white-space: nowrap;
}
.muted-soft { color: #cbd5e1; }

/* Beitragsstand als Zell-Hintergrund auf "Letzte Zahlung" — kombiniert
   Datum-Info mit Zahlungsstatus-Ampel (statt eigener Ampel-Spalte). */
.cell-letzte-zahlung {
    cursor: help;
    position: relative;
    border-left: 3px solid transparent;
    padding-left: 0.55rem !important;
}
.cell-letzte-zahlung.ampel-gruen     { background: #ecfdf5 !important; border-left-color: #10b981; }
.cell-letzte-zahlung.ampel-gelb      { background: #fffbeb !important; border-left-color: #f59e0b; }
.cell-letzte-zahlung.ampel-rot       { background: #fef2f2 !important; border-left-color: #ef4444; }
.cell-letzte-zahlung.ampel-unbekannt { background: #f8fafc !important; border-left-color: #cbd5e1; }
/* Hover-Verstärkung */
.member-table tbody tr:hover .cell-letzte-zahlung.ampel-gruen     { background: #d1fae5 !important; }
.member-table tbody tr:hover .cell-letzte-zahlung.ampel-gelb      { background: #fef3c7 !important; }
.member-table tbody tr:hover .cell-letzte-zahlung.ampel-rot       { background: #fee2e2 !important; }
.member-table tbody tr:hover .cell-letzte-zahlung.ampel-unbekannt { background: #f1f5f9 !important; }

/* Status-Pills */
.cell-status { white-space: nowrap; min-width: 110px; }
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.18rem 0.6rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 600;
    white-space: nowrap;
}
.status-pill-active   { background: #d1fae5; color: #065f46; }
.status-pill-warn     { background: #fef3c7; color: #78350f; }
.status-pill-paused   { background: #ddd6fe; color: #4c1d95; }
.status-pill-inactive { background: #e2e8f0; color: #475569; }

/* Aktion-Spalte: Icon-Buttons */
.cell-actions {
    text-align: right;
    white-space: nowrap;
    width: 1%;
}
.action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 0.4rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.95rem;
    margin-left: 0.15rem;
    transition: all 0.12s;
}
.action-icon:hover {
    background: #fff;
    border-color: #cbd5e1;
    color: var(--primary);
}
.action-icon.is-active {
    background: #ddd6fe;
    border-color: #a78bfa;
    color: #4c1d95;
}

/* Pause/Play als CSS-Shapes (Font-unabhängig) */
.icon-pause {
    display: inline-block;
    position: relative;
    width: 0.75rem;
    height: 0.95rem;
    vertical-align: middle;
}
.icon-pause::before,
.icon-pause::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 0.22rem;
    background: currentColor;
    border-radius: 1px;
}
.icon-pause::before { left: 0.05rem; }
.icon-pause::after  { right: 0.05rem; }

.icon-play {
    display: inline-block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0.5rem 0 0.5rem 0.75rem;
    border-color: transparent transparent transparent currentColor;
    vertical-align: middle;
    margin-left: 0.1rem;
}

/* Row-State-Hervorhebung dezenter machen (statt voller Hintergrund-Farbe) */
/* tbody-Prefix nötig, damit Spezifität (0,2,2) das Zebra-:nth-child(even) (auch 0,2,2)
   bei gleicher Spezifität durch späteren Stand schlägt. Sonst überschreibt Zebra
   den row-cancelled-Hintergrund auf geraden Zeilen → nur erste TD blieb gelb. */
.member-table tbody tr.row-deleted   { opacity: 0.55; }
.member-table tbody tr.row-deleted:hover { background: #f1f5f9; }
.member-table tbody tr.row-cancelled { background: #fffbeb; }
.member-table tbody tr.row-cancelled:hover { background: #fef3c7; }
.member-table tbody tr.row-paused    { background: #faf5ff; }
.member-table tbody tr.row-paused:hover { background: #f3e8ff; }

/* Sticky erste Spalte (Name) für Mitgliederliste — opt-in via .sticky-first-Klasse,
   damit andere Tabellen (Helfer-Pool) nicht versehentlich betroffen sind.
   Pro Row-State eigener Background, damit beim H-Scrollen kein "Loch" entsteht. */
.member-table.sticky-first th:first-child,
.member-table.sticky-first td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #fff;
    box-shadow: 1px 0 0 #e2e8f0;
}
.member-table.sticky-first thead th:first-child {
    background: linear-gradient(180deg, #fafbfc 0%, #f1f5f9 100%);
    z-index: 3;
}
.member-table.sticky-first tbody tr:nth-child(even) td:first-child {
    background: #fafbfc;
}
.member-table.sticky-first tbody tr.row-cancelled td:first-child { background: #fffbeb; }
.member-table.sticky-first tbody tr.row-paused    td:first-child { background: #faf5ff; }
.member-table.sticky-first tbody tr.row-deleted   td:first-child { background: #fafafa; }
.member-table.sticky-first tbody tr:hover td:first-child            { background: #fef2f2; }
.member-table.sticky-first tbody tr.row-cancelled:hover td:first-child { background: #fef3c7; }
.member-table.sticky-first tbody tr.row-paused:hover    td:first-child { background: #f3e8ff; }
.member-table.sticky-first tbody tr.row-deleted:hover   td:first-child { background: #f1f5f9; }

/* ─── Timeline (Start · Erinnerung · jetzt · Deadline) ─────────────── */
.timeline { margin: 1rem 0 0.4rem; }
.timeline-track { position:relative; height:6px; background:#e2e8f0;
                  border-radius:3px; margin:1.8rem 0 3rem; }
.timeline-progress { position:absolute; left:0; top:0; height:100%;
                     background: linear-gradient(90deg, #2563eb, #60a5fa);
                     border-radius:3px;
                     animation: timeline-fill 1.2s cubic-bezier(.22,.61,.36,1) 0.1s both; }
@keyframes timeline-fill { from { width: 0; } }
.timeline-now { position:absolute; top:-4px; width:14px; height:14px;
                background:#1d4ed8; border:2px solid #fff; border-radius:50%;
                transform:translateX(-50%); box-shadow:0 0 0 2px #1d4ed8;
                z-index:3;
                animation: timeline-slide 1.2s cubic-bezier(.22,.61,.36,1) 0.1s both,
                           timeline-pulse 2.2s ease-in-out 1.4s infinite; }
@keyframes timeline-slide { from { left: 0; } }
@keyframes timeline-pulse {
    0%, 100% { box-shadow: 0 0 0 2px #1d4ed8, 0 0 0 0 rgba(29,78,216,0.45); }
    50%      { box-shadow: 0 0 0 2px #1d4ed8, 0 0 0 9px rgba(29,78,216,0); }
}
.timeline-mark { position:absolute; top:-4px; width:14px; height:14px;
                 border-radius:50%; transform:translateX(-50%);
                 background:#fff; z-index:2;
                 animation: timeline-mark-in 0.4s ease-out 1.0s both; }
@keyframes timeline-mark-in { from { transform: translateX(-50%) scale(0); } }
.timeline-mark.start { left:0; border:3px solid #15803d; transform:translateX(0);
                       animation: timeline-mark-in-left 0.4s ease-out 0.2s both; }
@keyframes timeline-mark-in-left { from { transform: translateX(0) scale(0); } }
.timeline-mark.end   { left:100%; border:3px solid #b91c1c; transform:translateX(-100%);
                       animation: timeline-mark-in-right 0.4s ease-out 0.2s both; }
@keyframes timeline-mark-in-right { from { transform: translateX(-100%) scale(0); } }
.timeline-mark.reminder { border:3px solid #d97706; }
.timeline-label { position:absolute; top:14px; font-size:0.7rem; color:#475569;
                  white-space:nowrap; transform:translateX(-50%); line-height:1.1;
                  animation: timeline-label-in 0.5s ease-out 0.5s both; }
@keyframes timeline-label-in { from { opacity: 0; transform: translateX(-50%) translateY(-4px); } }
.timeline-label.start { left:0; transform:translateX(0); text-align:left;
                        animation-name: timeline-label-in-left; }
@keyframes timeline-label-in-left { from { opacity: 0; transform: translateX(0) translateY(-4px); } }
.timeline-label.end   { left:100%; transform:translateX(-100%); text-align:right;
                        animation-name: timeline-label-in-right; }
@keyframes timeline-label-in-right { from { opacity: 0; transform: translateX(-100%) translateY(-4px); } }
.timeline-label-top { position:absolute; bottom:14px; font-size:0.7rem;
                      font-weight:600; white-space:nowrap;
                      transform:translateX(-50%); line-height:1.1;
                      animation: timeline-label-in 0.5s ease-out 0.8s both; }
.timeline-label-top.now { color:#1d4ed8; }
.timeline-label-top.reminder { color:#d97706; }
/* Compact-Variante fuer Dashboard-Banner: weniger Hoehe, kleinere Labels */
.timeline.compact { margin: 0.6rem 0 0.2rem; }
.timeline.compact .timeline-track { margin: 1.4rem 0 2.4rem; }
.timeline.compact .timeline-label,
.timeline.compact .timeline-label-top { font-size: 0.65rem; }
@media (prefers-reduced-motion: reduce) {
    .timeline-progress, .timeline-now, .timeline-mark,
    .timeline-label, .timeline-label-top { animation: none; }
}
