/* FSXTurnierIT — Admin-UI
 *
 * Farbpalette und Komponenten-Stil sind 1:1 an FSXVereinskasse
 * angelehnt (Tailwind Slate-Palette), damit beide Anwendungen wie
 * zwei Funktionsbereiche derselben Software wirken.
 */

:root {
    /* Tailwind-Slate-Palette */
    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    /* Akzentfarben (analog Vereinskasse) */
    --blue-50:    #eff6ff;
    --blue-300:   #93c5fd;
    --blue-500:   #3b82f6;
    --blue-600:   #2563eb;
    --blue-700:   #1d4ed8;

    --emerald-50:  #ecfdf5;
    --emerald-200: #a7f3d0;
    --emerald-300: #6ee7b7;
    --emerald-600: #059669;
    --emerald-700: #047857;
    --emerald-900: #064e3b;

    --amber-50:  #fffbeb;
    --amber-100: #fef3c7;
    --amber-500: #f59e0b;
    --amber-700: #b45309;

    --rose-50:  #fff1f2;
    --rose-300: #fda4af;
    --rose-600: #e11d48;
    --rose-700: #be123c;
    --rose-900: #881337;

    /* Semantische Aliasse */
    --c-bg: var(--slate-50);
    --c-card: #ffffff;
    --c-border: var(--slate-200);
    --c-border-strong: var(--slate-300);
    --c-text: var(--slate-900);
    --c-muted: var(--slate-500);
    --c-primary: var(--slate-800);
    --c-primary-hover: var(--slate-700);
    --c-link: var(--blue-600);
    --c-link-hover: var(--blue-700);
    --c-danger: var(--rose-600);
    --c-danger-hover: var(--rose-700);
    --c-accent-bg: var(--slate-100);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--c-bg);
    color: var(--c-text);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
                 "Segoe UI", Roboto, "Helvetica Neue", Arial,
                 "Apple Color Emoji", "Segoe UI Emoji";
    font-size: 0.875rem;        /* Tailwind text-sm — wie Vereinskasse */
    line-height: 1.5;
    overflow-x: hidden;
    max-width: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
    text-decoration: underline;
}

code {
    background: var(--c-accent-bg);
    padding: 0.1em 0.3em;
    border-radius: 3px;
    font-size: 0.92em;
}

/* ===========================================================
   Layout: Topbar + Sidebar + Hauptinhalt
   =========================================================== */

:root {
    --sidebar-width: 240px;
    --topbar-height: 52px;
}

body.app {
    min-height: 100vh;
}

/* Topbar — dunkel wie Vereinskasse (bg-slate-800) */
.topbar {
    background: var(--slate-800);
    color: #ffffff;
    padding: 0 1rem;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.topbar .brand {
    font-weight: 700;
    color: #ffffff;
    font-size: 1.125rem;     /* Tailwind text-lg */
    text-decoration: none;
}

.topbar .brand:hover {
    text-decoration: none;
    color: #ffffff;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.topbar-right .btn {
    background: var(--slate-700);
    color: #ffffff;
    border-color: var(--slate-600);
}

.topbar-right .btn:hover {
    background: var(--slate-600);
    border-color: var(--slate-500);
    text-decoration: none;
}

.topbar-right .btn.primary {
    background: var(--blue-600);
    border-color: var(--blue-600);
}

.topbar-right .btn.primary:hover {
    background: var(--blue-700);
    border-color: var(--blue-700);
}

.topbar-user {
    font-size: 0.85rem;
    color: var(--slate-300);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inline-form {
    display: inline;
    margin: 0;
}

/* Mandanten-Wechsler in der Topbar (auf dunklem Hintergrund) */
.mandant-switcher {
    position: relative;
}

.mandant-switcher details {
    position: relative;
}

.mandant-switcher summary {
    list-style: none;
    cursor: pointer;
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--slate-600);
    border-radius: 5px;
    background: var(--slate-700);
    color: #ffffff;
    font-size: 0.85rem;
    user-select: none;
}

.mandant-switcher summary::-webkit-details-marker {
    display: none;
}

.mandant-switcher summary:hover {
    background: var(--slate-600);
    border-color: var(--slate-500);
}

.mandant-switcher-label {
    color: var(--slate-300);
    font-size: 0.78rem;
    margin-right: 0.25rem;
}

.mandant-switcher-caret {
    margin-left: 0.4rem;
    color: var(--slate-300);
    font-size: 0.7rem;
}

.mandant-switcher-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.4rem;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    min-width: 260px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 110;
    padding: 0.3rem 0;
}

.mandant-switcher-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: 0;
    padding: 0.5rem 0.9rem;
    font-size: 0.92rem;
    color: var(--c-text);
    cursor: pointer;
    display: block;
    line-height: 1.3;
}

.mandant-switcher-item:hover {
    background: var(--c-accent-bg);
}

.mandant-switcher-item.active {
    background: var(--c-primary);
    color: #ffffff;
    font-weight: 500;
}

.mandant-switcher-item.active small {
    color: rgba(255, 255, 255, 0.75);
}

.mandant-switcher-divider {
    border-top: 1px solid var(--c-border);
    margin: 0.2rem 0;
}

/* Statisches Badge wenn der User nur in einem Mandanten ist */
.mandant-badge {
    padding: 0.3rem 0.8rem;
    border: 1px solid var(--c-border);
    border-radius: 5px;
    background: var(--c-accent-bg);
    font-size: 0.88rem;
}

/* ===========================================================
   Rollen-/Berechtigungsmatrix — rollen-zentrisch
   (Rollen-Liste links, Detail rechts mit 3 Aktion-Sektionen)
   =========================================================== */

.rollen-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    align-items: flex-start;
}

@media (max-width: 900px) {
    .rollen-shell {
        grid-template-columns: 1fr;
    }
}

/* Linke Spalte — Rollen-Liste */
.rollen-list {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 0.6rem;
    position: sticky;
    top: calc(var(--topbar-height) + 1rem);
    max-height: calc(100vh - var(--topbar-height) - 2rem);
    overflow-y: auto;
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
}

.rollen-list-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-500);
    padding: 0.6rem 0.7rem 0.3rem;
    font-weight: 600;
}

.rollen-list-section-zentrale {
    margin-top: 0.4rem;
    border-top: 1px solid var(--c-border);
    padding-top: 0.8rem;
    color: var(--amber-700);
}

.rollen-list-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.2rem 0.5rem;
    padding: 0.55rem 0.75rem;
    border-radius: 6px;
    color: var(--slate-700);
    text-decoration: none;
    margin-bottom: 0.15rem;
    border: 1px solid transparent;
    line-height: 1.25;
}

.rollen-list-item:hover {
    background: var(--slate-100);
    color: var(--slate-900);
    text-decoration: none;
}

.rollen-list-item.active {
    background: var(--slate-800);
    color: #ffffff;
}

.rollen-list-item.active:hover {
    background: var(--slate-700);
}

.rollen-list-item.locked {
    opacity: 0.85;
}

.rollen-list-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.rollen-list-label small {
    font-size: 0.7rem;
    margin-left: 0.2rem;
}

.rollen-list-slug {
    grid-column: 1 / -1;
    font-size: 0.7rem;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    color: var(--slate-500);
}

.rollen-list-item.active .rollen-list-slug {
    color: var(--slate-300);
}

.rollen-list-badge {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    background: var(--amber-500);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    line-height: 1.2;
    min-width: 1.5rem;
    text-align: center;
}

.rollen-list-item.active .rollen-list-badge {
    background: var(--amber-100);
    color: var(--amber-700);
}

/* Rechte Spalte — Detail-Panel */
.rollen-detail {
    min-width: 0;
}

.rollen-empty {
    background: var(--c-card);
    border: 1px dashed var(--c-border);
    border-radius: 8px;
    padding: 2.5rem;
    text-align: center;
}

.rollen-detail-header {
    margin-bottom: 1.2rem;
}

.rollen-detail-header h2 {
    margin: 0 0 0.4rem;
    font-size: 1.5rem;
    color: var(--slate-900);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.rollen-detail-header p {
    margin: 0;
}

/* Ressource-Liste mit R/W/X-Checkboxen pro Zeile */
.permissions-card {
    padding: 0;
    overflow: hidden;
}

.permissions-card-header {
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid var(--c-border);
    background: var(--slate-50);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.permissions-card-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--slate-900);
}

.permissions-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--slate-500);
    font-weight: 500;
}

.permissions-legend span {
    cursor: help;
}

.permission-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.permission-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1rem;
    align-items: center;
    padding: 0.8rem 1.2rem;
    border-bottom: 1px solid var(--c-border);
    transition: background 100ms;
}

.permission-item:last-child {
    border-bottom: 0;
}

.permission-item:hover {
    background: var(--slate-50);
}

.permission-item.has-override {
    background: var(--blue-50);
}

.permission-item.has-override:hover {
    background: #dceaff;
}

.permission-text {
    min-width: 0;
}

.permission-label {
    font-weight: 600;
    color: var(--slate-900);
    font-size: 0.95rem;
}

.permission-desc {
    font-size: 0.82rem;
    color: var(--slate-500);
    line-height: 1.35;
    margin-top: 0.15rem;
}

/* R/W/X-Checkbox-Gruppe rechts */
.permission-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
}

.permission-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    width: 42px;
    padding: 0.3rem 0.2rem;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    user-select: none;
    transition: background 100ms, border-color 100ms;
}

.permission-cell:not(.cell-empty):hover {
    background: var(--slate-100);
    border-color: var(--slate-300);
}

.permission-cell input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--slate-800);
}

.permission-cell .cell-kuerzel {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--slate-500);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.permission-cell.cell-override {
    background: var(--blue-50);
    border-color: var(--blue-300);
    position: relative;
}

.permission-cell.cell-override::after {
    content: "";
    position: absolute;
    top: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--blue-600);
}

.permission-cell.cell-empty {
    cursor: default;
    opacity: 0.35;
}

.permission-cell.cell-empty .cell-kuerzel {
    color: var(--slate-400);
}

/* Platzhalter für die Checkbox bei „nicht definiert" */
.permission-cell.cell-empty::before {
    content: "—";
    color: var(--slate-300);
    font-size: 1.1rem;
    line-height: 1;
    height: 18px;
    display: flex;
    align-items: center;
}

/* Mobile: Actions in eigene Zeile */
@media (max-width: 540px) {
    .permission-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .permission-actions {
        justify-content: flex-start;
    }
}

/* Footer-Aktionen */
.rollen-detail-actions {
    display: flex;
    gap: 0.5rem;
    margin: 1.2rem 0 2rem;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding: 1rem;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    position: sticky;
    bottom: 1rem;
}

/* Alte Matrix-Klassen entfernen wir nicht — sie werden nicht mehr genutzt,
   aber Audit-Log und andere Templates referenzieren keine davon. */

.matrix-wrap {
    overflow-x: auto;
    background: var(--c-card);
    border: 2px solid #4b5563;
    border-radius: 6px;
    margin: 1rem 0;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

table.matrix {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9rem;
}

table.matrix th,
table.matrix td {
    border-bottom: 1px solid #b5bcc7;
    border-right: 1px solid #d8dde3;
    padding: 0;
    text-align: center;
    vertical-align: middle;
    background: var(--c-card);
}

/* Erste Spalte (Ressource) — sticky links */
table.matrix .matrix-th-ressource,
table.matrix .matrix-td-ressource {
    text-align: left;
    padding: 0.55rem 0.8rem;
    background: #e7eaf0;
    font-weight: 600;
    white-space: normal;
    position: sticky;
    left: 0;
    z-index: 5;
    min-width: 240px;
    max-width: 320px;
    border-right: 3px solid #4b5563;
}

.ressource-label {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1f2933;
    line-height: 1.25;
}

.ressource-slug {
    margin-top: 0.15rem;
    line-height: 1;
}

.ressource-slug code {
    font-size: 0.72rem;
    color: var(--c-muted);
    background: transparent;
    padding: 0;
}

.ressource-beschreibung {
    margin-top: 0.3rem;
    font-size: 0.78rem;
    color: #50596b;
    font-weight: 400;
    line-height: 1.35;
}

/* Kopf-Reihe (Rollen) — sticky oben */
table.matrix thead tr:first-child th {
    position: sticky;
    top: 0;
    z-index: 6;
    background: #d8dde3;
    padding: 0.6rem 0.5rem;
    border-bottom: 2px solid #4b5563;
    font-size: 0.85rem;
}

table.matrix thead tr:first-child .matrix-th-ressource {
    z-index: 10;
    background: #cfd6df;
}

table.matrix .matrix-th-rolle {
    min-width: 110px;
    line-height: 1.2;
}

.rolle-label {
    display: block;
    font-weight: 700;
    color: #1f2933;
    word-break: keep-all;
}

.rolle-slug {
    display: block;
    font-size: 0.7rem;
    color: var(--c-muted);
    margin-top: 0.15rem;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

table.matrix .matrix-th-rolle small.muted {
    display: block;
    font-size: 0.68rem;
    margin-top: 0.2rem;
}

table.matrix .rolle-zentrale {
    background: #fde8b8 !important;
}

table.matrix .rolle-locked {
    background: #d4c7cd !important;
}

/* Zweite Header-Reihe: R/W/X-Beschriftung */
.matrix-th-aktionen th {
    position: sticky;
    top: 76px; /* unter erste Zeile (ca. Höhe Rolle-Header) */
    background: #f1eff3;
    border-bottom: 2px solid #4b5563;
    padding: 0.35rem 0.4rem !important;
    z-index: 5;
}

.matrix-th-aktionen th:first-child {
    z-index: 8;
}

.aktion-h {
    display: inline-block;
    width: 32px;
    font-size: 0.85rem;
    font-weight: 800;
    color: #1f2933;
    letter-spacing: 0.05em;
}

/* Daten-Zellen */
table.matrix .matrix-cell {
    padding: 0.35rem 0.3rem;
    line-height: 1;
    min-width: 110px;
}

table.matrix tbody tr:nth-child(even) td {
    background: #fafbfc;
}

table.matrix tbody tr:nth-child(even) .matrix-td-ressource {
    background: #dde2e9;
}

table.matrix tbody tr:hover td {
    background: #eaf2fc;
}

table.matrix tbody tr:hover .matrix-td-ressource {
    background: #c8d3e3;
}

table.matrix .cell-locked {
    background: #e8e2e6 !important;
}

/* R/W/X-Checkboxen pro Zelle */
.cell-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    position: relative;
    cursor: pointer;
    border-radius: 4px;
}

.cell-action:hover {
    background: rgba(31, 95, 168, 0.12);
}

.cell-action.is-on {
    background: rgba(31, 95, 168, 0.18);
}

.cell-action.has-override {
    box-shadow: inset 0 0 0 2px #2c6cb0;
}

.cell-action input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #1f5fa8;
    /* Stärkerer Standard-Rahmen für nicht-WebKit */
    border: 2px solid #4b5563;
    border-radius: 3px;
}

.cell-action input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.cell-action-empty {
    color: #b5bcc7;
    user-select: none;
    cursor: default;
    font-size: 1rem;
    font-weight: 600;
}

/* Override-Dot oben rechts an der Zelle */
.override-dot {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #2c6cb0;
    box-shadow: 0 0 0 1.5px #ffffff;
    pointer-events: none;
}

.override-dot-inline {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #2c6cb0;
    box-shadow: 0 0 0 1.5px #ffffff;
    vertical-align: middle;
    margin: 0 0.2rem;
}

/* Bulk-Save-Buttons unter der Matrix */
.matrix-actions {
    display: flex;
    gap: 0.5rem;
    margin: 1.2rem 0 2rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Nav-Toggle (Mobile Hamburger) */
.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--slate-600);
    border-radius: 4px;
    padding: 0.3rem 0.55rem;
    font-size: 1.25rem;
    cursor: pointer;
    color: #ffffff;
    line-height: 1;
}

.nav-toggle:hover {
    background: var(--slate-700);
}

/* App-Shell: Sidebar + Container nebeneinander */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: calc(100vh - var(--topbar-height) - 60px);
}

/* Sidebar — hell, sauber, mit slate-Borders */
.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--c-border);
    padding: 1.2rem 0;
    overflow-y: auto;
    position: sticky;
    top: var(--topbar-height);
    height: calc(100vh - var(--topbar-height));
}

.nav-group {
    margin-bottom: 1.4rem;
    padding: 0 0.6rem;
}

.nav-group-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-500);
    padding: 0 0.7rem 0.4rem;
    font-weight: 600;
}

.nav-group-zentrale {
    border-top: 1px solid var(--c-border);
    padding-top: 1rem;
    margin-top: 0.6rem;
}

.nav-group-zentrale .nav-group-title {
    color: var(--amber-700);
}

.nav-link {
    display: block;
    padding: 0.4rem 0.7rem;
    color: var(--slate-700);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.875rem;
    line-height: 1.3;
}

.nav-link:hover {
    background: var(--slate-100);
    color: var(--slate-900);
    text-decoration: none;
}

.nav-link.active {
    background: var(--slate-800);
    color: #ffffff;
    font-weight: 500;
}

.nav-link-sub {
    font-size: 0.8rem;
    color: var(--c-muted);
    padding-left: 1.2rem;
}

.nav-backdrop {
    display: none;
}

/* Container — max-w-7xl wie Vereinskasse */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 2rem;
    width: 100%;
    min-width: 0;
}

/* Page-Header: H1 + Subtitle */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.875rem;       /* Tailwind text-3xl */
    font-weight: 700;
    margin: 0 0 0.4rem;
    color: var(--slate-900);
}

.page-header p {
    margin: 0;
    color: var(--slate-600);
}

/* Breadcrumbs */
.breadcrumbs {
    font-size: 0.88rem;
    color: var(--c-muted);
    margin-bottom: 0.6rem;
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

.breadcrumbs a {
    color: var(--c-muted);
}

.breadcrumbs a:hover {
    color: var(--c-primary);
}

.breadcrumbs span {
    color: var(--c-muted);
}

footer {
    text-align: center;
    color: var(--c-muted);
    padding: 1.5rem 0 2rem;
}

footer a {
    color: var(--c-muted);
}

h1 {
    font-size: 1.6rem;
    margin: 0.2rem 0 0.8rem;
}

h2 {
    font-size: 1.2rem;
    margin: 2rem 0 0.6rem;
}

.muted {
    color: var(--c-muted);
}

.empty {
    background: var(--c-card);
    border: 1px dashed var(--c-border);
    padding: 1.5rem;
    border-radius: 6px;
    text-align: center;
}

.row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

/* ===========================================================
   Karten + Sections
   =========================================================== */

/* Dashboard-Karten-Grid (Index, Mandanten-Übersicht etc.) */
.cards {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    margin-top: 1.5rem;
}

.cards.cards-stats {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

/* Card-Variante 1: Stat-Kachel (Zahlen-Kacheln auf Dashboards) */
.card-stat {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 1.25rem 1rem;
    text-align: center;
    color: var(--c-text);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    text-decoration: none;
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
}

a.card-stat:hover {
    border-color: var(--slate-400);
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08);
}

.card-num {
    font-size: 1.875rem;        /* Tailwind text-3xl */
    font-weight: 700;
    color: var(--slate-900);
}

.card-label {
    color: var(--c-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Card-Variante 2: Section-Box (rounded-lg shadow wie Vereinskasse) */
.card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
}

.card h2 {
    margin-top: 0;
}

/* Card-Variante 3: Klickbare Aktions-CTA (Index) */
.action-card {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    padding: 1.25rem;
    text-decoration: none;
    color: var(--c-text);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: border-color 120ms, box-shadow 120ms;
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
}

.action-card:hover {
    border-color: var(--slate-400);
    text-decoration: none;
    box-shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.08);
}

.action-card .ac-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--slate-900);
}

.action-card .ac-desc {
    color: var(--c-muted);
    font-size: 0.85rem;
}

/* Badges — Vereinskasse-Look (pill, dezent) */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
    border-radius: 4px;
    background: var(--slate-100);
    color: var(--slate-700);
    font-weight: 500;
    line-height: 1.4;
}

.badge-ok {
    background: var(--emerald-50);
    color: var(--emerald-700);
}

.badge-off {
    background: var(--slate-100);
    color: var(--slate-500);
}

.badge-warn {
    background: var(--amber-100);
    color: var(--amber-700);
}

/* Tabellen-Helper */
.col-actions {
    width: 1%;
    white-space: nowrap;
}

tr.row-inactive td {
    opacity: 0.55;
}

/* Tabellen — Vereinskasse-Look (Header bg-slate-100, divide-y) */
table.data {
    width: 100%;
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    margin-top: 1rem;
    box-shadow: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
}

table.data th,
table.data td {
    text-align: left;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--c-border);
    vertical-align: top;
    font-size: 0.875rem;
}

table.data thead th {
    background: var(--slate-100);
    font-weight: 600;
    color: var(--slate-700);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

table.data tbody tr:last-child td {
    border-bottom: none;
}

table.data tbody tr:hover td {
    background: var(--slate-50);
}

table.parcours tbody tr {
    background: var(--c-card);
}

/* Buttons — Vereinskasse-Look (rounded, slate-Farben) */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--slate-100);
    border: 1px solid var(--slate-300);
    border-radius: 6px;
    padding: 0.5rem 0.9rem;
    color: var(--slate-900);
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1.2;
    font-weight: 500;
    text-decoration: none;
    min-height: 36px;
    transition: background 120ms, border-color 120ms;
}

.btn:hover {
    background: var(--slate-200);
    border-color: var(--slate-400);
    text-decoration: none;
}

.btn.primary {
    background: var(--slate-800);
    border-color: var(--slate-800);
    color: #ffffff;
}

.btn.primary:hover {
    background: var(--slate-700);
    border-color: var(--slate-700);
}

.btn.danger {
    background: #ffffff;
    color: var(--rose-700);
    border-color: var(--rose-300);
}

.btn.danger:hover {
    background: var(--rose-600);
    border-color: var(--rose-600);
    color: #ffffff;
}

.btn.success {
    background: var(--emerald-600);
    border-color: var(--emerald-600);
    color: #ffffff;
}

.btn.success:hover {
    background: var(--emerald-700);
    border-color: var(--emerald-700);
}

.btn.small {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    min-height: 28px;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Forms */
.form {
    background: transparent;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 640px;
}

.form label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--slate-700);
}

.form label.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
}

/* Globale Input/Select-Styles im Admin-Container —
   gilt auch in form-inline, Filter-Bars, search-bars usw. */
.container input[type="text"],
.container input[type="search"],
.container input[type="email"],
.container input[type="number"],
.container input[type="password"],
.container input[type="tel"],
.container input[type="url"],
.container input[type="date"],
.container input[type="time"],
.container input[type="datetime-local"],
.container input:not([type]),
.container select,
.container textarea {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--slate-300);
    border-radius: 6px;
    font-size: 0.875rem;
    background: #ffffff;
    min-width: 0;
    max-width: 100%;
    font-family: inherit;
    color: var(--slate-900);
    line-height: 1.4;
    transition: border-color 120ms, box-shadow 120ms;
}

.container input:focus,
.container select:focus,
.container textarea:focus {
    outline: none;
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.container input::placeholder,
.container textarea::placeholder {
    color: var(--slate-400);
}

/* Innerhalb von .form sollen Inputs flexibel sein */
.form input:not([type="checkbox"]):not([type="radio"]),
.form select,
.form textarea {
    flex: 1 1 auto;
}

.form input[type="checkbox"],
.form input[type="radio"] {
    flex: 0 0 auto;
    width: auto;
}

.form .row {
    margin-top: 0.4rem;
    justify-content: flex-end;
}

.form-inline {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.6rem;
}

.form-inline input:not([type="checkbox"]):not([type="radio"]),
.form-inline select {
    flex: 1 1 240px;
}

/* Subnav (Buttons unter einer Heading) */
.subnav {
    display: flex;
    gap: 0.6rem;
    margin: 0.4rem 0 1.4rem;
    flex-wrap: wrap;
}

/* Callouts — Vereinskasse-Stil (rose/emerald/amber-50 BG + 300 Border) */
.callout {
    background: var(--amber-50);
    border: 1px solid var(--amber-100);
    border-left: 4px solid var(--amber-500);
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin: 0.5rem 0 1rem;
    font-size: 0.875rem;
    color: var(--amber-700);
}

.callout-success {
    background: var(--emerald-50);
    border-color: var(--emerald-200);
    border-left: 4px solid var(--emerald-600);
    color: var(--emerald-900);
}

.callout-danger {
    background: var(--rose-50);
    border-color: var(--rose-300);
    border-left: 4px solid var(--rose-600);
    color: var(--rose-900);
}

/* Helfer-PIN Flash-Block */
.pin-flash {
    padding: 1rem 1.2rem;
}

.pin-flash-inner {
    display: flex;
    gap: 1.5rem;
    align-items: baseline;
    flex-wrap: wrap;
}

.pin-flash-label {
    font-size: 1.05rem;
}

.pin-flash-code {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 2.2rem;
    letter-spacing: 0.25em;
    font-weight: 700;
    background: #ffffff;
    border: 1px solid #9bcf8f;
    border-radius: 6px;
    padding: 0.2rem 0.8rem;
    user-select: all;
}

.pin-flash-hint {
    margin-top: 0.7rem;
    font-size: 0.85rem;
}

/* Highlighted Row (Selektierter Fahrer in der Suche) */
table.data tbody tr.selected {
    background: var(--c-accent-bg);
}

/* Lauf-Erfassung */
.lauf-form {
    background: var(--c-card);
    border: 1px solid var(--c-border);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.6rem;
}

.lauf-meta {
    display: flex;
    gap: 1.2rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
}

.lauf-meta label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.92rem;
    color: var(--c-text);
}

.lauf-meta input,
.lauf-meta select {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--c-border);
    border-radius: 4px;
    background: #ffffff;
    font-size: 1rem;
    min-width: 0;
    max-width: 100%;
}

table.fehler-tabelle {
    margin-top: 0.6rem;
}

input.fehler-input {
    width: 4.5em;
    padding: 0.55rem 0.45rem;
    font-size: 1.15rem;
    text-align: center;
    border: 1px solid var(--c-border);
    border-radius: 4px;
    min-width: 0;
    max-width: 100%;
}

/* Wertungs-Tabelle */
table.wertung td.num,
table.wertung th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

table.wertung tr.row-pokal {
    background: #f3f7d6;
}

table.wertung tr.row-pokal td:first-child::before {
    content: "";
}

/* ===========================================================
   Mobile / Tablet-Querformat (Sidebar wird Drawer)
   Breakpoint 1100px deckt 1024×768-Tablets im Querformat ab.
   =========================================================== */

@media (max-width: 1100px) {
    .nav-toggle {
        display: inline-flex;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        width: 80%;
        max-width: 320px;
        height: calc(100vh - var(--topbar-height));
        transform: translateX(-100%);
        transition: transform 180ms ease;
        z-index: 90;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.08);
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    .nav-backdrop {
        display: block;
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
        z-index: 80;
    }

    body.nav-open .nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .container {
        padding: 1rem;
    }

    .topbar-user {
        display: none;
    }
}

@media (max-width: 720px) {
    table.data {
        font-size: 0.88rem;
    }
    table.data th,
    table.data td {
        padding: 0.45rem 0.5rem;
    }
    .pin-flash-code {
        font-size: 1.8rem;
    }
    h1 {
        font-size: 1.35rem;
    }
}
