:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --border: #dce2e9;
  --border-strong: #c4ccd6;
  --text: #16202b;
  --muted: #5b6878;
  --primary: #1f5fbf;
  --primary-hover: #194f9f;
  --primary-soft: #e6effb;
  --danger: #c0392f;
  --danger-soft: #fbeae8;
  --warn: #a86a0c;
  --warn-soft: #fdf3e1;
  --ok: #2d7d4f;
  --ok-soft: #e5f4ea;
  --info: #3b6ea8;
  --info-soft: #e8f0f9;
  --sidebar: #0e1a2b;
  --sidebar-text: #b9c6d8;
  --sidebar-muted: #7a8aa0;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(15, 25, 40, .06), 0 2px 6px rgba(15, 25, 40, .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1118;
    --surface: #141b24;
    --surface-2: #19212c;
    --border: #273241;
    --border-strong: #354355;
    --text: #e3e9f0;
    --muted: #93a1b3;
    --primary: #4d8fe6;
    --primary-hover: #6aa2ec;
    --primary-soft: #16283f;
    --danger: #ef6b61;
    --danger-soft: #3a1b1a;
    --warn: #e0a642;
    --warn-soft: #362810;
    --ok: #5bbf85;
    --ok-soft: #13301f;
    --info: #74a6e0;
    --info-soft: #152538;
    --sidebar: #080d14;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 1.45rem; font-weight: 650; }
h2 { font-size: 1.02rem; font-weight: 620; }
h3 { font-size: .92rem; font-weight: 620; }
a { color: var(--primary); }
code, .mono { font-family: var(--mono); font-size: .86em; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }
.stack > * + * { margin-top: .75rem; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: .65rem; align-items: center; padding: 1.1rem 1rem 1rem; }
.brand-logo { width: 34px; height: 34px; border-radius: 8px; background: #1f5fbf; display: grid; place-items: center; flex: none; }
.brand-logo.custom { background: transparent; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.logo-preview { width: 64px; height: 64px; border-radius: 10px; background: #1f5fbf; display: grid; place-items: center; flex: none; overflow: hidden; }
.logo-preview.custom { background: var(--surface-2); }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.brand-title { color: #fff; font-weight: 650; font-size: .98rem; }
.brand-sub { color: var(--sidebar-muted); font-size: .75rem; }
.nav { display: flex; flex-direction: column; padding: .25rem .5rem; gap: 2px; }
.nav a { display: flex; align-items: center; gap: .65rem; padding: .55rem .7rem; border-radius: 6px; color: var(--sidebar-text); text-decoration: none; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active { background: #1f5fbf; color: #fff; }
.nav svg { width: 18px; height: 18px; flex: none; }
.user-box { margin-top: auto; padding: .9rem 1rem; border-top: 1px solid rgba(255, 255, 255, .08); font-size: .85rem; }
.user-box .name { color: #fff; font-weight: 600; }
.user-box button { margin-top: .5rem; width: 100%; background: transparent; color: var(--sidebar-text); border-color: rgba(255, 255, 255, .18); }
.main { min-width: 0; }
#view { padding: 1.4rem 1.6rem 3rem; max-width: 1500px; }
#view.full { padding: 0; max-width: none; }
.page-header { display: flex; align-items: flex-end; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-header .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.page-sub { color: var(--muted); margin-top: .2rem; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { padding: .6rem .8rem; }
  .brand-sub { display: none; }
  .nav { flex-direction: row; overflow-x: auto; flex: 1 1 100%; order: 3; padding: 0 .4rem .4rem; }
  .nav a span { white-space: nowrap; }
  .user-box { margin: 0 0 0 auto; border: 0; padding: .5rem .8rem; }
  .user-box .role-line { display: none; }
  .user-box button { margin: 0; }
  #view { padding: 1rem; }
}

/* ---------- Karten, Raster ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; gap: .5rem; padding: .75rem 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header .actions { margin-left: auto; display: flex; gap: .4rem; }
.card-body { padding: 1rem; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 1rem; }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; box-shadow: var(--shadow); }
.kpi-value { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--muted); font-size: .8rem; }
.kpi.alert-kpi .kpi-value { color: var(--danger); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: .5rem .75rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data th { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--primary-soft); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.conflict-mission td { background: var(--surface-2); }
table.data tr.conflict-item td:first-child { padding-left: 1.5rem; width: 1%; }
table.data tr.no-mission td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.text-warn { color: var(--warn); }
.time-warning { color: var(--danger); font-size: 1rem; margin-left: .25rem; cursor: help; }
.mission-map { height: 220px; width: 100%; background: var(--surface-2); }
.mission-map .leaflet-container { font: inherit; }
table.data.team-status td { padding-top: .35rem; padding-bottom: .35rem; }
.check-group { display: flex; align-items: center; gap: .35rem; padding: .2rem 0; }
/* Einsätze einer Planung: deutlich abgesetzte Gruppe mit eigenem Aufklapp-Pfeil */
details.mission-group { border-top: 3px solid var(--border-strong); }
details.mission-group + details.mission-group, details.mission-group + .mission-item { margin-top: .4rem; }
details.mission-group > summary { display: flex; align-items: center; gap: .45rem; padding: .6rem .8rem; cursor: pointer;
  background: var(--surface-2); font-size: .95rem; list-style: none; user-select: none; }
details.mission-group > summary::-webkit-details-marker { display: none; }
details.mission-group > summary::before { content: '▸'; color: var(--muted); width: .9rem; transition: transform .15s; }
details.mission-group[open] > summary::before { content: '▾'; }
details.mission-group > summary:hover { background: var(--primary-soft); }
details.mission-group[open] > summary { border-bottom: 1px solid var(--border-strong); }
details.mission-group > summary .count { margin-left: auto; color: var(--muted); font-size: .8rem; font-weight: 500; }
details.mission-group > .mission-item { border-left: 3px solid var(--border-strong); }
details.mission-group > .mission-item.selected { border-left-color: var(--primary); }
details.layer-group > summary, details.area-group > summary { display: flex; align-items: center; gap: .35rem; padding: .25rem 0; cursor: pointer; }
details.layer-group > summary::marker, details.area-group > summary::marker { color: var(--muted); }
details.area-group { margin-left: 1rem; }
details.area-group .check-all { font-weight: 600; padding-left: 1.4rem; }
.check-field.check-child { padding-left: 1.4rem; }
.plan-warnings-body { border-bottom: 1px solid var(--border); }
.plan-warnings ul { margin: .35rem 0; padding-left: 1.2rem; }
.plan-warnings a:not(.btn) { color: inherit; font-weight: 600; text-decoration: underline; }
.plan-warnings li .btn { margin-left: .5rem; vertical-align: middle; }
/* Baumstruktur: Gesamtfläche mit Auf-/Zuklappen, Sektoren eingerückt */
.tree-toggle { display: inline-flex; align-items: center; justify-content: center; width: 1.3rem; height: 1.3rem; margin-right: .3rem; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: .85rem; line-height: 1; cursor: pointer; vertical-align: middle; }
.tree-toggle:hover { background: var(--surface-2); color: inherit; }
.tree-spacer { display: inline-block; width: 1.3rem; margin-right: .3rem; }
.tree-branch { display: inline-block; width: 1.3rem; margin: 0 .3rem 0 1.6rem; color: var(--muted); text-align: center; }

/* ---------- Buttons & Formulare ---------- */
button, .btn { font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .45rem .85rem; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; font-weight: 500; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--primary); }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-sm { padding: .25rem .55rem; font-size: .85rem; }
.btn-icon { padding: .3rem; }
.btn-icon svg { width: 16px; height: 16px; }
.btn-group { display: inline-flex; }
.btn-group > button { border-radius: 0; margin-left: -1px; }
.btn-group > button:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.btn-group > button:last-child { border-radius: 0 6px 6px 0; }
.btn-group > button.active { background: var(--primary); border-color: var(--primary); color: #fff; position: relative; }

input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; padding: .42rem .6rem; width: 100%; min-width: 0; }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=color] { padding: 2px; height: 34px; width: 48px; }
input[type=range] { padding: 0; }
textarea { min-height: 80px; resize: vertical; }
label { font-size: .82rem; font-weight: 550; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: .25rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-all { grid-column: 1 / -1; }
.check-field { display: flex; align-items: center; gap: .45rem; font-size: .9rem; color: var(--text); font-weight: 450; }
.hint { font-size: .8rem; color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { min-width: 140px; }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; margin-top: 1rem; flex-wrap: wrap; }

/* ---------- Badges & Hinweise ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .08rem .5rem; border-radius: 999px; font-size: .76rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.st-geplant { color: var(--info); background: var(--info-soft); border-color: transparent; }
.st-in_durchfuehrung { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.st-abgeschlossen { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.st-offen { color: var(--muted); }
.prio-hoch { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.prio-mittel { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.prio-niedrig { color: var(--muted); }
.sev-error { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.sev-warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .15); flex: none; vertical-align: middle; }

.alert { border-radius: 6px; padding: .6rem .8rem; border: 1px solid transparent; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }

ul.checks { list-style: none; margin: 0; padding: 0; }
ul.checks li { display: grid; grid-template-columns: 22px 1fr; gap: .4rem; padding: .45rem 0; border-bottom: 1px solid var(--border); }
ul.checks li:last-child { border-bottom: 0; }
ul.checks .icon { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; margin-top: 1px; }
ul.checks .check-ok .icon { background: var(--ok); }
ul.checks .check-warn .icon { background: var(--warn); }
ul.checks .check-error .icon { background: var(--danger); }
ul.checks .check-info .icon { background: var(--muted); }
ul.checks .label { font-weight: 600; margin-right: .3rem; }

.empty { padding: 1.6rem; text-align: center; color: var(--muted); }
.metric-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem .9rem; }
.metric-list div span { display: block; font-size: .75rem; color: var(--muted); }
.metric-list div strong { font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); padding: 0 .5rem; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; padding: .55rem .7rem; color: var(--muted); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
details.box { border: 1px solid var(--border); border-radius: 6px; }
details.box > summary { cursor: pointer; padding: .5rem .7rem; font-weight: 600; }
details.box > div { padding: 0 .7rem .7rem; }

/* ---------- Modal & Toasts ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8, 14, 24, .5); display: grid; place-items: center; z-index: 1000; padding: 1rem; }
.modal { background: var(--surface); border-radius: 10px; width: min(640px, 100%); max-height: calc(100vh - 2rem); display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.modal.wide { width: min(980px, 100%); }
.modal-header { padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.modal-header button { margin-left: auto; }
.modal-body { padding: 1.1rem; overflow: auto; }
.modal-footer { padding: .8rem 1.1rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
/* Schwebendes Fenster: links über Navigation und Flächenliste, Karte bleibt sichtbar und bedienbar */
.modal-backdrop.floating { background: transparent; pointer-events: none; display: block; padding: 0; }
.modal.floating { position: fixed; left: 1rem; top: 4.5rem; width: min(560px, calc(100vw - 2rem)); max-height: calc(100vh - 5.5rem); pointer-events: auto; border: 1px solid var(--border); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.modal.floating .modal-header { cursor: move; user-select: none; touch-action: none; }
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 2000; }
.toast { background: var(--text); color: var(--surface); padding: .6rem .9rem; border-radius: 6px; box-shadow: var(--shadow); max-width: 420px; animation: toast-in .15s ease-out; }
.toast-error { background: var(--danger); color: #fff; }
.toast-ok { background: var(--ok); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(160deg, #0e1a2b 0%, #16345c 100%); }
.login-card { width: min(420px, 100%); background: var(--surface); border-radius: 12px; padding: 1.8rem; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.login-card h1 { margin: .8rem 0 .2rem; }
.login-card .providers { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.2rem; }
.login-card .providers .btn { width: 100%; padding: .65rem; }
.dev-list { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; max-height: 300px; overflow: auto; }
.dev-list button { justify-content: space-between; }

/* ---------- Karte ---------- */
.map-layout { display: grid; grid-template-columns: 360px 1fr; height: 100vh; }
.map-panel { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.map-panel-head { padding: .9rem 1rem .6rem; border-bottom: 1px solid var(--border); }
.map-panel-body { overflow: auto; flex: 1; min-height: 0; }
.map-section { padding: .8rem 1rem; border-bottom: 1px solid var(--border); }
.map-section h3 { display: flex; align-items: center; gap: .4rem; margin-bottom: .5rem; }
.map-section h3 .actions { margin-left: auto; display: flex; gap: .25rem; }
.map-canvas-wrap { position: relative; min-width: 0; min-height: 0; }
.map-canvas { position: absolute; inset: 0; background: #d9dee5; }
.map-toolbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); z-index: 5; align-items: center; flex-wrap: wrap; max-width: calc(100% - 20px); }
.map-toolbar .drag-handle { cursor: grab; color: var(--muted); padding: 0 .3rem; font-size: 1rem; line-height: 1.6; user-select: none; touch-action: none; }
.map-toolbar .drag-handle:active { cursor: grabbing; }
.map-toolbar .tool { border: 0; padding: .4rem .6rem; font-size: .85rem; }
.map-toolbar .tool svg { width: 16px; height: 16px; }
.map-toolbar .tool.active { background: var(--primary); color: #fff; }
.map-toolbar .sep { width: 1px; align-self: stretch; background: var(--border); margin: 2px 2px; }
.map-toolbar input { width: 84px; padding: .25rem .4rem; }
.map-hint { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); background: rgba(14, 26, 43, .88); color: #fff; padding: .45rem .8rem; border-radius: 6px; font-size: .85rem; z-index: 5; pointer-events: none; max-width: 90%; text-align: center; }
.map-setup { position: absolute; inset: 0; display: grid; place-items: center; padding: 2rem; background: var(--surface-2); overflow: auto; }
.map-setup .card { max-width: 560px; }
.layer-item, .area-item { display: flex; align-items: center; gap: .5rem; padding: .35rem .4rem; border-radius: 6px; }
.area-item { cursor: pointer; }
.area-item:hover { background: var(--surface-2); }
.area-item.selected { background: var(--primary-soft); }
.area-item .meta { margin-left: auto; font-size: .78rem; color: var(--muted); text-align: right; }
.layer-group + .layer-group { margin-top: .4rem; }
.layer-group-title { display: flex; align-items: center; gap: .4rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: .3rem .4rem; }
.layer-group-title .actions { margin-left: auto; display: flex; gap: 2px; }
.coords-table { font-family: var(--mono); font-size: .8rem; max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; }
.coords-table table { width: 100%; border-collapse: collapse; }
.coords-table td { padding: .2rem .5rem; border-bottom: 1px solid var(--border); }
.vertex-label { position: absolute; transform: translate(-50%, -140%); background: #0e1a2b; color: #fff; font: 600 11px/1 var(--font); padding: 3px 5px; border-radius: 4px; white-space: nowrap; pointer-events: none; }
.drone-marker { position: absolute; transform: translate(-50%, -50%); background: #d6336c; color: #fff; font: 600 11px/1 var(--font); padding: 4px 6px; border-radius: 10px; border: 2px solid #fff; white-space: nowrap; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); }
@media (max-width: 860px) {
  .map-layout { grid-template-columns: 1fr; grid-template-rows: 55vh auto; height: auto; }
  .map-panel { order: 2; border-right: 0; }
  .map-canvas-wrap { order: 1; min-height: 55vh; }
}

/* ---------- Timeline ---------- */
.tl-controls { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-bottom: .8rem; }
.tl { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.tl-scroll { overflow-x: auto; }
.tl-inner { min-width: 900px; }
.tl-header, .tl-row { display: grid; grid-template-columns: 190px 1fr; }
.tl-header { background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; }
.tl-name { padding: .45rem .7rem; border-right: 1px solid var(--border); font-weight: 550; display: flex; flex-direction: column; justify-content: center; background: var(--surface); position: sticky; left: 0; z-index: 1; }
.tl-header .tl-name { background: var(--surface-2); }
.tl-name .roles { font-size: .74rem; color: var(--muted); font-weight: 450; }
.tl-track { position: relative; height: 46px; }
.tl-header .tl-track { height: 38px; }
.tl-row { border-bottom: 1px solid var(--border); }
.tl-row:last-child { border-bottom: 0; }
.tl-day { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border-strong); }
.tl-day-label { position: absolute; top: 3px; left: 4px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.tl-hour { position: absolute; bottom: 2px; font-size: .66rem; color: var(--muted); transform: translateX(-50%); }
.tl-hour-line { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--border); }
.tl-night { position: absolute; top: 0; bottom: 0; background: rgba(20, 35, 60, .07); pointer-events: none; }
@media (prefers-color-scheme: dark) { .tl-night { background: rgba(0, 0, 0, .28); } }
.tl-now { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--danger); z-index: 1; pointer-events: none; }
.tl-bar { position: absolute; border-radius: 4px; font-size: .7rem; overflow: hidden; white-space: nowrap; padding: 0 4px; line-height: 16px; cursor: default; }
.tl-bar.available { top: 5px; height: 16px; background: #cdebd6; color: #1e5a36; border: 1px solid #93cfa6; }
.tl-bar.unavailable { top: 5px; height: 16px; background: repeating-linear-gradient(45deg, #e8eaee, #e8eaee 4px, #d6dae1 4px, #d6dae1 8px); color: #4a5563; border: 1px solid #c3c9d2; }
.tl-bar.assignment { top: 24px; height: 17px; background: #1f5fbf; color: #fff; cursor: pointer; }
.tl-bar.assignment.st-in_durchfuehrung { background: #c77c0e; }
.tl-bar.assignment.st-abgeschlossen { background: #4f8a64; }
.tl-bar.conflict { outline: 2px solid var(--danger); outline-offset: 1px; }
.tl-bar.deletable { cursor: pointer; }
.tl-bar.deletable:hover { filter: brightness(1.15); }
@media (prefers-color-scheme: dark) {
  .tl-bar.available { background: #1d4a31; color: #bfe8cd; border-color: #2d6a47; }
  .tl-bar.unavailable { background: repeating-linear-gradient(45deg, #2a313b, #2a313b 4px, #333c48 4px, #333c48 8px); color: #b7c1cd; border-color: #3c4654; }
}
.tl-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: .6rem; }
.tl-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.tl-legend i { display: inline-block; width: 22px; height: 11px; border-radius: 3px; }

/* ---------- Einsätze ---------- */
.mission-layout { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .mission-layout { grid-template-columns: 1fr; } }
.mission-item { padding: .7rem .9rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.mission-item:hover { background: var(--surface-2); }
.mission-item.selected { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.mission-item .title { font-weight: 600; }
.mission-item .when { font-size: .82rem; color: var(--muted); }
.crew-list { display: flex; flex-direction: column; gap: .35rem; }
.crew-item { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 6px; }
.crew-item .role { font-size: .74rem; color: var(--muted); width: 56px; }
.crew-item .actions { margin-left: auto; }
.suggestion { border: 1px solid var(--border); border-radius: 6px; padding: .55rem .7rem; display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; align-items: center; }
.suggestion + .suggestion { margin-top: .45rem; }
.suggestion.feasible { border-left: 4px solid var(--ok); }
.suggestion.infeasible { border-left: 4px solid var(--danger); opacity: .85; }
.suggestion .when { font-weight: 600; }
.suggestion .details { font-size: .8rem; color: var(--muted); grid-column: 1; }
.score { font-variant-numeric: tabular-nums; font-weight: 650; }
