:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --text: #182033;
    --muted: #667085;
    --line: #d9deea;
    --primary: #1f5eff;
    --primary-dark: #1648c7;
    --danger: #c62828;
    --ok: #157347;
    --warn: #ad6800;
    --shadow: 0 10px 30px rgba(24, 32, 51, .08);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100%;
    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; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 28px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.brand {
    font-weight: 800;
    font-size: 19px;
    color: var(--text);
}
.nav { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.nav a {
    color: var(--text);
    font-weight: 600;
    padding: 8px 10px;
    border-radius: 10px;
}
.nav a:hover { background: #eef2ff; text-decoration: none; }

.container {
    width: min(1280px, calc(100% - 32px));
    margin: 26px auto 50px;
}
.container.narrow { width: min(560px, calc(100% - 32px)); }

.card,
.day-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}
.login-card { margin-top: 80px; }

h1, h2, h3 { margin-top: 0; line-height: 1.18; }
h1 { font-size: clamp(28px, 4vw, 42px); margin-bottom: 8px; }
h2 { font-size: 22px; margin-bottom: 16px; }
p { line-height: 1.55; }

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.page-head p { margin: 0; color: var(--muted); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }

.grid { display: grid; gap: 20px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.two.uneven { grid-template-columns: minmax(320px, .8fr) minmax(520px, 1.2fr); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; box-shadow: var(--shadow); }
.stat strong { display: block; font-size: 30px; }
.stat span { color: var(--muted); }

.grid-form { display: grid; gap: 14px; }
.course-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }
.form-row { display: flex; align-items: flex-end; gap: 12px; }
.form-row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 220px; }
.week-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

a.button,
button.button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 0;
    border-radius: 12px;
    padding: 9px 14px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}
.button:hover { background: var(--primary-dark); text-decoration: none; }
.button.secondary { background: #eef2ff; color: var(--primary); }
.button.secondary:hover { background: #dfe6ff; }
.button.danger { background: #ffebee; color: var(--danger); }
.button.danger:hover { background: #ffd7dc; }
.button.small { min-height: 32px; padding: 6px 9px; font-size: 13px; border-radius: 9px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }
.link-button {
    border: 0;
    background: none;
    color: var(--danger);
    padding: 0;
    cursor: pointer;
    font: inherit;
}
.link-button:hover { text-decoration: underline; }

label { display: grid; gap: 6px; font-weight: 700; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 600; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    color: var(--text);
    background: #fff;
}
input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-width: 16px;
    height: 16px;
    padding: 0;
    margin: 0;
}
label.check input[type="checkbox"],
label.check input[type="radio"] {
    flex: 0 0 auto;
}
textarea { resize: vertical; }
select[multiple] { min-height: 132px; }
.hint { font-weight: 500; color: var(--muted); font-size: 13px; }
.codebox { min-height: 190px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.flash {
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--line);
    background: #fff;
}
.flash.success { background: #ecfdf3; border-color: #b7ebc6; color: var(--ok); }
.flash.error { background: #fff1f1; border-color: #ffc9c9; color: var(--danger); }

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.clean-list { margin: 0; padding-left: 20px; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.details-row td { background: #f8faff; color: var(--muted); }
.rights-table th:not(:first-child), .rights-table td:not(:first-child) { min-width: 110px; }

.pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    background: #eef2ff;
    color: var(--primary);
}
.pill.ok, .pill.planned { background: #ecfdf3; color: var(--ok); }
.pill.off, .pill.cancelled { background: #fff1f1; color: var(--danger); }
.pill.completed { background: #f5f5f5; color: #555; }

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(150px, 1fr));
    gap: 14px;
}
.day-card { padding: 16px; min-height: 200px; }
.day-card h2 { font-size: 18px; margin-bottom: 12px; }
.day-card h2 span { display: block; color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }
.entry {
    border: 1px solid var(--line);
    background: #f8faff;
    border-radius: 14px;
    padding: 10px;
    margin-bottom: 10px;
}
.entry strong, .entry span, .entry small { display: block; }
.entry small { color: var(--muted); margin-top: 4px; }
.entry-actions { display: flex; gap: 8px; margin-top: 8px; font-size: 13px; }

.footer {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto 30px;
    color: var(--muted);
    font-size: 13px;
}

@media (max-width: 1000px) {
    .grid.two, .grid.two.uneven, .course-form { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page-head { display: grid; }
}

@media (max-width: 640px) {
    .topbar { align-items: flex-start; flex-direction: column; padding: 12px 16px; }
    .nav { gap: 4px; }
    .nav a { padding: 6px 8px; }
    .stats, .week-grid { grid-template-columns: 1fr; }
    .card, .day-card { padding: 16px; }
    table { font-size: 14px; }
    th, td { padding: 9px 6px; }
}

@media print {
    .topbar, .footer, .button, .actions, .entry-actions, form { display: none !important; }
    body { background: #fff; }
    .container { width: 100%; margin: 0; }
    .card, .day-card { box-shadow: none; border-color: #999; }
}


.course-days-block { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: #f8faff; }
.course-days-table th, .course-days-table td { vertical-align: top; }
.course-days-table input, .course-days-table select, .course-days-table textarea { min-width: 120px; }
.course-days-table textarea { min-width: 220px; }
.nested-table { margin-top: 10px; background: #fff; border-radius: 12px; overflow: hidden; }
.nested-table th, .nested-table td { padding: 9px 8px; font-size: 14px; }
.compact-scroll { margin-top: 6px; }
.pill.theory { background: #eef2ff; color: var(--primary); }
.pill.practice { background: #fff7e6; color: var(--warn); }

.compact-card { margin-bottom: 18px; }
.month-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(150px, 1fr));
    gap: 10px;
}
.weekday {
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: .04em;
    padding: 0 8px 4px;
}
.month-day {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 12px;
    min-height: 190px;
}
.month-day.outside { opacity: .55; background: #f8faff; }
.month-day h2 { font-size: 16px; margin-bottom: 10px; }
.schedule-day-weekday { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; padding: 2px 7px; margin-right: 6px; border-radius: 999px; background: #eef2ff; color: var(--primary); font-size: 12px; font-weight: 900; }
.small-text { font-size: 13px; margin: 0; }
.shift-entry { border-left: 5px solid var(--primary); }
.course-entry { border-left: 5px solid var(--warn); background: #fffaf0; }

.vehicle-schedule-line { display: block; margin-top: 4px; }
.vehicle-schedule-line .pill { margin-left: 5px; padding: 2px 7px; font-size: 11px; vertical-align: baseline; }
.vehicle-schedule-note { display: block; color: var(--muted); }
.course-days-table select[multiple] { min-width: 190px; min-height: 110px; }

@media (max-width: 1100px) {
    .month-calendar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .weekday { display: none; }
}

@media (max-width: 640px) {
    .month-calendar { grid-template-columns: 1fr; }
}
.inline-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.absence-entry { border-left: 5px solid #8a3ffc; background: #f7f0ff; }
.privacy-card { margin-top: 20px; }
.radio-card {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    background: #fff;
    font-weight: 600;
}
.radio-card input { width: auto; margin-top: 4px; }
.radio-card small { display: block; color: var(--muted); font-weight: 500; margin-top: 4px; line-height: 1.4; }
.radio-card.warning { background: #fffaf0; }
.selected-trainers { border: 1px dashed var(--line); border-radius: 14px; padding: 14px; background: #f8faff; }
.overview-card { padding: 0; overflow: hidden; }
.overview-scroll { max-height: calc(100vh - 220px); overflow: auto; }
.overview-table { min-width: 1800px; border-collapse: separate; border-spacing: 0; }
.overview-table th,
.overview-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 150px; }
.overview-table thead th { position: sticky; top: 0; z-index: 3; background: #f8faff; }
.overview-table thead th span { color: var(--muted); font-size: 12px; }
.overview-table .sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 190px;
    background: #fff;
}
.overview-table thead .sticky-col { z-index: 4; background: #f8faff; }
.trainer-name { font-size: 14px; }
.trainer-name span { color: var(--muted); font-weight: 600; font-size: 12px; }
.overview-day-cell { min-height: 90px; vertical-align: top; background: #fff; }
.overview-entry {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 7px;
    margin-bottom: 6px;
    background: #f8faff;
    font-size: 12px;
}
.overview-entry strong,
.overview-entry small { display: block; }
.overview-entry small { color: var(--muted); margin-top: 3px; line-height: 1.35; }
.overview-entry.shift-entry { border-left: 4px solid var(--primary); }
.overview-entry.course-entry { border-left: 4px solid var(--warn); background: #fffaf0; }
.overview-entry.absence-entry { border-left: 4px solid #8a3ffc; background: #f7f0ff; }
.private-row .trainer-name { color: var(--muted); }
.private-cell { color: var(--muted); background: #fafafa; text-align: center; font-weight: 700; }

@media print {
    .overview-scroll { max-height: none; overflow: visible; }
    .overview-table thead th,
    .overview-table .sticky-col { position: static; }
}

.room-board {
    display: grid;
    grid-template-columns: minmax(260px, .8fr) repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    align-items: stretch;
    overflow-x: auto;
    padding-bottom: 12px;
}
.room-column {
    min-width: 260px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.room-column-head {
    padding: 16px;
    border-bottom: 1px solid var(--line);
    background: #f8faff;
}
.room-column-head h2 {
    font-size: 18px;
    margin: 0 0 6px;
}
.room-column-head span,
.room-column-head small {
    display: block;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}
.unassigned-room .room-column-head { background: #fffaf0; }
.inactive-room { opacity: .75; }
.room-drop-zone {
    min-height: 260px;
    padding: 12px;
    transition: background .15s ease, outline .15s ease;
}
.room-drop-zone.drag-over {
    background: #eef2ff;
    outline: 2px dashed var(--primary);
    outline-offset: -8px;
}
.room-drop-zone.occupied.drag-over {
    background: #fff1f1;
}
.room-course-card {
    border: 1px solid var(--line);
    border-left: 5px solid var(--warn);
    background: #fffaf0;
    border-radius: 14px;
    padding: 10px;
    margin-bottom: 10px;
    cursor: grab;
}
.room-course-card.dragging { opacity: .55; }
.room-course-card strong,
.room-course-card small {
    display: block;
}
.room-course-card small {
    color: var(--muted);
    margin-top: 4px;
}
.empty-drop-hint {
    color: var(--muted);
    font-size: 13px;
    margin: 6px 0 0;
}
.room-drop-zone .room-course-card + .empty-drop-hint { display: none; }

@media (max-width: 900px) {
    .room-board { grid-template-columns: 1fr; overflow-x: visible; }
    .room-column { min-width: 0; }
}

/* Foyer-TV und Profilbilder */
.user-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mini-avatar,
.avatar-preview img {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e8eefc;
    color: #17315f;
    font-weight: 800;
    flex: 0 0 auto;
}
.avatar-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}
.profile-photo-card { margin-bottom: 18px; }
.profile-photo-layout {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 18px;
    align-items: center;
}
.profile-photo {
    width: 120px;
    height: 120px;
    border-radius: 26px;
    object-fit: cover;
    box-shadow: 0 12px 30px rgba(24, 39, 75, .14);
}
.profile-photo.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8eefc, #f8fbff);
    color: #17315f;
    font-size: 36px;
    font-weight: 900;
}
.compact-form { margin: 0; }
.room-map-fields {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    background: #fbfcff;
}
.room-map-fields legend {
    padding: 0 8px;
    font-weight: 800;
}
.grid.four {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 12px;
}
.clean-list.numbered {
    list-style: decimal;
    padding-left: 22px;
}

.foyer-body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top left, #263a62 0, #111827 38%, #07111f 100%);
    color: #f8fafc;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    overflow: hidden;
}
.foyer-screen {
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: clamp(16px, 2vw, 34px);
    box-sizing: border-box;
    gap: clamp(14px, 1.6vw, 26px);
}
.foyer-header,
.foyer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.foyer-kicker {
    text-transform: uppercase;
    letter-spacing: .18em;
    font-size: clamp(14px, 1vw, 20px);
    color: #93c5fd;
    font-weight: 900;
}
.foyer-header h1 {
    margin: 0;
    font-size: clamp(42px, 5vw, 86px);
    line-height: .95;
}
.foyer-meta {
    text-align: right;
    font-size: clamp(16px, 1.2vw, 24px);
    color: #cbd5e1;
}
.foyer-meta strong,
.foyer-meta span {
    display: block;
}
.foyer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(420px, .65fr);
    gap: clamp(16px, 2vw, 30px);
    min-height: 0;
}
.foyer-map-card,
.foyer-course-panel {
    border: 1px solid rgba(255,255,255,.16);
    background: rgba(255,255,255,.08);
    border-radius: 34px;
    box-shadow: 0 30px 100px rgba(0,0,0,.35);
    backdrop-filter: blur(16px);
    min-height: 0;
}
.foyer-map-card {
    padding: clamp(16px, 2vw, 28px);
}
.floor-map {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 640px;
    border-radius: 28px;
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px),
        linear-gradient(135deg, rgba(219,234,254,.20), rgba(15,23,42,.32));
    background-size: 64px 64px, 64px 64px, auto;
}
.floor-outline {
    position: absolute;
    inset: 5% 4%;
    border: 7px solid rgba(255,255,255,.58);
    border-radius: 36px 90px 42px 54px;
    clip-path: polygon(0 0, 83% 0, 100% 17%, 100% 100%, 12% 100%, 0 84%);
    box-shadow: inset 0 0 0 2px rgba(15,23,42,.25), 0 0 70px rgba(147,197,253,.18);
}
.floor-corridor {
    position: absolute;
    background: rgba(255,255,255,.12);
    border: 1px dashed rgba(255,255,255,.26);
}
.floor-corridor.horizontal {
    left: 8%;
    right: 8%;
    top: 48%;
    height: 7%;
    border-radius: 999px;
}
.floor-corridor.vertical {
    top: 11%;
    bottom: 9%;
    left: 48%;
    width: 6%;
    border-radius: 999px;
}
.floor-room {
    position: absolute;
    z-index: 2;
    border-radius: 22px;
    border: 2px solid rgba(255,255,255,.62);
    padding: clamp(10px, 1vw, 18px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.floor-room.occupied {
    background: linear-gradient(135deg, #f97316, #ef4444);
}
.floor-room.free {
    background: linear-gradient(135deg, rgba(34,197,94,.85), rgba(20,184,166,.78));
}
.floor-room-number {
    font-size: clamp(18px, 1.5vw, 30px);
    line-height: 1;
    font-weight: 1000;
    text-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.floor-course-title {
    font-size: clamp(15px, 1.05vw, 22px);
    line-height: 1.1;
    font-weight: 850;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.floor-room-sub {
    font-size: clamp(13px, .9vw, 18px);
    color: rgba(255,255,255,.88);
    font-weight: 800;
}
.foyer-course-panel {
    padding: clamp(16px, 1.8vw, 26px);
    overflow: auto;
}
.foyer-course-panel h2 {
    margin: 0 0 18px;
    font-size: clamp(24px, 2.1vw, 42px);
}
.foyer-course-card {
    position: relative;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
    padding: 18px;
    margin-bottom: 16px;
    border-radius: 26px;
    background: rgba(255,255,255,.94);
    color: #0f172a;
    box-shadow: 0 16px 42px rgba(0,0,0,.20);
}
.foyer-room-badge {
    grid-row: span 2;
    min-height: 74px;
    border-radius: 22px;
    background: #0f172a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8px;
    font-size: clamp(18px, 1.4vw, 28px);
    font-weight: 1000;
    line-height: 1.05;
}
.foyer-course-main h3 {
    margin: 3px 0 5px;
    font-size: clamp(23px, 1.9vw, 38px);
    line-height: 1.05;
}
.foyer-course-time,
.foyer-place {
    color: #475569;
    font-size: clamp(14px, 1vw, 20px);
    font-weight: 750;
}
.foyer-trainers {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.foyer-trainer {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    background: #eef2ff;
    padding: 6px 12px 6px 6px;
    font-size: clamp(14px, 1vw, 20px);
    font-weight: 850;
}
.foyer-trainer img,
.foyer-trainer span {
    width: clamp(38px, 3vw, 58px);
    height: clamp(38px, 3vw, 58px);
    border-radius: 999px;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #1e3a8a;
    color: #fff;
    font-weight: 1000;
}
.foyer-trainer.missing {
    background: #fee2e2;
}
.foyer-empty {
    border: 2px dashed rgba(255,255,255,.35);
    border-radius: 26px;
    padding: 26px;
    color: #cbd5e1;
    font-size: clamp(20px, 1.6vw, 32px);
}
.foyer-footer {
    color: #cbd5e1;
    font-size: clamp(14px, 1vw, 20px);
}
.foyer-footer a {
    color: #bfdbfe;
    text-decoration: none;
    font-weight: 900;
}

@media (max-width: 1200px) {
    .foyer-body { overflow: auto; }
    .foyer-layout { grid-template-columns: 1fr; }
    .floor-map { min-height: 560px; }
}
@media (max-width: 700px) {
    .grid.four { grid-template-columns: 1fr 1fr; }
    .profile-photo-layout { grid-template-columns: 1fr; }
    .foyer-screen { padding: 12px; }
    .foyer-header, .foyer-footer { align-items: flex-start; flex-direction: column; }
    .foyer-course-card { grid-template-columns: 1fr; }
    .foyer-room-badge, .foyer-trainers { grid-column: auto; }
}

/* Grafischer Raumplan-Editor */
.map-editor-card {
    overflow: visible;
}
.map-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.map-editor-help {
    flex: 1 1 420px;
    color: #475569;
    font-size: 14px;
}
.check.compact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    white-space: nowrap;
}
.map-editor-status {
    min-height: 22px;
    margin: 4px 0 12px;
    font-weight: 700;
    color: #64748b;
}
.map-editor-status.pending { color: #b45309; }
.map-editor-status.success { color: #15803d; }
.map-editor-status.error { color: #b91c1c; }
.map-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    align-items: start;
}
.map-editor-stage-wrap {
    background: #0f172a;
    border-radius: 28px;
    padding: 10px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 18px 45px rgba(15,23,42,.18);
}
.map-editor-stage {
    min-height: 680px;
    user-select: none;
    touch-action: none;
}
.map-editor-room {
    cursor: grab;
    min-width: 58px;
    min-height: 46px;
    outline: none;
    overflow: visible;
    transition: box-shadow .12s ease, transform .12s ease, border-color .12s ease;
}
.map-editor-room:active {
    cursor: grabbing;
}
.map-editor-room.selected {
    border-color: #facc15;
    box-shadow: 0 0 0 4px rgba(250,204,21,.35), 0 22px 55px rgba(0,0,0,.38);
    transform: translateY(-1px);
}
.map-editor-room.inactive {
    background: linear-gradient(135deg, rgba(100,116,139,.86), rgba(51,65,85,.78));
    opacity: .78;
}
.map-editor-room-content {
    position: relative;
    z-index: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 4px;
    height: 100%;
    pointer-events: none;
}
.map-editor-room-title {
    font-size: clamp(15px, 1.25vw, 24px);
    line-height: 1.05;
    font-weight: 1000;
    text-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.map-editor-room-meta,
.map-editor-room-size {
    font-size: clamp(11px, .8vw, 15px);
    line-height: 1.2;
    font-weight: 800;
    color: rgba(255,255,255,.88);
}
.map-editor-resize {
    position: absolute;
    right: -13px;
    bottom: -13px;
    z-index: 20;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255,255,255,.96);
    border-radius: 999px;
    background: #facc15;
    color: #0f172a;
    font-size: 19px;
    line-height: 1;
    font-weight: 1000;
    cursor: nwse-resize;
    box-shadow: 0 8px 22px rgba(0,0,0,.38), 0 0 0 3px rgba(15,23,42,.18);
    touch-action: none;
}
.map-editor-resize:hover,
.map-editor-resize:focus-visible {
    background: #fde047;
    transform: scale(1.08);
    outline: 3px solid rgba(250,204,21,.38);
    outline-offset: 2px;
}
.map-editor-room.selected .map-editor-resize {
    box-shadow: 0 10px 26px rgba(0,0,0,.45), 0 0 0 5px rgba(250,204,21,.30);
}
.map-editor-side {
    position: sticky;
    top: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 16px;
}
.map-editor-side h2 {
    margin-top: 0;
}
.room-editor-list {
    display: grid;
    gap: 8px;
    max-height: 620px;
    overflow: auto;
    padding-right: 2px;
}
.room-editor-list-item {
    width: 100%;
    text-align: left;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: white;
    padding: 10px 12px;
    cursor: pointer;
}
.room-editor-list-item strong,
.room-editor-list-item span {
    display: block;
}
.room-editor-list-item span {
    color: #64748b;
    font-size: 12px;
    margin-top: 3px;
}
.room-editor-list-item.active {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.14);
}
.room-editor-list-item.inactive {
    opacity: .68;
}
@media (max-width: 1000px) {
    .map-editor-layout {
        grid-template-columns: 1fr;
    }
    .map-editor-side {
        position: static;
    }
    .map-editor-stage {
        min-height: 540px;
    }
}

/* DB-Regio-inspirierte Gestaltung und bearbeitbarer Grundriss */
:root {
    --bg: #f5f5f5;
    --card: #ffffff;
    --text: #1f2933;
    --muted: #68707a;
    --line: #d7dce1;
    --primary: #ec0016;
    --primary-dark: #b00014;
    --danger: #b00014;
    --ok: #1f7a45;
    --warn: #a35d00;
    --shadow: 0 12px 34px rgba(31, 41, 51, .10);
}
.topbar {
    border-top: 5px solid var(--primary);
    background: rgba(255,255,255,.96);
}
.brand {
    color: #111827;
    letter-spacing: -.02em;
}
.brand::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 10px;
    border-radius: 999px;
    background: var(--primary);
    margin-right: 9px;
    vertical-align: 1px;
}
.nav a:hover { background: #fff1f2; color: var(--primary-dark); }
.button.secondary { background: #f1f3f5; color: #202733; border: 1px solid #d7dce1; }
.button.secondary:hover { background: #e6e9ed; color: #111827; }
.pill { background: #fff1f2; color: var(--primary-dark); }
.map-editor-card.db-editor-card { border-top: 5px solid var(--primary); }
.segmented-control {
    display: inline-flex;
    border: 1px solid #d7dce1;
    border-radius: 999px;
    padding: 3px;
    background: #f1f3f5;
}
button.segmented {
    border: 0;
    background: transparent;
    color: #374151;
    font-weight: 800;
    padding: 8px 12px;
    border-radius: 999px;
    cursor: pointer;
}
button.segmented.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px rgba(236,0,22,.24);
}
.db-stage-wrap {
    background: linear-gradient(135deg, #30343b, #15191f);
    border-radius: 30px;
}
.floor-map {
    background:
        linear-gradient(90deg, rgba(31,41,51,.06) 1px, transparent 1px),
        linear-gradient(rgba(31,41,51,.06) 1px, transparent 1px),
        linear-gradient(135deg, #fafafa, #e8ebee);
    background-size: 56px 56px, 56px 56px, auto;
    border: 1px solid rgba(255,255,255,.75);
}
.floor-geometry {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.floor-geometry.editable {
    pointer-events: auto;
}
.floor-shape {
    fill: rgba(255,255,255,.88);
    stroke: #6b7280;
    stroke-width: .65;
    vector-effect: non-scaling-stroke;
}
.floor-corridor-shape {
    fill: rgba(229,231,235,.86);
    stroke: rgba(236,0,22,.72);
    stroke-width: .38;
    stroke-dasharray: 1.2 .9;
    vector-effect: non-scaling-stroke;
}
.corridor-editor-group .floor-corridor-shape {
    cursor: move;
    pointer-events: all;
}
.corridor-editor-group.selected .floor-corridor-shape {
    fill: rgba(255,241,242,.95);
    stroke: #ec0016;
    stroke-width: .75;
    stroke-dasharray: none;
}
.corridor-label {
    fill: #4b5563;
    font-size: 2.4px;
    font-weight: 900;
    pointer-events: none;
    user-select: none;
}
.corridor-resize {
    fill: #ec0016;
    stroke: #fff;
    stroke-width: .35;
    cursor: nwse-resize;
    pointer-events: all;
    vector-effect: non-scaling-stroke;
}
.geometry-handle {
    fill: #fff;
    stroke: #ec0016;
    stroke-width: .55;
    cursor: grab;
    pointer-events: all;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,.2));
}
.geometry-handle:active { cursor: grabbing; }
.map-editor-room.geometry-muted {
    opacity: .52;
    pointer-events: none;
}
.geometry-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.geometry-list {
    display: grid;
    gap: 10px;
    margin: 12px 0;
    max-height: 360px;
    overflow: auto;
}
.corridor-list-item {
    border: 1px solid #d7dce1;
    background: #fff;
    border-radius: 14px;
    padding: 10px;
}
.corridor-list-item.active {
    border-color: #ec0016;
    box-shadow: 0 0 0 3px rgba(236,0,22,.12);
}
.corridor-select {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    padding: 0 0 8px;
    cursor: pointer;
}
.corridor-select strong,
.corridor-select span {
    display: block;
}
.corridor-select span {
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}
.editor-reset-form { margin-top: 14px; }

/* Foyer-TV im rot-weiß-grauen Leitsystem-Look */
.foyer-body {
    background: linear-gradient(135deg, #f7f7f7 0%, #e6e8eb 55%, #d7dbe0 100%);
    color: #111827;
}
.foyer-screen {
    position: relative;
}
.foyer-screen::before {
    content: '';
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    height: 12px;
    background: #ec0016;
    z-index: 5;
}
.foyer-kicker { color: #ec0016; }
.foyer-meta { color: #4b5563; }
.foyer-map-card,
.foyer-course-panel {
    border: 1px solid rgba(31,41,51,.12);
    background: rgba(255,255,255,.88);
    box-shadow: 0 26px 70px rgba(31,41,51,.18);
}
.foyer-course-panel h2 { color: #111827; }
.floor-room {
    z-index: 2;
    border-radius: 16px;
    border: 2px solid rgba(255,255,255,.92);
}
.floor-room.occupied {
    background: linear-gradient(135deg, #ec0016, #b00014);
    color: #fff;
}
.floor-room.free {
    background: rgba(255,255,255,.92);
    color: #202733;
    border-color: rgba(107,114,128,.58);
}
.floor-room.free .floor-room-sub,
.floor-room.free .map-editor-room-meta,
.floor-room.free .map-editor-room-size {
    color: #4b5563;
    text-shadow: none;
}
.floor-room.free .floor-room-number,
.floor-room.free .floor-course-title,
.floor-room.free .map-editor-room-title {
    text-shadow: none;
}
.foyer-course-card {
    border: 1px solid rgba(31,41,51,.10);
    border-left: 8px solid #ec0016;
    box-shadow: 0 14px 38px rgba(31,41,51,.12);
}
.foyer-room-badge { background: #ec0016; }
.foyer-footer { color: #4b5563; }
.foyer-footer a { color: #b00014; font-weight: 900; }
.map-editor-stage.geometry-mode .floor-geometry { z-index: 5; }
.map-editor-stage.geometry-mode .map-editor-room { z-index: 1; }

/* Foyer-TV: breiterer Plan, schmalere Kursübersicht */
.foyer-layout {
    grid-template-columns: minmax(0, 1fr) clamp(300px, 20vw, 380px);
}
.foyer-map-card {
    min-width: 0;
}
.foyer-course-panel {
    padding: clamp(12px, 1.2vw, 20px);
}
.foyer-course-panel h2 {
    font-size: clamp(20px, 1.45vw, 30px);
    margin-bottom: 12px;
}
.foyer-course-card {
    grid-template-columns: 68px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 20px;
}
.foyer-room-badge {
    min-height: 58px;
    border-radius: 16px;
    font-size: clamp(15px, 1vw, 22px);
}
.foyer-course-main h3 {
    font-size: clamp(17px, 1.18vw, 27px);
}
.foyer-course-time,
.foyer-place {
    font-size: clamp(12px, .82vw, 16px);
}
.foyer-trainers {
    gap: 6px;
}
.foyer-trainer {
    padding: 4px 8px 4px 4px;
    font-size: clamp(12px, .82vw, 16px);
}
.foyer-trainer img,
.foyer-trainer span {
    width: clamp(30px, 2vw, 42px);
    height: clamp(30px, 2vw, 42px);
}

/* Breiterer Editor-Plan */
.map-editor-layout {
    grid-template-columns: minmax(720px, 1fr) 340px;
}
.map-editor-stage {
    aspect-ratio: 16 / 9;
    min-height: 620px;
}
@media (max-width: 1100px) {
    .map-editor-layout { grid-template-columns: 1fr; }
    .map-editor-stage { min-height: 520px; }
}

/* Symbole und Wegweiser im Foyer-Plan */
.floor-marker {
    position: absolute;
    z-index: 6;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45em;
    padding: .45em .55em;
    border-radius: 999px;
    background: rgba(255,255,255,.94);
    color: #202733;
    border: 2px solid rgba(31,41,51,.22);
    box-shadow: 0 12px 30px rgba(31,41,51,.20);
    font-weight: 950;
    overflow: visible;
    user-select: none;
}
.floor-marker-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.8em;
    height: 1.8em;
    border-radius: 999px;
    background: #ec0016;
    color: #fff;
    font-size: clamp(14px, 1vw, 22px);
    line-height: 1;
    font-weight: 1000;
}
.floor-marker-label {
    white-space: nowrap;
    font-size: clamp(12px, .85vw, 18px);
    line-height: 1.05;
}
.floor-marker-arrow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2.3em;
    height: 0;
    border-top: .35em solid #ec0016;
    transform: translate(-50%, -50%) rotate(var(--marker-angle, 0deg)) translateX(2.2em);
    transform-origin: left center;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.18));
}
.floor-marker-arrow::after {
    content: '';
    position: absolute;
    right: -.12em;
    top: -.72em;
    border-left: .8em solid #ec0016;
    border-top: .55em solid transparent;
    border-bottom: .55em solid transparent;
}
.floor-marker-location {
    width: auto;
    min-width: 54px;
    background: transparent;
    border: 0;
    box-shadow: none;
    color: #b00014;
    flex-direction: column;
    gap: .1em;
    padding: 0;
}
.floor-marker-location .floor-marker-icon {
    min-width: 2.8em;
    height: 2.8em;
    background: #ec0016;
    border: .45em solid #fff;
    box-shadow: 0 0 0 .28em rgba(236,0,22,.22), 0 12px 25px rgba(31,41,51,.28);
    font-size: 0;
}
.floor-marker-location .floor-marker-label {
    background: #fff;
    border-radius: 999px;
    padding: .22em .65em;
    box-shadow: 0 8px 18px rgba(31,41,51,.16);
}
.floor-marker-stairs {
    border-radius: 18px;
    border-color: rgba(236,0,22,.42);
}
.floor-marker-fire_extinguisher .floor-marker-icon,
.floor-marker-first_aid .floor-marker-icon,
.floor-marker-defibrillator .floor-marker-icon {
    background: #b00014;
}

/* Marker im Editor */
.map-marker-editor {
    pointer-events: none;
}
.map-editor-stage.signage-mode .map-marker-editor {
    pointer-events: auto;
    cursor: grab;
}
.map-editor-stage.signage-mode .map-marker-editor:active {
    cursor: grabbing;
}
.map-marker-editor.selected {
    outline: 4px solid rgba(250,204,21,.65);
    outline-offset: 3px;
}
.marker-resize {
    position: absolute;
    right: -12px;
    bottom: -12px;
    width: 34px;
    height: 34px;
    border: 3px solid #fff;
    border-radius: 999px;
    background: #facc15;
    color: #111827;
    font-weight: 1000;
    cursor: nwse-resize;
    box-shadow: 0 8px 20px rgba(31,41,51,.32);
    touch-action: none;
}
.marker-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.marker-list {
    display: grid;
    gap: 10px;
    max-height: 420px;
    overflow: auto;
}
.marker-list-item {
    border: 1px solid #d7dce1;
    background: #fff;
    border-radius: 14px;
    padding: 10px;
}
.marker-list-item.active {
    border-color: #ec0016;
    box-shadow: 0 0 0 3px rgba(236,0,22,.12);
}
.marker-select {
    width: 100%;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    padding: 0 0 8px;
    cursor: pointer;
}
.marker-select strong,
.marker-select span {
    display: block;
}
.marker-select span {
    color: var(--muted);
    font-size: 12px;
    margin-top: 3px;
}
.map-editor-stage.signage-mode .floor-geometry { z-index: 0; }
.map-editor-stage.signage-mode .map-editor-room { z-index: 1; opacity: .55; pointer-events: none; }
.map-editor-stage.signage-mode .map-marker-editor { z-index: 8; }


/* Raumplan-Editor: Planungsbereich über volle Bildschirmbreite */
.wide-editor-card {
    width: calc(100vw - 32px);
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}
.wide-editor-card .map-editor-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}
.wide-editor-card .map-editor-stage-wrap {
    width: 100%;
}
.wide-editor-card .map-editor-stage {
    width: 100%;
    height: 680px;
    min-height: 680px;
    aspect-ratio: auto;
}
.wide-editor-card .map-editor-side {
    position: static;
    width: 100%;
}
.wide-editor-card #roomSidePanel,
.wide-editor-card #geometrySidePanel,
.wide-editor-card #markerSidePanel {
    max-width: 1280px;
}
@media (min-width: 1500px) {
    .wide-editor-card .map-editor-stage {
        height: 720px;
        min-height: 720px;
    }
}
@media (max-width: 900px) {
    .wide-editor-card {
        width: calc(100vw - 16px);
    }
    .wide-editor-card .map-editor-stage {
        height: 560px;
        min-height: 560px;
    }
}

/* Foyer-TV: Kursliste entfernt, Informationen direkt in den Raumkacheln */
.foyer-layout.foyer-layout-map-only {
    display: block;
    min-height: 0;
}
.foyer-map-card-full {
    height: 100%;
    min-width: 0;
}
.foyer-layout-map-only .floor-map {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: var(--foyer-map-ratio, 16 / 9);
}
.foyer-map-autofit {
    max-width: 100%;
    margin: 0 auto;
}
.floor-room-tv {
    gap: clamp(5px, .45vw, 10px);
    justify-content: flex-start;
    padding: clamp(8px, .8vw, 15px);
}
.floor-room-tv-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.floor-room-time {
    flex: 0 0 auto;
    border-radius: 999px;
    background: rgba(255,255,255,.18);
    color: #fff;
    padding: 4px 8px;
    font-weight: 1000;
    font-size: clamp(10px, .78vw, 16px);
    line-height: 1;
    white-space: nowrap;
}
.floor-room-detail {
    color: rgba(255,255,255,.9);
    font-size: clamp(10px, .78vw, 16px);
    font-weight: 850;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.floor-room-trainers {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-height: 0;
    overflow: hidden;
    margin-top: auto;
}
.floor-room-trainer {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.92);
    color: #111827;
    padding: 3px 8px 3px 3px;
    font-size: clamp(10px, .78vw, 15px);
    font-weight: 950;
    line-height: 1.05;
    box-shadow: 0 8px 20px rgba(31,41,51,.16);
}
.floor-room-trainer img,
.floor-room-trainer span {
    flex: 0 0 auto;
    width: clamp(24px, 2.05vw, 42px);
    height: clamp(24px, 2.05vw, 42px);
    border-radius: 999px;
    object-fit: cover;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #202733;
    color: #fff;
    font-weight: 1000;
    font-size: clamp(9px, .72vw, 14px);
}
.floor-room-trainer strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.floor-room-trainer.missing {
    background: #fff3cd;
    color: #5f4300;
}
.floor-room-trainer.more {
    background: rgba(255,255,255,.72);
}
.floor-room-more-courses {
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    color: #fff;
    padding: 4px 8px;
    font-weight: 900;
    font-size: clamp(10px, .72vw, 14px);
    align-self: flex-start;
}
.floor-room-free-label {
    margin-top: auto;
    font-size: clamp(13px, .95vw, 18px);
    color: #4b5563;
    font-weight: 900;
}
.floor-room.free .floor-room-time,
.floor-room.free .floor-room-detail,
.floor-room.free .floor-room-more-courses {
    color: #4b5563;
    background: rgba(31,41,51,.08);
}
@media (max-width: 1200px) {
    .foyer-layout-map-only .floor-map { min-height: 0; }
}

/* Foyer-TV: reine Präsentationsfläche ohne Editor-Canvas, Raster oder Rahmen */
body.foyer-body {
    background: #f5f6f7;
    color: #111827;
    overflow: hidden;
}
body.foyer-body .foyer-screen {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding: clamp(8px, 1.1vw, 18px) clamp(12px, 1.4vw, 26px);
    gap: clamp(6px, .7vw, 12px);
}
body.foyer-body .foyer-header {
    min-height: 0;
}
body.foyer-body .foyer-kicker {
    color: #ec0016;
    font-size: clamp(11px, .8vw, 16px);
}
body.foyer-body .foyer-header h1 {
    font-size: clamp(24px, 2.8vw, 52px);
    line-height: 1;
}
body.foyer-body .foyer-meta {
    color: #4b5563;
    font-size: clamp(12px, .9vw, 18px);
}
body.foyer-body .foyer-footer {
    min-height: 0;
    color: #6b7280;
    font-size: clamp(11px, .85vw, 16px);
}
body.foyer-body .foyer-footer a {
    color: #b00014;
}
body.foyer-body .foyer-layout.foyer-layout-map-only {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    height: 100%;
    width: 100%;
}
body.foyer-body .foyer-map-card.foyer-map-card-full {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    overflow: visible;
}
body.foyer-body .foyer-map-card-full .floor-map.foyer-presentation-map {
    position: relative;
    min-height: 0 !important;
    max-width: 100%;
    max-height: 100%;
    margin: 0 auto;
    border: 0 !important;
    border-radius: 0;
    outline: 0;
    box-shadow: none !important;
    background: transparent !important;
    background-image: none !important;
    background-size: auto !important;
    overflow: visible;
    aspect-ratio: auto !important;
}
body.foyer-body .foyer-presentation-map .floor-geometry {
    overflow: visible;
}
body.foyer-body .foyer-presentation-map .floor-shape {
    fill: rgba(255,255,255,.96);
    stroke: #9ca3af;
    stroke-width: .45;
}
body.foyer-body .foyer-presentation-map .floor-corridor-shape {
    fill: rgba(229,231,235,.94);
    stroke: rgba(236,0,22,.58);
    stroke-width: .28;
    stroke-dasharray: none;
}
body.foyer-body .foyer-presentation-map .floor-room {
    box-shadow: 0 10px 28px rgba(17,24,39,.18);
}


/* Foyer-TV Vollbreite-Fix: Breite hat Vorrang vor Höhen-Fit */
body.foyer-body {
    overflow-x: hidden;
    overflow-y: auto;
}
body.foyer-body .foyer-screen {
    min-height: 100vh;
    height: auto;
    padding-left: clamp(4px, .55vw, 12px);
    padding-right: clamp(4px, .55vw, 12px);
    padding-top: clamp(6px, .6vw, 12px);
    padding-bottom: clamp(6px, .6vw, 12px);
    gap: clamp(4px, .45vw, 8px);
}
body.foyer-body .foyer-header {
    align-items: flex-start;
}
body.foyer-body .foyer-kicker {
    font-size: clamp(10px, .65vw, 14px);
    letter-spacing: .22em;
}
body.foyer-body .foyer-header h1 {
    font-size: clamp(28px, 2.45vw, 48px);
}
body.foyer-body .foyer-meta {
    font-size: clamp(11px, .75vw, 16px);
    padding-top: 8px;
}
body.foyer-body .foyer-layout.foyer-layout-map-only {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
}
body.foyer-body .foyer-map-card.foyer-map-card-full {
    width: 100%;
    height: auto;
    min-height: 0;
    align-items: flex-start;
    justify-content: flex-start;
    overflow: visible;
}
body.foyer-body .foyer-map-card-full .floor-map.foyer-presentation-map {
    width: 100% !important;
    max-width: none;
    max-height: none;
    margin: 0;
    transform: none;
}
body.foyer-body .foyer-footer {
    padding: 0 clamp(10px, 1vw, 18px);
    margin-top: 4px;
}

/* Foyer-TV Mittelmaß-Fix: Plan lesbar, aber nicht mehr brutal über die gesamte Breite gezogen */
body.foyer-body .foyer-layout.foyer-layout-map-only {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    height: auto;
    min-height: 0;
}
body.foyer-body .foyer-map-card.foyer-map-card-full {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
}
body.foyer-body .foyer-map-card-full .floor-map.foyer-presentation-map {
    margin-left: auto;
    margin-right: auto;
    transform: none;
}

/* Wegweiser-Kästen: ein Pfeil pro Gruppe, keine Einzelpfeile */
.floor-marker-arrow { display: none !important; }
.floor-marker-group {
    position: absolute;
    z-index: 7;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: .35em;
    padding: .65em .75em .7em;
    border-radius: 22px;
    background: rgba(255,255,255,.96);
    border: 2px solid rgba(31,41,51,.20);
    box-shadow: 0 16px 36px rgba(31,41,51,.22);
    color: #1f2937;
    overflow: visible;
    user-select: none;
}
.floor-marker-group-title {
    color: #ec0016;
    font-size: clamp(10px, .72vw, 15px);
    line-height: 1;
    font-weight: 1000;
    letter-spacing: .08em;
    text-transform: uppercase;
    white-space: nowrap;
}
.floor-marker-group-items {
    display: grid;
    grid-template-columns: repeat(var(--group-columns, 1), minmax(0, 1fr));
    gap: .35em .55em;
    align-items: center;
    overflow: hidden;
}
.floor-marker-group-item {
    display: flex;
    align-items: center;
    gap: .4em;
    min-width: 0;
    font-weight: 950;
}
.floor-marker-group-item .floor-marker-icon {
    flex: 0 0 auto;
    min-width: 1.75em;
    height: 1.75em;
    font-size: clamp(11px, .7vw, 18px);
}
.floor-marker-group-item .floor-marker-label {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(11px, .82vw, 17px);
}
.floor-marker-group-empty {
    color: #6b7280;
    font-weight: 800;
    font-size: clamp(11px, .78vw, 15px);
}
.floor-marker-group-arrow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 3.7em;
    height: 0;
    border-top: .42em solid #ec0016;
    transform: translate(-50%, -50%) rotate(var(--group-arrow-angle, 0deg)) translateX(calc(50% + 2.2em));
    transform-origin: left center;
    filter: drop-shadow(0 3px 3px rgba(0,0,0,.18));
    pointer-events: none;
}
.floor-marker-group-arrow::after {
    content: '';
    position: absolute;
    right: -.16em;
    top: -.86em;
    border-left: 1em solid #ec0016;
    border-top: .65em solid transparent;
    border-bottom: .65em solid transparent;
}
.map-marker-group-editor {
    pointer-events: none;
}
.map-editor-stage.signage-mode .map-marker-group-editor {
    pointer-events: auto;
    cursor: grab;
    z-index: 7;
}
.map-editor-stage.signage-mode .map-marker-group-editor:active {
    cursor: grabbing;
}
.map-marker-group-editor.selected {
    outline: 4px solid rgba(250,204,21,.75);
    outline-offset: 4px;
}
.marker-group-resize {
    position: absolute;
    right: -12px;
    bottom: -12px;
    width: 34px;
    height: 34px;
    border: 3px solid #fff;
    border-radius: 999px;
    background: #facc15;
    color: #111827;
    font-weight: 1000;
    cursor: nwse-resize;
    box-shadow: 0 8px 20px rgba(31,41,51,.32);
    touch-action: none;
}
.map-editor-stage.signage-mode .map-marker-editor { z-index: 9; }
.marker-group-list-item { background: #fff7f7; }
.marker-group-list-item.active { border-color: #ec0016; box-shadow: 0 0 0 3px rgba(236,0,22,.12); }
body.foyer-body .foyer-presentation-map .floor-marker-group {
    box-shadow: 0 14px 30px rgba(17,24,39,.22);
}
body.foyer-body .foyer-presentation-map .floor-marker-group-title {
    font-size: clamp(9px, .62vw, 14px);
}

/* Wegweiser-Kasten direkt auf dem Canvas steuern */
.map-marker-group-editor {
    touch-action: none;
}
.map-marker-group-editor .marker-group-move-handle {
    position: absolute;
    left: 10px;
    top: -28px;
    z-index: 30;
    display: none;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #1f2937;
    color: #fff;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .02em;
    box-shadow: 0 10px 24px rgba(17,24,39,.28);
    pointer-events: none;
    white-space: nowrap;
}
.map-marker-group-editor.selected .marker-group-move-handle {
    display: inline-flex;
}
.marker-group-controlbar {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 38px);
    z-index: 35;
    display: none;
    align-items: center;
    gap: 5px;
    padding: 7px 8px;
    border-radius: 999px;
    background: rgba(255,255,255,.98);
    border: 1px solid rgba(31,41,51,.18);
    box-shadow: 0 18px 42px rgba(17,24,39,.24);
    transform: translateX(-50%);
    white-space: nowrap;
}
.map-marker-group-editor.selected .marker-group-controlbar {
    display: flex;
}
.marker-group-control-title {
    color: #4b5563;
    font-size: 12px;
    font-weight: 1000;
    padding: 0 4px 0 2px;
    text-transform: uppercase;
    letter-spacing: .08em;
}
.marker-group-controlbar button {
    width: 31px;
    height: 31px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: #f1f3f5;
    color: #111827;
    font-weight: 1000;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(31,41,51,.10);
    touch-action: manipulation;
}
.marker-group-controlbar button:hover,
.marker-group-controlbar button:focus-visible {
    background: #ec0016;
    color: #fff;
    outline: 3px solid rgba(236,0,22,.22);
    outline-offset: 2px;
}
.marker-group-controlbar button.danger:hover,
.marker-group-controlbar button.danger:focus-visible {
    background: #7f1d1d;
}
.map-editor-stage.signage-mode .map-marker-group-editor {
    cursor: move;
}
.map-editor-stage.signage-mode .map-marker-group-editor .marker-group-controlbar,
.map-editor-stage.signage-mode .map-marker-group-editor .marker-group-controlbar * {
    cursor: default;
}
.map-editor-stage.signage-mode .map-marker-group-editor .marker-group-resize {
    cursor: nwse-resize;
}

/* Planungszentrale / kurzfristige Dienstplanänderungen */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-bottom: 1.2rem;
}
.kpi-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 1rem 1.1rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, .07);
}
.kpi-card span { display:block; color:#6b7280; font-weight:700; font-size:.9rem; }
.kpi-card strong { display:block; color:#111827; font-size:2.2rem; line-height:1.1; margin:.25rem 0; }
.kpi-card small { color:#6b7280; }
.kpi-card.danger { border-color:#fecaca; background:#fff1f2; }
.kpi-card.warn { border-color:#fde68a; background:#fffbeb; }
.danger-row { background:#fff7f7; }
.success-text { color:#15803d; font-weight:700; }
.inline-form { display:flex; flex-wrap:wrap; gap:.45rem; align-items:center; }
.inline-form select { min-width:180px; }
.modal-backdrop[hidden] { display:none !important; }
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, .58);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
}
.modal-card {
    width: min(760px, 96vw);
    max-height: 86vh;
    overflow: auto;
    background: #fff;
    border-radius: 22px;
    padding: 1.35rem;
    box-shadow: 0 28px 80px rgba(0,0,0,.25);
    border-top: 8px solid #e2001a;
}
.modal-card h2 { margin-top:0; }
.modal-card textarea { width:100%; margin-top:.35rem; }
.confirm-needed {
    margin-top:.35rem;
    padding:.35rem .5rem;
    background:#fffbeb;
    border:1px solid #fde68a;
    border-radius:10px;
    font-size:.85rem;
    font-weight:700;
}
.bell { display:inline-block; margin-right:.25rem; }
.flash.warning {
    background:#fffbeb;
    color:#92400e;
    border-color:#fde68a;
}

/* Planer-Kalender: 28-Tage-Matrix */
.full-width-page {
    width: calc(100vw - 32px);
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}
.planner-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}
.planner-calendar-controls { flex-wrap: wrap; justify-content: flex-end; }
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: .35rem .7rem;
    font-weight: 800;
    font-size: .86rem;
    background: #eef2ff;
    color: #1d4ed8;
    white-space: nowrap;
}
.badge.danger { background: #fee2e2; color: #b91c1c; }
.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: .8rem;
}
.planner-unassigned-panel { margin-bottom: 1rem; }
.unassigned-course-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: .65rem;
}
.planner-calendar-shell {
    border-radius: 18px;
    border: 1px solid #d9deea;
    background: #fff;
    box-shadow: 0 14px 40px rgba(15,23,42,.08);
    overflow: hidden;
}
.planner-calendar-scroll {
    max-height: calc(100vh - 280px);
    overflow: auto;
}
.planner-calendar-table {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 3200px;
    width: max-content;
    font-size: .87rem;
}
.planner-calendar-table th,
.planner-calendar-table td {
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}
.planner-calendar-table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #f8fafc;
    color: #111827;
    padding: .55rem .45rem;
    text-align: center;
}
.planner-calendar-table .trainer-col {
    position: sticky;
    left: 0;
    z-index: 6;
    width: 220px;
    min-width: 220px;
    max-width: 220px;
    background: #fff;
    border-left: 1px solid #e5e7eb;
}
.planner-calendar-table thead .trainer-col {
    z-index: 8;
    background: #f1f5f9;
}
.trainer-name-cell {
    padding: .7rem .75rem;
    text-align: left;
}
.trainer-name-main { font-weight: 850; color: #111827; }
.trainer-role { color: #64748b; font-size: .78rem; margin-top: .1rem; }
.day-col {
    min-width: 112px;
    width: 112px;
}
.day-col .weekday { font-weight: 900; }
.day-col .date { font-size: .95rem; }
.day-col .holiday-name {
    color: #991b1b;
    font-size: .65rem;
    line-height: 1.1;
    margin-top: .15rem;
}
.day-col.non-workday,
.planner-cell.non-workday { background: #f3f4f6; }
.day-col.today,
.planner-cell.today { box-shadow: inset 0 0 0 2px rgba(226, 0, 26, .22); }
.day-col.locked-window .date::after {
    content: '';
}
.planner-cell {
    height: 96px;
    min-width: 112px;
    width: 112px;
    padding: .35rem;
    background: #fff;
    transition: background .15s ease, box-shadow .15s ease;
}
.planner-cell.drop-target {
    background: #e0f2fe !important;
    box-shadow: inset 0 0 0 3px #0284c7;
}
.planner-cell.overbooked { background: #fff7ed; }
.empty-drop-hint {
    color: #94a3b8;
    font-size: .76rem;
    font-weight: 700;
    text-align: center;
    margin-top: .55rem;
}
.planner-card {
    border-radius: 12px;
    padding: .45rem .5rem;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    box-shadow: 0 3px 9px rgba(15,23,42,.07);
    cursor: grab;
    overflow: hidden;
    margin-bottom: .35rem;
}
.planner-card.dragging { opacity: .45; }
.planner-card strong,
.planner-card span,
.planner-card small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}
.planner-card strong { color: #111827; font-size: .78rem; white-space: nowrap; }
.planner-card span { color: #334155; font-size: .76rem; white-space: nowrap; margin-top: .05rem; }
.planner-card small { color: #64748b; font-size: .68rem; line-height: 1.25; max-height: 2.5em; }
.planner-card-title { display:flex; gap:.2rem; align-items:center; min-width:0; }
.planner-card.course { background: #eff6ff; border-color: #93c5fd; }
.planner-card.shift { background: #f0fdf4; border-color: #86efac; }
.planner-card.absence { background: #fef2f2; border-color: #fecaca; cursor: not-allowed; }
.planner-card.unassigned { background: #fff7ed; border-color: #fdba74; }
.cell-warning {
    margin-top: .25rem;
    color: #b45309;
    font-weight: 900;
    font-size: .68rem;
    text-transform: uppercase;
}
@media (max-width: 900px) {
    .planner-calendar-header { display: block; }
    .planner-calendar-controls { justify-content: flex-start; }
    .planner-calendar-scroll { max-height: calc(100vh - 360px); }
}

.trainer-schedule-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #fff1f2;
    border: 1px solid rgba(220, 38, 38, 0.28);
    font-size: 11px;
    font-weight: 850;
    color: #dc2626;
    text-decoration: none;
    white-space: nowrap;
}
.trainer-schedule-open:hover,
.trainer-schedule-open:focus {
    background: #fee2e2;
    border-color: rgba(220, 38, 38, 0.5);
    color: #b91c1c;
}
.course-color-select {
    font-weight: 700;
}

/* Trainer-Auswahl in der Kurstag-Tagesplanung */
.day-trainer-cell {
    min-width: 240px;
}
.trainer-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: .45rem;
}
.trainer-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    border-radius: 999px;
    background: #eef2f7;
    color: #1f2937;
    padding: .28rem .55rem;
    font-size: .85rem;
    font-weight: 700;
    border: 1px solid #d6dee8;
}
.trainer-chip-remove {
    border: 0;
    background: transparent;
    color: #991b1b;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 .1rem;
}
.small-hint {
    display: block;
    margin-top: .35rem;
    font-size: .78rem;
}
.wide-modal {
    max-width: min(820px, 94vw);
}
.trainer-modal-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .65rem;
    margin: 1rem 0;
    max-height: 60vh;
    overflow: auto;
}
.trainer-choice {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    text-align: left;
    border: 1px solid #d6dee8;
    background: #fff;
    border-radius: 14px;
    padding: .85rem;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .06);
}
.trainer-choice span {
    color: #64748b;
    font-size: .82rem;
}
.trainer-choice.active {
    border-color: #d0001f;
    background: #fff5f5;
    box-shadow: 0 0 0 2px rgba(208, 0, 31, .12);
}
.notice.info {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    border-radius: 14px;
    padding: 1rem;
}

.form-info {
    align-self: end;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--border, #d8dee9);
    border-radius: 0.8rem;
    background: var(--surface-muted, #f5f7fa);
    line-height: 1.35;
}

/* Kalenderregeln / Kursfarben */
.course-color-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 999px;
    margin-right: 6px;
    vertical-align: middle;
    border: 1px solid rgba(0,0,0,.12);
}
.planner-card.course {
    border-left: 5px solid var(--course-color, #cc0000);
    background: color-mix(in srgb, var(--course-color, #cc0000) 12%, #ffffff);
}
.planner-card.course.unassigned {
    border-left-color: var(--course-color, #cc0000);
}
.day-col.shutdown,
.planner-cell.shutdown {
    background: #fff7cc !important;
}
.day-col.holiday,
.planner-cell.holiday {
    background: #f3f4f6;
}
.day-col.weekend,
.planner-cell.weekend {
    background: #eef0f3;
}
.planner-cell.non-workday.drop-target {
    outline: 2px dashed #d97706;
}

/* Führungskraft-Historie und globale Lightboxen */
.narrow-card { max-width: 640px; margin-left: auto; margin-right: auto; }
.history-details {
    max-width: 520px;
    max-height: 260px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: .75rem;
    font-size: .82rem;
}
.app-global-modal-card { max-width: 560px; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }
.form-static {
    min-width: 170px;
    padding: 0.72rem 0.85rem;
    border: 1px solid #d9dfe7;
    border-radius: 12px;
    background: #f8fafc;
    color: #1f2937;
}
.form-static strong { color: #111827; }

/* Erweiterung: Planer-Kalender, Einsatzorte, Live-Bearbeitung */
.planner-card.shutdown {
    background: #fef3c7 !important;
    border-color: #f59e0b !important;
    color: #78350f;
    cursor: default;
}
.planner-card.shutdown strong::before {
    content: "⛔ ";
}
.edit-lock-warning {
    margin: 0 0 16px 0;
}
.trainer-filter-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
}
.trainer-filter-check:last-child { border-bottom: 0; }
.trainer-filter-check input { width: auto; }
.trainer-filter-check div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.trainer-filter-check span {
    color: #6b7280;
    font-size: 12px;
}
.trainer-filter-list {
    max-height: 340px;
    overflow: auto;
}
.trainer-filter-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 10px;
}
.shutdown-entry {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    color: #78350f;
}
.month-day.shutdown-day {
    background: #fffbeb;
}


/* Modulbearbeitung im Planungskalender */
.planner-course-edit-card {
    width: min(1480px, 98vw);
    height: min(920px, 96vh);
    max-height: 96vh;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    background: #fff;
}
.modal-title-row h2 { margin: 0; }
.planner-course-edit-frame {
    border: 0;
    width: 100%;
    flex: 1 1 auto;
    background: #f8fafc;
}
.embedded-modal-page {
    background: #f8fafc;
}
.embedded-modal-container {
    width: 100%;
    max-width: none;
    padding: 1rem;
}
.modal-page-head {
    margin-bottom: .85rem;
}
@media (max-width: 900px) {
    .planner-course-edit-card {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }
}

.compact-warning {
    margin-top: .55rem;
    padding: .55rem .65rem;
    font-size: .86rem;
}
.quick-trainer-list {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .35rem;
}
.button.tiny {
    padding: .18rem .45rem;
    font-size: .78rem;
    border-radius: .45rem;
}
.warning-row {
    background: #fff7d6;
}

.section-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-heading-row h2 { margin: 0; }
.course-day-toggle-wrap { margin-top: 8px; }
.course-days-detail-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.course-days-detail[hidden] { display: none !important; }

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 14px;
    margin-top: .5rem;
}
.equipment-fieldset {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    background: #fff;
}
.equipment-fieldset legend {
    padding: 0 8px;
    font-weight: 800;
}
.checkbox-grid .check,
.equipment-option {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
    font-weight: 700;
}
.template-vehicle-box {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    background: #f8fafc;
}
.template-vehicle-grid {
    display: grid;
    grid-template-columns: minmax(220px, max-content) minmax(260px, 420px);
    gap: 14px;
    align-items: end;
}
@media (max-width: 760px) {
    .template-vehicle-grid { grid-template-columns: 1fr; }
}
.compact-check {
    white-space: nowrap;
    align-items: center;
    gap: .35rem;
}
.vehicle-planning-scroll { overflow-x: auto; }
.vehicle-week-table { min-width: 1100px; table-layout: fixed; }
.vehicle-week-table th:first-child { min-width: 180px; position: sticky; left: 0; background: var(--card-bg, #fff); z-index: 2; }
.vehicle-day-cell { min-width: 150px; vertical-align: top; }
.vehicle-card {
    border: 1px solid rgba(0,0,0,.12);
    border-radius: 12px;
    padding: .55rem;
    margin-bottom: .45rem;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.vehicle-card strong, .vehicle-card small { display: block; }
.vehicle-card small { color: #555; margin-top: .2rem; }
.pill.warning { background: #fef3c7; color: #92400e; border-color: #f59e0b; }

.compact-stats { margin: 0; }
.vehicle-summary-card { padding-bottom: 14px; }
.vehicle-week-table { min-width: 1500px; }
.vehicle-week-table th:first-child { min-width: 210px; }
.vehicle-day-cell { min-width: 240px; }
.vehicle-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .5rem;
    margin-bottom: .25rem;
}
.vehicle-card-head strong { flex: 1; }
.vehicle-dispo-form {
    display: grid;
    gap: .4rem;
    margin-top: .55rem;
}
.vehicle-dispo-form label {
    display: grid;
    gap: .18rem;
    font-size: 12px;
    color: var(--muted);
    font-weight: 700;
}
.vehicle-dispo-form input,
.vehicle-dispo-form select,
.vehicle-dispo-form textarea {
    width: 100%;
    font-size: 13px;
    padding: .45rem .5rem;
}
.vehicle-dispo-form textarea { resize: vertical; }
.vehicle-actions { margin-top: .15rem; }
.vehicle-readonly-details { margin-top: .45rem; }
.vehicle-status-open { border-left: 4px solid #d7dce1; }
.vehicle-status-available { border-left: 4px solid var(--ok); }
.vehicle-status-available_other_location { border-left: 4px solid #f59e0b; }
.vehicle-status-not_available { border-left: 4px solid var(--danger); }
.pill.neutral { background: #f5f5f5; color: #555; }

/* Fahrzeugdispo: Kalender nur als Übersicht, Bearbeitung in Listenansicht */
.vehicle-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.vehicle-calendar-table { min-width: 1200px; }
.vehicle-calendar-table th:first-child { min-width: 190px; }
.vehicle-calendar-table .vehicle-day-cell { min-width: 155px; padding: .5rem; }
.vehicle-calendar-table .vehicle-card { padding: .5rem; margin-bottom: .4rem; }
.vehicle-card-link { display: block; color: inherit; text-decoration: none; cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.vehicle-card-link:hover { text-decoration: none; transform: translateY(-1px); box-shadow: 0 5px 14px rgba(0,0,0,.10); border-color: rgba(31,94,255,.35); }
.vehicle-card-link .pill { white-space: normal; text-align: right; }
.vehicle-card-head { align-items: flex-start; }
.vehicle-card-head strong { min-width: 0; }
.vehicle-list { display: grid; gap: .5rem; }
.vehicle-list-header,
.vehicle-list-row {
    display: grid;
    grid-template-columns: minmax(250px, 1.25fr) minmax(170px, .7fr) minmax(150px, .65fr) minmax(190px, .8fr) minmax(190px, .8fr) minmax(220px, 1fr) minmax(110px, .45fr);
    gap: .65rem;
    align-items: start;
}
.vehicle-list-header {
    padding: .35rem .65rem;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.vehicle-list-row {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    padding: .75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
    scroll-margin-top: 95px;
}
.vehicle-list-row:target { outline: 3px solid rgba(31,94,255,.22); border-color: var(--primary); }
.vehicle-list-row.vehicle-dispo-form { margin-top: 0; }
.vehicle-list-row.vehicle-dispo-form label { font-size: 12px; color: var(--muted); }
.vehicle-list-row.vehicle-dispo-form input,
.vehicle-list-row.vehicle-dispo-form select,
.vehicle-list-row.vehicle-dispo-form textarea { min-height: 38px; }
.vehicle-need-cell { display: grid; gap: .18rem; }
.vehicle-need-cell strong,
.vehicle-need-cell span,
.vehicle-need-cell small { display: block; }
.vehicle-need-cell small { color: var(--muted); }
.vehicle-readonly-row > div { min-width: 0; overflow-wrap: anywhere; }
.vehicle-actions { align-self: end; }

@media (max-width: 1150px) {
    .vehicle-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .vehicle-list-header { display: none; }
    .vehicle-list-row { grid-template-columns: 1fr 1fr; }
    .vehicle-need-cell { grid-column: 1 / -1; }
    .vehicle-actions { align-self: start; }
}

@media (max-width: 720px) {
    .vehicle-stats { grid-template-columns: 1fr; }
    .vehicle-list-row { grid-template-columns: 1fr; }
}

/* Fahrzeugdispo kompakt und anonymisiert */
.vehicle-calendar-simple { min-width: 980px; }
.vehicle-calendar-simple th:first-child {
    position: static;
    left: auto;
    min-width: auto;
    background: transparent;
}
.vehicle-calendar-simple .vehicle-day-cell { min-width: 140px; }
.vehicle-calendar-simple .vehicle-card {
    text-align: center;
    font-weight: 800;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.vehicle-card.vehicle-status-open {
    background: #f3f4f6;
    border-color: #d1d5db;
}
.vehicle-card.vehicle-status-available,
.vehicle-card.vehicle-status-available_other_location {
    background: #dcfce7;
    border-color: var(--ok);
}
.vehicle-card.vehicle-status-not_available {
    background: #fee2e2;
    border-color: var(--danger);
}
.vehicle-dispo-compact-list .vehicle-list-header,
.vehicle-dispo-compact-list .vehicle-list-row {
    grid-template-columns: minmax(180px, .9fr) minmax(180px, .9fr) minmax(160px, .8fr) minmax(260px, 1.3fr) minmax(160px, .75fr);
    align-items: center;
}
.vehicle-location-cell { overflow-wrap: anywhere; }
.vehicle-save-cell {
    display: grid;
    gap: .35rem;
    align-self: stretch;
}
.vehicle-save-cell label { margin: 0; }
.vehicle-dispo-compact-list textarea {
    resize: vertical;
    min-height: 38px;
}
.vehicle-series-select { margin-top: .35rem; width: 100%; min-width: 150px; }

@media (max-width: 1150px) {
    .vehicle-dispo-compact-list .vehicle-list-row { grid-template-columns: 1fr 1fr; }
    .vehicle-dispo-compact-list .vehicle-list-header { display: none; }
}

@media (max-width: 720px) {
    .vehicle-dispo-compact-list .vehicle-list-row { grid-template-columns: 1fr; }
}


/* Fahrzeug-Standortwarnung: Status „Verfügbar an anderem Standort“ */
.vehicle-location-warning {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    line-height: 1;
    vertical-align: text-bottom;
}
.vehicle-location-warning.small {
    width: 16px;
    height: 16px;
    font-size: 12px;
    margin-left: 4px;
}
.planner-open-vehicles-table .vehicle-series-cell strong { display: block; }
.planner-open-vehicles-table .vehicle-series-cell small { color: var(--muted); }

/* Planer-Kalender: Zoom, kompakte Kacheln und Rechtsklick-Details */
.planner-zoomable { --planner-zoom: 1; }
.planner-zoom-control {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .35rem .55rem;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    font-weight: 800;
}
.planner-zoom-control label { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.planner-zoom-control input[type="range"] { width: 150px; min-height: auto; padding: 0; }
.planner-zoom-control span { min-width: 44px; text-align: right; color: #475569; }
.planner-zoomable .planner-calendar-table {
    min-width: calc(3200px * var(--planner-zoom));
    font-size: calc(.87rem * var(--planner-zoom));
}
.planner-zoomable .planner-calendar-table .trainer-col {
    width: calc(220px * var(--planner-zoom));
    min-width: calc(220px * var(--planner-zoom));
    max-width: calc(220px * var(--planner-zoom));
}
.planner-zoomable .day-col,
.planner-zoomable .planner-cell {
    min-width: calc(112px * var(--planner-zoom));
    width: calc(112px * var(--planner-zoom));
}
.planner-zoomable .planner-cell {
    height: calc(96px * var(--planner-zoom));
    padding: calc(.35rem * var(--planner-zoom));
}
.planner-zoomable .planner-card {
    padding: calc(.45rem * var(--planner-zoom)) calc(.5rem * var(--planner-zoom));
    border-radius: calc(12px * var(--planner-zoom));
    margin-bottom: calc(.35rem * var(--planner-zoom));
}
.planner-zoomable .planner-card strong { font-size: calc(.78rem * var(--planner-zoom)); }
.planner-zoomable .planner-card span { font-size: calc(.76rem * var(--planner-zoom)); }
.planner-zoomable .planner-card small { font-size: calc(.68rem * var(--planner-zoom)); }
.planner-card[data-course-details] { cursor: context-menu; }
.planner-course-info-card { width: min(900px, 96vw); }
.planner-course-info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin-top: .85rem;
}
.planner-course-info-grid > div {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: .75rem;
    background: #f8fafc;
}
.planner-course-info-grid .wide { grid-column: 1 / -1; }
.planner-course-info-grid strong {
    display: block;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: #64748b;
    margin-bottom: .22rem;
}
.planner-course-info-grid span { display: block; font-weight: 800; color: #111827; white-space: pre-wrap; }
.planner-course-info-actions {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}
@media (max-width: 700px) {
    .planner-course-info-grid { grid-template-columns: 1fr; }
}

/* Nachrichtentool */
.messages-layout {
    display: grid;
    grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.message-thread-list { display: grid; gap: .55rem; }
.message-thread-link {
    display: block;
    padding: .75rem;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    background: #fff;
}
.message-thread-link:hover,
.message-thread-link.active { border-color: #e2001a; box-shadow: 0 8px 22px rgba(15,23,42,.08); }
.message-thread-link strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.message-thread-link span { display:block; color:#64748b; font-size:.86rem; margin-top:.15rem; }
.message-window { display: grid; gap: .8rem; }
.message-posts {
    display: grid;
    gap: .65rem;
    max-height: 56vh;
    overflow: auto;
    padding-right: .25rem;
}
.message-post {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: .75rem;
    background: #f8fafc;
}
.message-post.mine { background:#eef2ff; border-color:#c7d2fe; }
.message-post-head { display:flex; justify-content:space-between; gap:.75rem; color:#64748b; font-size:.82rem; font-weight:800; margin-bottom:.35rem; }
.message-post-body { white-space:pre-wrap; color:#111827; }
.message-compose textarea { width:100%; min-height:110px; }
.message-toolbar { display:flex; gap:.55rem; flex-wrap:wrap; justify-content:space-between; align-items:center; }
.teams-note { color:#64748b; font-size:.86rem; margin-top:.35rem; }
@media (max-width: 900px) {
    .messages-layout { grid-template-columns: 1fr; }
}

/* Vorplanungskalender */
.preplanning-calendar-table .trainer-col { width: 260px; min-width: 260px; max-width: 260px; }
.preplanning-calendar-table .planner-cell { height: 118px; }
.preplanning-card .planner-calendar-scroll { max-height: calc(100vh - 320px); }

/* Fahrtage */
.driving-log-table { min-width: 1900px; }
.driving-log-table th,
.driving-log-table td { vertical-align: top; }
.driving-log-table input,
.driving-log-table textarea { min-width: 110px; }
.driving-log-table textarea { min-width: 180px; }
.planned-driving-row { background: #fffbeb; }
@media print {
    .topbar, .driving-print-hide, .flash, .page-head .actions { display: none !important; }
    .container { max-width: none; margin: 0; padding: 0; }
    .card { box-shadow: none; border-color: #999; page-break-inside: avoid; }
    .driving-log-table input,
    .driving-log-table textarea {
        border: 0;
        padding: 0;
        background: transparent;
        font: inherit;
    }
}

/* Zentrale Vorplanung: fortlaufende Jahresansicht */
.preplanning-year-card { overflow: hidden; }
.preplanning-year-scroll { overflow: auto; max-height: calc(100vh - 260px); border: 1px solid var(--border); border-radius: 14px; }
.preplanning-year-grid { min-width: calc(240px + var(--timeline-width)); background: var(--card); }
.preplanning-year-header-row,
.preplanning-year-row { display: grid; grid-template-columns: 240px var(--timeline-width); align-items: stretch; }
.preplanning-year-header-row { position: sticky; top: 0; z-index: 3; background: var(--card); border-bottom: 1px solid var(--border); }
.preplanning-course-head,
.preplanning-course-label { position: sticky; left: 0; z-index: 2; background: var(--card); border-right: 1px solid var(--border); }
.preplanning-course-head { font-weight: 700; padding: 6px 10px; }
.preplanning-course-label { display: flex; align-items: center; gap: 6px; padding: 4px 8px; min-height: 30px; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preplanning-year-row { border-bottom: 1px solid rgba(148, 163, 184, 0.22); }
.preplanning-year-track { position: relative; min-height: 30px; background-image: repeating-linear-gradient(to right, rgba(148,163,184,.18) 0, rgba(148,163,184,.18) 1px, transparent 1px, transparent var(--day-width)); }
.preplanning-year-track.header { min-height: 30px; background-image: none; }
.preplanning-month { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--border); font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.preplanning-month-line { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(15,23,42,.16); }
.preplanning-module-bar { position: absolute; top: 5px; height: 20px; line-height: 20px; border-radius: 7px; padding: 0 6px; font-size: 0.75rem; font-weight: 700; color: white; background: var(--course-color, #CC0000); text-decoration: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; box-shadow: 0 1px 2px rgba(15,23,42,.18); }
.preplanning-module-bar.open-trainer { opacity: .72; border: 1px dashed rgba(15,23,42,.45); }
.preplanning-module-bar.transferred { box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.preplanning-module-bar:hover { filter: brightness(.95); color: white; }
#preplanning-module-select option[hidden] { display: none; }

.planner-card.driving {
    background: #ecfeff;
    border-color: #06b6d4;
}
.planner-cell-action-menu {
    position: fixed;
    left: -9999px;
    top: -9999px;
    z-index: 3000;
    min-width: 190px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    box-shadow: 0 18px 45px rgba(15,23,42,.22);
    padding: .35rem;
    user-select: none;
}
.planner-cell-action-menu[hidden] { display: none !important; }
.planner-cell-action-menu button {
    display: block;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: .6rem .75rem;
    border-radius: 10px;
    font-weight: 800;
    color: #111827;
    cursor: pointer;
}
.planner-cell-action-menu button:hover { background: #f1f5f9; }
.planner-assign-card { width: min(760px, 96vw); }
.planner-assign-list {
    display: grid;
    gap: .5rem;
    max-height: 58vh;
    overflow: auto;
    margin-top: .8rem;
}
.planner-assign-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .7rem;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #f8fafc;
}
.planner-assign-row strong,
.planner-assign-row span,
.planner-assign-row small { display: block; }
.planner-assign-row span { color: #334155; font-weight: 700; font-size: .88rem; }
.planner-assign-row small { color: #64748b; font-size: .8rem; }

/* Fix: Vorplanung kompakt als echte Jahres-Gantt-Ansicht */
.preplanning-auto-form {
    grid-template-columns: minmax(260px, 1.2fr) minmax(180px, .7fr) minmax(260px, 1fr);
    align-items: end;
}
.preplanning-year-card { overflow: hidden; }
.preplanning-year-scroll {
    overflow: auto;
    max-height: calc(100vh - 280px);
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
}
.preplanning-year-grid {
    display: block !important;
    min-width: calc(180px + var(--timeline-width));
    width: calc(180px + var(--timeline-width));
    background: #fff;
}
.preplanning-year-header-row,
.preplanning-year-row {
    display: grid !important;
    grid-template-columns: 180px var(--timeline-width) !important;
    align-items: stretch;
    width: calc(180px + var(--timeline-width));
}
.preplanning-year-header-row {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    border-bottom: 1px solid var(--border);
}
.preplanning-course-head,
.preplanning-course-label {
    position: sticky;
    left: 0;
    z-index: 4;
    background: #fff;
    border-right: 1px solid var(--border);
}
.preplanning-course-head {
    min-height: 24px;
    padding: 4px 8px;
    font-size: .76rem;
    font-weight: 800;
}
.preplanning-course-label {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 2px 6px;
    font-size: .76rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.preplanning-year-row { min-height: 24px; border-bottom: 1px solid rgba(148, 163, 184, .22); }
.preplanning-year-track {
    position: relative;
    min-height: 24px;
    background-image: repeating-linear-gradient(to right, rgba(148,163,184,.16) 0, rgba(148,163,184,.16) 1px, transparent 1px, transparent var(--day-width));
}
.preplanning-year-track.header { min-height: 24px; background-image: none; }
.preplanning-month {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border);
    font-size: .7rem;
    font-weight: 800;
    color: var(--muted);
}
.preplanning-month-line { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(15,23,42,.16); }
.preplanning-module-bar {
    position: absolute;
    top: 3px;
    height: 18px;
    line-height: 18px;
    border-radius: 5px;
    padding: 0 5px;
    font-size: .68rem;
    font-weight: 800;
    color: #fff;
    background: var(--course-color, #CC0000);
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    box-shadow: 0 1px 2px rgba(15,23,42,.20);
    cursor: grab;
}
.preplanning-module-bar:active { cursor: grabbing; }
.preplanning-module-bar.open-trainer { opacity: .72; border: 1px dashed rgba(15,23,42,.55); }
.preplanning-module-bar.transferred { cursor: default; box-shadow: inset 0 0 0 2px rgba(255,255,255,.55); }
.preplanning-module-bar.dragging { opacity: .45; }
.preplanning-drop-track.drop-target { outline: 2px dashed rgba(31,94,255,.35); outline-offset: -2px; background-color: rgba(31,94,255,.04); }
@media (max-width: 900px) {
    .preplanning-auto-form { grid-template-columns: 1fr; }
}

/* Fix: echtes vertikales Rechtsklickmenü wie ein Desktop-Kontextmenü */
.planner-cell-action-menu {
    position: fixed !important;
    left: -9999px;
    top: -9999px;
    z-index: 10000 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    min-width: 210px;
    max-width: 280px;
    padding: 4px 0 !important;
    margin: 0 !important;
    background: #ffffff !important;
    color: #111827 !important;
    border: 1px solid #9ca3af !important;
    border-radius: 4px !important;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .28) !important;
    user-select: none;
}
.planner-cell-action-menu[hidden] { display: none !important; }
.planner-cell-action-menu > button {
    all: unset;
    box-sizing: border-box !important;
    display: block !important;
    width: 100% !important;
    min-height: 30px;
    padding: 7px 28px 7px 28px !important;
    font-size: 13px !important;
    line-height: 16px !important;
    font-weight: 500 !important;
    text-align: left !important;
    white-space: nowrap !important;
    color: #111827 !important;
    background: transparent !important;
    cursor: default !important;
}
.planner-cell-action-menu > button:hover,
.planner-cell-action-menu > button:focus {
    background: #2563eb !important;
    color: #ffffff !important;
    outline: none !important;
}

/* Fix 2026-07-08: Vorplanung ohne Reload + echtes Kontextmenü */
.preplanning-module-bar.saving{opacity:.55;filter:saturate(.75)}
.preplanning-save-status{position:fixed;right:18px;bottom:18px;z-index:5000;background:#0f172a;color:#fff;border-radius:10px;padding:9px 12px;font-weight:800;box-shadow:0 14px 35px rgba(15,23,42,.28)}
.preplanning-save-status.error{background:#b91c1c}
#planner-cell-action-menu.planner-cell-action-menu{position:fixed!important;left:-9999px;top:-9999px;z-index:10000!important;display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:0!important;min-width:220px;max-width:300px;padding:4px 0!important;margin:0!important;background:#fff!important;color:#111827!important;border:1px solid #9ca3af!important;border-radius:4px!important;box-shadow:0 10px 28px rgba(15,23,42,.28)!important;user-select:none!important}
#planner-cell-action-menu.planner-cell-action-menu[hidden]{display:none!important}
#planner-cell-action-menu.planner-cell-action-menu>button{all:unset!important;box-sizing:border-box!important;display:block!important;width:100%!important;min-height:30px!important;padding:7px 28px!important;font-size:13px!important;line-height:16px!important;font-weight:500!important;text-align:left!important;white-space:nowrap!important;color:#111827!important;background:transparent!important;border:0!important;border-radius:0!important;cursor:default!important}
#planner-cell-action-menu.planner-cell-action-menu>button:hover,#planner-cell-action-menu.planner-cell-action-menu>button:focus{background:#2563eb!important;color:#fff!important;outline:none!important}

/* Mobile-/Trainer-Ansicht: alle Seiten, die Trainer im Login sehen, müssen auf Handy bedienbar bleiben. */
@media (max-width: 760px) {
    html, body { max-width: 100%; overflow-x: hidden; }
    body { font-size: 15px; }
    .topbar {
        position: static;
        align-items: flex-start;
        gap: 10px;
        padding: 10px 12px;
    }
    .brand { font-size: 17px; }
    .nav {
        width: 100%;
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        gap: 6px;
    }
    .nav a {
        flex: 0 0 auto;
        white-space: nowrap;
        font-size: 14px;
        padding: 7px 9px;
    }
    .container,
    .footer {
        width: 100%;
        margin: 12px auto 24px;
        padding-left: 10px;
        padding-right: 10px;
    }
    .page-head,
    .section-title-row,
    .section-head,
    .planner-calendar-header {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }
    h1 { font-size: 26px; }
    h2 { font-size: 20px; }
    .card,
    .day-card {
        border-radius: 14px;
        padding: 14px;
    }
    .stats,
    .grid.two,
    .grid.two.uneven,
    .grid.four,
    .course-form,
    .grid-form,
    .compact-form,
    .profile-photo-layout {
        grid-template-columns: 1fr !important;
    }
    .form-row,
    .week-picker {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }
    .actions,
    .inline-actions,
    .planner-calendar-controls {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .actions > *,
    .inline-actions > *,
    .planner-calendar-controls > *,
    form.inline,
    .button {
        width: 100%;
        max-width: 100%;
    }
    .button {
        white-space: normal;
        min-height: 42px;
        text-align: center;
    }
    input,
    select,
    textarea {
        font-size: 16px;
        min-width: 0;
    }
    select[multiple] { min-height: 150px; }
    .table-scroll {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--line);
        border-radius: 12px;
    }
    .table-scroll table { min-width: 760px; }
    .driving-log-table { min-width: 1500px; }
    .driving-log-table input,
    .driving-log-table textarea { min-width: 105px; }
    .trainer-profile-list { padding-left: 0; list-style: none; display: grid; gap: 8px; }
    .trainer-profile-list li { display: grid; gap: 5px; }
    .checkbox-grid,
    .tall-checkbox-grid {
        display: grid;
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
    .modal-card,
    .planner-assign-card {
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        max-height: calc(100vh - 20px);
        overflow: auto;
        border-radius: 14px;
        padding: 14px;
    }
    .planner-calendar-scroll,
    .overview-scroll,
    .preplanning-year-scroll {
        max-height: 70vh;
        -webkit-overflow-scrolling: touch;
    }
}

/* Finaler Kontextmenü-Fix: keine Buttonleiste, sondern vertikales Windows-ähnliches Menü. */
#planner-cell-action-menu.planner-cell-action-menu {
    position: fixed !important;
    left: -9999px;
    top: -9999px;
    z-index: 10000 !important;
    display: block !important;
    min-width: 230px;
    max-width: 320px;
    padding: 4px 0 !important;
    margin: 0 !important;
    background: #fff !important;
    color: #111827 !important;
    border: 1px solid #9ca3af !important;
    border-radius: 6px !important;
    box-shadow: 0 12px 32px rgba(15,23,42,.30) !important;
    user-select: none !important;
}
#planner-cell-action-menu.planner-cell-action-menu[hidden] { display: none !important; }
#planner-cell-action-menu.planner-cell-action-menu .planner-cell-action-item {
    box-sizing: border-box !important;
    display: block !important;
    width: 100% !important;
    min-height: 32px !important;
    padding: 7px 30px 7px 28px !important;
    font-size: 13px !important;
    line-height: 18px !important;
    font-weight: 500 !important;
    text-align: left !important;
    white-space: nowrap !important;
    color: #111827 !important;
    background: #fff !important;
    border: 0 !important;
    border-radius: 0 !important;
    cursor: default !important;
}
#planner-cell-action-menu.planner-cell-action-menu .planner-cell-action-item:hover,
#planner-cell-action-menu.planner-cell-action-menu .planner-cell-action-item:focus {
    background: #2563eb !important;
    color: #fff !important;
    outline: none !important;
}
.availability-entry { border-left: 5px solid #16a34a; background: #f0fdf4; }
.blocker-entry { border-left: 5px solid #f97316; background: #fff7ed; }
.overview-entry.blocker-entry { border-left: 4px solid #f97316; background: #fff7ed; }

/* Nachtrag: Fahrtage und nicht automatisch verfügbare Wochenenden/Feiertage im Dienstplan */
.driving-entry { border-left: 5px solid #0ea5e9; background: #eff6ff; }
.nonworkday-entry { border-left: 5px solid #94a3b8; background: #f8fafc; color: #475569; }

/* Fahrstundenübersicht */
.driving-hours-overview-scroll { max-height: calc(100vh - 260px); }
.driving-hours-overview-table th:first-child { position: sticky; left: 0; z-index: 2; background: #fff; min-width: 220px; text-align: left; }
.driving-hours-overview-table thead th { position: sticky; top: 0; z-index: 3; background: #f8fafc; }
.driving-hours-overview-table thead th:first-child { z-index: 4; }
.number-cell { text-align: right; white-space: nowrap; }
.driving-hours-status { min-width: 130px; border-radius: 10px; padding: 8px 10px; font-weight: 700; text-align: center; white-space: nowrap; }
.driving-hours-status span { display: block; font-size: .78rem; font-weight: 600; margin-top: 2px; }
.driving-hours-status-red { background: #fee2e2; color: #991b1b; }
.driving-hours-status-yellow { background: #fef3c7; color: #92400e; }
.driving-hours-status-green { background: #dcfce7; color: #166534; }

/* Menü-Aufräumung: Einstellungen-Dropdown, Profil-/Logout-Symbole */
.topbar-main {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
    flex: 1 1 auto;
}
.topbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.icon-link {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: var(--text);
    background: #f1f3f5;
    border: 1px solid var(--line);
    font-size: 20px;
    line-height: 1;
    text-decoration: none;
}
.icon-link:hover {
    background: #fff1f2;
    color: var(--primary-dark);
    text-decoration: none;
}
.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}
.nav-dropdown summary {
    list-style: none;
    color: var(--text);
    font-weight: 700;
    padding: 8px 28px 8px 10px;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    position: relative;
}
.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary::after {
    content: '▾';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--muted);
}
.nav-dropdown[open] summary,
.nav-dropdown summary:hover {
    background: #fff1f2;
    color: var(--primary-dark);
}
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 1000;
    display: grid;
    gap: 2px;
    min-width: 230px;
    max-width: min(320px, calc(100vw - 24px));
    padding: 6px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .18);
}
.nav-dropdown-menu a {
    display: block;
    width: 100%;
    padding: 9px 10px;
    border-radius: 10px;
    color: var(--text);
    font-weight: 650;
    text-decoration: none;
}
.nav-dropdown-menu a:hover,
.nav-dropdown-menu a:focus {
    background: #fff1f2;
    color: var(--primary-dark);
    text-decoration: none;
    outline: none;
}
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.settings-card {
    display: grid;
    gap: 8px;
    min-height: 128px;
    padding: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text);
    text-decoration: none;
}
.settings-card:hover {
    border-color: var(--primary);
    text-decoration: none;
}
.settings-card strong {
    font-size: 18px;
}
.settings-card span {
    color: var(--muted);
    line-height: 1.4;
}
@media (max-width: 760px) {
    .topbar-main {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .topbar-actions {
        position: absolute;
        right: 12px;
        top: 10px;
    }
    .icon-link {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        font-size: 18px;
    }
    .nav-dropdown summary {
        font-size: 14px;
        padding: 7px 28px 7px 9px;
    }
    .nav-dropdown-menu {
        left: 0;
        right: auto;
    }
}
@media (max-width: 760px) {
    .topbar { position: relative; }
}

/* Kursvorlagen */
.inline-panel {
    border: 1px solid var(--border, #ddd);
    background: var(--panel-muted, #f8f9fb);
    border-radius: 10px;
    padding: .75rem;
    margin: .75rem 0 1rem;
}
.inline-panel .inline-form {
    gap: .6rem;
    align-items: end;
}
.inline-panel label {
    margin: 0;
}
.badge.ok { background: #dcfce7; color: #166534; }
.security-doc-list code { white-space: normal; }


/* Hospitationen: Kursfarbe behalten, aber deutlich transparenter anzeigen. */
.planner-card.course.hospitation {
    border-left-color: var(--course-color, #cc0000);
    background: color-mix(in srgb, var(--course-color, #cc0000) 7%, #ffffff) !important;
    opacity: .64;
    cursor: pointer;
}
.planner-card.course.hospitation:hover,
.planner-card.course.hospitation:focus-within {
    opacity: .86;
}
.checkbox-grid { display: flex; flex-wrap: wrap; gap: .45rem 1rem; }
.compact-fieldset { border: 1px solid #e5e7eb; border-radius: 12px; padding: .8rem; }
.compact-fieldset legend { font-weight: 800; padding: 0 .35rem; }
.inline-edit-form { margin-top: .65rem; min-width: min(680px, 90vw); }

/* Vorplanung: allgemeine Kurszeile zeigt gemeinsame Belegung aller ET/VT-Spezialisierungen */
.preplanning-occupied-bar {
    position: absolute;
    top: 3px;
    height: 18px;
    line-height: 18px;
    border-radius: 5px;
    padding: 0 6px;
    font-size: .66rem;
    font-weight: 900;
    color: #334155;
    background: repeating-linear-gradient(135deg, rgba(148,163,184,.42) 0, rgba(148,163,184,.42) 4px, rgba(226,232,240,.75) 4px, rgba(226,232,240,.75) 8px);
    border: 1px solid rgba(100,116,139,.45);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    pointer-events: none;
    z-index: 1;
}
.preplanning-module-bar { z-index: 2; }

/* OFAT-Kursassistent */
.page-title-row { display:flex; justify-content:space-between; gap:1rem; align-items:flex-start; }
.stacked-form { display:flex; flex-direction:column; gap:.75rem; }
.align-end { align-self:end; }
.interview-section { margin:1.25rem 0; }
.ofat-interview-table tr[style*="display: none"] { display:none !important; }
.module-category-badge { display:inline-flex; align-items:center; justify-content:center; min-width:2.2rem; border-radius:999px; padding:.15rem .55rem; background:var(--badge-color, #334155); color:white; font-weight:700; font-size:.82rem; }
@media (max-width: 720px) { .page-title-row { display:block; } .align-end { align-self:stretch; } }


/* Entwickler: automatisch ausblendbarer Rollen-Ansichtsschalter */
.developer-role-switcher {
    position: fixed;
    left: 0;
    top: 50%;
    z-index: 1600;
    display: flex;
    align-items: center;
    transform: translate(-286px, -50%);
    transition: transform .2s ease;
    filter: drop-shadow(0 18px 35px rgba(15, 23, 42, .22));
}
.developer-role-switcher:hover,
.developer-role-switcher:focus-within,
.developer-role-switcher.is-open {
    transform: translate(0, -50%);
}
.developer-role-panel {
    width: 286px;
    max-height: min(82vh, 720px);
    overflow-y: auto;
    padding: 16px;
    border: 1px solid #24304a;
    border-left: 0;
    border-radius: 0 18px 18px 0;
    background: #111827;
    color: #f8fafc;
}
.developer-role-heading {
    display: grid;
    gap: 3px;
    margin-bottom: 12px;
}
.developer-role-heading strong { font-size: 17px; }
.developer-role-heading span,
.developer-role-current,
.developer-role-note { color: #cbd5e1; font-size: 12px; line-height: 1.4; }
.developer-role-current {
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255,255,255,.08);
}
.developer-role-current strong { color: #fff; }
.developer-role-form { margin: 0 0 6px; }
.developer-role-option {
    width: 100%;
    display: grid;
    gap: 2px;
    padding: 9px 10px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: #f8fafc;
    text-align: left;
    cursor: pointer;
    font: inherit;
}
.developer-role-option:hover,
.developer-role-option:focus-visible {
    background: rgba(255,255,255,.1);
    outline: none;
}
.developer-role-option.current {
    border-color: #60a5fa;
    background: rgba(37, 99, 235, .3);
}
.developer-role-option span { font-weight: 800; }
.developer-role-option small {
    display: -webkit-box;
    overflow: hidden;
    color: #cbd5e1;
    font-size: 11px;
    line-height: 1.3;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.developer-role-note { margin: 12px 2px 0; }
.developer-role-tab {
    width: 34px;
    height: 74px;
    margin-left: -1px;
    border: 1px solid #24304a;
    border-left: 0;
    border-radius: 0 14px 14px 0;
    background: #111827;
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}
.developer-role-switcher:hover .developer-role-tab,
.developer-role-switcher:focus-within .developer-role-tab,
.developer-role-switcher.is-open .developer-role-tab { color: #93c5fd; }
@media (max-width: 760px) {
    .developer-role-switcher { transform: translate(-270px, -50%); }
    .developer-role-panel { width: 270px; max-height: 76vh; }
}

/* Trainer-Dashboard: persönliche Planung statt allgemeiner Verwaltungsübersicht */
.trainer-dashboard-head {
    align-items: center;
    margin-bottom: 24px;
}
.trainer-dashboard-head h1 {
    margin: 3px 0 8px;
}
.trainer-dashboard-eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.trainer-dashboard-section {
    margin-bottom: 22px;
}
.trainer-dashboard-section-head {
    align-items: flex-start;
    margin-bottom: 18px;
}
.trainer-dashboard-section-head h2 {
    margin: 2px 0 4px;
}
.trainer-dashboard-section-head p {
    margin: 0;
}
.trainer-driving-capture-card {
    display: grid;
    grid-template-columns: auto minmax(240px, .85fr) minmax(360px, 1.15fr);
    gap: 20px;
    align-items: center;
    margin-bottom: 22px;
    padding: 22px;
    border: 1px solid #bfd0ff;
    border-radius: var(--radius);
    background: linear-gradient(135deg, #f7f9ff 0%, #eef3ff 100%);
    box-shadow: var(--shadow);
}
.trainer-driving-capture-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 17px;
    background: var(--primary);
    color: #fff;
    font-size: 27px;
    font-weight: 900;
}
.trainer-driving-capture-copy h2 {
    margin: 2px 0 6px;
}
.trainer-driving-capture-copy p {
    margin: 0;
    color: var(--muted);
}
.trainer-driving-capture-actions {
    display: grid;
    gap: 9px;
}
.trainer-driving-capture-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 58px;
    padding: 10px 12px;
    border: 1px solid #d8e1ff;
    border-radius: 14px;
    background: #fff;
    color: var(--text);
}
.trainer-driving-capture-link:hover {
    border-color: #9db3ff;
    text-decoration: none;
}
.trainer-driving-capture-link > span:first-child {
    display: grid;
    gap: 3px;
}
.trainer-driving-capture-link small {
    color: var(--muted);
}
.trainer-planned-days-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(185px, 1fr));
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 3px;
}
.trainer-planned-day-card {
    min-width: 185px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fbfcff;
}
.trainer-planned-day-card.is-near {
    border-color: #9db3ff;
    box-shadow: inset 0 0 0 1px #dbe4ff;
}
.trainer-planned-day-card > header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}
.trainer-planned-day-card > header > div {
    display: grid;
    gap: 2px;
}
.trainer-planned-day-card > header span:not(.pill) {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}
.trainer-planned-day-card > header strong {
    font-size: 24px;
}
.trainer-day-items {
    display: grid;
    gap: 9px;
    padding: 12px;
}
.trainer-day-item {
    position: relative;
    display: grid;
    gap: 4px;
    padding: 11px 11px 11px 14px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fff;
}
.trainer-day-item::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 0;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--primary);
}
.trainer-day-item-shift::before { background: #7c3aed; }
.trainer-day-item-driving::before { background: #0f766e; }
.trainer-day-item-hospitation::before { background: #d97706; }
.trainer-day-type {
    color: var(--primary);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.trainer-day-item-shift .trainer-day-type { color: #6d28d9; }
.trainer-day-item-driving .trainer-day-type { color: #0f766e; }
.trainer-day-item-hospitation .trainer-day-type { color: #b45309; }
.trainer-day-item strong {
    font-size: 14px;
    line-height: 1.3;
}
.trainer-day-item small {
    color: var(--muted);
    line-height: 1.4;
}
.trainer-dashboard-empty {
    display: grid;
    gap: 5px;
    place-items: center;
    min-height: 150px;
    padding: 24px;
    border: 1px dashed #cbd3e3;
    border-radius: 16px;
    background: #fafbfe;
    text-align: center;
}
.trainer-dashboard-empty.compact {
    min-height: 105px;
}
.trainer-dashboard-empty span {
    color: var(--muted);
}
.trainer-coordination-list {
    display: grid;
    gap: 10px;
}
.trainer-coordination-row {
    display: grid;
    grid-template-columns: 105px minmax(260px, 1fr) minmax(220px, .8fr);
    gap: 18px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #fbfcff;
}
.trainer-coordination-date {
    display: grid;
    gap: 3px;
    padding-right: 14px;
    border-right: 1px solid var(--line);
}
.trainer-coordination-date span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}
.trainer-coordination-date strong {
    font-size: 22px;
}
.trainer-coordination-course {
    display: grid;
    gap: 4px;
}
.trainer-coordination-course small {
    color: var(--muted);
    line-height: 1.4;
}
.trainer-coordination-people {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}
.trainer-coordination-people span {
    padding: 6px 9px;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary-dark);
    font-size: 13px;
    font-weight: 800;
}
.driving-log-table tr:target td {
    background: #fff7d6;
    box-shadow: inset 0 2px 0 #f59e0b, inset 0 -2px 0 #f59e0b;
}
@media (max-width: 1050px) {
    .trainer-driving-capture-card {
        grid-template-columns: auto 1fr;
    }
    .trainer-driving-capture-actions {
        grid-column: 1 / -1;
    }
    .trainer-planned-days-grid {
        grid-template-columns: repeat(5, minmax(220px, 1fr));
    }
}
@media (max-width: 760px) {
    .trainer-dashboard-head {
        align-items: stretch;
    }
    .trainer-driving-capture-card {
        grid-template-columns: 1fr;
        padding: 17px;
    }
    .trainer-driving-capture-icon {
        width: 46px;
        height: 46px;
    }
    .trainer-driving-capture-actions {
        grid-column: auto;
    }
    .trainer-driving-capture-link {
        align-items: flex-start;
        flex-direction: column;
    }
    .trainer-planned-days-grid {
        grid-template-columns: repeat(5, minmax(245px, 82vw));
    }
    .trainer-coordination-row {
        grid-template-columns: 82px 1fr;
        gap: 12px;
    }
    .trainer-coordination-people {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-left: 94px;
    }
}
@media (max-width: 500px) {
    .trainer-coordination-row {
        grid-template-columns: 1fr;
    }
    .trainer-coordination-date {
        display: flex;
        align-items: baseline;
        gap: 8px;
        padding: 0 0 9px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .trainer-coordination-people {
        grid-column: auto;
        padding-left: 0;
    }
}

/* Entwickler: konkrete Trainerperson innerhalb der Traineransicht wechseln */
.developer-role-current span {
    display: block;
    margin-top: 3px;
    color: #bfdbfe;
}
.developer-person-switch {
    margin: 12px 0 8px;
    padding: 11px;
    border: 1px solid rgba(96, 165, 250, .45);
    border-radius: 12px;
    background: rgba(30, 64, 175, .18);
}
.developer-person-switch > strong {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
}
.developer-person-switch p {
    margin: 0;
    color: #cbd5e1;
    font-size: 12px;
}
.developer-person-form {
    display: grid;
    gap: 5px;
    margin: 0;
}
.developer-person-form label {
    color: #bfdbfe;
    font-size: 11px;
    font-weight: 800;
}
.developer-person-form select {
    width: 100%;
    min-width: 0;
    padding: 8px 9px;
    border: 1px solid #475569;
    border-radius: 9px;
    background: #f8fafc;
    color: #0f172a;
    font: inherit;
}

/* Fortlaufende Trainer-Gesamtübersicht */
.trainer-rolling-head {
    align-items: flex-end;
}
.trainer-rolling-actions {
    justify-content: flex-end;
}
.overview-table-rolling {
    min-width: max-content;
}
.overview-table-rolling th,
.overview-table-rolling td {
    min-width: 148px;
}
.overview-table th.is-today,
.overview-table td.is-today {
    background: #eef6ff;
    box-shadow: inset 3px 0 0 var(--primary), inset -1px 0 0 rgba(37, 99, 235, .12);
}
.overview-table thead th.is-today {
    background: #dfeeff;
}
.overview-table th.is-weekend:not(.is-today),
.overview-table td.is-weekend:not(.is-today) {
    background: #fbfcff;
}
.overview-mobile-view {
    display: none;
}
.overview-mobile-toolbar {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}
.overview-mobile-toolbar strong {
    text-align: center;
    line-height: 1.25;
}
.overview-mobile-nav {
    min-width: 52px;
    min-height: 46px;
    padding: 8px;
    font-size: 20px;
}
.overview-mobile-nav:disabled {
    opacity: .35;
    cursor: default;
}
.overview-swipe-hint {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}
.overview-mobile-days {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 1px;
    -webkit-overflow-scrolling: touch;
    padding: 2px 1px 14px;
}
.overview-mobile-day {
    flex: 0 0 calc(100vw - 44px);
    max-width: 520px;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.overview-mobile-day.is-today {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, .12), var(--shadow);
}
.overview-mobile-day.is-weekend:not(.is-today) {
    background: #fbfcff;
}
.overview-mobile-day-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 15px;
    background: #f8faff;
    border-bottom: 1px solid var(--line);
}
.overview-mobile-day.is-today .overview-mobile-day-header {
    background: #eaf3ff;
}
.overview-mobile-day-header span {
    color: var(--muted);
    font-weight: 700;
}
.overview-mobile-day-header strong {
    font-size: 18px;
}
.overview-mobile-trainers {
    display: grid;
}
.overview-mobile-trainer {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
}
.overview-mobile-trainer:last-child {
    border-bottom: 0;
}
.overview-mobile-trainer > header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}
.overview-mobile-trainer > header strong {
    color: var(--text);
    font-size: 15px;
}
.overview-mobile-trainer > header span {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}
.overview-mobile-entries .overview-entry {
    margin-bottom: 7px;
    font-size: 13px;
}
.overview-mobile-entries .overview-entry:last-child {
    margin-bottom: 0;
}
.overview-mobile-empty,
.overview-mobile-trainer .private-cell {
    margin: 0;
    padding: 10px 11px;
    border-radius: 10px;
    background: #f8fafc;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
}

@media (max-width: 820px) {
    .trainer-rolling-head {
        display: block;
    }
    .trainer-rolling-head h1 {
        font-size: 1.55rem;
    }
    .trainer-rolling-actions {
        display: grid;
        grid-template-columns: 1fr;
        margin-top: 14px;
    }
    .trainer-rolling-actions .button {
        width: 100%;
        min-height: 44px;
    }
    .trainer-rolling-overview {
        padding: 12px;
        overflow: visible;
        background: transparent;
        border: 0;
        box-shadow: none;
    }
    .trainer-rolling-overview .overview-desktop-view {
        display: none;
    }
    .trainer-rolling-overview .overview-mobile-view {
        display: block;
    }
}

@media (max-width: 420px) {
    .overview-mobile-day {
        flex-basis: calc(100vw - 30px);
    }
    .overview-mobile-trainer > header {
        display: block;
    }
    .overview-mobile-trainer > header span {
        display: block;
        margin-top: 2px;
    }
}

@media print {
    .trainer-rolling-overview .overview-desktop-view {
        display: block !important;
    }
    .trainer-rolling-overview .overview-mobile-view {
        display: none !important;
    }
}

/* Kompakte Minimalansicht der fortlaufenden Trainer-Gesamtübersicht */
.overview-table-rolling {
    table-layout: fixed;
    min-width: 0;
}
.overview-table-rolling col.overview-trainer-col {
    width: 152px;
}
.overview-table-rolling col.overview-date-col {
    width: 116px;
}
.overview-table-rolling th,
.overview-table-rolling td {
    width: auto;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
}
.overview-table-rolling .sticky-col {
    width: 152px;
    min-width: 152px;
    max-width: 152px;
}
.overview-table-rolling thead th:not(.sticky-col) {
    width: 116px;
    min-width: 116px;
    max-width: 116px;
    padding: 7px 4px;
    font-size: 12px;
    text-align: center;
}
.overview-table-rolling .overview-day-cell {
    width: 116px;
    min-width: 116px;
    max-width: 116px;
    min-height: 0;
    padding: 4px;
    overflow: hidden;
}
.overview-table-rolling .trainer-name {
    padding: 7px 8px;
    font-size: 12px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}
.overview-entry-minimal {
    margin: 0 0 4px;
    padding: 5px 6px;
    border-radius: 7px;
    font-size: 11px;
    line-height: 1.2;
    overflow: hidden;
}
.overview-entry-minimal:last-child {
    margin-bottom: 0;
}
.overview-entry-minimal strong,
.overview-entry-minimal small {
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
}
.overview-entry-minimal strong {
    font-size: 11px;
    line-height: 1.2;
}
.overview-entry-minimal small {
    margin-top: 2px;
    font-size: 10px;
    line-height: 1.2;
}

@media (max-width: 820px) {
    .trainer-rolling-overview .overview-mobile-toolbar {
        grid-template-columns: 42px minmax(0, 1fr) 42px;
        gap: 6px;
        margin-bottom: 5px;
    }
    .trainer-rolling-overview .overview-mobile-nav {
        min-width: 42px;
        min-height: 40px;
        padding: 5px;
        font-size: 18px;
    }
    .trainer-rolling-overview .overview-swipe-hint {
        margin-bottom: 7px;
        font-size: 11px;
    }
    .trainer-rolling-overview .overview-mobile-days {
        gap: 8px;
        padding-bottom: 8px;
    }
    .trainer-rolling-overview .overview-mobile-day {
        flex: 0 0 100%;
        width: 100%;
        max-width: none;
        border-radius: 12px;
    }
    .trainer-rolling-overview .overview-mobile-day-header {
        padding: 9px 11px;
    }
    .trainer-rolling-overview .overview-mobile-day-header strong {
        font-size: 15px;
    }
    .trainer-rolling-overview .overview-mobile-trainer {
        display: grid;
        grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
        gap: 8px;
        align-items: start;
        padding: 7px 9px;
    }
    .trainer-rolling-overview .overview-mobile-trainer > header {
        display: block;
        margin: 0;
        min-width: 0;
    }
    .trainer-rolling-overview .overview-mobile-trainer > header strong {
        display: block;
        font-size: 12px;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }
    .trainer-rolling-overview .overview-mobile-entries {
        min-width: 0;
    }
    .trainer-rolling-overview .overview-mobile-entries .overview-entry-minimal {
        margin-bottom: 4px;
        padding: 5px 6px;
        font-size: 11px;
    }
    .trainer-rolling-overview .overview-mobile-empty,
    .trainer-rolling-overview .overview-mobile-trainer .private-cell {
        margin: 0;
        padding: 5px 6px;
        border-radius: 7px;
        font-size: 11px;
        line-height: 1.25;
    }
}

@media (max-width: 420px) {
    .trainer-rolling-overview .overview-mobile-day {
        flex-basis: 100%;
    }
    .trainer-rolling-overview .overview-mobile-trainer {
        grid-template-columns: 88px minmax(0, 1fr);
        gap: 6px;
        padding: 6px 7px;
    }
}
