* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #eef2f7;
    color: #1f2937;
}

.app-header {
    position: relative;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: white;
    padding: 18px clamp(16px, 3vw, 28px) 44px;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.app-header::after {
    content: "";
    position: absolute;
    top: 18px;
    right: clamp(16px, 3vw, 28px);
    display: block;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background-color: rgba(255, 255, 255, .94);
    background-image: url("../school-logo.php");
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
    border: 8px solid rgba(255, 255, 255, .94);
    box-shadow: 0 14px 28px rgba(15, 23, 42, .16);
}

.dashboard-app-header::after {
    display: none;
}

.app-header h1 {
    margin: 0;
    font-size: clamp(24px, 3vw, 32px);
    line-height: 1.15;
    letter-spacing: 0;
    max-width: calc(100% - 78px);
}

.app-header p {
    margin: 7px 0 0;
    opacity: .92;
    font-size: 16px;
    line-height: 1.4;
    max-width: calc(100% - 78px);
}

.page-header-bar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    max-width: 1440px;
    margin: 0 auto;
    padding-right: 96px;
}

.page-header-copy {
    min-width: 0;
}

.page-header-copy h1,
.page-header-copy p {
    max-width: none;
}

.page-header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .92);
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 900;
    white-space: nowrap;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .14);
}

.page-header-action:hover {
    background: #ffffff;
    color: #1e40af;
}

.page-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.page-header-bar.no-action {
    padding-right: 86px;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    max-width: 1100px;
    margin: 0 auto;
}

.dashboard-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.school-logo {
    display: block;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .94);
    border: 8px solid rgba(255, 255, 255, .94);
    object-fit: contain;
    box-shadow: 0 14px 28px rgba(15, 23, 42, .16);
}

.dashboard-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 18px;
    background: rgba(255, 255, 255, .14);
    backdrop-filter: blur(10px);
}

.dashboard-user span,
.dashboard-user small {
    display: block;
}

.dashboard-user span {
    font-weight: 800;
    line-height: 1.1;
}

.dashboard-user small {
    color: rgba(255, 255, 255, .78);
    font-size: 12px;
}

.icon-action,
.header-logout,
.compact-admin-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 800;
    line-height: 1.2;
}

.icon-action {
    width: 38px;
    background: rgba(255, 255, 255, .92);
    color: #1d4ed8;
    position: relative;
}

.icon-action::before,
.settings-mark {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 3px solid currentColor;
    border-radius: 999px;
    background:
        linear-gradient(currentColor, currentColor) center / 4px 4px no-repeat,
        radial-gradient(circle at center, transparent 0 4px, currentColor 4px 5px, transparent 5px);
}

.icon-action::after,
.settings-mark::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 4px;
    height: 28px;
    border-top: 5px solid currentColor;
    border-bottom: 5px solid currentColor;
    border-radius: 999px;
    transform: translate(-50%, -50%) rotate(45deg);
}

.settings-mark {
    position: relative;
    color: currentColor;
    margin-right: 3px;
}

.header-logout {
    padding: 0 12px;
    background: #dc2626;
    color: white;
}

.header-logout-form {
    margin: 0;
}

.header-logout-form .header-logout {
    width: auto;
    border: 0;
}

.dashboard-container {
    max-width: 1100px;
    margin-top: -26px;
}

.dashboard-card {
    padding: 18px;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.section-title-row h2,
.section-title-row p {
    margin: 0;
}

.section-title-row p {
    margin-top: 4px;
    color: #6b7280;
}

.compact-admin-link {
    flex: 0 0 auto;
    padding: 0 12px;
    background: #e5e7eb;
    color: #111827;
}

.app-container {
    max-width: 1100px;
    margin: 22px auto 30px;
    padding: 0 16px;
}

.app-container.wide-container {
    max-width: 1440px;
}

.public-form-page .app-header {
    padding-bottom: 28px;
}

.public-form-page .app-container {
    margin-top: 20px;
}

.card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid rgba(226, 232, 240, .9);
    box-shadow: 0 12px 26px rgba(15, 23, 42, .10);
}

.card h2 {
    margin-top: 0;
    font-size: 20px;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.module-card {
    display: grid;
    grid-template-columns: 42px 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    align-items: center;
    text-decoration: none;
    color: #111827;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
    min-height: 92px;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.module-card:hover {
    transform: translateY(-2px);
    border-color: #bfdbfe;
    background: #ffffff;
    box-shadow: 0 12px 24px rgba(37, 99, 235, .12);
}

.module-icon {
    grid-row: 1 / span 2;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 900;
}

.module-card strong {
    display: block;
    font-size: 15px;
    margin-bottom: 2px;
}

.module-card span {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.35;
}

.module-card .module-icon {
    color: #1d4ed8;
    font-size: 14px;
    line-height: 1;
}

.module-grid.action-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.module-card.action-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 7px;
    min-height: 92px;
}

.module-card.action-card strong,
.module-card.action-card span {
    min-width: 0;
}

.module-card.action-card strong {
    font-size: 16px;
    line-height: 1.2;
    margin: 0;
}

.module-card.action-card span {
    font-size: 14px;
    line-height: 1.35;
}

.logout {
    display: block;
    text-align: center;
    padding: 14px;
    border-radius: 16px;
    background: #dc2626;
    color: white;
    text-decoration: none;
    font-weight: 600;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 26px;
    padding: 28px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .18);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.login-logo {
    display: block;
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border: 6px solid #f8fafc;
    border-radius: 15px;
    background: #ffffff;
    object-fit: contain;
}

.login-brand h1 {
    margin: 0;
    font-size: 28px;
}

.login-brand p {
    margin: 4px 0 0;
    color: #6b7280;
}

.login-feedback {
    margin: 0 0 18px;
}

.login-field {
    margin-bottom: 18px;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 52px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 6px;
    display: grid;
    place-items: center;
    width: 40px;
    min-height: 34px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #475569;
    transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
    background: #eff6ff;
    color: #1d4ed8;
}

.password-toggle-icon {
    position: relative;
    display: block;
    width: 19px;
    height: 12px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.password-toggle-icon::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: currentColor;
    transform: translate(-50%, -50%);
}

.password-toggle[aria-pressed="true"] .password-toggle-icon::before {
    content: "";
    position: absolute;
    z-index: 1;
    top: 3px;
    left: -3px;
    width: 21px;
    border-top: 2px solid currentColor;
    transform: rotate(-35deg);
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid #d1d5db;
    font: inherit;
    font-size: 15px;
    line-height: 1.35;
    background: white;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

label {
    display: block;
    margin: 0 0 6px;
    color: #1f2937;
    font-weight: 700;
    line-height: 1.25;
}

label + br,
label + br + br {
    display: none;
}

.checkbox-line,
.person-option,
.radio-option,
.bulk-check,
.segment label,
.class-checkboxes label,
.appointment-days label,
.appointment-times label {
    margin-bottom: 0;
}

button {
    width: 100%;
    min-height: 42px;
    padding: 10px 14px;
    border: 0;
    border-radius: 12px;
    background: #2563eb;
    color: white;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px;
    border-radius: 14px;
}

.notice {
    background: #dcfce7;
    color: #166534;
    padding: 12px;
    border-radius: 14px;
    margin-bottom: 14px;
}

.back-link {
    display: inline-block;
    padding: 10px 14px;
    border-radius: 12px;
    background: #e5e7eb;
    color: #111827;
    text-decoration: none;
    font-weight: 600;
}

.top-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

body .top-actions {
    justify-content: flex-end;
    align-items: center;
}

body .top-actions .back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: 10px 14px;
    border-radius: 12px;
    background: #e5e7eb;
    color: #111827;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.back-link:hover,
body .top-actions .back-link:hover,
.compact-admin-link:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Terminreservierung */

.appointment-box {
    background: linear-gradient(135deg, #f5f3ff, #ffffff);
    border: 2px solid #ddd6fe;
    border-radius: 24px;
    padding: 22px;
    margin-top: 12px;
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.12);
}

.appointment-info {
    background: #ede9fe;
    color: #4c1d95;
    padding: 14px 16px;
    border-radius: 16px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.appointment-days,
.appointment-times {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0 22px;
}

.appointment-day-btn,
.appointment-time-btn {
    width: auto;
    border: 2px solid #c7d2fe;
    background: linear-gradient(135deg, #ffffff, #eef2ff);
    color: #3730a3;
    border-radius: 18px;
    padding: 13px 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(99, 102, 241, 0.10);
    transition: all 0.2s ease;
}

.appointment-day-btn:hover,
.appointment-time-btn:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
}

.appointment-day-btn.active,
.appointment-time-btn.active {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: white;
    border-color: #6366f1;
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.25);
}

.appointment-summary {
    background: #ecfdf5;
    border: 2px solid #86efac;
    color: #14532d;
    border-radius: 20px;
    padding: 18px;
    margin: 20px 0;
    font-size: 17px;
    line-height: 1.5;
}

@media (max-width: 900px) {
    .module-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-header,
    .section-title-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-user {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 520px) {
    .app-header {
        padding: 12px 14px 30px;
        border-bottom-left-radius: 18px;
        border-bottom-right-radius: 18px;
    }

    .public-form-page .app-header {
        display: grid;
        justify-items: center;
        gap: 8px;
        padding: 18px 14px 24px;
        text-align: center;
    }

    .public-form-page .app-header::after {
        position: static;
        width: 72px;
        height: 72px;
        order: -1;
    }

    .public-form-page .app-header h1,
    .public-form-page .app-header p {
        max-width: 100%;
    }

    .app-header h1 {
        font-size: 22px;
    }

    .app-header p {
        margin-top: 5px;
        font-size: 14px;
        line-height: 1.35;
    }

    .page-header-bar {
        flex-direction: column;
        gap: 12px;
        padding-right: 72px;
    }

    .page-header-actions {
        justify-content: flex-start;
    }

    .page-header-action {
        min-height: 38px;
        padding: 0 12px;
        font-size: 14px;
    }

    .app-container {
        margin-top: 14px;
        padding: 0 10px;
    }

    .dashboard-container {
        /* Der Dashboard-Inhalt erhält auf kleinen Displays denselben ruhigen
           Abstand zur Kopfzeile wie die übrigen Modulansichten. */
        margin-top: 16px;
    }

    .module-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .card {
        border-radius: 18px;
        padding: 14px;
        margin-bottom: 12px;
    }

    .card h2 {
        font-size: 19px;
    }

    .module-card {
        min-height: 0;
        padding: 12px;
        border-radius: 14px;
    }

    .dashboard-brand {
        align-items: flex-start;
    }

    .school-logo {
        width: 44px;
        height: 44px;
        border-radius: 13px;
        font-size: 12px;
    }

    .dashboard-user {
        display: grid;
        grid-template-columns: 1fr auto auto;
    }

    .dashboard-user small {
        grid-column: 1;
    }

    .header-logout {
        padding: 0 10px;
    }

    .hero-badge {
        padding: 6px 10px;
        margin-bottom: 10px;
        font-size: 12px;
    }

    input,
    select,
    textarea,
    button {
        min-height: 40px;
        padding: 9px 11px;
        border-radius: 12px;
        font-size: 14px;
    }

    .back-link {
        padding: 9px 12px;
        border-radius: 12px;
        font-size: 14px;
    }

    .top-actions {
        justify-content: flex-end;
        gap: 8px;
        margin-bottom: 12px;
    }

    .table-wrap {
        margin-left: -4px;
        margin-right: -4px;
        padding-bottom: 4px;
    }

    .appointment-day-btn,
    .appointment-time-btn {
        flex: 1 1 calc(50% - 10px);
        justify-content: center;
    }
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    color: white;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
}

.app-header h1 {
    margin: 0;
    font-size: clamp(24px, 3vw, 32px);
    line-height: 1.15;
    letter-spacing: 0;
    max-width: 900px;
}

.app-header p {
    margin: 7px 0 0;
    opacity: .92;
    font-size: 16px;
    line-height: 1.4;
    max-width: 900px;
}

@media (max-width: 700px) {
    .app-header h1 {
        font-size: 22px;
    }

    .app-header p {
        font-size: 14px;
    }
}
