:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --text: #1e2430;
    --muted: #6a7486;
    --border: #d7deea;
    --primary: #2558e0;
    --primary-soft: #e8efff;
    --danger: #c83737;
    --danger-soft: #fde9e9;
    --success: #1f8b4c;
    --success-soft: #e8f8ee;
    --warning: #b7791f;
    --warning-soft: #fff5e6;
    --shadow: 0 12px 30px rgba(27, 44, 94, 0.08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

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

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    margin: 0 0 0.6rem;
}

p {
    margin: 0 0 1rem;
}

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    background: #f1f4fa;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
}

.brand {
    font-size: 1.2rem;
    font-weight: 800;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.user-pill {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem 0.8rem;
    background: var(--primary-soft);
    border-radius: 12px;
    font-size: 0.9rem;
}

.shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - 82px);
}

.sidebar {
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 1rem;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-link {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    color: var(--text);
    font-weight: 600;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
    text-decoration: none;
}

.link-button {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    font-weight: 800;
}

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

.content {
    padding: 1.5rem;
}

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

.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}

.form-panel {
    min-width: 0;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-wrapper.wide {
    align-items: flex-start;
}

.auth-panel {
    width: min(460px, 100%);
}

.auth-panel.wide {
    width: min(840px, 100%);
}

/* Gast-Anmeldung (ohne Topbar): ruhiger Hintergrund, klare Karte */
body.auth-page {
    background:
        radial-gradient(1100px 520px at 10% -8%, rgba(37, 88, 224, 0.12), transparent 52%),
        radial-gradient(800px 420px at 92% 108%, rgba(37, 88, 224, 0.07), transparent 50%),
        var(--bg);
}

body.auth-page .auth-wrapper {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: clamp(1.25rem, 5vw, 2.75rem);
}

body.auth-page .auth-wrapper > .flash {
    width: min(420px, 100%);
    margin-bottom: 0;
}

body.auth-page .auth-login-card {
    position: relative;
    overflow: hidden;
    padding: clamp(1.4rem, 4vw, 2rem) clamp(1.2rem, 4vw, 1.85rem);
    margin-bottom: 0;
    border-radius: calc(var(--radius) + 2px);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.65) inset,
        0 22px 48px rgba(27, 44, 94, 0.1),
        var(--shadow);
}

body.auth-page .auth-login-card::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #5b8cff);
}

body.auth-page .auth-login-app {
    margin: 0 0 0.4rem;
    font-size: clamp(1.05rem, 2.4vw, 1.35rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--primary);
    line-height: 1.2;
}

body.auth-page .auth-login-heading {
    margin: 0 0 0.55rem;
    font-size: clamp(1.45rem, 4vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--text);
}

body.auth-page .auth-login-lead {
    margin: 0 0 1.35rem;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 36em;
}

body.auth-page .auth-login-form {
    gap: 1rem;
}

body.auth-page .auth-login-form label span {
    font-size: 0.9rem;
}

body.auth-page .auth-login-form input[type="text"],
body.auth-page .auth-login-form input[type="password"] {
    padding: 0.82rem 1rem;
    font-size: 1rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

body.auth-page .auth-login-form input[type="text"]:focus,
body.auth-page .auth-login-form input[type="password"]:focus {
    outline: none;
    border-color: rgba(37, 88, 224, 0.45);
    box-shadow: 0 0 0 3px rgba(37, 88, 224, 0.18);
}

body.auth-page .auth-login-submit {
    width: 100%;
    margin-top: 0.15rem;
    padding: 0.82rem 1rem;
    font-size: 1rem;
    font-weight: 600;
}

body.auth-page .auth-login-footer {
    margin: 1.4rem 0 0;
    padding-top: 1.05rem;
    border-top: 1px solid var(--border);
    line-height: 1.45;
}

body.auth-page .auth-login-footer a {
    font-weight: 600;
    text-underline-offset: 0.12em;
}

@media (max-width: 420px) {
    body.auth-page .auth-login-card {
        padding: 1.25rem 1.1rem;
    }
}

.narrow {
    max-width: 520px;
}

.grid-two,
.grid-three,
.panel-split,
.teacher-selection-layout,
.teacher-assignment-layout,
.planner-layout {
    display: grid;
    gap: 1rem;
}

.grid-two,
.panel-split,
.teacher-selection-layout,
.planner-layout {
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
}

.grid-three {
    grid-template-columns: repeat(3, minmax(260px, 1fr));
}

.teacher-assignment-layout {
    grid-template-columns: minmax(240px, 280px) 1fr;
    gap: 0.65rem;
    align-items: start;
    /* Topbar klebt bei 0; Lehrer-Zuteilungs-Leiste bei 84px — Raster/Pool darunter einrasten */
    --teacher-assign-sticky-top: calc(84px + 6.25rem);
    --teacher-assign-panel-max: max(13rem, calc(100vh - var(--teacher-assign-sticky-top) - 1.25rem));
}

/* Lehrer-Zuteilung: Pool + Wochenraster */
.teacher-assign-toolbar .teacher-assign-toolbar-row {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.65rem 1rem;
}

.teacher-assign-hint {
    margin: 0;
    max-width: 32rem;
    line-height: 1.35;
}

.teacher-assign-chip-row {
    margin-top: 0.55rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--border);
}

.teacher-assign-print-row {
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.75rem;
}

.teacher-assign-filter-chips {
    margin-top: 0.45rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.65rem;
}

.teacher-choose-toolbar-chips {
    margin-top: 0.35rem;
}

.teacher-choose-toolbar-legend {
    margin: 0 0 0.35rem;
}

.teacher-choose-selection-closed {
    margin-top: 0.35rem;
}

.teacher-choose-toolbar-fold.planner-fold,
.teacher-timetable-toolbar-fold.planner-fold {
    margin-top: 0;
    border: 0;
    background: transparent;
}

.teacher-choose-toolbar-fold .planner-fold__body,
.teacher-timetable-toolbar-fold .planner-fold__body {
    padding-top: 0.4rem;
    margin-top: 0.35rem;
    border-radius: 0 0 8px 8px;
}

.teacher-choose-toolbar-fold__heading,
.teacher-timetable-toolbar-fold__heading {
    font-size: 1.08rem;
    font-weight: 700;
}

.teacher-selection-layout--selection-closed .teacher-choose-pool-panel {
    opacity: 0.72;
}

.teacher-selection-layout--selection-closed .teacher-choose-pool-panel .inline-form .button {
    pointer-events: none;
    opacity: 0.55;
}

.teacher-dashboard-legend {
    margin: 0 0 0.65rem;
    max-width: 42rem;
    line-height: 1.4;
}

.teacher-dashboard-metrics .metric-card.metric-ok {
    border-color: #9dcea8;
    background: #f4fbf5;
}

.teacher-dashboard-metrics .metric-card.metric-warn {
    border-color: #e4ab56;
    background: var(--warning-soft);
}

.teacher-dashboard-hint {
    margin: 0.5rem 0 0;
    max-width: 28rem;
}

.teacher-dashboard-actions .chip-link--action {
    font-weight: 600;
}

.chip-link.chip-link--muted {
    opacity: 0.68;
}

.teacher-choose-selection-scope {
    margin: 0 0 0.45rem;
}

.teacher-choose-result-dialog {
    border: none;
    padding: 0;
    border-radius: calc(var(--radius) + 4px);
    max-width: min(26rem, calc(100vw - 2rem));
    box-shadow: 0 24px 60px rgba(27, 44, 94, 0.18), var(--shadow);
    background: var(--panel);
    color: var(--text);
}

.teacher-choose-result-dialog::backdrop {
    background: rgba(30, 36, 48, 0.42);
    backdrop-filter: blur(2px);
}

.teacher-choose-result-dialog__inner {
    padding: 1.35rem 1.45rem 1.5rem;
}

.teacher-choose-result-dialog__title {
    margin: 0 0 0.65rem;
    font-size: 1.1rem;
    font-weight: 700;
}

.teacher-choose-result-dialog__message {
    margin: 0 0 1.25rem;
    font-size: 1.02rem;
    line-height: 1.45;
}

.teacher-choose-result-dialog__close {
    width: 100%;
}

/* ——— Lehrkräfte: einheitliches Layout (nicht Admin-kompakt), touch-freundlich ——— */
.teacher-app .content {
    padding: clamp(1rem, 2.5vw, 1.65rem);
}

.teacher-app .page-head {
    flex-wrap: wrap;
    gap: 0.65rem;
}

.teacher-app .page-head h1 {
    font-size: clamp(1.2rem, 2.6vw, 1.65rem);
    line-height: 1.2;
}

.teacher-app .panel,
.teacher-app .sticky-toolbar.panel {
    border-radius: 14px;
}

.teacher-app .teacher-app-chip-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.85rem;
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
}

.teacher-app .teacher-choose-toolbar-fold__body .teacher-app-chip-row {
    margin-top: 0.35rem;
    padding-top: 0.2rem;
    border-top: 0;
}

.teacher-app .chip-list--compact {
    gap: 0.5rem;
}

.teacher-app .chip-list--compact .chip-link {
    padding: 0.55rem 1.05rem;
    font-size: 0.95rem;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.teacher-app .planner-grid.planner-grid--teacher.phase-sized-rows {
    --phase-size-base: clamp(1.08rem, 2.2vw, 1.52rem);
}

.teacher-app .planner-grid.planner-grid--teacher .phase-head {
    width: 6.75rem;
    min-width: 6.75rem;
    max-width: 6.75rem;
    padding: 0.35rem 0.55rem;
    font-size: 0.8rem;
    line-height: 1.3;
}

.teacher-app .planner-grid.planner-grid--teacher .phase-head-stunde {
    font-size: 0.88rem;
}

.teacher-app .planner-grid.planner-grid--teacher .phase-head-stunde-time {
    margin-top: 0.08rem;
    font-size: 0.75rem;
}

.teacher-app .planner-grid.planner-grid--teacher thead th {
    padding: 0.45rem 0.55rem;
    font-size: 0.9rem;
}

.teacher-app .planner-grid.planner-grid--teacher .teacher-timetable-slot {
    padding: 0.48rem 0.58rem;
    gap: 0.12rem;
    border-radius: 10px;
}

.teacher-app .planner-grid.planner-grid--teacher .teacher-timetable-slot strong {
    font-size: 0.98rem;
    line-height: 1.2;
}

.teacher-app .planner-grid.planner-grid--teacher .teacher-timetable-slot span {
    font-size: 0.86rem;
    line-height: 1.32;
}

.teacher-app .planner-grid.planner-grid--teacher .pause-scope-details--inline summary {
    font-size: 0.82rem;
}

.teacher-app .planner-grid.planner-grid--teacher .warning-text {
    font-size: 0.82rem;
}

.teacher-app .planner-grid.planner-grid--teacher.phase-sized-rows tbody tr.phase-sized-row > td.scheduled-cell {
    padding: 0.32rem 0.42rem;
    vertical-align: top;
}

.teacher-app .planner-grid.planner-grid--teacher .scheduled-cell .teacher-timetable-slot {
    box-sizing: border-box;
    min-height: 100%;
}

.teacher-app .slot-chip,
.teacher-app .assigned-slot-chip {
    padding: 0.72rem 0.88rem;
    gap: 0.32rem;
    border-radius: 12px;
}

.teacher-app .slot-chip strong,
.teacher-app .assigned-slot-chip strong {
    font-size: 1.02rem;
    line-height: 1.2;
}

.teacher-app .slot-chip span,
.teacher-app .assigned-slot-chip span {
    font-size: 0.9rem;
    line-height: 1.35;
}

.teacher-app .slot-chip .button,
.teacher-app .assigned-slot-chip .button,
.teacher-app .slot-chip .button-small,
.teacher-app .assigned-slot-chip .button-small {
    min-height: 2.5rem;
    padding: 0.42rem 0.9rem;
    font-size: 0.9rem;
}

.teacher-app .teacher-choose-toolbar-fold__heading,
.teacher-app .teacher-timetable-toolbar-fold__heading {
    font-size: 1.2rem;
}

.teacher-app .teacher-choose-toolbar-fold .planner-fold__summary,
.teacher-app .teacher-timetable-toolbar-fold .planner-fold__summary {
    min-height: 2.75rem;
    padding: 0.55rem 0.75rem;
    align-items: center;
}

.teacher-app .teacher-choose-toolbar-fold .planner-fold__meta,
.teacher-app .teacher-timetable-toolbar-fold .planner-fold__meta {
    font-size: 0.9rem;
}

.teacher-app .teacher-dashboard-metrics {
    gap: 1rem;
}

.teacher-app .metric-card span {
    font-size: 0.88rem;
}

.teacher-app .metric-card strong {
    font-size: 1.32rem;
}

.teacher-app .sidebar nav {
    gap: 0.45rem;
}

.teacher-app .nav-link {
    padding: 0.95rem 1.05rem;
    min-height: 2.75rem;
    display: flex;
    align-items: center;
}

@media (max-width: 960px) {
    .teacher-app .teacher-selection-layout {
        grid-template-columns: 1fr !important;
        gap: 1.1rem;
    }
}

@media (max-width: 720px) {
    .teacher-app .planner-grid {
        /* allow dense timetable on phones; still scrollable if needed */
        min-width: 460px;
    }

    .teacher-app .planner-grid-wrap {
        /* use full width on mobile so horizontal scroll feels natural */
        margin-left: -0.65rem;
        margin-right: -0.65rem;
        padding-left: 0.65rem;
        padding-right: 0.65rem;
    }

    .teacher-app .teacher-choose-toolbar-fold .planner-fold__summary,
    .teacher-app .teacher-timetable-toolbar-fold .planner-fold__summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .teacher-app .teacher-choose-toolbar-fold .planner-fold__meta,
    .teacher-app .teacher-timetable-toolbar-fold .planner-fold__meta {
        text-align: left;
        width: 100%;
        max-width: none;
    }

    .teacher-app .topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .teacher-app .topbar-actions {
        justify-content: flex-start;
    }

    /* Teacher timetable on phones: show mobile day-list, hide desktop grid */
    .teacher-app .timetable-mobile {
        display: block !important;
    }

    .teacher-app .planner-grid-wrap {
        display: none !important;
    }

    /* Hide toolbar hint + print link on mobile */
    .teacher-app .teacher-timetable-toolbar-fold .planner-fold__body {
        display: none;
    }

    /* Compact slot chips on mobile (choose_slots, slot pools) */
    .teacher-app .slot-chip,
    .teacher-app .assigned-slot-chip {
        padding: 0.42rem 0.6rem;
        gap: 0.1rem;
        border-radius: 10px;
    }

    .teacher-app .slot-chip strong,
    .teacher-app .assigned-slot-chip strong {
        font-size: 0.88rem;
        line-height: 1.15;
    }

    .teacher-app .slot-chip span,
    .teacher-app .assigned-slot-chip span {
        font-size: 0.76rem;
        line-height: 1.2;
    }

    .teacher-app .slot-chip .muted.small,
    .teacher-app .assigned-slot-chip .muted.small {
        font-size: 0.7rem;
    }

    .teacher-app .slot-chip .button,
    .teacher-app .slot-chip .button-small,
    .teacher-app .assigned-slot-chip .button,
    .teacher-app .assigned-slot-chip .button-small {
        min-height: 2rem;
        padding: 0.28rem 0.65rem;
        font-size: 0.8rem;
    }

    .teacher-app .slot-chip .status-pill,
    .teacher-app .assigned-slot-chip .status-pill {
        font-size: 0.7rem;
        padding: 0.12rem 0.4rem;
        margin-top: 0.05rem;
    }

    .teacher-app .slot-pool {
        gap: 0.35rem;
    }

    .teacher-app .slot-chip .pause-scope-details--inline summary,
    .teacher-app .assigned-slot-chip .pause-scope-details--inline summary {
        font-size: 0.72rem;
    }
}

/* Default: hide mobile list on desktop */
.timetable-mobile {
    display: none;
}

/* ——— Mobile Timetable Styles ——— */

/* Day tabs: horizontal scrollable pill bar */
.timetable-mobile-tabs {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 0 0.75rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid var(--border);
}

.timetable-mobile-tabs::-webkit-scrollbar {
    display: none;
}

.timetable-mobile-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0.5rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--muted);
    background: var(--bg);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.timetable-mobile-tab__radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
}

.timetable-mobile-tab:has(.timetable-mobile-tab__radio:checked) {
    background: var(--primary);
    color: #fff;
}

.timetable-mobile-tab--today {
    font-weight: 800;
}

/* Show short labels on narrow screens, full labels on wider ones */
.timetable-mobile-tab__full {
    display: none;
}

.timetable-mobile-tab__short {
    display: inline;
}

@media (min-width: 480px) {
    .timetable-mobile-tab__full {
        display: inline;
    }
    .timetable-mobile-tab__short {
        display: none;
    }
}

/* Day sections */
.timetable-mobile-day {
    animation: ttm-fade-in 0.18s ease;
}

@keyframes ttm-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.timetable-mobile-day__title {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0.75rem 0 0.5rem;
    color: var(--text);
}

.timetable-mobile-day__list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

/* Individual time-slot row */
.timetable-mobile-row {
    display: grid;
    grid-template-columns: 6rem 1fr;
    gap: 0.55rem;
    align-items: start;
    min-height: 2.8rem;
}

.timetable-mobile-row--conflict {
    border-left: 3px solid var(--warning);
    padding-left: 0.45rem;
    border-radius: 2px;
}

.timetable-mobile-row__when {
    padding-top: 0.55rem;
    text-align: right;
}

.timetable-mobile-row__phase {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.timetable-mobile-row__clock {
    font-size: 0.7rem;
    color: var(--muted);
    margin-top: 0.1rem;
    line-height: 1.2;
}

.timetable-mobile-row__span {
    display: inline-block;
    margin-top: 0.15rem;
    padding: 0.08rem 0.35rem;
    border-radius: 4px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1.3;
}

.timetable-mobile-row__what {
    min-width: 0;
}

.timetable-mobile-row__what > .teacher-timetable-slot {
    border-radius: 12px;
    padding: 0.55rem 0.7rem;
    gap: 0.18rem;
}

/* Empty-phase summary */
.timetable-mobile-row--empty-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0;
    border-top: 1px dashed var(--border);
    border-bottom: 1px dashed var(--border);
}

/* Conflict badges */
.timetable-mobile-conflict-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.18rem 0.5rem;
    border-radius: 6px;
    background: var(--warning-soft);
    font-size: 0.76rem !important;
    font-weight: 700;
    line-height: 1.3;
}

.timetable-mobile-conflict-badge::before {
    content: "\26A0";
    font-size: 0.82rem;
}

/* Collapsible details for secondary info */
.timetable-mobile-details {
    margin-top: 0.12rem;
}

.timetable-mobile-details summary {
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--primary);
    font-weight: 600;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
}

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

.timetable-mobile-details summary::after {
    content: " \25BE";
    font-size: 0.72rem;
}

.timetable-mobile-details[open] summary::after {
    content: " \25B4";
}

.timetable-mobile-details__body {
    padding-top: 0.2rem;
}

.timetable-mobile-details__body span {
    font-size: 0.78rem;
    line-height: 1.35;
}

.teacher-assign-toolbar-fold.planner-fold {
    margin-top: 0;
    border: 0;
    background: transparent;
}

.teacher-assign-toolbar-fold .planner-fold__body {
    padding-top: 0.4rem;
    margin-top: 0.35rem;
    border-radius: 0 0 8px 8px;
}

.teacher-assign-toolbar-fold__heading {
    font-size: 1.08rem;
    font-weight: 700;
}

/* Eingeklappte Leiste: weniger Abstand für Sticky-Pool/Raster */
body:has(.teacher-assign-workspace):has(.teacher-assign-toolbar-fold:not([open])) .teacher-assignment-layout {
    --teacher-assign-sticky-top: calc(84px + 3.35rem);
}

.teacher-assign-raster-panel .teacher-assign-raster-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    margin-bottom: 0.55rem;
    flex-shrink: 0;
}

/* Lehrer-Zuteilung: linke Liste + rechtes Raster beim Scrollen nutzbar halten */
.teacher-assignment-layout .teacher-assign-pool-panel {
    position: sticky;
    top: var(--teacher-assign-sticky-top);
    align-self: start;
    max-height: var(--teacher-assign-panel-max);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.teacher-assignment-layout .teacher-assign-pool-panel #teacher-slot-pool {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.teacher-assignment-layout .teacher-assign-raster-panel {
    position: sticky;
    top: var(--teacher-assign-sticky-top);
    align-self: start;
    max-height: var(--teacher-assign-panel-max);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    z-index: 4;
}

.teacher-assignment-layout .teacher-assign-raster-body-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Vertikales Scrollen nur im gemeinsamen Raster-Bereich; waagerecht weiter im Tabellen-Wrapper */
.teacher-assignment-layout .teacher-assign-raster-body-scroll .planner-grid-wrap {
    overflow-x: auto;
    overflow-y: visible;
}

/* Lehrer-Zuteilung: Karten nutzen die Monitorhöhe, Seite scrollt nur oben; Inhalt in den Panels scrollt */
body:has(.teacher-assign-workspace) .shell {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: calc(100dvh - 82px);
}

body:has(.teacher-assign-workspace) .sidebar {
    flex: 0 0 260px;
}

body:has(.teacher-assign-workspace) .content {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

body:has(.teacher-assign-workspace) .content .page-head,
body:has(.teacher-assign-workspace) .content .flash,
body:has(.teacher-assign-workspace) .teacher-assign-toolbar {
    flex-shrink: 0;
}

.teacher-assign-workspace {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.teacher-assign-workspace .teacher-assignment-layout {
    flex: 1;
    min-height: 0;
    align-items: stretch;
}

@media (min-width: 1101px) {
    .teacher-assign-workspace .teacher-assignment-layout {
        grid-template-rows: minmax(0, 1fr);
    }
}

.teacher-assign-workspace .teacher-assign-pool-panel,
.teacher-assign-workspace .teacher-assign-raster-panel {
    max-height: none;
    min-height: 0;
    align-self: stretch;
    margin-bottom: 0;
}

.teacher-assign-workspace .teacher-assign-pool-panel > h2 {
    flex-shrink: 0;
}

.teacher-assign-raster-header h2 {
    margin: 0 0 0.12rem;
    font-size: 0.98rem;
}

.teacher-assign-points {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.teacher-assign-assign-hint {
    flex: 1 1 11rem;
    max-width: 18rem;
    min-height: 2.5rem;
    padding: 0.4rem 0.55rem;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: #f8fafc;
}

.teacher-assign-assign-hint strong {
    display: block;
    margin-bottom: 0.08rem;
    font-size: 0.88rem;
}

.teacher-assign-assign-hint .muted.small {
    font-size: 0.72rem;
    line-height: 1.25;
}

.teacher-assign-pool-hint {
    margin: 0 0 0.45rem;
}

.teacher-assignment-layout .slot-chip.slot-chip--assign-click {
    cursor: pointer;
    user-select: none;
}

.teacher-assign-dialog {
    width: min(22rem, calc(100vw - 2rem));
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

.teacher-assign-dialog::backdrop {
    background: rgba(15, 23, 42, 0.35);
}

.teacher-assign-dialog form {
    padding: 1rem 1.1rem 1.05rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.teacher-assign-dialog-title {
    margin: 0;
    font-size: 1.05rem;
}

.teacher-assign-dialog-slot {
    margin: 0;
    line-height: 1.35;
}

.teacher-assign-dialog-label {
    font-size: 0.85rem;
    font-weight: 600;
}

.teacher-assign-dialog-select {
    width: 100%;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
}

.teacher-assign-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.35rem;
}

.teacher-assign-unscheduled {
    margin-bottom: 0.85rem;
}

.teacher-assign-subheading {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
}

/* Lehrer-Zuteilung: dichtere Darstellung (nur diese Seite) */
.teacher-assignment-layout .slot-pool {
    gap: 0.4rem;
    min-height: 72px;
}

.teacher-assignment-layout .slot-pool-secondary {
    padding: 0.45rem;
    border-radius: 9px;
}

.teacher-assignment-layout .slot-chip,
.teacher-assignment-layout .assigned-slot-chip,
.teacher-assignment-layout .teacher-timetable-slot {
    padding: 0.38rem 0.48rem;
    border-radius: 9px;
    gap: 0.1rem;
}

.teacher-assignment-layout .slot-chip strong,
.teacher-assignment-layout .assigned-slot-chip strong,
.teacher-assignment-layout .teacher-timetable-slot strong {
    font-size: 0.84rem;
    line-height: 1.2;
}

.teacher-assignment-layout .slot-chip span,
.teacher-assignment-layout .assigned-slot-chip span,
.teacher-assignment-layout .teacher-timetable-slot span {
    font-size: 0.72rem;
    line-height: 1.25;
}

.teacher-assignment-layout .slot-chip .small,
.teacher-assignment-layout .assigned-slot-chip .small,
.teacher-assignment-layout .teacher-timetable-slot .small {
    font-size: 0.68rem;
}

.teacher-assignment-layout .slot-chip.slot-chip--assigned-this-teacher {
    border-color: #e4ab56;
    background: var(--warning-soft);
}

.teacher-assignment-layout .slot-chip.full.slot-chip--assigned-this-teacher {
    background: #f5ead4;
    border-color: #d9a24e;
}

.teacher-assignment-layout .slot-chip-teacher-hint {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--warning);
    margin-top: 0.08rem;
}

.teacher-assignment-layout [data-dnd-item][draggable="true"] {
    user-select: none;
    -webkit-user-drag: element;
}

.teacher-assignment-layout .slot-chip.slot-chip--assign-click:focus-visible {
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: 2px;
}

.teacher-assignment-layout form.inline-form,
.teacher-assignment-layout form.inline-form button {
    -webkit-user-drag: none;
}

.teacher-assignment-layout section.panel > h2 {
    font-size: 0.95rem;
    margin: 0 0 0.45rem;
}

.teacher-assignment-layout .pause-scope-details--inline summary {
    font-size: 0.72rem;
}

.teacher-assignment-layout .button-small {
    padding: 0.15rem 0.45rem;
    font-size: 0.72rem;
}

.planner-layout {
    grid-template-columns: 360px 1fr;
}

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

.form-column-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-weight: 600;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

select[multiple] {
    min-height: 14rem;
}

textarea {
    resize: vertical;
}

.checkbox-row {
    flex-direction: row;
    align-items: center;
    gap: 0.65rem;
    font-weight: 500;
}

.checkbox-row input {
    width: auto;
}

.checkbox-fieldset {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.85rem 1rem 1rem;
    margin: 0 0 1rem;
}

.checkbox-fieldset legend {
    padding: 0 0.35rem;
    font-weight: 600;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: 0.35rem 0.75rem;
    margin-top: 0.35rem;
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 12px;
    padding: 0.65rem 0.95rem;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
}

.button:hover,
button:hover {
    text-decoration: none;
    filter: brightness(0.98);
}

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

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

.button-light {
    background: #fff;
}

.button-small {
    padding: 0.45rem 0.7rem;
    border-radius: 10px;
    font-size: 0.9rem;
}

.button-row,
.button-list,
.filter-row,
.toolbar-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.slots-filter-form {
    margin-bottom: 1rem;
}

.filter-search-label {
    flex: 1 1 220px;
    min-width: 180px;
    margin: 0;
    font-weight: 600;
    position: relative;
}

.filter-search-label .filter-search {
    width: 100%;
    margin-top: 0.25rem;
    padding-right: 2rem;
}

.filter-search-label .filter-search-clear {
    position: absolute;
    right: 0.35rem;
    bottom: 0.35rem;
    width: 1.5rem;
    height: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 1.1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.filter-search-label .filter-search-clear:hover {
    color: var(--text);
    background: #f3f5f9;
}

.button-list.vertical {
    flex-direction: column;
    align-items: stretch;
}

.inline-form {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    margin: 0;
}

.hidden-form {
    display: none;
}

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

.small {
    font-size: 0.88rem;
}

.tiny {
    font-size: 0.75rem;
}

.flash {
    border-radius: 14px;
    padding: 0.85rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.flash-success {
    background: var(--success-soft);
    border-color: #cdeed8;
    color: var(--success);
}

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

.flash-warning {
    background: var(--warning-soft);
    border-color: #f4deaa;
    color: var(--warning);
}

.info-box {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #f8faff;
    padding: 0.85rem;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1rem;
    box-shadow: var(--shadow);
}

.metric-card span {
    display: block;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.metric-card strong {
    font-size: 1.5rem;
}

.metric-ok {
    border-color: #b9e7ca;
    background: var(--success-soft);
}

.metric-warn {
    border-color: #f2cf9c;
    background: var(--warning-soft);
}

.meta-list {
    display: grid;
    gap: 0.5rem;
}

.meta-list div {
    display: grid;
    grid-template-columns: 170px 1fr;
    gap: 0.5rem;
    align-items: baseline;
}

.meta-list dt {
    font-weight: 700;
}

.meta-list dd {
    margin: 0;
}

.slots-group {
    margin-bottom: 1.1rem;
}

.slots-group:last-child {
    margin-bottom: 0;
}

.slots-group-heading {
    margin: 0 0 0.4rem;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 0.65rem;
}

.slots-group-heading .muted {
    font-weight: 500;
}

.slot-aggregate-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.35rem;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    background: #e4e9f2;
    color: #4a5568;
    vertical-align: middle;
}

.slot-bucket-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 12rem;
}

.slot-bucket-actions__line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px dashed var(--border);
}

.slot-bucket-actions__line:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.slot-bucket-actions__form {
    display: inline-flex;
    margin: 0;
}

.pause-scope-details summary {
    cursor: pointer;
    list-style-position: outside;
}

.pause-scope-details--inline {
    margin-top: 0.25rem;
}

.pause-scope-details--inline summary {
    font-size: 0.8rem;
    color: var(--muted);
}

.pause-scope-list {
    margin: 0.25rem 0 0;
    padding-left: 1.1rem;
}

.slot-chip--pause,
.slot-card--pause-supervision,
.teacher-timetable-slot--pause {
    border-left: 3px solid #8b95a8;
}

.table-wrap {
    overflow: auto;
}

.table-wrap.large table {
    min-width: 860px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 0.8rem 0.7rem;
    text-align: left;
    vertical-align: top;
}

th {
    background: #fafcff;
    position: sticky;
    top: 0;
    z-index: 1;
}

tr.is-current {
    background: #f8fbff;
}

.actions-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    background: #eef2f8;
    color: var(--muted);
    margin-right: 0.3rem;
    margin-top: 0.2rem;
}

.status-pill.success {
    background: var(--success-soft);
    color: var(--success);
}

.status-pill.neutral {
    background: #eef2f8;
    color: var(--muted);
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.chip-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 0.9rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-weight: 600;
}

.chip-link span {
    color: var(--muted);
    font-size: 0.85rem;
}

.chip-link.active,
.chip-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
    text-decoration: none;
    border-color: #b9cbff;
}

.chip-choice {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    background: #fff;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.chip-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip-choice:has(input:checked) {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #b9cbff;
}

.chip-choice span {
    font-size: 0.9rem;
}

.sticky-toolbar {
    position: sticky;
    top: 84px;
    z-index: 15;
}

.slot-pool,
.assigned-slot-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    min-height: 120px;
}

/* Wochenraster: Slot-Pool (nicht platziert) als Grid, nicht nur Liste */
.planner-class-fold-body .slot-pool.drop-zone {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    align-content: start;
    gap: 0.7rem;
}

.planner-class-fold-body .slot-pool.drop-zone > p {
    grid-column: 1 / -1;
}

.planner-pool-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1rem;
}

.planner-pool-section .pool-section-title {
    margin: 0 0 0.15rem;
    font-size: 1rem;
}

.planner-pool-section .pool-section-sub {
    margin: 0 0 0.5rem;
}

.slot-pool-secondary {
    background: #f8f9fc;
    border-radius: 12px;
    padding: 0.65rem;
    border: 1px dashed var(--border);
}

.pool-filter-form {
    margin-bottom: 0.25rem;
}

.planner-weekdays-panel {
    margin-bottom: 1rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.planner-toolbar-panel {
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.planner-toolbar-main {
    align-items: flex-end;
    margin-bottom: 0;
}

.planner-toolbar-print-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.65rem 1rem;
    margin-bottom: 0.55rem;
}

.planner-toolbar-print-year {
    flex: 1 1 12rem;
    min-width: 0;
}

.planner-toolbar-print-all {
    flex: 0 0 auto;
}

.planner-chips-row {
    margin-top: 0.15rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--border);
}

.planner-class-chip-form {
    margin: 0;
}

.planner-chip-fieldset--bare {
    border: 0;
    padding: 0;
    margin: 0.35rem 0 0;
    min-width: 0;
}

.chip-toggle {
    position: relative;
    cursor: pointer;
    margin: 0;
}

.chip-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.chip-toggle-face {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem 0.45rem;
    padding: 0.42rem 0.72rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.25;
}

.chip-toggle-name {
    font-weight: 600;
}

.chip-toggle-meta {
    font-weight: 500;
    color: var(--muted);
    font-size: 0.78rem;
}

.chip-toggle input:checked + .chip-toggle-face {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #b9cbff;
}

.chip-toggle input:focus-visible + .chip-toggle-face {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.planner-inline-label {
    margin: 0 0 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.chip-list--compact {
    gap: 0.35rem;
}

.chip-list--compact .chip-link {
    padding: 0.42rem 0.72rem;
    font-size: 0.88rem;
}

.button-list--compact {
    gap: 0.45rem;
}

.planner-class-picker {
    margin-top: 0;
}

.planner-fold {
    margin-top: 0.55rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fafbff;
}

.planner-fold--weekdays {
    margin-top: 0;
}

.planner-fold__summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem 0.75rem;
    padding: 0.42rem 0.65rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
    list-style: none;
}

.planner-fold__summary::-webkit-details-marker {
    display: none;
}

.planner-fold__title::before {
    content: '';
    display: inline-block;
    width: 0.35em;
    height: 0.35em;
    margin-right: 0.35em;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(-45deg);
    vertical-align: 0.12em;
    transition: transform 0.12s ease;
}

.planner-fold[open] > .planner-fold__summary .planner-fold__title::before {
    transform: rotate(45deg);
    vertical-align: 0.08em;
}

.planner-fold__meta {
    font-weight: 500;
    color: var(--muted);
    font-size: 0.85rem;
    max-width: 100%;
    text-align: right;
}

.planner-fold__body {
    padding: 0 0.65rem 0.55rem;
    border-top: 1px solid var(--border);
    background: #fff;
}

.planner-fold__hint {
    margin: 0.5rem 0 0.35rem;
    line-height: 1.35;
}

.planner-compact-fieldset {
    position: relative;
    padding: 0.5rem 0.65rem 0.55rem;
    margin: 0.45rem 0 0.35rem;
}

.planner-fold .planner-compact-fieldset {
    margin-top: 0.35rem;
}

.checkbox-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(7.25rem, 1fr));
    gap: 0.15rem 0.45rem;
    margin-top: 0.15rem;
}

.checkbox-row--compact {
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.button-row--tight {
    margin-top: 0.35rem;
    margin-bottom: 0;
}

.planner-sr-legend {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.planner-class-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    margin-bottom: 0.35rem;
}

.planner-class-heading h2 {
    margin: 0;
    font-size: 1.15rem;
}

.planner-class-block,
.planner-class-fold {
    scroll-margin-top: 4.5rem;
}

.planner-class-fold {
    overflow: hidden;
}

.planner-class-fold > summary {
    list-style: none;
    cursor: pointer;
}

.planner-class-fold > summary::-webkit-details-marker {
    display: none;
}

.planner-class-fold-summary {
    padding: 0;
}

.planner-class-fold-body {
    padding-top: 0.25rem;
}

.planner-subheading {
    margin: 1rem 0 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.planner-class-block > .planner-subheading:first-of-type {
    margin-top: 0.75rem;
}

.pool-mode-fieldset {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 0.85rem 0.85rem;
    margin: 0 0 0.75rem;
}

.pool-mode-fieldset legend {
    padding: 0 0.35rem;
    font-weight: 600;
}

.slot-chip-readonly {
    opacity: 0.72;
    cursor: not-allowed;
}

.slot-chip,
.assigned-slot-chip,
.slot-card,
.teacher-timetable-slot {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.75rem 0.8rem;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
}

.slot-chip strong,
.assigned-slot-chip strong,
.slot-card strong,
.teacher-timetable-slot strong {
    font-size: 1rem;
}

.slot-chip span,
.assigned-slot-chip span,
.slot-card span,
.teacher-timetable-slot span {
    color: var(--muted);
    font-size: 0.9rem;
}

.slot-chip[draggable="true"],
.assigned-slot-chip[draggable="true"],
.slot-card[draggable="true"] {
    cursor: grab;
}

.dragging {
    opacity: 0.55;
}

.slot-chip.full {
    background: #f0f2f6;
    color: #8893a5;
    border-style: dashed;
}

.slot-chip.inactive {
    background: #f7f8fb;
    border-style: dashed;
}

.assigned-slot-chip.conflict,
.teacher-timetable-slot.conflict,
.slot-card.conflict {
    border-color: #e4ab56;
    background: var(--warning-soft);
}

.warning-text {
    color: var(--warning) !important;
    font-weight: 700;
}

.planner-grid-wrap {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable both-edges;
}

.planner-grid {
    min-width: 920px;
    table-layout: fixed;
}

/* Teacher timetable: override global min-width for better mobile UX */
.teacher-app .planner-grid.planner-grid--teacher {
    min-width: 640px;
}

.planner-class-fold-body .planner-grid {
    border-collapse: separate;
    border-spacing: 0;
}

.room-planner-grid {
    border-collapse: separate;
    border-spacing: 0;
}

.planner-class-fold-body .planner-grid th,
.planner-class-fold-body .planner-grid td {
    border: 0;
    border-bottom: 1px dashed #d5dbe6;
    border-left: 1px dashed #d5dbe6;
}

.room-planner-grid th,
.room-planner-grid td {
    border: 0;
    border-bottom: 1px dashed #d5dbe6;
    border-left: 1px dashed #d5dbe6;
}

.planner-class-fold-body .planner-grid th:first-child,
.planner-class-fold-body .planner-grid td:first-child {
    border-left: 0;
}

.room-planner-grid th:first-child,
.room-planner-grid td:first-child {
    border-left: 0;
}

.planner-grid th,
.planner-grid td {
    width: 12.5%;
}

.phase-head {
    width: 10rem;
    min-width: 10rem;
}

.phase-head-stunde {
    display: block;
    font-weight: 700;
}

.phase-head-stunde-time {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.2;
}

/* Zeilenhöhe ~ proportional zu unit_length; Pause (0) = halbe Basis */
.planner-grid.phase-sized-rows {
    --phase-size-base: clamp(2rem, 2.6vw, 3.15rem);
}

/* Kompaktes Wochenraster (Klassen-Planner, Lehrer-Zuteilung, veröffentlichter Lehrerplan) */
.planner-grid.planner-grid--compact.phase-sized-rows {
    --phase-size-base: clamp(0.72rem, 1vw, 0.92rem);
}

.planner-grid.planner-grid--compact .phase-head {
    width: 4.5rem;
    min-width: 4.5rem;
    max-width: 4.5rem;
    padding: 0.15rem 0.3rem;
    font-size: 0.65rem;
    line-height: 1.2;
}

.planner-grid.planner-grid--compact .phase-head-stunde {
    font-size: 0.68rem;
}

.planner-grid.planner-grid--compact .phase-head-stunde-time {
    margin-top: 0.04rem;
    font-size: 0.58rem;
}

.planner-grid.planner-grid--compact thead th {
    padding: 0.28rem 0.25rem;
    font-size: 0.68rem;
    line-height: 1.15;
}

.planner-grid.planner-grid--compact .slot-card,
.planner-grid.planner-grid--compact .teacher-timetable-slot {
    padding: 0.22rem 0.28rem;
    gap: 0.04rem;
    border-radius: 6px;
}

.planner-grid.planner-grid--compact .slot-card strong,
.planner-grid.planner-grid--compact .teacher-timetable-slot strong {
    font-size: 0.74rem;
    line-height: 1.15;
}

.planner-grid.planner-grid--compact .slot-card span,
.planner-grid.planner-grid--compact .teacher-timetable-slot span {
    font-size: 0.62rem;
    line-height: 1.2;
}

.planner-grid.planner-grid--compact .slot-card .small,
.planner-grid.planner-grid--compact .slot-card .muted.small,
.planner-grid.planner-grid--compact .teacher-timetable-slot .small,
.planner-grid.planner-grid--compact .teacher-timetable-slot .muted.small {
    font-size: 0.58rem;
}

.planner-grid.planner-grid--compact .slot-card .inline-form,
.planner-grid.planner-grid--compact .teacher-timetable-slot .inline-form {
    margin-top: 0.08rem;
}

.planner-grid.planner-grid--compact .pause-scope-details--inline summary {
    font-size: 0.58rem;
}

.planner-grid.planner-grid--compact .warning-text {
    font-size: 0.58rem;
}

.planner-grid.planner-grid--compact .button-small {
    padding: 0.1rem 0.32rem;
    font-size: 0.62rem;
}

.planner-grid.phase-sized-rows tbody tr.phase-sized-row > th.phase-head,
.planner-grid.phase-sized-rows tbody tr.phase-sized-row > td {
    min-height: calc(var(--phase-size-base) * var(--phase-h, 1));
    vertical-align: top;
}

.planner-grid.phase-sized-rows tbody tr.phase-sized-row > td.drop-cell {
    min-height: calc(var(--phase-size-base) * var(--phase-h, 1));
}

.teacher-grid.phase-sized-rows tbody tr.phase-sized-row > td {
    min-height: calc(var(--phase-size-base) * var(--phase-h, 1));
}

.teacher-grid.phase-sized-rows tbody tr.phase-sized-row > th.phase-head {
    min-height: calc(var(--phase-size-base) * var(--phase-h, 1));
}

.phase-hide-yl-title {
    margin: 1rem 0 0.35rem;
    font-size: 1rem;
}

.phase-hide-table-wrap {
    margin-bottom: 0.75rem;
}

.phase-hide-matrix {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.phase-hide-matrix th,
.phase-hide-matrix td {
    border: 1px solid var(--border);
    text-align: center;
    padding: 0.25rem 0.2rem;
}

.checkbox-fieldset-select-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.45rem;
}

.phase-bulk-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.85rem;
}

.phase-bulk-col {
    width: 2.35rem;
    text-align: center;
    vertical-align: middle;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
}

.phase-bulk-cb {
    margin: 0;
    cursor: pointer;
}

/* Zeitphasen / Stundenraster: kompaktere Darstellung */
.time-phases-page .grid-two {
    gap: 0.75rem;
}

.time-phases-page section.panel {
    padding: 0.75rem 0.85rem;
    margin-bottom: 0.65rem;
}

.time-phases-page .panel h2 {
    font-size: 1.12rem;
    margin: 0 0 0.45rem;
}

.time-phases-page .panel h3 {
    font-size: 0.9rem;
    margin: 0.55rem 0 0.28rem;
}

.time-phases-page .panel > p.muted.small {
    margin: 0 0 0.5rem;
    font-size: 0.78rem;
    line-height: 1.35;
}

.time-phases-page .stack-form {
    gap: 0.55rem;
}

.time-phases-page .checkbox-fieldset {
    padding: 0.5rem 0.65rem 0.6rem;
    margin: 0 0 0.55rem;
}

.time-phases-page .checkbox-fieldset legend {
    font-size: 0.86rem;
}

.time-phases-page .checkbox-grid {
    grid-template-columns: repeat(auto-fill, minmax(8.25rem, 1fr));
    gap: 0.15rem 0.45rem;
    margin-top: 0.2rem;
}

.time-phases-page .checkbox-row {
    gap: 0.4rem;
    font-size: 0.88rem;
}

.time-phases-page .checkbox-fieldset .muted.small {
    margin: 0 0 0.3rem;
    font-size: 0.76rem;
    line-height: 1.32;
}

.time-phases-page .checkbox-fieldset-select-row {
    margin: 0 0 0.28rem;
    gap: 0.3rem;
}

.time-phases-page label > span:first-child {
    font-size: 0.86rem;
}

.time-phases-page input[type="text"],
.time-phases-page input[type="number"],
.time-phases-page input[type="time"],
.time-phases-page select {
    padding: 0.48rem 0.58rem;
    border-radius: 10px;
}

.time-phases-page .button-row {
    margin-top: 0.25rem;
}

.time-phases-page .table-wrap.compact table th,
.time-phases-page .table-wrap.compact table td {
    padding: 0.32rem 0.42rem;
    font-size: 0.81rem;
}

.time-phases-page .table-wrap.compact th {
    font-size: 0.76rem;
}

.time-phases-page .actions-cell {
    gap: 0.28rem;
}

.time-phases-page .phase-bulk-toolbar {
    margin-bottom: 0.5rem;
}

.time-phases-page .phase-bulk-col {
    width: 1.95rem;
    font-size: 0.7rem;
}

.time-phases-page .phase-hide-yl-title {
    margin-top: 0.45rem;
    margin-bottom: 0.22rem;
    font-size: 0.88rem;
}

.time-phases-page .phase-hide-table-wrap {
    margin-bottom: 0.3rem;
}

.time-phases-page .phase-hide-matrix {
    font-size: 0.74rem;
}

.time-phases-page .phase-hide-matrix th,
.time-phases-page .phase-hide-matrix td {
    padding: 0.08rem 0.1rem;
}

.time-phases-page .phase-hide-corner {
    text-align: left;
    min-width: 5.25rem;
    padding: 0.2rem 0.3rem;
    font-size: 0.74rem;
}

.time-phases-page .phase-hide-matrix tbody th {
    padding: 0.12rem 0.28rem 0.12rem 0;
    font-size: 0.74rem;
}

.time-phases-page .phase-hide-cell {
    width: 1.55rem;
}

.time-phases-page .phase-hide-label {
    min-height: 1.25rem;
}

.time-phases-page .phase-hide-label input {
    width: 0.9rem;
    height: 0.9rem;
}

.time-phases-page section.time-phases-exceptions-panel {
    padding: 0.55rem 0.65rem;
}

.time-phases-exceptions-panel .planner-fold {
    margin-top: 0;
}

.planner-fold--time-exceptions {
    background: #f9fafc;
}

.time-phases-exceptions-intro {
    margin: 0 0 0.5rem;
    max-width: 48rem;
    line-height: 1.35;
}

.time-phases-exceptions-form {
    gap: 0.45rem;
}

.time-phases-exceptions-form .phase-hide-yl-block + .phase-hide-yl-block {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--border);
}

.time-phases-exceptions-actions {
    margin-top: 0.35rem;
    margin-bottom: 0;
}

.phase-hide-yl-block {
    min-width: 0;
}

.phase-hide-corner {
    text-align: left;
    min-width: 7rem;
}

.phase-hide-matrix tbody th {
    text-align: right;
    padding-right: 0.5rem;
    white-space: nowrap;
    font-weight: 600;
}

.phase-hide-cell {
    width: 2.25rem;
}

.phase-hide-label {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 1.75rem;
    cursor: pointer;
}

.phase-hide-label input {
    width: auto;
    margin: 0;
}

.drop-cell,
.drop-zone,
.teacher-card {
    transition: background 0.15s ease, border-color 0.15s ease;
}

.drop-cell {
    min-height: 88px;
    background: #fbfcff;
}

.drop-cell-pause {
    background: #f4f5f7;
    border-style: dashed;
    border-bottom: 1px dashed #d5dbe6;
    border-top: 1px dashed #d5dbe6;
    border-bottom-color: #d5dbe6;
    border-top-color: #d5dbe6;
}

.scheduled-cell-pause {
    border-bottom: 1px dashed #d5dbe6;
    border-top: 1px dashed #d5dbe6;
}

.drop-label {
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.na-cell {
    background: #f0f3f8;
}

.drop-zone-hover {
    background: #eef4ff !important;
    border-color: var(--primary) !important;
}

.scheduled-cell {
    background: #f8fbff;
}

/* Wochenraster: Slots optisch vom Raster abtrennen (grün, wenn kein Konflikt) */
.planner-class-fold-body .slot-pool .slot-chip:not(.conflict):not(.full):not(.inactive) {
    background: var(--success-soft);
    border-color: #bfe7cc;
}

.planner-grid.planner-grid--compact .slot-card:not(.conflict) {
    background: var(--success-soft);
    border-color: #bfe7cc;
}

/* Rowspan-Zelle: Inhalt über die zusammengefassten Zeilen mitziehen */
.planner-grid.phase-sized-rows tbody tr.phase-sized-row > td.scheduled-cell {
    padding: 0.4rem;
    vertical-align: top;
}

.planner-grid.planner-grid--compact.phase-sized-rows tbody tr.phase-sized-row > td.scheduled-cell {
    padding: 0.18rem 0.22rem;
    vertical-align: top;
}

.planner-grid.planner-grid--compact .scheduled-cell .slot-card,
.planner-grid.planner-grid--compact .scheduled-cell .teacher-timetable-slot {
    box-sizing: border-box;
    min-height: 100%;
}

.planner-grid .scheduled-cell .slot-card {
    box-sizing: border-box;
    min-height: 100%;
    height: 100%;
}

.print-grid.phase-sized-rows tbody tr.phase-sized-row > td.scheduled-cell {
    padding: 0.25rem;
    vertical-align: top;
}

.print-grid .scheduled-cell.print-slot {
    box-sizing: border-box;
    min-height: 100%;
    height: 100%;
}

.teacher-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.teacher-card {
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 0.9rem;
    background: #fbfcff;
}

.teacher-card header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.teacher-points {
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 700;
    background: var(--warning-soft);
    color: var(--warning);
}

.teacher-points.ok {
    background: var(--success-soft);
    color: var(--success);
}

.teacher-points.warn {
    background: var(--warning-soft);
    color: var(--warning);
}

.teacher-points.bad {
    background: var(--danger-soft);
    color: var(--danger);
}

/* Nutzerübersicht: Fortschritts-Markierung in Tabellenzeilen (subtil) */
tr.users-progress-row--ok > td {
    background: rgba(31, 139, 76, 0.06);
}

tr.users-progress-row--warn > td {
    background: rgba(183, 121, 31, 0.08);
}

tr.users-progress-row--bad > td {
    background: rgba(200, 55, 55, 0.07);
}

/* keep action buttons readable */
tr.users-progress-row--ok > td.actions-cell,
tr.users-progress-row--warn > td.actions-cell,
tr.users-progress-row--bad > td.actions-cell {
    background: transparent;
}

.print-wrapper {
    padding: 1.25rem;
}

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

.credentials-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 1rem;
}

.credential-card {
    min-height: 160px;
    padding: 1rem;
    border: 2px dashed #9098a8;
    border-radius: 14px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    page-break-inside: avoid;
}

.credential-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.print-class-block {
    margin-bottom: 2rem;
    page-break-inside: avoid;
}

.print-classes-pages {
    display: block;
}

.print-class-table-wrap {
    display: block;
}

.only-print {
    display: none !important;
}

/* Klassen-Stundenpläne: benannte Druckseite A4 quer (nur Blöcke mit page: timetable) */
@page timetable {
    size: A4 landscape;
    margin: 5mm;
}

.print-grid .scheduled-cell {
    background: #fff;
}

.teacher-grid td {
    min-height: 90px;
}

.compact-list {
    padding-left: 1.1rem;
    margin: 0 0 1rem;
}

.compact-list li {
    margin-bottom: 0.35rem;
}

.week-switcher {
    gap: 0.5rem;
}

.no-print {
    display: block;
}

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

    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .grid-two,
    .panel-split,
    .teacher-selection-layout,
    .teacher-assignment-layout,
    .teacher-assign-layout,
    .planner-layout,
    .grid-three {
        grid-template-columns: 1fr;
    }

    .teacher-assignment-layout {
        --teacher-assign-sticky-top: calc(84px + 7.25rem);
    }

    body:has(.teacher-assign-workspace):has(.teacher-assign-toolbar-fold:not([open])) .teacher-assignment-layout {
        --teacher-assign-sticky-top: calc(84px + 4.35rem);
    }

    body:has(.teacher-assign-workspace) .shell {
        flex-direction: column;
    }

    body:has(.teacher-assign-workspace) .sidebar {
        flex: 0 0 auto;
        width: 100%;
    }
}

@media (max-width: 720px) {
    .content {
        padding: 1rem;
    }

    .topbar {
        padding: 1rem;
    }

    .planner-grid {
        min-width: 760px;
    }

    .credentials-grid {
        grid-template-columns: 1fr;
    }
}

@media print {
    body {
        background: #fff;
    }

    .no-print {
        display: none !important;
    }

    .only-print {
        display: block !important;
    }

    .panel,
    .metric-card {
        box-shadow: none;
        border-color: #bfc7d7;
    }

    .print-wrapper {
        padding: 0;
    }

    .credential-card,
    .print-class-block {
        break-inside: avoid;
    }

    .planner-grid,
    .teacher-grid {
        min-width: 0;
        width: 100%;
    }

    /* Beim Drucken normaler Admin-Seiten (z. B. Wochenraster, Lehrer-Zuteilung)
       sind die "compact" Screen-Werte zu klein. Daher im Print auf cm-basierte
       Basishöhen und lesbare Typografie umstellen. */
    .planner-grid.planner-grid--compact.phase-sized-rows,
    .teacher-grid.phase-sized-rows {
        --phase-size-base: clamp(1.05rem, 0.32cm, 1.55rem);
    }

    .planner-grid.planner-grid--compact .phase-head {
        width: 2.3cm;
        min-width: 2.3cm;
        max-width: 2.3cm;
        font-size: 8pt;
        line-height: 1.15;
        padding: 2pt 3pt;
    }

    .planner-grid.planner-grid--compact thead th {
        font-size: 8pt;
        padding: 2pt 3pt;
    }

    .planner-grid.planner-grid--compact .slot-card strong,
    .planner-grid.planner-grid--compact .teacher-timetable-slot strong {
        font-size: 8.5pt;
    }

    .planner-grid.planner-grid--compact .slot-card span,
    .planner-grid.planner-grid--compact .teacher-timetable-slot span,
    .planner-grid.planner-grid--compact .slot-card .muted.small,
    .planner-grid.planner-grid--compact .warning-text {
        font-size: 7.5pt;
    }

    /* Eine Klasse = eine A4-Querseite */
    body.print-class-timetables .print-classes-pages {
        margin: 0;
        padding: 0;
    }

    body.print-class-timetables .print-class-block {
        page: timetable;
        page-break-after: always;
        break-after: page;
        page-break-inside: avoid;
        break-inside: avoid;
        box-sizing: border-box;
        width: 100%;
        min-height: 190mm;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }

    body.print-class-timetables .print-class-block:last-child {
        page-break-after: auto;
        break-after: auto;
    }

    body.print-class-timetables .print-sheet-context {
        font-size: 8pt;
        margin: 0 0 2mm;
        color: #444;
    }

    body.print-class-timetables .print-class-title {
        font-size: 13pt;
        line-height: 1.15;
        margin: 0 0 3mm;
        font-weight: 700;
    }

    body.print-class-timetables .print-class-table-wrap {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    body.print-class-timetables .print-class-table-wrap .print-grid {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0 !important;
        table-layout: fixed;
        border-collapse: collapse;
        font-size: 8pt;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    body.print-class-timetables .print-class-table-wrap .print-grid th,
    body.print-class-timetables .print-class-table-wrap .print-grid td {
        padding: 2pt 3pt;
        border: 1px solid #999;
        vertical-align: top;
        overflow-wrap: anywhere;
        word-wrap: break-word;
    }

    body.print-class-timetables .print-class-table-wrap .print-grid.phase-sized-rows {
        /* Default; wird in den Druck-Views per inline style mm-genau überschrieben. */
        --phase-size-base: clamp(1.05rem, 0.32cm, 1.55rem);
    }

    body.print-class-timetables .print-class-table-wrap .print-grid.phase-sized-rows tbody tr.phase-sized-row > th.phase-head,
    body.print-class-timetables .print-class-table-wrap .print-grid.phase-sized-rows tbody tr.phase-sized-row > td {
        min-height: calc(var(--phase-size-base) * var(--phase-h, 1));
    }

    /* Tabellen ignorieren min-height teils im Drucklayout → Höhe direkt auf die Zeile legen. */
    body.print-class-timetables .print-class-table-wrap .print-grid.phase-sized-rows tbody tr.phase-sized-row {
        height: calc(var(--phase-size-base) * var(--phase-h, 1));
    }

    /* 0-Länge: typografisch abwerten (Pausenzeilen/Pausenaufsichten/0-Slots). */
    body.print-class-timetables .print-slot.print-slot--zero strong {
        font-size: 8pt;
        font-weight: 700;
    }
    body.print-class-timetables .print-slot.print-slot--zero span {
        font-size: 7pt;
        color: #6b778c;
    }
    body.print-class-timetables .print-teacher-slot.print-teacher-slot--zero {
        opacity: 0.9;
    }

    body.print-class-timetables .print-class-table-wrap .print-grid thead th {
        font-weight: 700;
        background: #eef1f7;
    }

    body.print-class-timetables .print-class-table-wrap .phase-head {
        width: 8%;
        min-width: 0;
        font-size: 8pt;
        font-weight: 700;
        background: #f3f5f9;
    }

    body.print-class-timetables .print-slot {
        line-height: 1.2;
        background: #fff !important;
    }

    body.print-class-timetables .print-slot strong {
        font-size: 8.5pt;
    }

    body.print-class-timetables .print-slot span {
        font-size: 7.5pt;
    }

    body.print-class-timetables .print-teacher-slot {
        margin-bottom: 3pt;
        padding-bottom: 2pt;
        border-bottom: 1px solid #ddd;
        line-height: 1.25;
    }

    body.print-class-timetables .print-teacher-slot:last-child {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: 0;
    }

    body.print-class-timetables .print-teacher-slot--conflict {
        background: #fff5e6 !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* ==================== Enhanced Print Grid (Klassen-Druckansicht A+B) ==================== */

/* Kategorie-Farbpalette – screen + print */
.psc-0 { background: #eff6ff; border-left: 3px solid #93c5fd; }
.psc-1 { background: #f0fdf4; border-left: 3px solid #86efac; }
.psc-2 { background: #fefce8; border-left: 3px solid #fde047; }
.psc-3 { background: #fff7ed; border-left: 3px solid #fdba74; }
.psc-4 { background: #faf5ff; border-left: 3px solid #c4b5fd; }
.psc-5 { background: #f0fdfa; border-left: 3px solid #5eead4; }
.psc-pause { background: #fef3c7; border-left: 3px solid #fbbf24; }

/* Slot-Inhalt Hierarchie */
.pse-name {
    display: block;
    font-size: 8.5pt;
    font-weight: 700;
    line-height: 1.2;
    color: #111;
}
.pse-teacher {
    display: block;
    font-size: 7pt;
    font-weight: 600;
    color: #374151;
    margin-top: 1pt;
}
.pse-teacher--none {
    color: #9ca3af;
    font-style: italic;
    font-weight: 400;
}
.pse-room {
    float: right;
    font-size: 6pt;
    background: #e5e7eb;
    border-radius: 3px;
    padding: 0.5pt 2.5pt;
    color: #6b7280;
    margin-left: 3pt;
    margin-bottom: 1pt;
    white-space: nowrap;
}

/* Legende */
.pse-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 3mm;
    flex-wrap: wrap;
}
.pse-legend {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
    font-size: 7pt;
    color: #374151;
}
.pse-legend-item {
    display: flex;
    align-items: center;
    gap: 3pt;
    white-space: nowrap;
}
.pse-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Freie Zelle */
.pse-free { background: #f9fafb; }

@media print {
    /* Farben im Druck erzwingen */
    .psc-0, .psc-1, .psc-2, .psc-3, .psc-4, .psc-5, .psc-pause {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
    .psc-0 { background: #eff6ff !important; border-left: 3px solid #93c5fd !important; }
    .psc-1 { background: #f0fdf4 !important; border-left: 3px solid #86efac !important; }
    .psc-2 { background: #fefce8 !important; border-left: 3px solid #fde047 !important; }
    .psc-3 { background: #fff7ed !important; border-left: 3px solid #fdba74 !important; }
    .psc-4 { background: #faf5ff !important; border-left: 3px solid #c4b5fd !important; }
    .psc-5 { background: #f0fdfa !important; border-left: 3px solid #5eead4 !important; }
    .psc-pause { background: #fef3c7 !important; border-left: 3px solid #fbbf24 !important; }

    /* Dunkler Tabellenkopf */
    body.print-class-timetables .print-grid--enhanced thead th {
        background: #1e3a5f !important;
        color: #fff !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
    body.print-class-timetables .print-grid--enhanced th.pse-time-head {
        background: #1e3a5f !important;
    }
    body.print-class-timetables .print-grid--enhanced .phase-head {
        background: #f3f5f9 !important;
        color: #111 !important;
    }

    /* Kategoriefarben mit höherer Spezifität über die weiße Grundregel (.print-slot) stellen */
    body.print-class-timetables .print-slot.print-slot--enhanced.psc-0 { background: #eff6ff !important; border-left: 3px solid #93c5fd !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    body.print-class-timetables .print-slot.print-slot--enhanced.psc-1 { background: #f0fdf4 !important; border-left: 3px solid #86efac !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    body.print-class-timetables .print-slot.print-slot--enhanced.psc-2 { background: #fefce8 !important; border-left: 3px solid #fde047 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    body.print-class-timetables .print-slot.print-slot--enhanced.psc-3 { background: #fff7ed !important; border-left: 3px solid #fdba74 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    body.print-class-timetables .print-slot.print-slot--enhanced.psc-4 { background: #faf5ff !important; border-left: 3px solid #c4b5fd !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    body.print-class-timetables .print-slot.print-slot--enhanced.psc-5 { background: #f0fdfa !important; border-left: 3px solid #5eead4 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    body.print-class-timetables .print-slot.print-slot--enhanced.psc-pause { background: #fef3c7 !important; border-left: 3px solid #fbbf24 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }

    /* Raum-Badge im Druck */
    .pse-room {
        background: #e5e7eb !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    /* Legende im Druck sichtbar lassen */
    .pse-sheet-header { margin-bottom: 2mm; }
    .pse-legend { font-size: 6.5pt; }

    /* Freie Zellen */
    .pse-free { background: #f9fafb !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* ==================== Sick Reports & Substitutions ==================== */

.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.3;
}
.badge-success  { background: var(--success-soft); color: var(--success); }
.badge-warning  { background: var(--warning-soft); color: var(--warning); }
.badge-info     { background: var(--primary-soft); color: var(--primary); }
.badge-neutral  { background: #f1f4fa; color: var(--muted); }
.badge-danger   { background: var(--danger-soft); color: var(--danger); }

/* Substitution legend */
.sub-legend {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.sub-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}
.sub-quality-optimal  { background: #e8f8ee; color: #1a7a3f; border: 1px solid #aedfc1; }
.sub-quality-possible { background: #fff5e6; color: #7a5200; border: 1px solid #f5d07a; }
.sub-quality-excluded { background: #f3f4f7; color: var(--muted); border: 1px solid var(--border); }
.sub-quality-assigned { background: var(--primary-soft); color: var(--primary); border: 1px solid #b3c8f8; }

/* Slot card in substitution matrix */
.sub-slot-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    background: #fff;
}
.sub-slot-card--assigned {
    border-color: var(--success);
    background: #f6fdf9;
}
.sub-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.sub-assigned-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Candidate rows */
.sub-candidates {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.sub-candidate {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.88rem;
    flex-wrap: wrap;
}
.sub-candidate.sub-quality-optimal  { background: #f0faf4; border: 1px solid #c0e8cc; }
.sub-candidate.sub-quality-possible { background: #fffbf0; border: 1px solid #f0d888; }
.sub-candidate.sub-quality-excluded { background: #f5f6f9; border: 1px solid #e2e5ec; opacity: 0.7; }
.sub-candidate--current { outline: 2px solid var(--primary); }

.sub-candidate-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    flex-wrap: wrap;
}
.sub-rank {
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--muted);
    min-width: 1.8rem;
}
.sub-name  { font-weight: 600; }
.sub-scores {
    display: flex;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.82rem;
}
.sub-day-detail {
    width: 100%;
    margin-top: 0.25rem;
}
.sub-day-detail summary {
    cursor: pointer;
}
.sub-day-list {
    margin: 0.25rem 0 0 1rem;
    padding: 0;
    font-size: 0.82rem;
    color: var(--muted);
    list-style: disc;
}

/* Feedback panel */
.panel-feedback {
    margin-bottom: 1.25rem;
}
.feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.feedback-message {
    margin: 0 0 0.75rem;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--border);
    background: var(--bg);
    border-radius: 4px;
    font-size: 0.92rem;
    white-space: pre-wrap;
}

/* Form helpers */
.checkbox-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.checkbox-col {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    font-weight: normal;
}
.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.88rem;
}
.form-grid {
    display: grid;
    gap: 1rem;
}
.form-group textarea,
.form-group input[type="email"],
.form-group input[type="time"],
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    background: #fff;
}
.form-group textarea { resize: vertical; }
.required { color: var(--danger); }
.w-full { width: 100%; }

/* Table helpers */
.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.data-table th,
.data-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
.data-table th {
    background: var(--bg);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.data-table tr:last-child td { border-bottom: 0; }

.button-list--tight {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

/* Timetable substitution markers */
.slot-substitution-badge {
    display: inline-block;
    background: #e8efff;
    color: var(--primary);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    margin-top: 2px;
}
.slot-substitution-original-badge {
    display: inline-block;
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    margin-top: 2px;
}

/* List compact */
.list-compact {
    margin: 0;
    padding-left: 1rem;
    font-size: 0.85rem;
}
.list-compact li { margin: 0.1rem 0; }

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.toolbar h2 { margin: 0; }

@media print {

    body.print-class-timetables .print-teacher-conflict {
        display: block;
        font-size: 7pt;
        font-weight: 700;
        color: #a86b00;
        margin-top: 1pt;
    }

    body.print-class-timetables .print-class-table-wrap .na-cell {
        background: #f5f6f8 !important;
    }

    body.print-mode .teacher-grid.phase-sized-rows tbody tr.phase-sized-row > th.phase-head,
    body.print-mode .teacher-grid.phase-sized-rows tbody tr.phase-sized-row > td,
    .teacher-grid.phase-sized-rows tbody tr.phase-sized-row > th.phase-head,
    .teacher-grid.phase-sized-rows tbody tr.phase-sized-row > td {
        min-height: calc(var(--phase-size-base) * var(--phase-h, 1));
    }

    .teacher-grid.phase-sized-rows tbody tr.phase-sized-row {
        height: calc(var(--phase-size-base) * var(--phase-h, 1));
    }
}

/* ================================================================
   NOTIFICATION BELL (topbar)
   ================================================================ */
.notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s;
    flex-shrink: 0;
}
.notif-bell:hover { background: var(--bg-card); }
.notif-bell--has-new { color: var(--primary); }
.notif-bell__badge {
    position: absolute;
    top: 0.05rem;
    right: 0.05rem;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    background: var(--danger);
    color: #fff;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1.1rem;
    text-align: center;
    pointer-events: none;
}

/* ================================================================
   TEACHER DASHBOARD (mobile-first)
   ================================================================ */
.tdb-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
    margin-bottom: 1rem;
}
.tdb-metric {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    text-align: center;
}
.tdb-metric--ok   { border-color: var(--success); background: var(--success-soft); }
.tdb-metric--warn { border-color: var(--warning); background: var(--warning-soft); }
.tdb-metric__label { font-size: 0.72rem; color: var(--muted); margin-bottom: 0.25rem; }
.tdb-metric__value { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1; }

.tdb-actions {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: 0.65rem;
    margin-bottom: 1rem;
}
.tdb-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 0.6rem 0.85rem;
    text-decoration: none;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    transition: box-shadow 0.15s, border-color 0.15s;
    position: relative;
}
.tdb-btn:hover { border-color: var(--primary); box-shadow: 0 2px 8px var(--shadow); }
.tdb-btn--muted { opacity: 0.6; }
.tdb-btn--alert { border-color: var(--primary); background: var(--primary-soft); }
.tdb-btn__icon { font-size: 1.6rem; line-height: 1; }
.tdb-btn__label { font-size: 0.8rem; }
.tdb-btn__hint  { font-size: 0.66rem; color: var(--muted); }
.tdb-btn__badge {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.2rem;
    background: var(--danger);
    color: #fff;
    border-radius: 999px;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 1.2rem;
    text-align: center;
}

.tdb-lower {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
.tdb-status .tdb-status__formula { margin-top: 0.85rem; font-size: 0.65rem; line-height: 1.5; }

.tdb-sub-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.tdb-sub-item {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.5rem 0.6rem;
    background: var(--bg);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}
.tdb-sub-item__slot { font-size: 0.82rem; font-weight: 600; }
.tdb-sub-item__for  { font-size: 0.72rem; }

.tdb-notifs { }

@media (max-width: 640px) {
    .tdb-metrics { grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
    .tdb-metric { padding: 0.6rem 0.5rem; }
    .tdb-metric__value { font-size: 1.25rem; }
    .tdb-lower { grid-template-columns: 1fr; }
    .tdb-actions { grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
    .tdb-btn { padding: 0.7rem 0.3rem 0.6rem; }
    .tdb-btn__icon { font-size: 1.35rem; }
    .tdb-btn__label { font-size: 0.7rem; }
    .tdb-btn__hint  { display: none; }
}

/* ================================================================
   IN-APP NOTIFICATION LIST
   ================================================================ */
.inapp-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.inapp-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.inapp-item:last-child { border-bottom: none; }
.inapp-item--unread { background: var(--primary-soft); margin: 0 -0.5rem; padding: 0.6rem 0.5rem; border-radius: 6px; }
.inapp-item__body  { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.inapp-item__msg   { font-size: 0.82rem; font-weight: 500; line-height: 1.35; word-break: break-word; }
a.inapp-item__msg  { color: var(--primary); text-decoration: none; }
a.inapp-item__msg:hover { text-decoration: underline; }
.inapp-item__time  { font-size: 0.7rem; }
.notif-read-btn    { min-width: 1.8rem; padding: 0.2rem 0.4rem; font-size: 0.72rem; }
.notif-page-head   { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.notif-page-head h2 { margin: 0; }

.inapp-list--full .inapp-item { padding: 0.7rem 0; }
.inapp-list--full .inapp-item--unread { margin: 0 -0.75rem; padding: 0.7rem 0.75rem; }

/* ================================================================
   SICK REPORT CARDS (teacher view)
   ================================================================ */
.sick-closed-box {
    text-align: center;
    padding: 2.5rem 1rem;
}
.sick-closed-box__icon { font-size: 3rem; margin-bottom: 0.75rem; }
.sick-closed-box h2 { margin: 0 0 0.5rem; }
.sick-hint-box { margin-bottom: 1rem; border-radius: var(--radius); }

.sr-cards { display: flex; flex-direction: column; gap: 0.85rem; }
.sr-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.sr-card__head { display: flex; align-items: center; gap: 0.5rem; }
.sr-card__days { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sr-day-chip {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
}
.sr-card__note { font-style: italic; }
.sr-card__subs { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.sr-sub-chip {
    display: inline-block;
    padding: 0.18rem 0.5rem;
    background: var(--success-soft);
    color: var(--success);
    border-radius: 6px;
    font-size: 0.72rem;
}

.day-checkbox-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.35rem; }
.day-checkbox { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; cursor: pointer; }
.day-checkbox input[type="checkbox"] { accent-color: var(--primary); width: 1.1rem; height: 1.1rem; }
.day-checkbox span { font-size: 0.72rem; font-weight: 600; }

.form-group--time .time-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.form-group--time label { font-size: 0.8rem; }
.sick-admin-status-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.6rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}
.sick-admin-status-bar__left { display: flex; align-items: center; gap: 0.5rem; flex: 1; flex-wrap: wrap; }

/* ================================================================
   FEEDBACK PAGE
   ================================================================ */
.feedback-type-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.35rem; }
.feedback-type-chip { display: flex; }
.feedback-type-chip input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.feedback-type-chip span {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: var(--bg);
    border: 1.5px solid var(--border);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    user-select: none;
}
.feedback-type-chip input[type="radio"]:checked + span {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary);
}
.feedback-type-chip span:hover { border-color: var(--primary); }

.feedback-list { display: flex; flex-direction: column; gap: 0.75rem; }
.feedback-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.feedback-card__head { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.feedback-card__msg  { font-size: 0.82rem; line-height: 1.4; }
.feedback-card__reply {
    font-size: 0.78rem;
    padding: 0.4rem 0.65rem;
    background: var(--primary-soft);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

/* ================================================================
   PUBLIC SUBSTITUTION PLAN
   ================================================================ */
.public-plan-wrapper {
    max-width: 52rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}
.public-plan-header { text-align: center; margin-bottom: 2rem; }
.public-plan-brand {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.35rem;
}
.public-plan-title { font-size: 1.75rem; font-weight: 800; margin: 0 0 0.25rem; }
.public-plan-pin-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 24rem;
    margin: 0 auto;
}
.public-plan-pin-box h2 { margin: 0 0 0.4rem; }
.public-plan-pin-form { margin-top: 1rem; }
.public-plan-pin-row { display: flex; gap: 0.5rem; }
.public-plan-pin-input {
    flex: 1;
    padding: 0.55rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 1.05rem;
    letter-spacing: 0.1em;
    text-align: center;
}
.public-plan-pin-input:focus { border-color: var(--primary); outline: none; }
.public-plan-empty { text-align: center; padding: 2.5rem 1rem; }
.public-plan-table-wrap { overflow-x: auto; }
.public-plan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.public-plan-table th,
.public-plan-table td {
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.public-plan-table th { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.public-plan-group-row td {
    background: var(--primary-soft);
    color: var(--primary);
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
}

/* ================================================================
   ADMIN SUBSTITUTIONS OVERVIEW
   ================================================================ */
.sub-overview-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 1rem;
}
.sub-overview-card {
    background: var(--warning-soft);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 0.55rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}
.sub-overview-card__name  { font-weight: 700; font-size: 0.82rem; }
.sub-overview-card__count { font-size: 0.72rem; color: var(--muted); }

/* ================================================================
   ADMIN SETTINGS PAGE
   ================================================================ */
.settings-section { margin-bottom: 0; }
.settings-section h2 { margin-top: 0; }
.settings-group-label { font-weight: 600; font-size: 0.82rem; display: block; margin-bottom: 0.4rem; }
.settings-public-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.65rem;
    padding: 0.45rem 0.75rem;
    background: var(--bg);
    border-radius: 6px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
}
.settings-public-link__url { font-size: 0.8rem; font-family: monospace; color: var(--primary); word-break: break-all; }
.checkbox-label--large {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.5rem 0;
}
.checkbox-label--large input { width: 1.15rem; height: 1.15rem; flex-shrink: 0; accent-color: var(--primary); }
.checkbox-col { display: flex; flex-direction: column; gap: 0.3rem; }

/* ================================================================
   COMPACT SLOT CHIPS (choose_slots compact mode)
   ================================================================ */
.teacher-app .slot-chip.slot-chip--compact {
    padding: 0.5rem 0.7rem 0.5rem;
    gap: 0.15rem;
}
.slot-chip__meta {
    font-size: 0.72rem;
    color: var(--muted);
    line-height: 1.2;
}
.slot-chip__avail {
    font-size: 0.72rem;
    color: var(--muted);
}

/* ================================================================
   STATUS PILL EXTRAS
   ================================================================ */
.status-pill.badge-warning { background: var(--warning-soft); color: var(--warning); }

/* ================================================================
   FORM HELPERS
   ================================================================ */
.form-label-strong { font-weight: 600; font-size: 0.85rem; }

/* ================================================================
   MOBILE HAMBURGER DRAWER
   ================================================================ */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 8px;
    color: var(--text);
    line-height: 1;
    flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--primary-soft); }

.drawer-close-btn {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0.75rem 0.75rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.45rem 0.75rem;
    font: inherit;
    font-size: 0.88rem;
    cursor: pointer;
    color: var(--text);
}
.drawer-close-btn:hover { background: var(--primary-soft); }

.drawer-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.38);
    z-index: 39;
    backdrop-filter: blur(1px);
}

.drawer-footer {
    display: none;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.drawer-user {
    font-size: 0.83rem;
    color: var(--muted);
    padding: 0.25rem 1rem 0.5rem;
    line-height: 1.4;
}
.drawer-user strong {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
}

@media (max-width: 720px) {
    /* ── Slim topbar: single row, only brand + bell + hamburger ── */
    .topbar {
        flex-direction: row !important;
        align-items: center !important;
        padding: 0.55rem 1rem !important;
        gap: 0.5rem;
    }
    .topbar > div:first-child {
        flex: 1 1 auto;
        min-width: 0;
    }
    .topbar > div:first-child .muted { display: none; }
    .brand { font-size: 1rem; }

    /* hide desktop-only topbar items on mobile */
    .topbar .user-pill,
    .topbar .week-switcher,
    .topbar a.button { display: none !important; }

    /* teacher-app topbar overrides for slim row */
    .teacher-app .topbar { flex-direction: row !important; align-items: center !important; }
    .teacher-app .topbar-actions { justify-content: flex-end !important; }

    /* show hamburger */
    .hamburger-btn { display: flex; align-items: center; }

    /* show close button inside drawer */
    .drawer-close-btn { display: flex; }

    /* drawer footer visible */
    .drawer-footer { display: flex; }

    /* ── Sidebar becomes a left-side drawer ── */
    .shell { grid-template-columns: 1fr; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 270px;
        max-width: 84vw;
        z-index: 40;
        border-right: 1px solid var(--border);
        border-bottom: none !important;
        transform: translateX(-100%);
        transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        padding: 1rem 0;
        background: #fff;
    }
    .sidebar nav {
        padding: 0 0.75rem;
    }

    body.drawer-open .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    }
    body.drawer-open .drawer-overlay { display: block; }

    /* page-head h1 a bit smaller */
    .page-head h1 { font-size: 1.25rem; }

    /* content keeps full width */
    .content { padding: 0.9rem 1rem; }
}

/* ================================================================
   MOBILE TIMETABLE GRID (tmg) — Kalender-Stil mit Span-Kacheln
   ================================================================ */
.tmg-grid {
    display: grid;
    grid-template-columns: 5.2rem 1fr;
    /* grid-template-rows set inline per day */
    gap: 0;
}

/* ── Linke Zeitspalte ── */
.tmg-time {
    grid-column: 1;
    border-right: 2px solid var(--border);
    padding-right: 0.45rem;
    padding-top: 0.35rem;
    text-align: right;
    position: relative;
    overflow: hidden;
}

.tmg-dot {
    position: absolute;
    right: -5px;
    top: 0.52rem;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    z-index: 1;
}
.tmg-dot--free {
    background: var(--border);
}

.tmg-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.tmg-clock {
    font-size: 0.64rem;
    color: var(--muted);
    margin-top: 0.05rem;
    line-height: 1.2;
}

/* ── Rechte Inhaltsspalte ── */
.tmg-content {
    grid-column: 2;
    padding: 0.2rem 0 0.2rem 0.5rem;
    border-bottom: 1px solid #edf0f5;
    position: relative;
}

.tmg-content--empty {
    background: var(--bg);
}

.tmg-content--conflict {
    border-left: 3px solid var(--warning);
    padding-left: 0.35rem;
}

/* ── Slot-Kachel ── */
.tmg-card {
    height: calc(100% - 0.15rem);
    border-radius: 10px;
    padding: 0.4rem 0.6rem;
    background: var(--primary-soft);
    border: 1.5px solid #c3d4ff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.08rem;
    font-size: 0.78rem;
    overflow: hidden;
}

.tmg-card strong {
    font-size: 0.82rem;
    color: var(--primary);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tmg-card .tmg-sub {
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tmg-card .tmg-dur {
    display: inline-block;
    margin-top: 0.15rem;
    padding: 0.05rem 0.3rem;
    border-radius: 4px;
    background: #c3d4ff;
    color: var(--primary);
    font-size: 0.61rem;
    font-weight: 700;
    line-height: 1.4;
    align-self: flex-start;
}

/* Pause card variant */
.tmg-card--pause {
    background: var(--warning-soft);
    border-color: #f6d087;
}
.tmg-card--pause strong {
    color: var(--warning);
}
.tmg-card--pause .tmg-dur {
    background: #f6d087;
    color: var(--warning);
}

/* Conflict card */
.tmg-card--conflict {
    border-color: var(--warning);
    background: #fff9ef;
}
