: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;
}
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; }
.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; }
.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;
}


/* Lehrgangsbearbeitung 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;
    }
}
