.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 1rem;
    margin: 0;
}

/*
 * Abstände gehören zum Layout-Container, nicht zur Kachel selbst.
 * Dadurch werden Kacheln in Grid- und Flex-Layouts nicht mehr versetzt.
 */
.card-grid,
.card-stack {
    display: grid;
    gap: 0.75rem;
}

.card-grid > .card,
.card-stack > .card {
    margin: 0;
}

/* Direkte, frei untereinander stehende Seitenkacheln behalten Abstand. */
.page > .card + .card,
.page > .card + form.card,
.page > form.card + .card,
.page > form.card + form.card {
    margin-top: 0.75rem;
}

.card--inner {
    background: var(--color-surface-soft);
    box-shadow: none;
    padding: 0.65rem;
    margin-bottom: 0.55rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2.25rem;
    border: 1px solid rgba(201, 20, 43, 0.28);
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    background: linear-gradient(180deg, var(--color-accent-red), var(--color-accent-red-dark));
    color: #fff;
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(28, 39, 55, 0.08);
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.button:hover {
    background: linear-gradient(180deg, var(--color-accent-red-dark), #8f0c1c);
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(28, 39, 55, 0.12);
}

.button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(28, 39, 55, 0.08);
}

.button:disabled,
.button.is-disabled {
    border-color: var(--color-border);
    background: var(--color-primary-light);
    color: var(--color-muted);
    box-shadow: none;
    cursor: not-allowed;
}

.button:disabled:active,
.button.is-disabled:active {
    transform: none;
}

.button--secondary {
    border-color: var(--color-border);
    background: linear-gradient(180deg, #fff, var(--color-primary-light));
    color: var(--color-primary-dark);
}

.button--secondary:hover {
    border-color: var(--color-border-strong);
    background: linear-gradient(180deg, #fff, #e9edf3);
    color: var(--color-primary-dark);
}

.button--quiet {
    border-color: var(--color-border);
    background: var(--color-surface-soft);
    color: var(--color-primary-dark);
}

.button--quiet:hover {
    border-color: var(--color-border-strong);
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
}

.button--danger {
    background: var(--color-danger);
}

.button--danger:hover {
    background: var(--color-accent-red-dark);
}

.badge,
.status-dot {
    display: inline-block;
    border-radius: 999px;
    font-weight: 650;
    line-height: 1.2;
}

.badge {
    padding: 0.18rem 0.5rem;
    font-size: 0.8rem;
}

.badge--large {
    margin-top: 0.4rem;
    padding: 0.32rem 0.75rem;
    font-size: 0.95rem;
}

.status-dot {
    margin-left: 0.4rem;
    padding: 0.14rem 0.42rem;
    font-size: 0.76rem;
    background: #e5e7eb;
    color: var(--color-text);
    white-space: nowrap;
}

.badge--entwurf,
.status-dot--offen {
    background: #e5e7eb;
    color: #374151;
}

.badge--in_planung,
.status-dot--angefragt {
    background: #fff4bf;
    color: #6f5a00;
}

.badge--veroeffentlicht,
.status-dot--bestaetigt {
    background: #dff3e8;
    color: var(--color-success);
}

.badge--primary {
    border: 1px solid rgba(201, 20, 43, 0.18);
    background: var(--color-accent-red-soft);
    color: var(--color-accent-red-dark);
}

.badge--zur_freigabe {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge--abgesagt,
.status-dot--abgelehnt,
.status-dot--abgesagt {
    background: #f8dede;
    color: var(--color-danger);
}

.status-dot--ersatzkandidat {
    background: #e4e9f2;
    color: var(--color-primary-dark);
}

.notice {
    margin: 0;
    padding: 0.58rem 0.72rem;
    border: 1px solid #d7e0e8;
    border-radius: var(--radius);
    background: #f4f7fa;
    color: var(--color-text);
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.4;
}

.notice--info {
    border-color: #cedbe8;
    background: var(--color-info-soft);
    color: var(--color-info);
}

.notice--success {
    border-color: #b8ddc2;
    background: var(--color-success-soft);
    color: var(--color-success);
}

.notice--warning {
    border-color: #eadca0;
    background: var(--color-warning-soft);
    color: var(--color-warning);
}

.notice--error {
    border-color: #e2b9b9;
    background: var(--color-danger-soft);
    color: var(--color-danger);
}

.notice--compact {
    padding: 0.4rem 0.58rem;
    font-size: 0.8rem;
}

.notice strong,
.notice b {
    font-weight: 500;
}

main.page > .notice + .notice {
    margin-top: 0.4rem;
}

main.page > .notice + :not(.notice) {
    margin-top: 0.72rem;
}

.event-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.icon-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.7rem;
    height: 1.7rem;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
    color: var(--color-primary-dark);
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
}

.icon-action:hover {
    background: var(--color-primary-light);
    text-decoration: none;
}

.icon-action--danger {
    color: var(--color-danger);
}
.obsolete-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    width: max-content;
    max-width: 100%;
    padding: 0.12rem 0.42rem;
    border: 1px solid #ef4444;
    border-radius: 999px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.15;
    white-space: nowrap;
    cursor: help;
}

.obsolete-badge__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1;
}

.obsolete-badge::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.45rem);
    z-index: 100001;
    display: none;
    width: max-content;
    max-width: min(22rem, 80vw);
    padding: 0.45rem 0.55rem;
    border-radius: var(--radius);
    background: #111827;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
    box-shadow: 0 8px 24px rgba(0,0,0,0.22);
    transform: translateX(-50%);
}

.obsolete-badge::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(100% + 0.15rem);
    z-index: 100002;
    display: none;
    width: 0;
    height: 0;
    border-left: 0.35rem solid transparent;
    border-right: 0.35rem solid transparent;
    border-top: 0.35rem solid #111827;
    transform: translateX(-50%);
}

.obsolete-badge:hover::after,
.obsolete-badge:hover::before,
.obsolete-badge:focus::after,
.obsolete-badge:focus::before {
    display: block;
}

.badge--test {
    background: #fff3cd;
    border-color: #d39e00;
    color: #6b4f00;
}

/* Testlehrgänge bleiben in allen internen Ansichten eindeutig erkennbar. */
.test-mode,
.test-mode-panel,
.test-mode-banner {
    --test-mode-accent: #6f42c1;
    --test-mode-border: #a98bd4;
    --test-mode-surface: #f4effb;
    --test-mode-surface-strong: #ebe1f7;
}

.view-as-banner {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.55rem 1rem;
    background: #ffd200;
    color: #252b36;
    border-bottom: 2px solid #b98500;
    box-shadow: 0 4px 14px rgba(28, 39, 55, 0.18);
}

.view-as-banner__inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.view-as-banner__readonly {
    padding: 0.12rem 0.45rem;
    border: 1px solid rgba(37, 43, 54, 0.45);
    border-radius: 999px;
    font-size: 0.78rem;
}

.view-as-banner form {
    margin-left: auto;
}

.view-as-banner .button {
    background: #2f3948;
    border-color: #2f3948;
    color: #fff;
}

@media (max-width: 640px) {
    .view-as-banner__inner {
        align-items: stretch;
    }

    .view-as-banner form {
        width: 100%;
        margin-left: 0;
    }

    .view-as-banner .button {
        width: 100%;
    }
}

.test-mode .site-header {
    box-shadow: inset 0 -4px 0 var(--test-mode-accent);
}

.test-mode .page-header,
.test-mode .entry-accordion,
.test-mode .card,
.test-mode .billing-flat-section {
    border-color: var(--test-mode-border);
}

.test-mode .entry-accordion__summary,
.test-mode details.card > summary {
    background: var(--test-mode-surface);
    background-clip: padding-box;
}

.test-mode details.card > summary {
    border-radius: calc(var(--radius) - 1px);
}

.test-mode details.card[open] > summary {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.test-mode .button:not(.button--danger):not(.button--success) {
    border-color: var(--test-mode-border);
}

.test-mode-banner {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0 0 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--test-mode-border);
    border-left: 0.35rem solid var(--test-mode-accent);
    border-radius: var(--radius);
    background: var(--test-mode-surface);
    color: #3f2a66;
    font-size: 0.88rem;
    font-weight: 400;
}

.test-mode-row > td,
tr.test-mode-row > td {
    background: #f7f3fc;
}

.test-mode-panel {
    border-color: var(--test-mode-border) !important;
    background: var(--test-mode-surface) !important;
}

.test-mode-panel > .entry-accordion__summary {
    background: var(--test-mode-surface-strong);
}

.badge--test {
    background: #eee5fa;
    border-color: #8b5fc6;
    color: #4d287c;
}

@media (max-width: 700px) {
    .test-mode-banner {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.3rem;
    }
}

/* Graduierungen: Sportart und Graduierung bleiben als gemeinsame, ruhig lesbare Einheit zusammen. */
.graduation-chips {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .22rem .3rem;
    min-width: 0;
    vertical-align: middle;
}
.graduation-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: .12rem .38rem;
    border: 1px solid color-mix(in srgb, var(--color-border) 82%, transparent);
    border-radius: .42rem;
    background: color-mix(in srgb, var(--color-surface-soft) 74%, var(--color-surface));
    color: inherit;
    font-size: .92em;
    font-weight: 400;
    line-height: 1.25;
    white-space: nowrap;
}
.graduation-chips--compact {
    gap: .14rem .22rem;
}
.graduation-chips--compact .graduation-chip {
    padding: .08rem .3rem;
    border-radius: .36rem;
    font-size: .9em;
}
.graduation-chips--summary {
    justify-content: flex-end;
}
@media (max-width: 620px) {
    .graduation-chip {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Auf Touch-Geräten bleibt das Symbol klein, die antippbare Fläche wird aber vernünftig groß. */
@media (max-width: 800px) and (pointer: coarse) {
    .icon-action {
        width: 2.25rem !important;
        height: 2.25rem !important;
        min-width: 2.25rem !important;
        min-height: 2.25rem !important;
        border-color: transparent;
        background: transparent;
        font-size: 0.85rem;
    }

    .icon-action:focus-visible,
    .icon-action:active {
        border-color: var(--color-border);
        background: var(--color-primary-light);
    }
}

/* Einheitliche Navigationssprache: große Seitentabs und kompakte Bereichstabs.
 * Seitentabs am oberen Rand sehen überall identisch aus. Keine Modul-Sonderlocken. */
.page-tabs {
    display: flex;
    align-items: flex-end;
    gap: 0.18rem;
    margin: 0 0 0.9rem;
    padding: 0 0.35rem;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 1px solid var(--color-border-strong, var(--color-border));
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.page-tabs::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

.page-tab {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 2.8rem;
    margin: 0;
    padding: 0.62rem 1rem 0.58rem;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 0.55rem 0.55rem 0 0;
    background: transparent;
    color: var(--color-muted);
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}

.page-tab:hover {
    border-color: var(--color-border);
    border-bottom-color: transparent;
    background: rgba(255, 255, 255, 0.52);
    color: var(--color-primary-dark);
    text-decoration: none;
}

.page-tab.is-active,
.page-tab[aria-current="page"] {
    margin-bottom: -1px;
    border-color: var(--color-border-strong, var(--color-border));
    border-bottom-color: var(--color-surface);
    background: var(--color-surface);
    color: var(--color-primary-dark);
}

.page-tab.is-active::after,
.page-tab[aria-current="page"]::after {
    content: "";
    position: absolute;
    top: -1px;
    right: 0.45rem;
    left: 0.45rem;
    height: 3px;
    border-radius: 999px 999px 0 0;
    background: var(--color-accent-red);
}

.section-tabs {
    display: inline-flex;
    max-width: 100%;
    gap: 0.2rem;
    margin: 0 0 0.75rem;
    padding: 0.22rem;
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: 0.58rem;
    background: var(--color-surface-soft);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.section-tab {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0.38rem 0.7rem;
    border: 1px solid transparent;
    border-radius: 0.42rem;
    background: transparent;
    color: var(--color-muted);
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.15;
    text-decoration: none;
    white-space: nowrap;
}

.section-tab:hover {
    background: rgba(255,255,255,0.72);
    color: var(--color-primary-dark);
    text-decoration: none;
}

.section-tab.is-active,
.section-tab[aria-current="page"] {
    border-color: var(--color-border);
    background: var(--color-surface);
    color: var(--color-primary-dark);
    box-shadow: 0 1px 2px rgba(28, 39, 55, 0.08);
}

.event-context-tabs {
    margin-bottom: 0.8rem;
}

@media (max-width: 700px) {
    .page-tabs {
        padding-inline: 0;
    }

    .page-tab {
        min-height: 2.55rem;
        padding-inline: 0.78rem;
        font-size: 0.88rem;
    }
}
