:root {
  --navy: #112d49;
  --navy-2: #1b3e5f;
  --ink: #19283a;
  --muted: #6b7785;
  --line: #e3e8ec;
  --canvas: #f3f5f4;
  --white: #ffffff;
  --red: #e6433f;
  --teal: #3db8b5;
  --gold: #eaaa28;
  --purple: #8c63d9;
  --shadow: 0 8px 30px rgba(17, 45, 73, 0.07);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; font-family: "DM Sans", system-ui, sans-serif; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 242px 1fr; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 30px 18px 20px; display: flex; flex-direction: column; color: #fff; background: var(--navy); z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 32px; color: #fff; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; color: var(--gold); font-family: "Fraunces", serif; font-size: 17px; }
.brand strong, .profile strong { display: block; font-size: 15px; }
.brand small, .profile small, .sidebar-note small { display: block; margin-top: 2px; color: rgba(255,255,255,.56); font-size: 11px; }
.nav { display: grid; gap: 5px; }
.nav-item { width: 100%; padding: 11px 12px; border: 0; border-radius: 9px; display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.72); background: transparent; text-align: left; font-size: 13px; transition: .18s ease; }
.nav-item span { width: 22px; font-size: 18px; text-align: center; color: rgba(255,255,255,.5); }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.12); font-weight: 600; }
.nav-item.active span { color: var(--gold); }
.sidebar-note { margin: auto 4px 18px; padding: 13px; display: flex; gap: 10px; align-items: flex-start; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: rgba(255,255,255,.04); font-size: 11px; }
.sidebar-note strong { display:block; font-size: 11px; }
.pulse { width: 7px; height: 7px; margin-top: 4px; flex: 0 0 auto; border-radius: 50%; background: #65d4a4; box-shadow: 0 0 0 5px rgba(101,212,164,.1); }
.pulse.offline { background:#eaaa28; box-shadow:0 0 0 5px rgba(234,170,40,.1); }
.pulse.error { background:#e6433f; box-shadow:0 0 0 5px rgba(230,67,63,.1); }
.profile { padding: 14px 6px 0; border-top: 1px solid rgba(255,255,255,.1); display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; }
.avatar { width: 34px; height: 34px; display:grid; place-items:center; border-radius:50%; color:var(--navy); background:var(--gold); font-weight:700; font-size:11px; }
.profile button { border:0; color:rgba(255,255,255,.5); background:transparent; }

main { min-width: 0; padding: 0 34px 40px; }
.topbar { min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 3px; color: #8893a0; font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin:0; color:var(--navy); font-family:"Fraunces", serif; font-size: 27px; }
h2 { margin:0; color:var(--navy); font-size:18px; letter-spacing:-.02em; }
.topbar-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:9px; }
.button { min-height: 39px; padding: 0 15px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; font-weight: 600; }
.button.primary { color:#fff; background:var(--red); box-shadow:0 5px 14px rgba(230,67,63,.2); }
.button.primary:hover { background:#d83b38; }
.button.secondary { color:var(--navy); border-color:#dce2e7; background:#fff; }
.button.compact { min-height:34px; padding:0 11px; font-size:11px; }
.icon-button { width:36px; height:36px; border:1px solid var(--line); border-radius:8px; color:var(--navy); background:#fff; font-size:19px; }
.mobile-menu { display:none; }
.card { border:1px solid rgba(17,45,73,.09); border-radius:12px; background:#fff; box-shadow:var(--shadow); }
.page { display:none; }
.page.active { display:block; }

.event-bar { min-height:72px; padding:12px 18px; display:flex; align-items:center; gap:24px; }
.event-bar > label:first-child { min-width: 300px; }
.event-bar .bus-select-label { min-width:150px; }
.event-bar label > span { display:block; color:var(--muted); font-size:10px; font-weight:600; }
.event-bar select { width:100%; padding:4px 25px 3px 0; border:0; outline:0; color:var(--navy); background:transparent; font-weight:700; font-size:14px; }
.event-meta { display:flex; align-items:center; gap:7px; color:var(--muted); font-size:11px; white-space:nowrap; }
.event-meta strong { color:var(--ink); }
.status-dot { width:7px; height:7px; border-radius:50%; background:#45b984; }
.text-button { margin-left:auto; padding:8px 0; border:0; color:var(--red); background:transparent; font-size:11px; font-weight:600; white-space:nowrap; }

.stats { margin:14px 0; display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
.stat { min-height:82px; padding:15px 17px; display:grid; grid-template-columns:auto 1fr; column-gap:12px; align-items:center; }
.stat-icon { grid-row:1/3; width:38px; height:38px; display:grid; place-items:center; border-radius:9px; color:var(--navy); background:#edf3f4; font-weight:700; }
.stat strong { align-self:end; color:var(--navy); font-size:20px; line-height:1; }
.stat small { align-self:start; margin-top:5px; color:var(--muted); font-size:10px; }
.stat.warning .stat-icon { color:#a56c00; background:#fff4d6; }
.stat.danger .stat-icon { color:var(--red); background:#fff0ef; }

.planner-grid { display:grid; grid-template-columns:minmax(0, 1fr) 294px; gap:14px; align-items:start; }
.seat-card { min-width:0; overflow:hidden; }
.card-head { min-height:73px; padding:16px 18px; display:flex; align-items:center; gap:18px; border-bottom:1px solid var(--line); }
.card-head > div:first-child { margin-right:auto; }
.deck-switch { padding:3px; display:flex; gap:3px; border-radius:8px; background:#f0f3f4; }
.deck-switch button { padding:7px 11px; border:0; border-radius:6px; color:var(--muted); background:transparent; font-size:11px; }
.deck-switch button span { margin-left:4px; opacity:.6; }
.deck-switch button.active { color:var(--navy); background:#fff; box-shadow:0 1px 4px rgba(17,45,73,.12); font-weight:700; }
.map-help { margin:14px 18px 0; padding:9px 11px; display:flex; gap:9px; align-items:center; border-radius:8px; color:#526272; background:#f1f6f6; font-size:10px; }
.help-icon { width:18px; height:18px; display:grid; place-items:center; flex:0 0 auto; border-radius:50%; color:#fff; background:var(--teal); font-size:10px; font-weight:700; }
.map-help button { margin-left:auto; border:0; color:#82909d; background:transparent; font-size:16px; }
.overlay-editor { margin:10px 18px 0; padding:10px 12px; display:flex; gap:12px; align-items:center; border:1px solid #f0d582; border-radius:8px; color:#6d5818; background:#fff8e4; font-size:10px; }
.overlay-editor > span { margin-right:auto; }
.overlay-editor label { display:flex; align-items:center; gap:6px; font-size:9px; font-weight:700; }
.overlay-editor select { height:30px; padding:0 26px 0 8px; border:1px solid #e5cc7b; border-radius:6px; color:var(--ink); background:#fff; font-size:10px; }
.layout-editor { border-color:#94c8c6; color:#174f52; background:#edf9f8; }
.layout-edit { cursor:crosshair; }
.seat.layout-position { border:2px solid #fff; color:#fff; background:var(--navy); box-shadow:0 0 0 2px var(--teal), 0 3px 8px rgba(17,45,73,.3); cursor:pointer; }
.seat-map-wrap { margin: 10px 18px 0; overflow:hidden; border:1px solid #edf0f2; border-radius:10px; background:#fafafa; }
.seat-map { position:relative; width:100%; aspect-ratio:1300/620; background-position:center; background-repeat:no-repeat; background-size:100% 100%; }
.seat-map.upper { background-image:url("assets/bus-oberdeck-crop.png"); }
.seat-map.lower { background-image:url("assets/bus-unterdeck-crop.png"); }
.seat { position:absolute; width:3.85%; aspect-ratio:1/1; padding:0; transform:translate(-50%,-50%); border:2px solid transparent; border-radius:5px; display:grid; place-items:center; color:#fff; background:transparent; font-size:clamp(7px, .78vw, 11px); font-weight:700; transition:transform .12s ease, box-shadow .12s ease, background .12s ease; }
.seat.empty { border:1px dashed rgba(17,45,73,.28); background:rgba(255,255,255,.22); color:transparent; }
.seat.reserved-empty { border-style:solid; border-width:3px; box-shadow:inset 0 0 0 2px rgba(255,255,255,.72); }
.seat.assigned { border-width:3px; box-shadow:0 0 0 2px #fff, 0 0 0 5px var(--seat-color), 0 4px 9px rgba(17,45,73,.32); text-shadow:0 1px 2px rgba(0,0,0,.5); }
.seat .zone-dot { width:7px; height:7px; border-radius:50%; background:currentColor; opacity:.95; box-shadow:0 0 0 2px rgba(255,255,255,.85); }
.seat.conflict { outline:3px solid var(--red); }
.seat:hover, .seat.selected { z-index:5; transform:translate(-50%,-50%) scale(1.15); box-shadow:0 3px 10px rgba(17,45,73,.25); outline:2px solid #fff; }
.seat.selected { border-color:var(--gold); }
.seat.vip::after { content:"★"; position:absolute; right:-5px; top:-7px; width:14px; height:14px; display:grid; place-items:center; border-radius:50%; color:#fff; background:var(--purple); font-size:8px; box-shadow:0 1px 3px rgba(0,0,0,.2); }
.seat .seat-name { position:absolute; left:50%; bottom:calc(100% + 6px); padding:4px 6px; transform:translateX(-50%); border-radius:5px; color:#fff; background:var(--navy); font-size:9px; font-weight:600; white-space:nowrap; opacity:0; pointer-events:none; }
.seat:hover .seat-name, .seat.selected .seat-name { opacity:1; }
.seat .seat-name::after { content:""; position:absolute; top:100%; left:50%; transform:translateX(-50%); border:4px solid transparent; border-top-color:var(--navy); }
.overlay-edit .seat { cursor:move; outline:1px solid rgba(230,67,63,.5); }
.map-toolbar { min-height:37px; padding:0 11px; display:flex; align-items:center; gap:13px; border-top:1px solid #edf0f2; color:var(--muted); font-size:9px; }
.map-toolbar > span { display:flex; align-items:center; gap:5px; }
.map-toolbar .spacer { margin-left:auto; }
.seat-key { width:12px; height:12px; border-radius:3px; display:inline-block; }
.seat-key.free { border:1px dashed #9ba6af; }
.seat-key.selected { border:2px solid var(--gold); background:var(--navy); }
.vip-key { color:var(--purple); }
.legend { padding:13px 18px 17px; display:flex; flex-wrap:wrap; gap:16px; }
.legend-item { display:flex; align-items:center; gap:6px; color:var(--muted); font-size:10px; }
.legend-item i { width:9px; height:9px; border-radius:3px; }
.legend-item strong { color:var(--ink); font-size:10px; }

.queue-card { min-height:600px; overflow:hidden; }
.queue-head { min-height:73px; }
.count-badge { display:inline-grid; min-width:21px; height:21px; padding:0 6px; place-items:center; border-radius:12px; color:var(--red); background:#fff0ef; font-size:10px; vertical-align:2px; }
.filters { padding:12px 14px 8px; display:flex; gap:6px; }
.filter { padding:5px 9px; border:1px solid var(--line); border-radius:15px; color:var(--muted); background:#fff; font-size:9px; }
.filter.active { color:#fff; border-color:var(--navy); background:var(--navy); }
.selection-hint { margin:0 14px 8px; padding:8px 10px; border-radius:7px; color:#6d5200; background:#fff5d9; font-size:9px; }
.person-list { max-height: 520px; padding:0 7px 10px; overflow:auto; }
.person { width:100%; padding:10px 8px; border:0; border-bottom:1px solid #eef1f3; display:grid; grid-template-columns:34px 1fr auto; gap:9px; align-items:center; background:#fff; text-align:left; border-radius:7px; }
.person:hover { background:#f6f8f8; }
.person.active { background:#fff7dd; outline:1px solid #efd27a; }
.person-avatar { position:relative; width:34px; height:34px; display:grid; place-items:center; border-radius:50%; color:#fff; font-size:10px; font-weight:700; }
.person-avatar .vip-star { position:absolute; right:-3px; top:-3px; width:14px; height:14px; display:grid; place-items:center; border:2px solid #fff; border-radius:50%; color:#fff; background:var(--purple); font-size:7px; }
.person strong { display:block; color:var(--ink); font-size:11px; }
.person small { display:block; margin-top:3px; color:var(--muted); font-size:9px; }
.priority-tag { padding:3px 5px; border-radius:4px; color:#a36700; background:#fff1c9; font-size:8px; font-weight:700; text-transform:uppercase; }
.empty-list { padding:40px 20px; color:var(--muted); text-align:center; font-size:11px; }

.management-layout { display:grid; grid-template-columns:minmax(0,1fr) 310px; gap:14px; }
.management-main, .detail-panel { min-height:640px; padding:24px; }
.section-intro { max-width:680px; margin-bottom:24px; }
.section-intro h2 { margin:4px 0 8px; font-size:24px; }
.section-intro p { margin:0; color:var(--muted); font-size:12px; line-height:1.65; }
.table { width:100%; border-collapse:collapse; }
.table th { padding:10px; color:var(--muted); border-bottom:1px solid var(--line); font-size:9px; text-align:left; text-transform:uppercase; letter-spacing:.08em; }
.table td { padding:13px 10px; border-bottom:1px solid #edf0f2; font-size:11px; }
.inline-select, .inline-input { max-width:150px; height:31px; padding:0 7px; border:1px solid var(--line); border-radius:6px; color:var(--ink); background:#fff; font-size:10px; }
.inline-input { width:130px; }
.source-tag { display:block; margin-top:3px; color:#5c778f; font-size:8px; }
.table .person-avatar { width:30px; height:30px; display:inline-grid; margin-right:8px; vertical-align:middle; }
.group-dot { width:9px; height:9px; display:inline-block; margin-right:7px; border-radius:3px; }
.group-cards { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.group-card { padding:16px; border:1px solid var(--line); border-radius:9px; }
.group-card-head { display:flex; align-items:center; justify-content:space-between; }
.group-card h3 { margin:0; color:var(--navy); font-size:13px; }
.editable-group { display:grid; gap:12px; }
.editable-group .group-card-head { gap:9px; }
.group-name-input { width:100%; min-width:0; height:34px; padding:0 8px; border:1px solid var(--line); border-radius:6px; color:var(--navy); background:#fff; font-weight:700; font-size:12px; }
.group-color-input { width:38px; height:34px; padding:3px; flex:0 0 auto; border:1px solid var(--line); border-radius:6px; background:#fff; }
.group-edit-row { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.group-edit-row label, .group-match-label { display:grid; gap:5px; color:var(--muted); font-size:9px; font-weight:600; }
.group-edit-row input, .group-match-label select, .group-match-label input { width:100%; height:32px; padding:0 8px; border:1px solid var(--line); border-radius:6px; color:var(--ink); background:#fff; font-size:10px; }
.group-card p { margin:8px 0 12px; color:var(--muted); font-size:10px; }
.progress { height:5px; overflow:hidden; border-radius:5px; background:#edf0f2; }
.progress span { height:100%; display:block; border-radius:5px; }
.group-stats { margin-top:7px; display:flex; justify-content:space-between; color:var(--muted); font-size:9px; }
.priority-list { display:grid; gap:8px; }
.priority-row { padding:13px; display:grid; grid-template-columns:32px minmax(0,1fr) auto auto; gap:10px; align-items:center; border:1px solid var(--line); border-radius:8px; }
.priority-row.disabled-rule { opacity:.55; background:#f6f7f7; }
.priority-number { width:27px; height:27px; display:grid; place-items:center; border-radius:7px; color:var(--navy); background:#eef3f4; font-size:11px; font-weight:700; }
.priority-row strong { display:block; font-size:11px; }
.priority-row small { color:var(--muted); font-size:9px; }
.move-buttons { display:flex; gap:3px; }
.move-buttons button { width:26px; height:26px; border:1px solid var(--line); border-radius:6px; background:#fff; color:var(--navy); }
.rule-toggle { display:flex; align-items:center; gap:5px; color:var(--muted); font-size:9px; white-space:nowrap; }
.rule-match { max-width:260px; margin-top:8px; display:flex; align-items:center; gap:7px; color:var(--muted); font-size:9px; }
.rule-match input, .rule-match select { height:28px; min-width:130px; padding:0 7px; border:1px solid var(--line); border-radius:6px; background:#fff; font-size:10px; }
.rule-link { display:block; margin-top:7px; color:#397270; font-size:9px; }
.rule-jump { margin-top:4px; font-size:9px; }
.priority-audit { margin-bottom:14px; padding:12px 14px; display:grid; gap:4px; border-left:3px solid var(--teal); border-radius:6px; color:#315e5d; background:#edf8f7; font-size:10px; }
.priority-field { display:grid; gap:5px; }
.priority-field label { display:flex; align-items:center; gap:4px; color:var(--muted); font-size:8px; font-weight:600; }
.derived-value { color:var(--navy) !important; background:#f4f6f7 !important; font-weight:700; }
.detail-panel h3 { margin:0 0 12px; color:var(--navy); font-size:14px; }
.detail-panel p, .detail-panel li { color:var(--muted); font-size:10px; line-height:1.6; }
.detail-panel ul { padding-left:17px; }
.api-status { padding:12px; display:flex; gap:10px; align-items:center; border-radius:8px; color:#6b5518; background:#fff6dc; font-size:10px; }
.api-status i { width:9px; height:9px; border-radius:50%; background:var(--gold); }
.api-status.connected { color:#276b50; background:#eaf8f1; }
.api-status.connected i { background:#45b984; }
.api-status + .button { margin:12px 0 5px; }
.button:disabled { cursor:not-allowed; opacity:.5; box-shadow:none; }
.endpoint { margin-top:8px; padding:11px; border:1px solid var(--line); border-radius:7px; }
.endpoint code { color:var(--red); font-size:9px; }
.endpoint strong { display:block; margin-bottom:4px; color:var(--ink); font-size:10px; }
.property-config select { width:100%; height:34px; margin:5px 0; padding:0 8px; border:1px solid var(--line); border-radius:6px; color:var(--ink); background:#fff; font-size:10px; }
.property-config small { display:block; color:var(--muted); font-size:9px; line-height:1.45; }
.notice { padding:12px; border-left:3px solid var(--teal); color:var(--muted); background:#f1f8f7; font-size:10px; line-height:1.5; }
.aside-form { display:grid; gap:10px; margin-bottom:16px; }
.aside-form label { display:grid; gap:5px; color:var(--muted); font-size:9px; font-weight:600; }
.aside-form input, .aside-form select { height:34px; padding:0 8px; border:1px solid var(--line); border-radius:6px; background:#fff; font-size:10px; }
.bus-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px; }
.bus-card { overflow:hidden; border:1px solid var(--line); border-radius:10px; }
.bus-preview { height:150px; display:grid; place-items:center; overflow:hidden; background:#f6f7f7; }
.bus-preview img { width:100%; height:100%; object-fit:contain; }
.bus-info { padding:14px; }
.bus-info h3 { margin:0 0 5px; color:var(--navy); font-size:13px; }
.bus-info p { margin:0; color:var(--muted); font-size:9px; }
.bus-info footer { margin-top:12px; display:flex; align-items:center; justify-content:space-between; }
.template-status { padding:4px 7px; border-radius:5px; color:#8b6200; background:#fff2c7; font-size:8px; font-weight:700; }
.template-status.ready { color:#267554; background:#e5f6ed; }
.detection-status { display:block; margin-top:7px; color:var(--muted); font-size:8px; line-height:1.4; }
.template-button-stack { margin-top:10px; display:grid; gap:7px; }
.template-button-stack .button { width:100%; }
.template-workbench { min-width:760px; }
.template-workbench-head { margin-bottom:14px; display:flex; align-items:center; justify-content:space-between; gap:16px; }
.template-title-input { width:min(560px,70vw); padding:4px 0; border:0; border-bottom:2px solid transparent; color:var(--navy); background:transparent; font:700 24px inherit; }
.template-title-input:focus { border-bottom-color:var(--teal); outline:0; }
.template-head-actions { display:flex; gap:8px; }
.level-tabs { margin-bottom:10px; display:flex; flex-wrap:wrap; gap:6px; }
.level-tabs button { padding:8px 11px; border:1px solid var(--line); border-radius:7px; color:var(--navy); background:#fff; font-size:10px; }
.level-tabs button.active { color:#fff; border-color:var(--navy); background:var(--navy); }
.level-tabs span { margin-left:4px; opacity:.7; }
.level-tabs .add-level { border-style:dashed; color:var(--teal); }
.template-level-settings { margin-bottom:10px; padding:12px; display:grid; grid-template-columns:1.1fr .7fr 1.4fr auto auto; gap:8px; align-items:end; border-radius:9px; background:#f3f6f7; }
.template-level-settings label { display:grid; gap:4px; color:var(--muted); font-size:9px; font-weight:600; }
.template-level-settings input, .template-editor-toolbar select { min-width:0; height:34px; padding:0 8px; border:1px solid var(--line); border-radius:6px; background:#fff; font-size:10px; }
.template-editor-toolbar { min-height:52px; padding:9px 11px; display:flex; flex-wrap:wrap; align-items:center; gap:10px; border:1px solid var(--line); border-bottom:0; border-radius:9px 9px 0 0; background:#fff; }
.template-editor-toolbar > span { color:var(--muted); font-size:9px; }
.template-editor-toolbar > strong { margin-left:auto; font-size:10px; }
.template-editor-toolbar > strong.complete { color:#267554; }
.template-editor-toolbar > strong.incomplete { color:var(--red); }
.template-editor-toolbar > label { display:flex; align-items:center; gap:7px; color:var(--muted); font-size:9px; }
.editor-mode-switch { display:flex; gap:3px; padding:3px; border-radius:7px; background:#edf1f2; }
.editor-mode-switch button { padding:6px 9px; border:0; border-radius:5px; color:var(--muted); background:transparent; font-size:9px; }
.editor-mode-switch button.active { color:#fff; background:var(--navy); }
.template-map { position:relative; width:100%; aspect-ratio:1300/620; overflow:hidden; border:1px solid var(--line); background-color:#f7f8f8; background-position:center; background-repeat:no-repeat; background-size:100% 100%; cursor:crosshair; touch-action:none; }
.template-seat { position:absolute; width:38px; height:38px; padding:0; transform:translate(-50%,-50%) rotate(var(--seat-rotation,0deg)); border:2px solid #fff; border-radius:7px; color:#fff; box-shadow:0 0 0 2px var(--seat-color),0 3px 8px rgba(17,45,73,.25); font-size:10px; font-weight:800; cursor:grab; touch-action:none; }
.template-seat:active { cursor:grabbing; }
.template-seat.selected { outline:4px solid var(--gold); z-index:3; }
.template-seat.group-seat { box-shadow:0 0 0 3px var(--seat-color),0 3px 8px rgba(17,45,73,.3); }
.template-editor-help { margin:8px 0 0; color:var(--muted); font-size:9px; line-height:1.5; }
.bus-level-form { display:grid; grid-column:1/-1; gap:12px; }
.bus-level-form fieldset { padding:13px; display:grid; grid-template-columns:minmax(180px,1.35fr) minmax(120px,.75fr) minmax(140px,.9fr); gap:11px; border:1px solid var(--line); border-radius:8px; }
.bus-level-form legend { padding:0 5px; color:var(--navy); font-size:10px; font-weight:700; }
.bus-level-form label { display:grid; align-content:start; gap:5px; }
.bus-level-form input:not([type="file"]) { width:100%; min-width:0; color:var(--navy); background:#fff; font-size:12px; font-weight:600; }
.bus-level-form input[type="number"] { font-variant-numeric:tabular-nums; }
.bus-level-form .level-field-image { grid-column:1/-1; }
.bus-level-form .level-field-image input { margin-top:0; }
.bus-level-form small { color:var(--muted); font-size:8px; font-weight:500; }
#busDialog { width:min(700px, calc(100% - 32px)); overflow-y:auto; }

dialog { width:min(520px, calc(100% - 32px)); max-height:calc(100vh - 40px); padding:0; border:0; border-radius:13px; box-shadow:0 20px 70px rgba(17,45,73,.25); }
dialog.wide-dialog { width:min(780px, calc(100% - 32px)); }
dialog.report-dialog { width:min(1120px, calc(100% - 32px)); }
dialog::backdrop { background:rgba(17,45,73,.42); backdrop-filter:blur(2px); }
dialog form, .dialog-content { padding:22px; }
.dialog-head { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:19px; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:13px; }
.form-grid label { color:var(--muted); font-size:10px; font-weight:600; }
.form-grid label.full { grid-column:1/-1; }
.form-grid input:not([type="checkbox"]), .form-grid select, .form-grid textarea { width:100%; margin-top:6px; padding:0 10px; border:1px solid var(--line); border-radius:7px; color:var(--ink); background:#fff; outline:none; font-size:11px; }
.form-grid input:not([type="checkbox"]), .form-grid select { height:39px; }
.form-grid textarea { min-height:90px; padding-top:9px; resize:vertical; font-family:inherit; }
.form-grid input[type="file"] { height:auto; padding:9px; }
.form-grid input:focus, .form-grid select:focus { border-color:var(--teal); box-shadow:0 0 0 3px rgba(61,184,181,.12); }
.check-label { display:flex; gap:8px; align-items:center; padding-top:20px; }
.dialog-actions { margin-top:22px; display:flex; justify-content:flex-end; gap:8px; }
.form-note { margin:15px 0 0; color:var(--muted); font-size:9px; line-height:1.5; }
.group-multiselect { margin-top:7px; padding:8px; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; border:1px solid var(--line); border-radius:8px; background:#f8f9f9; }
.group-multiselect label { min-width:0; padding:8px; display:flex; align-items:center; gap:7px; border:1px solid #e3e8e9; border-radius:7px; color:var(--ink); background:#fff; font-size:10px; cursor:pointer; }
.group-multiselect label:has(input:checked) { border-color:#78bebb; background:#edf8f7; }
.group-multiselect i { width:9px; height:9px; flex:0 0 auto; border-radius:3px; }
.danger-text { color:var(--red) !important; }
.split-actions { display:grid; grid-template-columns:auto 1fr auto auto; }
.template-actions, .report-actions { margin-top:12px; display:flex; flex-wrap:wrap; gap:8px; }
.person-detail-meta { margin:-4px 0 18px; padding:12px; display:flex; align-items:center; gap:10px; border-radius:9px; background:#f3f6f7; }
.person-detail-meta strong, .person-detail-meta small { display:block; }
.person-detail-meta small { margin-top:3px; color:var(--muted); font-size:9px; }
.person-event-history { margin-top:8px; padding-top:14px; border-top:1px solid var(--line); }
.person-event-history .table { margin-top:8px; }
.status-tag { display:inline-flex; align-items:center; min-height:24px; padding:4px 8px; border-radius:14px; font-size:8px; font-weight:700; white-space:nowrap; }
.status-tag.checked-in { color:#216b4c; background:#e4f6ec; }
.status-tag.pending, .status-tag.no-show { color:#9a342f; background:#fff0ef; }
.status-tag.registered { color:#315e78; background:#eaf2f7; }
.status-tag.cancelled { color:#6f5865; background:#f2edf0; }
.registration-summary { margin:0 0 18px; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.registration-summary article { min-height:72px; padding:13px; display:flex; flex-direction:column; justify-content:center; border:1px solid var(--line); border-radius:9px; background:#f7f9f9; }
.registration-summary strong { color:var(--navy); font-size:21px; }
.registration-summary span { margin-top:2px; color:var(--muted); font-size:9px; }
.registration-summary article.success { border-color:#bfe3d0; background:#edf8f2; }
.registration-summary article.warning { border-color:#f0d2d0; background:#fff5f4; }
.management-event-picker label { flex:1; }
.management-event-picker select { width:100%; }
.management-event-picker .button { margin-left:0; }
.registration-table { min-width:900px; }
.checkin-table { min-width:760px; }
.checkin-table tr.checked-row { background:#f4fbf7; }
.checkin-table tr.pending-row { background:#fffafa; }
.cancelled-section { padding-top:8px; border-top:2px solid #eadde3; }
.no-checkin-section { padding-top:8px; border-top:2px solid #f1d5d3; }
.result-section { margin-top:22px; }
.result-section h3 { display:flex; align-items:center; gap:7px; color:var(--navy); font-size:14px; }
.result-section h3 span { min-width:22px; height:22px; padding:0 6px; display:inline-grid; place-items:center; border-radius:12px; color:var(--red); background:#fff0ef; font-size:9px; }
.table-scroll { overflow:auto; }
.event-filters { margin-bottom:14px; padding:12px; display:flex; align-items:end; gap:10px; border-radius:8px; background:#f4f6f7; }
.event-filters label { display:grid; gap:4px; color:var(--muted); font-size:9px; font-weight:600; }
.event-filters select { min-width:140px; height:34px; padding:0 8px; border:1px solid var(--line); border-radius:6px; background:#fff; }
.event-filters span { margin-left:auto; color:var(--muted); font-size:9px; }
.table-actions { display:flex; gap:6px; }
.people-table { min-width:980px; }
.people-toolbar { margin-bottom:12px; padding:10px 12px; display:flex; align-items:end; gap:12px; border-radius:8px; background:#f4f6f7; }
.people-toolbar label { display:grid; gap:4px; color:var(--muted); font-size:9px; font-weight:600; }
.people-toolbar select { min-width:170px; height:34px; padding:0 8px; border:1px solid var(--line); border-radius:6px; background:#fff; }
.people-toolbar span { margin-left:auto; color:var(--muted); font-size:9px; }
.archived-members { margin-top:28px; padding-top:20px; border-top:1px solid var(--line); }
.archived-members h3 { margin:0 0 5px; color:var(--navy); font-size:14px; }
.archived-members h3 span { min-width:22px; height:22px; padding:0 6px; display:inline-grid; place-items:center; border-radius:12px; color:var(--muted); background:#edf1f2; font-size:9px; }
.archived-members > p { margin:0 0 12px; color:var(--muted); font-size:10px; }
.archived-members tbody { opacity:.78; }
.management-main { overflow:auto; }
.event-bus-list { display:grid; gap:10px; }
.event-bus-row { padding:13px; display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:end; gap:12px; border:1px solid var(--line); border-radius:8px; }
.event-bus-row > div { display:grid; grid-template-columns:1fr 1.4fr; gap:10px; }
.event-bus-row label, .group-bus-editor label { display:grid; gap:5px; color:var(--muted); font-size:9px; font-weight:600; }
.event-bus-row input:not([type="radio"]), .event-bus-row select, .group-bus-editor select { height:34px; padding:0 8px; border:1px solid var(--line); border-radius:6px; background:#fff; font-size:10px; }
.group-bus-editor { margin-top:20px; padding-top:18px; border-top:1px solid var(--line); display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; }
.group-bus-editor h3, .group-bus-editor p { grid-column:1/-1; margin:0; }
.group-bus-editor p { color:var(--muted); font-size:9px; }
.template-zone-button { width:100%; margin-top:12px; }
.field-label { display:block; color:var(--muted); font-size:10px; font-weight:600; }
.quick-template-buttons { margin-top:7px; display:flex; flex-wrap:wrap; gap:7px; }
.quick-template-buttons small { color:var(--muted); font-weight:400; }
.quick-template-button { padding:7px 10px; border:1px solid #b9d4d3; border-radius:18px; color:var(--navy); background:#eff8f7; font:600 9px inherit; cursor:pointer; }
.quick-template-button:hover, .quick-template-button.selected { color:#fff; border-color:var(--teal); background:var(--teal); }
.admin-add-form { margin-bottom:16px; display:flex; gap:8px; }
.admin-add-form input { min-width:280px; height:38px; padding:0 10px; flex:1; border:1px solid var(--line); border-radius:7px; }
.admin-template-list { display:grid; gap:8px; }
.admin-template-row { padding:10px; display:grid; grid-template-columns:1fr auto; gap:8px; border:1px solid var(--line); border-radius:8px; }
.admin-template-row input { min-width:0; height:34px; padding:0 9px; border:1px solid var(--line); border-radius:6px; }
.admin-section { margin-top:26px; padding-top:20px; border-top:1px solid var(--line); }
.admin-section > h3 { margin:0 0 14px; color:var(--navy); }
.settings-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.settings-grid label, .mail-template-form label { display:grid; gap:5px; color:var(--muted); font-size:9px; font-weight:600; }
.settings-grid input, .settings-grid select, .mail-template-form input, .mail-template-form textarea { width:100%; padding:0 9px; border:1px solid var(--line); border-radius:6px; background:#fff; font:10px inherit; }
.settings-grid input, .settings-grid select, .mail-template-form input { height:35px; }
.mail-template-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.mail-template-form { padding:14px; display:grid; gap:10px; border:1px solid var(--line); border-radius:9px; }
.mail-template-form h4 { margin:0; color:var(--navy); }
.mail-template-form textarea { min-height:150px; padding:9px; resize:vertical; }
.mail-count { min-width:42px; height:42px; display:grid; place-items:center; border-radius:50%; color:#fff; background:var(--teal); font-weight:800; }
.guide-sections { display:grid; gap:9px; }
.guide-sections details { padding:0 14px; border:1px solid var(--line); border-radius:9px; background:#fff; }
.guide-sections summary { padding:14px 0; color:var(--navy); font-size:12px; font-weight:700; cursor:pointer; }
.guide-sections details > p, .guide-sections details > ol { margin:0 0 15px; color:var(--muted); font-size:10px; line-height:1.7; }
.api-warning { margin:12px 0; padding:12px; border-left:3px solid var(--red); border-radius:5px; color:#793035; background:#fff0ef; font-size:9px; line-height:1.5; }
.api-warning strong { display:block; margin-bottom:4px; font-size:10px; }
.api-warning p { margin:5px 0; color:#793035; }
.api-warning code { color:#793035; }
.priority-suggestions { margin-bottom:14px; }
.toast { position:fixed; right:24px; bottom:24px; z-index:50; max-width:340px; padding:12px 16px; border-radius:8px; color:#fff; background:var(--navy); box-shadow:0 10px 30px rgba(17,45,73,.25); font-size:11px; opacity:0; transform:translateY(10px); pointer-events:none; transition:.2s ease; }
.toast.show { opacity:1; transform:translateY(0); }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 206px 1fr; }
  .sidebar { padding-left:12px; padding-right:12px; }
  main { padding-left:20px; padding-right:20px; }
  .event-meta { display:none; }
  .planner-grid { grid-template-columns:1fr; }
  .queue-card { min-height:0; }
  .person-list { max-height:320px; }
}

@media (max-width: 780px) {
  .app-shell { display:block; }
  .sidebar { position:fixed; left:-250px; width:230px; transition:left .2s ease; }
  .sidebar.open { left:0; }
  main { padding:0 12px 28px; }
  .mobile-menu { display:block; }
  .topbar { min-height:84px; }
  #resetButton { display:none; }
  .topbar-actions { max-width:70%; gap:5px; }
  .topbar-actions .button { min-height:34px; padding:0 9px; font-size:10px; }
  h1 { font-size:22px; }
  .event-bar { align-items:flex-start; flex-direction:column; gap:6px; }
  .event-bar label { min-width:0; width:100%; }
  .event-bar .text-button { margin-left:0; }
  .stats { grid-template-columns:1fr 1fr; }
  .card-head { align-items:flex-start; flex-wrap:wrap; }
  .deck-switch { order:3; width:100%; }
  .deck-switch button { flex:1; }
  #editOverlayButton { display:inline-flex; }
  .seat-map-wrap { margin-left:8px; margin-right:8px; overflow-x:auto; }
  .seat-map { min-width:720px; }
  .map-help { margin-left:8px; margin-right:8px; }
  .management-layout { grid-template-columns:1fr; }
  .group-cards { grid-template-columns:1fr; }
  .bus-grid { grid-template-columns:1fr; }
  .form-grid { grid-template-columns:1fr; }
  .form-grid label.full { grid-column:auto; }
  .group-multiselect { grid-template-columns:1fr; }
  .settings-grid, .mail-template-grid { grid-template-columns:1fr; }
  .template-level-settings { grid-template-columns:1fr 1fr; }
  .bus-level-form fieldset { grid-template-columns:1fr; }
}

@media print {
  .sidebar, .topbar-actions, .queue-card, .event-bar, .stats, .map-help, .map-toolbar, #editOverlayButton { display:none !important; }
  .app-shell { display:block; }
  main { padding:0; }
  .topbar { min-height:65px; }
  .planner-grid { display:block; }
  .seat-card { box-shadow:none; border:0; }
}

/* Schematische Busvorlagen und barrierefreie Plätze */
.template-map-scroll { width:100%; overflow:auto; border:1px solid var(--line); background:#eef2f3; }
.template-map-scroll .template-map { border:0; }
.template-map.schematic-bus { width:max(100%,calc(var(--bus-length,12) * 70px)); aspect-ratio:var(--bus-length,12) / 4; min-height:320px; }
.schematic-bus { position:relative; overflow:hidden; background-color:#f4f7f7 !important; background-image:linear-gradient(90deg,rgba(61,184,181,.05) 1px,transparent 1px),linear-gradient(rgba(61,184,181,.05) 1px,transparent 1px) !important; background-size:32px 32px !important; }
.schematic-bus::before { content:""; position:absolute; inset:5% 3%; z-index:0; border:4px solid #3db8b5; border-radius:12% 5% 5% 12% / 22% 12% 12% 22%; background:rgba(255,255,255,.88); box-shadow:inset 0 0 0 2px rgba(23,58,94,.08); pointer-events:none; }
.schematic-bus::after { content:"Fahrtrichtung"; position:absolute; left:5%; top:50%; z-index:0; padding:6px 9px; transform:translateY(-50%) rotate(-90deg); border-radius:5px; color:#173a5e; background:#e2f3f2; font-size:9px; font-weight:800; letter-spacing:.05em; pointer-events:none; }
.schematic-bus > * { z-index:1; }
.template-tool-palette { display:flex; flex-wrap:wrap; gap:4px; }
.template-tool-palette button { min-height:30px; padding:0 8px; border:1px solid var(--line); border-radius:5px; color:var(--muted); background:#fff; font-size:9px; }
.template-tool-palette button.active { color:#fff; border-color:var(--navy); background:var(--navy); }
.template-editor-toolbar input { height:32px; max-width:170px; padding:0 7px; border:1px solid var(--line); border-radius:5px; }
.template-seat.wheelchair-seat,.seat.wheelchair-seat { border-radius:50%; background:#1679a7 !important; border-color:#0d5f87 !important; color:#fff !important; }
.template-seat.wheelchair-seat { display:grid; grid-template-columns:auto auto; place-content:center; gap:2px; }
.template-seat.wheelchair-seat span { font-size:13px; line-height:1; }
.template-seat.wheelchair-seat small { font-size:7px; }
.seat.wheelchair-seat > span:first-child { font-size:clamp(9px,1vw,14px); }
.template-element,.map-fixture { position:absolute; display:flex; align-items:center; justify-content:center; flex-direction:column; gap:2px; transform:translate(-50%,-50%); border:2px solid #486477; border-radius:7px; color:#173a5e; background:rgba(255,255,255,.92); font-size:8px; font-weight:700; text-align:center; touch-action:none; }
.template-element { padding:3px; cursor:grab; }
.template-element b,.map-fixture b { font-size:14px; line-height:1; }
.template-element span,.map-fixture small { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.template-element.selected { outline:3px solid var(--gold); z-index:4; }
.template-element-driver,.map-fixture-driver { border-color:#eaaa28; background:#fff4d7; }
.template-element-access,.map-fixture-access { border-color:#267554; color:#216b4c; background:#e4f6ec; }
.template-element-stairs,.map-fixture-stairs { border-color:#7153a8; color:#65489a; background:#f0eafa; }
.template-element-blocked,.map-fixture-blocked { border-color:#c13b37; color:#9a342f; background:rgba(255,224,221,.92); }
.template-seat small { display:block; color:inherit; font-size:8px; font-weight:800; line-height:1; }
.selected-seat-fields { width:100%; padding-top:9px; display:grid; grid-template-columns:repeat(4,minmax(110px,1fr)) auto; gap:8px; align-items:end; border-top:1px solid var(--line); }
.selected-seat-fields label { display:grid; gap:4px; color:var(--muted); font-size:9px; font-weight:600; }
.selected-seat-fields input,.selected-seat-fields select { width:100%; max-width:none; height:34px; padding:0 8px; border:1px solid var(--line); border-radius:6px; color:var(--ink); background:#fff; }
.compact-check { display:flex !important; min-height:34px; align-items:center; gap:7px !important; padding-bottom:4px; }
.compact-check input { width:auto !important; height:auto !important; }
.seat { transform:translate(-50%,-50%) rotate(var(--seat-rotation,0deg)); }
.seat:hover,.seat.selected { transform:translate(-50%,-50%) rotate(var(--seat-rotation,0deg)) scale(1.15); }
.seat-type-companion:not(.assigned),.seat-type-crew:not(.assigned),.seat-type-vip:not(.assigned),.seat-type-emergencySeat:not(.assigned) { border-style:solid; }
.seat-type-vip:not(.assigned) { border-color:#8c63d9; }
.seat-type-crew:not(.assigned) { border-color:#244e71; }
.template-element-table,.map-fixture-table { border-radius:50%; color:#765815; background:#f6df9b; border-color:#b88e2f; }

@media (max-width:780px) {
  .selected-seat-fields { grid-template-columns:1fr 1fr; }
}
.map-fixture { pointer-events:none; }
.secret-status { min-height:45px; display:flex; flex-direction:column; justify-content:center; gap:3px; }
.secret-status strong { color:var(--navy); font-size:10px; }
.secret-status small { color:var(--muted); font-size:9px; }
.schematic-preview { width:78%; height:52%; display:grid; place-items:center; border:3px solid var(--teal); border-radius:24px 9px 9px 24px; color:var(--navy); background:#fff; font-size:10px; font-weight:800; }
