/* Fahrschultermin UI (Phase 7) - mobile-first, Dark/Light-Theme */

:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-contrast: #ffffff;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .06);
    --shadow-lg: 0 10px 25px rgba(15, 23, 42, .12);
    --radius: 12px;
    --grid-line: #eef2f7;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
}

[data-theme="dark"] {
    --bg: #0b1120;
    --surface: #131c2e;
    --surface-2: #0f1828;
    --border: #243049;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
    --grid-line: #1c2742;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* ---------- Topbar ---------- */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}
.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #fff;
    display: grid; place-items: center;
    font-weight: 700; font-size: 15px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text small { color: var(--text-muted); font-size: 12px; }

.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a {
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
}
.mainnav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.mainnav a.active { background: var(--primary); color: var(--primary-contrast); }
/* Zaehler offener Buchungsanfragen (Anf. 20) */
.nav-badge {
    display: inline-block;
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    line-height: 16px;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.role-switch { display: flex; align-items: center; gap: 6px; }
.role-switch label { font-size: 12px; color: var(--text-muted); }
.role-switch select, select, input, textarea {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 14px;
    font-family: inherit;
}
.theme-toggle, .nav-toggle {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 38px; height: 38px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
}
.nav-toggle { display: none; }

/* ---------- Layout ---------- */
.content { max-width: 1280px; margin: 0 auto; padding: 20px 16px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .sub { color: var(--text-muted); font-size: 14px; }

.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-weight: 500; }
.flash-success { background: rgba(22,163,74,.12); color: var(--success); border: 1px solid rgba(22,163,74,.3); }
.flash-error { background: rgba(220,38,38,.12); color: var(--danger); border: 1px solid rgba(220,38,38,.3); }
.flash-info { background: rgba(37,99,235,.12); color: var(--primary); border: 1px solid rgba(37,99,235,.3); }
.flash-warning { background: rgba(217,119,6,.12); color: #b45309; border: 1px solid rgba(217,119,6,.3); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 9px 14px;
    font-size: 14px; font-weight: 600;
    cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; border-color: var(--text-muted); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(220,38,38,.4); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-pad { padding: 18px; }
.card h2, .card h3 { margin-top: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.stat .value { font-size: 30px; font-weight: 700; }
.stat .label { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.stat.accent { border-left: 4px solid var(--primary); }
.stat.warn { border-left: 4px solid var(--warning); }
.stat.ok { border-left: 4px solid var(--success); }

.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin: 26px 0 12px; }

/* ---------- Calendar toolbar ---------- */
.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-title { font-size: 18px; font-weight: 700; }
.view-tabs { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; border: 1px solid var(--border); }
.view-tabs a { padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
.view-tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.view-tabs a:hover { text-decoration: none; }

/* ---------- Kennzahlen / Feiertag / Sonne ---------- */
.cal-metrics { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.cal-metrics .metric {
    background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
    padding: 6px 14px; font-size: 13px; color: var(--text-muted); box-shadow: var(--shadow);
}
.cal-metrics .metric strong { color: var(--text); font-size: 15px; }
.cal-metrics .metric.metric-limit { color: #dc2626; }
.cal-metrics .metric.metric-limit strong { color: #dc2626; }
.cal-metrics .metric.sun { color: #b45309; }
[data-theme="dark"] .cal-metrics .metric.sun { color: #fbbf24; }
.holiday-banner {
    background: rgba(220,38,38,.1); border: 1px solid rgba(220,38,38,.3);
    color: var(--danger); padding: 10px 14px; border-radius: var(--radius);
    margin-bottom: 14px; font-weight: 600; font-size: 14px;
}

/* ---------- Day grid ---------- */
.daygrid { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.daygrid-inner { position: relative; }
.hour-row { display: grid; grid-template-columns: 60px 1fr; border-top: 1px solid var(--grid-line); height: 60px; }
.hour-row:first-child { border-top: none; }
.hour-row.night { background: rgba(30,41,59,.14); }
.hour-row.night .hour-label { color: var(--text); opacity: .75; }
[data-theme="dark"] .hour-row.night { background: rgba(2,6,23,.55); }
.hour-label { font-size: 12px; color: var(--text-muted); padding: 4px 8px; text-align: right; }
.hour-slot { position: relative; }
.grid-overlays { position: absolute; top: 0; left: 60px; right: 0; bottom: 0; pointer-events: none; z-index: 1; }
.grid-band { position: absolute; left: 0; right: 0; }
.grid-band-night { background: rgba(30,41,59,.12); }
[data-theme="dark"] .grid-band-night { background: rgba(2,6,23,.45); }
.grid-band-unavailable {
    background: repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(100,116,139,.22) 5px, rgba(100,116,139,.22) 10px);
    border-top: 1px dashed rgba(100,116,139,.35);
    border-bottom: 1px dashed rgba(100,116,139,.35);
}
.grid-band-rest {
    background: rgba(217, 119, 6, .15);
    border-left: 3px solid var(--warning);
    pointer-events: none;
}
.grid-band-label {
    position: absolute; left: 6px; top: 4px; font-size: 10px; font-weight: 700;
    color: var(--warning); text-shadow: 0 0 4px var(--surface);
}
.schedule-gap {
    position: absolute; left: 4px; right: 4px; z-index: 2;
    background: rgba(148, 163, 184, .25);
    border: 1px dashed var(--border);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 600; color: var(--text-muted);
    pointer-events: none;
}
.schedule-gap-warn {
    background: rgba(217, 119, 6, .18);
    border-color: var(--warning);
    color: var(--warning);
}
.schedule-travel {
    background: rgba(37, 99, 235, .12);
    border-color: rgba(37, 99, 235, .35);
    color: var(--primary);
}
.grid-band-holiday {
    background: rgba(220, 38, 38, .12);
    border-left: 3px solid var(--danger);
    pointer-events: none;
}
.grid-band-holiday .grid-band-label { color: var(--danger); }
.grid-band-booking-lead {
    background: repeating-linear-gradient(-45deg, rgba(100,116,139,.12), rgba(100,116,139,.12) 8px, rgba(148,163,184,.18) 8px, rgba(148,163,184,.18) 16px);
    border-top: 1px dashed var(--text-muted); border-bottom: 1px dashed var(--text-muted);
    z-index: 1;
}
.grid-band-booking-lead .grid-band-label { color: var(--text-muted); font-size: 11px; }
.booking-lead-banner {
    background: rgba(100, 116, 139, .12);
    border: 1px solid rgba(100, 116, 139, .35);
    color: var(--text-muted);
}
/* Schulferien-Hinweis (Phase 34, Anf. 49): Info, nicht blockierend */
.school-holiday-banner {
    background: rgba(13, 148, 136, .10);
    border: 1px solid rgba(13, 148, 136, .35);
    color: #0d9488;
}
[data-theme="dark"] .school-holiday-banner { color: #2dd4bf; }
.bp-hint-warn { color: var(--danger); font-weight: 600; }
.bp-hint {
    font-size: 12px; color: var(--text-muted); background: var(--surface-2);
    border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
    margin-bottom: 10px;
}
.settings-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-top: 12px;
}
.settings-form label {
    display: flex; flex-direction: column; gap: 6px;
    font-size: 13px; font-weight: 600;
}
.settings-form input, .settings-form select {
    font-weight: 400;
}
.field-hint {
    font-size: 11px; font-weight: 400; color: var(--text-muted);
}
.travel-matrix-wrap { max-width: 100%; }
table.travel-matrix th, table.travel-matrix td { text-align: center; vertical-align: middle; }
table.travel-matrix th[scope=row] { text-align: left; white-space: nowrap; font-weight: 600; }
table.travel-matrix input[type=number] {
    width: 56px; padding: 6px 4px; text-align: center; font-size: 13px;
}
table.travel-matrix td.matrix-diag { background: var(--surface-2); }
table.travel-matrix .matrix-bill { display: block; font-size: 10px; margin-top: 2px; color: var(--text-muted); white-space: nowrap; }

/* Terminort-Dialog im Kalender */
.ft-dialog { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.ft-dialog[hidden] { display: none !important; }
.ft-dialog-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); }
.ft-dialog-card {
    position: relative; z-index: 1; width: min(480px, 100%); max-height: 90vh; overflow: auto;
    background: var(--surface); border-radius: var(--radius); padding: 20px 22px;
    box-shadow: 0 20px 50px rgba(0,0,0,.18);
}
.ft-dialog-card h3 { margin: 0 0 6px; }
.ft-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.loc-quick-add summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--accent); margin-bottom: 6px; }
.settings-form textarea {
    width: 100%; min-height: 72px; padding: 10px 12px; border: 1px solid var(--border);
    border-radius: 8px; font: inherit; resize: vertical;
}

.events-layer { position: absolute; top: 0; left: 60px; right: 0; bottom: 0; z-index: 2; }

.event.is-private-block {
    background: repeating-linear-gradient(-45deg, #94a3b8, #94a3b8 6px, #cbd5e1 6px, #cbd5e1 12px);
    color: #1e293b; border: 1px solid #64748b; cursor: default;
}
.event.is-travel-block {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e3a5f; border: 1px dashed #3b82f6; cursor: default; font-size: 12px;
}
.event.is-travel-block.is-billable-travel {
    border-style: solid; border-color: #2563eb;
}
.event.is-pause-block {
    background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
    color: #14532d; border: 1px solid #86efac; cursor: default; font-size: 12px;
}
.event.is-pause-block.is-hard-pause {
    border-color: #16a34a; border-width: 2px;
}
.event.is-private-block .ev-delete { position: absolute; top: 2px; right: 4px; }
.event.is-private-block .ev-delete button {
    background: rgba(255,255,255,.7); border: none; border-radius: 4px; cursor: pointer; font-size: 11px; padding: 0 4px;
}

.cal-instructor { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cal-instructor label { font-weight: 600; color: var(--text-muted); }
.cal-instructor select { min-width: 140px; }
.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.cal-toolbar .view-tabs { margin-left: auto; }

.event {
    position: absolute;
    left: 6px; right: 6px;
    border-radius: 8px;
    padding: 6px 8px;
    color: #fff;
    overflow: hidden;
    box-shadow: var(--shadow);
    border-left: 4px solid rgba(255,255,255,.55);
    font-size: 12px;
    text-decoration: none;
    display: block;
}
.event:hover { text-decoration: none; filter: brightness(1.05); box-shadow: var(--shadow-lg); }
.event .ev-time { font-weight: 700; font-size: 11px; opacity: .95; }
.event .ev-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event .ev-meta { font-size: 11px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event.is-requested { opacity: .92; border-left-style: dashed; }
.event.is-completed, .event.is-no_show { opacity: .7; }

/* status chips */
.chip {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 600;
    padding: 3px 9px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-confirmed { color: var(--success); }
.status-requested { color: var(--warning); }
.status-counter-offered { color: #7c3aed; }
.status-completed { color: var(--primary); }
.status-no-show { color: var(--danger); }
.status-cancelled, .status-declined { color: var(--text-muted); }
.status-billable-ready { color: #0d9488; }
.status-rescheduled { color: var(--text-muted); }

/* ---------- Week grid ---------- */
.weekgrid { display: grid; grid-template-columns: 50px repeat(7, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.weekgrid .wk-head { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--border); border-left: 1px solid var(--grid-line); font-size: 12px; text-decoration: none; color: inherit; display: block; }
.weekgrid .wk-head.today { background: rgba(37,99,235,.1); }
.weekgrid .wk-head.holiday { background: rgba(220,38,38,.1); }
.weekgrid .wk-head.booking-blocked { background: rgba(100,116,139,.12); opacity: 0.75; }
.weekgrid .wk-head .wk-day { color: var(--text-muted); }
.weekgrid .wk-head .wk-date { font-size: 18px; font-weight: 700; }
.weekgrid .wk-head .wk-ue { font-size: 10px; color: var(--primary); font-weight: 600; }
.weekgrid .wk-head .wk-holiday { font-size: 9px; color: var(--danger); font-weight: 600; line-height: 1.1; }
.weekgrid .wk-head .wk-booking-blocked { font-size: 9px; color: var(--text-muted); font-weight: 600; }
.weekgrid .wk-head .wk-school-holiday { font-size: 9px; color: #0d9488; font-weight: 600; line-height: 1.1; }
[data-theme="dark"] .weekgrid .wk-head .wk-school-holiday { color: #2dd4bf; }
.weekgrid .wk-col.booking-blocked { background: repeating-linear-gradient(-45deg, rgba(100,116,139,.06), rgba(100,116,139,.06) 6px, rgba(148,163,184,.1) 6px, rgba(148,163,184,.1) 12px); opacity: 0.72; }
.wk-col.holiday { background: rgba(220,38,38,.05); }
.wk-col { position: relative; border-left: 1px solid var(--grid-line); min-height: 640px; }
.wk-corner { border-bottom: 1px solid var(--border); }
.wk-hours { border-right: 1px solid var(--grid-line); }
.wk-hour { height: 40px; border-top: 1px solid var(--grid-line); font-size: 10px; color: var(--text-muted); padding: 1px 4px; text-align: right; }
.wk-bg { position: absolute; inset: 0; }
.wk-bg .line { border-top: 1px solid var(--grid-line); height: 40px; }
.event-sm {
    position: absolute; left: 2px; right: 2px;
    border-radius: 6px; padding: 3px 5px; color: #fff;
    font-size: 10px; overflow: hidden; text-decoration: none; display: block;
    border-left: 3px solid rgba(255,255,255,.5);
}
.event-sm:hover { text-decoration: none; filter: brightness(1.05); }
.event-sm .ev-time { font-weight: 700; }
.event-sm .ev-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Instructor columns ---------- */
.instructor-grid { display: grid; grid-template-columns: 50px repeat(var(--cols, 3), 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.inst-head { padding: 10px; text-align: center; font-weight: 700; border-bottom: 1px solid var(--border); border-left: 1px solid var(--grid-line); }
.inst-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-grid; place-items: center; font-size: 13px; margin-bottom: 4px; }

/* ---------- Lists / tables ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px 14px;
}
.list-item .swatch { width: 6px; align-self: stretch; border-radius: 4px; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; }
.list-item .li-meta { color: var(--text-muted); font-size: 13px; }
.list-item .li-time { font-weight: 700; white-space: nowrap; }

table.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
table.tbl th, table.tbl td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
table.tbl th { background: var(--surface-2); color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; margin-right: 8px; }

/* ---------- Stundenarten-Editor ---------- */
.st-item { gap: 10px; }
.st-sort { display: flex; flex-direction: column; gap: 3px; }
.st-arrow { padding: 2px 8px; line-height: 1; font-size: 11px; }
.st-arrow:disabled { opacity: .35; cursor: not-allowed; }
.st-item .chip { font-size: 11px; padding: 2px 7px; }

/* ---------- Detail ---------- */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; }
.kv dt { color: var(--text-muted); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 18px; border-left: 2px solid var(--border); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 12px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.timeline .tl-time { color: var(--text-muted); font-size: 12px; }

/* ---------- Forms ---------- */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-row input, .form-row select, .form-row textarea { width: 100%; }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.radio-cards label { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; font-weight: 600; }
.radio-cards input { width: auto; }
.radio-cards input:checked + span { color: var(--primary); }

/* signature pad */
.sigpad-wrap { border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); position: relative; }
#sigpad { width: 100%; height: 200px; display: block; touch-action: none; border-radius: var(--radius); }
.sigpad-actions { display: flex; justify-content: space-between; padding: 8px; }

.warn-box { background: rgba(217,119,6,.12); border: 1px solid rgba(217,119,6,.35); color: var(--warning); padding: 12px 14px; border-radius: var(--radius); font-size: 14px; }
.empty { text-align: center; color: var(--text-muted); padding: 40px 20px; }

/* ---------- Baustein-Panel + Drag&Drop (Anf. 7) ---------- */
.cal-layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.cal-main { min-width: 0; }
.events-layer .drop-ghost {
    position: absolute; left: 6px; right: 6px;
    background: rgba(37,99,235,.18); border: 2px dashed var(--primary);
    border-radius: 8px; color: var(--primary); font-size: 11px; font-weight: 600;
    padding: 2px 6px; pointer-events: none; z-index: 5; overflow: hidden;
}
.baustein-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; position: sticky; top: 16px; }
.bp-head h3 { margin: 0 0 2px; }
.bp-head .sub { color: var(--text-muted); font-size: 12px; margin-bottom: 12px; }
.bp-student { margin-bottom: 12px; }
.bp-student label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.bp-student select { width: 100%; }
/* Fahrschueler-Autovervollstaendigung (Anf. 29/34) */
.bp-ac { position: relative; }
.bp-ac input { width: 100%; padding-right: 28px; }
.bp-ac-clear {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); text-decoration: none; font-size: 12px; line-height: 1;
}
.bp-ac-clear:hover { color: var(--danger); }
.bp-ac-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
    background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12); overflow: hidden; max-height: 260px; overflow-y: auto;
}
.bp-ac-item {
    display: block; width: 100%; text-align: left; background: none; border: 0;
    padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--border);
    color: var(--text); font: inherit;
}
.bp-ac-item:last-child { border-bottom: 0; }
.bp-ac-item:hover, .bp-ac-item:focus { background: var(--surface-2); }
.bp-ac-name { display: block; font-weight: 600; font-size: 13px; }
.bp-ac-meta { display: block; color: var(--text-muted); font-size: 11px; margin-top: 1px; }
.bp-ac-empty { padding: 8px 10px; color: var(--text-muted); font-size: 12px; }
.bp-curriculum { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin-bottom: 12px; }
.bp-assign { display: flex; gap: 6px; }
.bp-assign select { flex: 1; min-width: 0; }
.bp-class + .bp-class { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 10px; }
.bp-class-head { font-weight: 700; font-size: 13px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.bp-prog { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 3px 0; }
.bp-prog-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-prog-vals { color: var(--text-muted); white-space: nowrap; font-size: 11px; }
.bp-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.bp-tab { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.bp-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.bp-cards { display: none; flex-direction: column; gap: 8px; }
.bp-cards.active { display: flex; }
.bp-card { display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--primary); border-radius: 8px; padding: 8px 10px; cursor: grab; touch-action: none; user-select: none; }
.bp-card[data-draggable="1"]:active { cursor: grabbing; }
.bp-card[data-draggable="0"] { opacity: .55; cursor: not-allowed; }
.bp-card-name { font-weight: 600; font-size: 13px; }
.bp-card-meta { color: var(--text-muted); font-size: 11px; }
.bp-float { position: fixed; z-index: 1000; transform: translate(-50%, -50%); pointer-events: none; background: var(--primary); color: #fff; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
body.bp-dragging { user-select: none; cursor: grabbing; }

/* ---------- Analoguhr-Zeitpicker (Anf. 12) ---------- */
.ft-analog-time {
    width: 5.5em;
    cursor: pointer;
    text-align: center;
    font-variant-numeric: tabular-nums;
    background: var(--surface-2);
}
.ft-analog-time:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.atp-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(15, 23, 42, .45);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.atp-overlay[hidden] { display: none !important; }
body.atp-open { overflow: hidden; }
.atp-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: min(320px, 100%);
    padding: 16px;
}
.atp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.atp-close { border: 0; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-muted); }
.atp-display { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 8px 0; }
.atp-seg {
    border: 0; background: transparent; font-size: 28px; font-weight: 700;
    font-variant-numeric: tabular-nums; cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.atp-seg.active { background: var(--primary); color: #fff; }
.atp-colon { font-size: 28px; font-weight: 700; }
.atp-hint { text-align: center; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.atp-face { width: 100%; height: auto; display: block; margin: 0 auto 12px; }
.atp-ring { fill: var(--surface-2); stroke: var(--border); stroke-width: 2; }
.atp-hand { stroke: var(--primary); stroke-width: 3; stroke-linecap: round; }
.atp-hub { fill: var(--primary); }
.atp-tick { fill: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; }
.atp-tick:hover { fill: var(--primary); }
.atp-actions { display: flex; justify-content: flex-end; gap: 8px; }
.time-field-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.time-field-row label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.ev-time-editable { cursor: pointer; text-decoration: underline dotted; }

/* ---------- Responsive ---------- */
@media (max-width: 1040px) {
    .cal-layout { grid-template-columns: 1fr; }
    .baustein-panel { position: static; }
}
@media (max-width: 860px) {
    .nav-toggle { display: block; order: 3; margin-left: auto; }
    .mainnav { display: none; flex-basis: 100%; flex-direction: column; }
    .mainnav.open { display: flex; }
    .detail-grid { grid-template-columns: 1fr; }
    .weekgrid { font-size: 9px; }
    .role-switch label { display: none; }
}
@media (max-width: 600px) {
    .radio-cards { grid-template-columns: 1fr; }
    .weekgrid { overflow-x: auto; }
}

/* ---------- Auth (Login) ---------- */
.authbox { display: flex; align-items: center; gap: 10px; }
.auth-user { display: flex; flex-direction: column; line-height: 1.1; text-align: right; }
.auth-user .auth-name { font-weight: 600; font-size: 13px; }
.auth-user .auth-role { color: var(--text-muted); font-size: 11px; }
.auth-body { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
    width: 100%; max-width: 380px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 28px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-brand strong { display: block; font-size: 18px; }
.auth-brand small { color: var(--text-muted); }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.auth-form input {
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-2); color: var(--text); font-size: 14px;
}
.auth-form input:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
.btn-block { width: 100%; margin-top: 16px; justify-content: center; }
.auth-demo { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); }
.auth-demo-title { margin-bottom: 6px; }
.auth-demo ul { margin: 0; padding-left: 16px; }
.auth-demo code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* Firmen-/Kontextauswahl (Anf. 18/19) */
.context-hello { font-size: 13px; color: var(--text-muted); margin: 0 0 14px; }
.context-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.context-list form { margin: 0; }
.context-item {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left;
    font-size: 14px; transition: border-color .12s, background .12s;
}
.context-item:hover { border-color: var(--primary); }
.context-item.is-active { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; }
.context-name { font-weight: 600; }
.context-role { font-size: 12px; color: var(--text-muted); }

/* Firmen-Umschalter in der Topbar (Anf. 18) */
.tenant-switch { display: flex; align-items: center; gap: 6px; margin: 0; }
.tenant-switch label { font-size: 12px; color: var(--text-muted); }
@media (max-width: 720px) { .tenant-switch label { display: none; } }
