:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #687386;
    --border: #dfe5ec;
    --primary: #123c88;
    --primary-dark: #0d2f70;
    --accent: #f4df18;
    --success: #147a45;
    --success-bg: #e8f7ef;
    --danger: #b42318;
    --danger-bg: #fff0ee;
    --shadow: 0 10px 30px rgba(23, 32, 51, 0.08);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

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

a:hover {
    text-decoration: underline;
}

button,
input {
    font: inherit;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    background: #0f357c;
    border-bottom: 4px solid var(--accent);
    color: #fff;
}

.topbar-inner {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: var(--accent);
    color: #172033;
    font-size: 13px;
    font-weight: 900;
}

.nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.nav a,
.link-button {
    color: #fff;
    font-weight: 650;
}

.nav-user {
    color: #dce7ff;
    padding-left: 10px;
    border-left: 1px solid rgba(255,255,255,.25);
}

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

.link-button {
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.link-button:hover {
    text-decoration: underline;
}

.main-content {
    padding: 36px 0 64px;
}

.footer {
    border-top: 1px solid var(--border);
    background: #fff;
    color: var(--muted);
}

.footer-inner {
    min-height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    font-size: 14px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(30px, 4vw, 46px);
    line-height: 1.08;
    letter-spacing: -0.035em;
}

h2 {
    margin-bottom: 10px;
    font-size: 23px;
    letter-spacing: -0.02em;
}

.eyebrow {
    margin-bottom: 5px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .12em;
}

.muted,
.help-text {
    color: var(--muted);
}

.help-text {
    margin: -2px 0 0;
    font-size: 14px;
}

.page-heading {
    margin-bottom: 26px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
}

.dashboard-heading {
    align-items: center;
}

.heading-actions {
    flex: 0 0 auto;
}

.card {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card-body {
    padding: 26px;
}

.auth-card {
    width: min(520px, 100%);
    margin: 40px auto;
}

.form-card {
    max-width: 680px;
}

.grid {
    display: grid;
    gap: 24px;
}

.two-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.section-heading,
.card-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.card-header-row {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
}

.card-header-row h2,
.card-header-row p {
    margin-bottom: 0;
}

.stack-form {
    display: grid;
    gap: 18px;
}

.stack-form label:not(.check-row) {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

.stack-form label small {
    color: var(--muted);
    font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="time"] {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cbd4df;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    outline: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(18, 60, 136, .12);
}

fieldset {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

legend {
    padding: 0 6px;
    color: var(--text);
    font-weight: 800;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 5px 0;
    font-weight: 650;
}

.check-row input {
    width: 18px;
    height: 18px;
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .08s ease, background .15s ease, border-color .15s ease;
}

.button:hover {
    text-decoration: none;
}

.button:active {
    transform: translateY(1px);
}

.button-primary {
    background: var(--primary);
    color: #fff;
}

.button-primary:hover {
    background: var(--primary-dark);
}

.button-secondary {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

.button-secondary:hover {
    border-color: #b8c3d0;
    background: #f8fafc;
}

.button-danger-outline {
    background: #fff;
    border-color: #efb6af;
    color: var(--danger);
}

.button-small {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 14px;
}

.danger-zone {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.alert {
    margin-bottom: 18px;
    padding: 13px 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 650;
}

.alert-success {
    border-color: #b8e0c9;
    background: var(--success-bg);
    color: var(--success);
}

.alert-error {
    border-color: #f0beb9;
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-info {
    border-color: #c9daf8;
    background: #eef4ff;
    color: #234b91;
}

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 850;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-muted {
    background: #edf0f4;
    color: #5f6b7b;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.status-card {
    display: grid;
    gap: 4px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}

.status-card strong {
    font-size: 19px;
}

.status-card small,
.status-label {
    color: var(--muted);
}

.status-label {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.empty-state {
    text-align: center;
}

.empty-state .card-body {
    padding: 44px 24px;
}

.availability-list {
    display: grid;
    gap: 22px;
}

.table-wrap {
    overflow-x: auto;
}

.availability-table,
.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.availability-table th,
.availability-table td,
.admin-table th,
.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.availability-table thead th,
.admin-table thead th {
    background: #f8fafc;
    color: #596579;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.availability-table tbody tr:last-child td,
.availability-table tbody tr:last-child th,
.admin-table tbody tr:last-child td {
    border-bottom: 0;
}

.time-cell {
    width: 90px;
    font-size: 18px;
}

.slot-unavailable {
    display: inline-block;
    color: #8a3440;
    font-weight: 800;
}

.slot-unknown {
    color: #9aa4b3;
}

.availability-table td > small,
.admin-table td small,
.slot-available > small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
}

.slot-available {
    min-width: 250px;
    padding: 10px 12px;
    border: 1px solid #b9e3ca;
    border-radius: 9px;
    background: var(--success-bg);
}

.slot-available > strong {
    color: var(--success);
}

.court-line {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(20, 122, 69, .15);
    font-size: 14px;
}

.court-line > span:last-child {
    text-align: right;
    font-weight: 700;
}

.court-line small {
    display: block;
    color: var(--muted);
    font-weight: 500;
}

.admin-table td strong,
.admin-table td small {
    display: block;
}

.align-right {
    text-align: right !important;
}

@media (max-width: 850px) {
    .two-columns,
    .status-grid {
        grid-template-columns: 1fr;
    }

    .page-heading,
    .dashboard-heading,
    .footer-inner,
    .topbar-inner {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-inner {
        padding: 15px 0;
    }

    .nav {
        gap: 12px;
    }

    .nav-user {
        padding-left: 0;
        border-left: 0;
    }

    .heading-actions,
    .heading-actions form,
    .heading-actions .button {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .shell {
        width: min(100% - 20px, 1180px);
    }

    .main-content {
        padding-top: 24px;
    }

    .card-body,
    .card-header-row {
        padding: 18px;
    }

    .availability-table th,
    .availability-table td,
    .admin-table th,
    .admin-table td {
        padding: 11px 10px;
    }

    .slot-available {
        min-width: 220px;
    }
}

.table-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

/* v0.4.1: Navigation bleibt beim Scrollen sichtbar. */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 14px rgba(15, 53, 124, 0.14);
}

.no-free-slots {
    padding: 24px;
    color: var(--muted);
    background: var(--surface);
    font-weight: 650;
}

/* v0.5.0 */
select {
    width: 100%;
    min-height: 44px;
    padding: 10px 38px 10px 12px;
    border: 1px solid #cbd4df;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font: inherit;
    outline: none;
}

select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(18, 60, 136, .12);
}

.invite-result {
    overflow-wrap: anywhere;
}

.invite-result a {
    font-weight: 700;
}

/* v0.6.0 */
.brand-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}

.button:disabled {
    cursor: not-allowed;
    opacity: .62;
    transform: none;
}

.button-primary:disabled:hover {
    background: var(--primary);
}

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

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.day-picker {
    position: relative;
}

.day-picker > summary {
    list-style: none;
    user-select: none;
}

.day-picker > summary::-webkit-details-marker {
    display: none;
}

.day-picker > summary::after {
    content: '▾';
    margin-left: 9px;
    font-size: 12px;
}

.day-picker[open] > summary::after {
    content: '▴';
}

.day-picker-menu {
    position: absolute;
    z-index: 50;
    top: calc(100% + 8px);
    right: 0;
    width: min(520px, calc(100vw - 32px));
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: 0 18px 45px rgba(23, 32, 51, .18);
}

.day-picker-title {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.day-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 7px;
}

.day-picker-link {
    display: grid;
    gap: 1px;
    min-width: 0;
    padding: 8px 9px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    background: #fff;
}

.day-picker-link:hover {
    border-color: #b8c3d0;
    background: var(--surface-soft);
    text-decoration: none;
}

.day-picker-link span {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-picker-link strong {
    font-size: 14px;
}

.day-picker-link.is-active {
    border-color: var(--primary);
    background: #eef4ff;
    color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.day-availability-panel {
    display: grid;
    grid-template-columns: minmax(260px, .9fr) minmax(0, 1.6fr);
    gap: 22px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--border);
    background: #fff;
}

.my-day-availability h3 {
    margin: 0 0 5px;
    font-size: 18px;
}

.my-day-availability .muted {
    margin-bottom: 14px;
    font-size: 14px;
}

.availability-choice {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.choice-button {
    min-height: 38px;
    padding: 7px 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.choice-button:hover {
    background: var(--surface-soft);
}

.choice-yes.is-active {
    border-color: #8fd0aa;
    background: var(--success-bg);
    color: var(--success);
    box-shadow: inset 0 0 0 1px #8fd0aa;
}

.choice-no.is-active {
    border-color: #efb6af;
    background: var(--danger-bg);
    color: var(--danger);
    box-shadow: inset 0 0 0 1px #efb6af;
}

.choice-open.is-active {
    border-color: #b8c3d0;
    background: #edf0f4;
    color: #5f6b7b;
    box-shadow: inset 0 0 0 1px #b8c3d0;
}

.team-availability {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.team-status-group {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}

.team-status-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 9px;
    font-size: 14px;
}

.person-chip-list {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.person-chip {
    display: inline-flex;
    max-width: 100%;
    padding: 4px 7px;
    border-radius: 999px;
    background: #fff;
    color: #445065;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.compact-empty {
    font-size: 12px;
}

.availability-table {
    table-layout: fixed;
}

.availability-table.duration-columns-2 {
    min-width: 620px;
}

.availability-table.duration-columns-1 {
    min-width: 480px;
}

.availability-table .col-start {
    width: 16%;
}

.availability-table.duration-columns-2 .col-duration {
    width: 42%;
}

.availability-table.duration-columns-1 .col-duration {
    width: 84%;
}

.availability-table .time-cell {
    width: auto;
}

.availability-table .slot-available {
    min-width: 0;
    width: 100%;
}

.auth-secondary-link {
    justify-self: start;
    font-weight: 700;
}

.reset-password-form {
    margin-top: 18px;
}

@media (max-width: 850px) {
    .dashboard-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-actions > *,
    .dashboard-actions form,
    .dashboard-actions .button,
    .dashboard-actions summary {
        width: 100%;
    }

    .day-picker-menu {
        right: auto;
        left: 0;
    }

    .day-availability-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .day-picker-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .day-picker-menu {
        width: calc(100vw - 20px);
        max-height: min(70vh, 560px);
        overflow-y: auto;
    }

    .day-availability-panel {
        padding: 18px;
    }

    .team-availability {
        grid-template-columns: 1fr;
    }

    .availability-choice {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .choice-button {
        padding-left: 7px;
        padding-right: 7px;
        font-size: 13px;
    }
}

/* v0.7.0 */
.weekday-selector {
    display: flex;
    flex-wrap: nowrap;
    gap: 9px;
    width: 100%;
    margin: -10px 0 24px;
    padding: 2px 0 6px;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.weekday-button {
    flex: 1 0 0;
    min-width: 118px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(23, 32, 51, .03);
}

.weekday-button:hover {
    border-color: #b8c3d0;
    background: var(--surface-soft);
    text-decoration: none;
}

.weekday-button.is-active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 5px 14px rgba(18, 60, 136, .18);
}

.selected-weekday-summary {
    display: flex;
    align-items: baseline;
    gap: 9px;
    margin: 24px 0 12px;
    color: var(--muted);
    font-size: 14px;
}

.selected-weekday-summary strong {
    color: var(--text);
    font-size: 16px;
}

.availability-day {
    scroll-margin-top: 92px;
}

@media (max-width: 850px) {
    .weekday-button {
        flex: 0 0 auto;
        min-width: 108px;
    }
}

@media (max-width: 600px) {
    .weekday-selector {
        margin-top: -4px;
        gap: 7px;
    }

    .weekday-button {
        min-width: 96px;
        padding: 9px 11px;
        font-size: 13px;
    }

    .selected-weekday-summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }
}

/* v0.7.1: durchgehend responsive Oberfläche ohne horizontales Scrollen. */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

.shell,
.card,
.card-body,
.grid,
.grid > *,
.page-heading,
.page-heading > *,
.status-grid,
.status-card,
.availability-list,
.availability-day,
.day-availability-panel,
.my-day-availability,
.team-availability,
.team-status-group,
.table-wrap {
    min-width: 0;
}

.mobile-menu {
    display: none;
    position: relative;
    margin-left: auto;
}

.mobile-menu > summary {
    list-style: none;
}

.mobile-menu > summary::-webkit-details-marker {
    display: none;
}

.mobile-menu-toggle {
    width: 46px;
    height: 46px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 5px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 11px;
    background: rgba(255, 255, 255, .08);
    cursor: pointer;
    user-select: none;
}

.mobile-menu-toggle span {
    width: 22px;
    height: 2px;
    border-radius: 999px;
    background: #fff;
    transition: transform .15s ease, opacity .15s ease;
}

.mobile-menu[open] .mobile-menu-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-menu[open] .mobile-menu-toggle span:nth-child(2) {
    opacity: 0;
}

.mobile-menu[open] .mobile-menu-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.mobile-menu-panel {
    position: absolute;
    z-index: 1200;
    top: calc(100% + 10px);
    right: 0;
    width: min(290px, calc(100vw - 20px));
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid rgba(15, 53, 124, .12);
    border-radius: 14px;
    background: #fff;
    color: var(--text);
    box-shadow: 0 18px 48px rgba(23, 32, 51, .22);
}

.mobile-menu-panel a,
.mobile-menu-logout {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 750;
    text-align: left;
}

.mobile-menu-panel a:hover,
.mobile-menu-logout:hover {
    background: var(--surface-soft);
    text-decoration: none;
}

.mobile-menu-user {
    display: block;
    margin: 2px 4px 6px;
    padding: 4px 8px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.mobile-menu-panel form {
    margin: 0;
}

.mobile-menu-logout {
    cursor: pointer;
}

.weekday-selector {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 9px;
    width: 100%;
    margin: -10px 0 24px;
    padding: 2px 0 6px;
    overflow: visible;
}

.weekday-button {
    min-width: 0;
    width: 100%;
    white-space: normal;
}

.availability-table-wrap,
.table-wrap {
    max-width: 100%;
}

.availability-table {
    min-width: 0 !important;
}

.availability-table td,
.availability-table th,
.admin-table td,
.admin-table th {
    overflow-wrap: anywhere;
    word-break: normal;
}

.court-line > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .topbar-inner {
        min-height: 66px;
        padding: 9px 0;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .brand {
        min-width: 0;
        font-size: 17px;
    }

    .brand span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .desktop-nav {
        display: none;
    }

    .mobile-menu {
        display: block;
    }

    .weekday-selector {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .weekday-button {
        min-width: 0;
    }
}

@media (max-width: 760px) {
    .topbar-inner {
        min-height: 66px;
        padding: 9px 0;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    .brand {
        min-width: 0;
        font-size: 17px;
    }

    .brand span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .desktop-nav {
        display: none;
    }

    .mobile-menu {
        display: block;
    }

    .main-content {
        padding-top: 22px;
    }

    .page-heading,
    .dashboard-heading {
        gap: 16px;
        margin-bottom: 20px;
    }

    .page-heading h1 {
        font-size: clamp(30px, 10vw, 40px);
        overflow-wrap: anywhere;
    }

    .heading-actions,
    .heading-actions form,
    .heading-actions .button {
        max-width: 100%;
    }

    .status-grid {
        gap: 10px;
    }

    .status-card {
        padding: 15px 16px;
    }

    .card-header-row {
        align-items: flex-start;
    }

    .card-header-row .badge {
        flex: 0 0 auto;
        max-width: 45%;
        white-space: normal;
        text-align: center;
    }

    .day-availability-panel {
        gap: 14px;
    }

    .team-availability {
        grid-template-columns: 1fr;
    }

    .availability-table-wrap {
        overflow: visible;
        padding: 12px;
        border-top: 1px solid var(--border);
        background: var(--surface-soft);
    }

    .availability-table,
    .availability-table tbody {
        display: block;
        width: 100%;
    }

    .availability-table colgroup,
    .availability-table thead {
        display: none;
    }

    .availability-table tbody {
        display: grid;
        gap: 12px;
    }

    .availability-table tbody tr {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 3px 12px rgba(23, 32, 51, .04);
    }

    .availability-table tbody tr:last-child td,
    .availability-table tbody tr:last-child th {
        border-bottom: initial;
    }

    .availability-table .time-cell {
        grid-column: 1 / -1;
        width: 100%;
        display: flex;
        align-items: baseline;
        gap: 8px;
        padding: 0 0 7px;
        border: 0;
        border-bottom: 1px solid var(--border);
        font-size: 20px;
    }

    .availability-table .time-cell::before {
        content: 'Start';
        color: var(--muted);
        font-size: 11px;
        font-weight: 850;
        text-transform: uppercase;
        letter-spacing: .06em;
    }

    .availability-table td {
        min-width: 0;
        display: block;
        padding: 9px;
        border: 1px solid var(--border) !important;
        border-radius: 10px;
        background: var(--surface-soft);
    }

    .availability-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 6px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 850;
        line-height: 1.2;
        text-transform: uppercase;
        letter-spacing: .05em;
    }

    .availability-table.duration-columns-1 td {
        grid-column: 1 / -1;
    }

    .availability-table .slot-available {
        width: 100%;
        min-width: 0;
        padding: 0;
        border: 0;
        background: transparent;
    }

    .availability-table .slot-available > strong {
        display: block;
        font-size: 14px;
        line-height: 1.25;
    }

    .availability-table .slot-available > small,
    .availability-table td > small {
        font-size: 11px;
        line-height: 1.25;
    }

    .court-line {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1px;
        margin-top: 6px;
        padding-top: 6px;
        font-size: 12px;
        line-height: 1.3;
    }

    .court-line > span:last-child {
        text-align: left;
        font-weight: 750;
    }

    .court-line small {
        font-size: 10px;
    }

    .admin-table,
    .admin-table tbody,
    .admin-table tr,
    .admin-table td {
        display: block;
        width: 100%;
    }

    .admin-table thead {
        display: none;
    }

    .admin-table tbody {
        display: grid;
        gap: 12px;
        padding: 12px;
        background: var(--surface-soft);
    }

    .admin-table tr {
        padding: 8px 12px;
        border: 1px solid var(--border);
        border-radius: 12px;
        background: #fff;
    }

    .admin-table td {
        display: grid;
        grid-template-columns: minmax(84px, 34%) minmax(0, 1fr);
        gap: 10px;
        padding: 9px 0;
        border-bottom: 1px solid var(--border);
        text-align: left !important;
    }

    .admin-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 11px;
        font-weight: 850;
        text-transform: uppercase;
        letter-spacing: .05em;
    }

    .admin-table td:last-child {
        border-bottom: 0;
    }

    .admin-table .table-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 600px) {
    .shell {
        width: calc(100% - 20px);
    }

    .weekday-selector {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
        margin-top: -2px;
    }

    .weekday-button {
        padding: 10px 8px;
        font-size: 14px;
    }

    .availability-choice {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .choice-button {
        min-width: 0;
        white-space: normal;
    }

    .footer-inner {
        gap: 6px;
    }
}

@media (max-width: 380px) {
    .brand {
        font-size: 15px;
    }

    .brand-icon {
        width: 34px;
        height: 34px;
    }

    .mobile-menu-toggle {
        width: 42px;
        height: 42px;
    }

    .availability-table tbody tr {
        padding: 9px;
        gap: 6px;
    }

    .availability-table td {
        padding: 7px;
    }

    .availability-choice {
        grid-template-columns: 1fr;
    }
}

/* v0.8.0: sticky Header, Versionsbadge, PWA-Installation, Hilfe und Admin-Zeitfenster. */
html,
body {
    max-width: 100%;
    overflow-x: clip;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 2000;
    width: 100%;
    box-shadow: 0 5px 16px rgba(15, 53, 124, .16);
}

.version-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 3px 8px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    background: rgba(255, 255, 255, .10);
    color: #fff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: .025em;
    white-space: nowrap;
}

.version-badge-accent {
    border-color: #e9d20c;
    background: var(--accent);
    color: #172033;
    box-shadow: 0 0 0 3px rgba(244, 223, 24, .14);
}

.nav-install-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    font: inherit;
    font-weight: 650;
    cursor: pointer;
}

.nav-install-button:hover {
    text-decoration: underline;
}

.mobile-menu-install {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 750;
    text-align: left;
    cursor: pointer;
}

.mobile-menu-install:hover {
    background: var(--surface-soft);
}

.mobile-menu-version {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 4px 2px;
    padding: 10px 8px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.settings-grid {
    align-items: start;
}

.admin-settings-card {
    grid-column: 1 / -1;
}

.time-window-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.time-window-grid label {
    display: grid;
    gap: 7px;
    font-weight: 700;
}

.setting-summary {
    display: grid;
    gap: 3px;
    margin-top: 22px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-soft);
}

.setting-summary span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .055em;
}

.setting-summary strong {
    font-size: 16px;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.help-card-wide {
    grid-column: 1 / -1;
}

.help-card p:last-child,
.help-card dl:last-child,
.help-card ol:last-child {
    margin-bottom: 0;
}

.help-steps {
    margin: 18px 0;
    padding-left: 22px;
}

.help-steps li + li {
    margin-top: 8px;
}

.help-note {
    padding: 12px 14px;
    border-left: 4px solid var(--primary);
    border-radius: 0 9px 9px 0;
    background: #eef4ff;
    color: #34435d;
    font-size: 14px;
}

.security-list {
    display: grid;
    gap: 0;
    margin: 18px 0;
}

.security-list > div {
    display: grid;
    grid-template-columns: minmax(120px, .38fr) minmax(0, 1fr);
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}

.security-list > div:last-child {
    border-bottom: 0;
}

.security-list dt {
    color: var(--muted);
    font-size: 13px;
    font-weight: 850;
}

.security-list dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    background: #eef1f5;
    color: #23324b;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .9em;
    overflow-wrap: anywhere;
}

.security-table-wrap {
    max-width: 100%;
    overflow: visible;
}

.security-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.security-table th,
.security-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.security-table th {
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.security-table th:nth-child(1) { width: 26%; }
.security-table th:nth-child(2) { width: 27%; }
.security-table th:nth-child(3) { width: 47%; }

.is-standalone .topbar {
    padding-top: env(safe-area-inset-top, 0px);
}

@media (max-width: 760px) {
    .help-grid {
        grid-template-columns: 1fr;
    }

    .help-card-wide {
        grid-column: auto;
    }

    .time-window-grid {
        grid-template-columns: 1fr;
    }

    .security-table,
    .security-table tbody,
    .security-table tr,
    .security-table td {
        display: block;
        width: 100%;
    }

    .security-table thead {
        display: none;
    }

    .security-table tbody {
        display: grid;
        gap: 12px;
    }

    .security-table tr {
        padding: 10px 12px;
        border: 1px solid var(--border);
        border-radius: 11px;
        background: #fff;
    }

    .security-table td {
        padding: 8px 0;
        border-bottom: 1px solid var(--border);
    }

    .security-table td:last-child {
        border-bottom: 0;
    }

    .security-table td::before {
        display: block;
        margin-bottom: 2px;
        color: var(--muted);
        font-size: 10px;
        font-weight: 850;
        text-transform: uppercase;
        letter-spacing: .055em;
    }

    .security-table td:nth-child(1)::before { content: 'Datenart'; }
    .security-table td:nth-child(2)::before { content: 'Speicherung'; }
    .security-table td:nth-child(3)::before { content: 'Hinweis'; }

    .security-list > div {
        grid-template-columns: 1fr;
        gap: 3px;
    }
}


/* PWA-Installation */
[hidden] {
    display: none !important;
}

html.has-modal,
html.has-modal body {
    overflow: hidden;
}

.pwa-install-backdrop {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(10, 24, 48, .58);
}

.pwa-install-modal {
    position: relative;
    width: min(560px, 100%);
    max-height: min(720px, calc(100dvh - 40px));
    overflow-y: auto;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(10, 24, 48, .28);
}

.pwa-install-modal h2 {
    margin: 4px 44px 14px 0;
}

.pwa-install-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text);
    font: inherit;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.pwa-install-help {
    color: var(--text);
    line-height: 1.55;
}

.pwa-install-help p {
    margin: 0 0 14px;
}

.pwa-install-help ol {
    margin: 0 0 16px;
    padding-left: 24px;
}

.pwa-install-help li + li {
    margin-top: 8px;
}

.pwa-install-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

@media (max-width: 640px) {
    .pwa-install-backdrop {
        align-items: end;
        padding: 10px;
    }

    .pwa-install-modal {
        width: 100%;
        max-height: calc(100dvh - 20px);
        padding: 22px 18px 18px;
        border-radius: 18px;
    }

    .pwa-install-actions .button {
        width: 100%;
    }
}

/* v0.9.2: kompakte Wochentage, Verfügbarkeiten und PayPal-Liste. */
.weekday-selector {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 7px;
}

.weekday-button {
    min-width: 0;
    padding-left: 6px;
    padding-right: 6px;
    white-space: nowrap;
}

.paypal-card {
    overflow: hidden;
}

.paypal-list {
    display: grid;
}

.paypal-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-width: 0;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.paypal-row:last-child {
    border-bottom: 0;
}

.paypal-person {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.paypal-person strong {
    font-size: 16px;
}

.paypal-person span {
    min-width: 0;
    color: var(--muted);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.paypal-open-button {
    flex: 0 0 auto;
}

@media (max-width: 760px) {
    .weekday-selector {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 5px;
        margin-bottom: 16px;
    }

    .weekday-button {
        min-height: 42px;
        padding: 8px 3px;
        border-radius: 9px;
        font-size: 13px;
        line-height: 1;
    }

    .day-availability-panel {
        gap: 12px;
        padding: 12px 14px;
    }

    .my-day-availability h3 {
        margin-bottom: 2px;
        font-size: 17px;
    }

    .my-day-availability .muted {
        margin: 0 0 9px;
        font-size: 13px;
        line-height: 1.35;
    }

    .availability-choice {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .choice-button {
        min-height: 38px;
        padding: 7px 5px;
        font-size: 12px;
        white-space: nowrap;
    }

    .team-availability {
        gap: 6px;
    }

    .team-status-group {
        padding: 8px 10px;
        border-radius: 9px;
    }

    .team-status-heading {
        margin-bottom: 5px;
        font-size: 13px;
    }

    .team-status-heading .badge {
        min-width: 28px;
        min-height: 28px;
        padding: 4px 7px;
    }

    .person-chip-list {
        gap: 4px;
    }

    .person-chip {
        padding: 3px 6px;
        font-size: 11px;
    }

    .compact-empty {
        font-size: 11px;
    }

    .paypal-row {
        gap: 10px;
        padding: 12px 14px;
    }

    .paypal-person strong {
        font-size: 14px;
    }

    .paypal-person span {
        font-size: 12px;
    }

    .paypal-open-button {
        padding: 8px 10px;
        font-size: 12px;
    }
}

@media (max-width: 420px) {
    .weekday-selector {
        gap: 4px;
    }

    .weekday-button {
        min-height: 39px;
        padding: 7px 2px;
        font-size: 12px;
    }

    .availability-choice {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .choice-button {
        font-size: 11px;
    }

    .paypal-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .paypal-open-button {
        width: 100%;
    }
}

/* v0.9.3: PWA-Diagnose im Installationsdialog. */
.pwa-diagnostics {
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-soft);
}

.pwa-diagnostics summary {
    cursor: pointer;
    font-weight: 800;
}

.pwa-diagnostics ul {
    margin: 10px 0 0;
    padding-left: 20px;
    font-size: .9rem;
}

.pwa-diagnostics li + li {
    margin-top: 5px;
}

/* v0.10.0: sichtbarer, gesperrter Ladezustand beim 4PADEL-Abruf. */
.button.is-loading {
    gap: 9px;
}

.button.is-loading::before {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    content: "";
    animation: refresh-button-spin .8s linear infinite;
}

@keyframes refresh-button-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .button.is-loading::before {
        animation: none;
    }
}


/* Spieler-/Datumsübersicht */
.overview-heading {
    margin-bottom: 20px;
}

.overview-card {
    overflow: hidden;
}

.overview-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface-soft);
}

.overview-table-hint {
    display: none;
    padding: 10px 14px 0;
    color: var(--muted);
    font-size: 12px;
}

.overview-table-wrap {
    width: 100%;
    max-width: 100%;
    overflow: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.overview-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
}

.overview-table th,
.overview-table td {
    min-width: 118px;
    height: 54px;
    padding: 9px 12px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.overview-table tr > *:last-child {
    border-right: 0;
}

.overview-table tbody tr:last-child > * {
    border-bottom: 0;
}

.overview-table thead th {
    position: sticky;
    top: 0;
    z-index: 4;
    background: #f8fafc;
    color: #596579;
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.overview-table .overview-date-column {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 98px;
    width: 98px;
    background: #fff;
    text-align: left;
}

.overview-table thead .overview-date-column {
    z-index: 6;
    background: #f8fafc;
}

.overview-date-column a {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: var(--text);
    text-decoration: none;
}

.overview-date-column a:hover {
    color: var(--primary);
}

.overview-date-column span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.overview-date-column strong {
    font-size: 15px;
}

.overview-table .is-current-user {
    background: #f4f7fc;
}

.overview-table thead .is-current-user {
    background: #edf3fd;
    color: var(--primary);
}

.overview-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 68px;
    min-height: 30px;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 850;
    line-height: 1;
}

.overview-status-available {
    border-color: #b9e3ca;
    background: var(--success-bg);
    color: var(--success);
}

.overview-status-unavailable {
    border-color: #f0c5ca;
    background: #fff0f1;
    color: #a2212e;
}

.overview-status-open {
    border-color: #d5dbe4;
    background: #f4f6f8;
    color: #667286;
}

@media (max-width: 900px) {
    .overview-table-hint {
        display: block;
    }

    .overview-table-wrap {
        padding-top: 8px;
    }

    .overview-table th,
    .overview-table td {
        min-width: 104px;
        height: 50px;
        padding: 8px 10px;
    }

    .overview-table .overview-date-column {
        min-width: 88px;
        width: 88px;
    }

    .overview-status {
        min-width: 62px;
        min-height: 28px;
        padding: 4px 8px;
    }
}
