/* AW Suite – Design-System */
:root {
  color-scheme: light;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 256px;

  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef1f6;
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a;
  --text-2: #475467;
  --muted: #8a94a6;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.16);

  --brand: #1b2340;
  --brand-2: #2a3563;
  --accent: #2a78d6;
  --accent-soft: rgba(42, 120, 214, 0.10);
  --accent-text: #1c5cab;

  --good: #0ca30c;      --good-text: #006300;     --good-soft: rgba(12, 163, 12, 0.10);
  --warning: #fab219;   --warning-text: #8a5a00;  --warning-soft: rgba(250, 178, 25, 0.16);
  --serious: #ec835a;   --serious-text: #a3441d;  --serious-soft: rgba(236, 131, 90, 0.16);
  --critical: #d03b3b;  --critical-text: #b42323; --critical-soft: rgba(208, 59, 59, 0.10);
  --neutral-soft: rgba(100, 116, 139, 0.12);

  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #4a3aa7; --series-8: #e34948;
  --seq-0: #eef4fd; --seq-1: #cde2fb; --seq-2: #9ec5f4; --seq-3: #6da7ec; --seq-4: #3987e5; --seq-5: #256abf; --seq-6: #184f95; --seq-7: #0d366b;
  --div-neg: #d03b3b; --div-mid: #f0efec; --div-pos: #2a78d6;
  --grid: #e7e9ee;
  --axis: #c3c7d0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0f19; --surface: #121826; --surface-2: #161d2d; --surface-3: #1d2638;
    --border: rgba(255, 255, 255, 0.08); --border-strong: rgba(255, 255, 255, 0.16);
    --text: #f1f5f9; --text-2: #c1c9d6; --muted: #8190a5;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25); --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
    --brand: #0e1426; --brand-2: #1a2342; --accent: #3987e5; --accent-soft: rgba(57, 135, 229, 0.16); --accent-text: #86b6ef;
    --good-text: #3fcf3f; --warning-text: #fac74f; --serious-text: #f3a283; --critical-text: #f08080;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
    --seq-0: #141c2e; --seq-1: #102a4f; --seq-2: #184f95; --seq-3: #1c5cab; --seq-4: #2a78d6; --seq-5: #5598e7; --seq-6: #86b6ef; --seq-7: #cde2fb;
    --div-mid: #383835; --grid: #232b3b; --axis: #38414f;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f19; --surface: #121826; --surface-2: #161d2d; --surface-3: #1d2638;
  --border: rgba(255, 255, 255, 0.08); --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f1f5f9; --text-2: #c1c9d6; --muted: #8190a5;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25); --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
  --brand: #0e1426; --brand-2: #1a2342; --accent: #3987e5; --accent-soft: rgba(57, 135, 229, 0.16); --accent-text: #86b6ef;
  --good-text: #3fcf3f; --warning-text: #fac74f; --serious-text: #f3a283; --critical-text: #f08080;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
  --seq-0: #141c2e; --seq-1: #102a4f; --seq-2: #184f95; --seq-3: #1c5cab; --seq-4: #2a78d6; --seq-5: #5598e7; --seq-6: #86b6ef; --seq-7: #cde2fb;
  --div-mid: #383835; --grid: #232b3b; --axis: #38414f;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- Shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 20px 14px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-2) 100%); color: #dfe5f2;
  display: flex; flex-direction: column; gap: 18px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 10px; color: #fff; }
.brand img { height: auto; max-height: 34px; max-width: 180px; filter: brightness(0) invert(1); }
.sidebar { overflow-x: hidden; }
.brand small { display: block; font-size: 11px; color: #9aa7c7; letter-spacing: .08em; text-transform: uppercase; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group h6 { margin: 0 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #7f8bab; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: #cdd5e6; font-weight: 500; }
.nav-link:hover { background: rgba(255, 255, 255, 0.07); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(255, 255, 255, 0.13); color: #fff; box-shadow: inset 3px 0 0 #6da7ec; }
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); font-size: 12px; color: #8e9abb; }
.sidebar-foot .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--good); }
.sidebar-foot .dot.bad { background: var(--critical); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .title { min-width: 0; flex: 1 1 260px; }
.topbar h1 { font-size: 20px; font-weight: 700; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topbar .tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.menu-toggle { display: none; }
.content { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 20px; max-width: 1680px; width: 100%; }
.demo-banner { margin: 0 28px; margin-top: 14px; padding: 9px 14px; border-radius: 10px; background: var(--warning-soft); color: var(--warning-text); font-weight: 500; font-size: 13px; }

/* ---------------------------------------------------------------- Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, .input:focus-visible, .seg button:focus-visible, .nav-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-text); border-color: var(--accent-text); }
.btn-danger { color: var(--critical-text); border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
.btn-danger:hover { background: var(--critical-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-icon { width: 36px; padding: 0; }
.btn svg { width: 16px; height: 16px; }

.input, select.input, textarea.input {
  height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
  min-width: 0; width: 100%;
}
textarea.input { height: auto; padding: 10px 12px; min-height: 90px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }

.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border); }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.range-custom { display: inline-flex; align-items: center; gap: 6px; }
.range-custom input { width: 138px; height: 32px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 12px; font-weight: 600; color: var(--text-2); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent-text); }
.chip .count { font-weight: 500; color: var(--muted); }

.alert { padding: 11px 14px; border-radius: 10px; font-size: 13px; font-weight: 500; }
.alert-ok { background: var(--good-soft); color: var(--good-text); }
.alert-error { background: var(--critical-soft); color: var(--critical-text); }
.alert-warn { background: var(--warning-soft); color: var(--warning-text); }

/* ---------------------------------------------------------------- Cards & Grid */
.grid { display: grid; gap: 20px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; display: flex; flex-direction: column; }
.card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 18px 6px; }
.card-head h2 { font-size: 15px; font-weight: 650; }
.card-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 10px 18px 18px; min-width: 0; }
.card-body.flush { padding: 0; }
.chart { width: 100%; height: 320px; }
.map { width: 100%; height: 460px; border-radius: 10px; overflow: hidden; background: var(--surface-3); z-index: 0; }
.map.tall { height: 560px; }
.map .leaflet-tooltip { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px; box-shadow: var(--shadow); font-size: 12px; }
.map .leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--muted); font-size: 10px; }
.map .leaflet-control-attribution a { color: var(--muted); }
.map .leaflet-bar a { background: var(--surface); color: var(--text); border-color: var(--border); }
.map .map-legend { background: var(--surface); color: var(--text-2); border: 1px solid var(--border); border-radius: 9px; padding: 8px 10px; font-size: 11px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px; }
.map .map-legend b { color: var(--text); font-size: 11px; margin-bottom: 2px; }
.map .map-legend span { display: flex; align-items: center; gap: 6px; }
.map .map-legend i { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.map-stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 10px; }
.map-stats b { color: var(--text); font-size: 14px; margin-right: 4px; }
@media (max-width: 640px) { .map, .map.tall { height: 340px; } }
.chart.tall { height: 420px; }
.chart.short { height: 240px; }
.loading { opacity: .55; transition: opacity .2s; pointer-events: none; }

/* ---------------------------------------------------------------- KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 13px; box-shadow: var(--shadow); min-width: 0; }
.kpi .k-label { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.kpi .k-unit { font-size: 14px; font-weight: 600; color: var(--text-2); margin-left: 3px; }
.kpi .k-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted); min-height: 20px; white-space: nowrap; overflow: hidden; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; font-weight: 650; font-size: 12px; white-space: nowrap; flex: none; }
.delta.good { background: var(--good-soft); color: var(--good-text); }
.delta.bad { background: var(--critical-soft); color: var(--critical-text); }
.delta.neutral { background: var(--neutral-soft); color: var(--text-2); }
.info { display: inline-grid; place-items: center; flex: none; width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--surface); font-size: 10px; font-weight: 700; line-height: 1; color: var(--muted); cursor: help; }
.info:hover, .info:focus-visible { color: var(--accent-text); border-color: var(--accent); outline: none; }
.kpi .k-text { overflow: hidden; text-overflow: ellipsis; }
.tip-pop { position: fixed; z-index: 200; max-width: 280px; padding: 8px 11px; border-radius: 9px; background: var(--text); color: var(--bg); font-size: 12px; line-height: 1.4; box-shadow: var(--shadow-lg); pointer-events: none; }
.tip-pop.wide { max-width: min(460px, calc(100vw - 16px)); }
.combo-list { position: absolute; z-index: 150; top: calc(100% + 4px); left: 0; width: max(100%, 280px); max-width: min(420px, calc(100vw - 32px)); max-height: 320px; overflow-y: auto;
  padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-lg); }
.combo-option { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.combo-option small { color: var(--muted); font-size: 11px; white-space: nowrap; }
.combo-option:hover, .combo-option.active { background: var(--accent-soft); }

/* ---------------------------------------------------------------- Status */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.active { background: var(--good-soft); color: var(--good-text); }
.badge.attention { background: var(--warning-soft); color: var(--warning-text); }
.badge.inactive { background: var(--serious-soft); color: var(--serious-text); }
.badge.critical { background: var(--critical-soft); color: var(--critical-text); }
.badge.new, .badge.suspended, .badge.neutral { background: var(--neutral-soft); color: var(--text-2); }
.badge.completed { background: var(--accent-soft); color: var(--accent-text); }
.badge.done_unclosed { background: var(--accent-soft); color: var(--accent-text); }
.badge.stale { background: var(--neutral-soft); color: var(--text-2); }
.badge.not_student { background: var(--neutral-soft); color: var(--text-2); }
.badge.plain::before { display: none; }
.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 600; }

/* ---------------------------------------------------------------- Tables */
.table-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 0 18px 12px; }
.table-tools .input { max-width: 260px; }
.table-wrap { overflow: auto; max-height: 640px; border-top: 1px solid var(--border); }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-weight: 600; color: var(--text-2); font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; }
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--text); }
.table th .arrow { opacity: .5; margin-left: 4px; font-size: 10px; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- Flugschule */
.students { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.student {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.student:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); text-decoration: none; }
.student .top { display: flex; gap: 12px; align-items: center; }
.avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; font-size: 15px; }
.student .name { font-weight: 650; font-size: 15px; }
.student .meta { font-size: 12px; color: var(--muted); }
.student .status { margin-left: auto; }
.stage-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }
.stage-strip span { height: 8px; border-radius: 3px; background: var(--surface-3); position: relative; overflow: hidden; }
.stage-strip span i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 3px; }
.stage-strip span.done i { background: var(--good); }
.stage-strip span.current { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.stage-strip span.exam i { background: var(--series-7); }
.student .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.student .stats div { background: var(--surface-2); border-radius: 9px; padding: 7px 9px; }
.student .stats b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.student .stats small { font-size: 11px; color: var(--muted); }
.student .foot { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.progress-num { font-weight: 700; font-size: 13px; }
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

/* Fluglehrer-Kacheln mit Schüler-Unterkacheln */
.fi-groups { display: flex; flex-direction: column; gap: 16px; }
.fi-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.fi-group-head { display: grid; grid-template-columns: auto minmax(160px, 1fr) minmax(220px, 340px); gap: 16px; align-items: center; padding: 16px 18px;
  background: linear-gradient(90deg, var(--accent-soft), transparent 70%); border-bottom: 1px solid var(--border); }
.fi-group-head .avatar { width: 48px; height: 48px; border-radius: 14px; font-size: 17px; }
.fi-group-head h3 { font-size: 16px; }
.fi-group-head .meta { font-size: 12px; color: var(--text-2); display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.fi-group.none .fi-group-head { background: var(--surface-2); }
.subtiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; padding: 14px 18px 18px; }
.subtile { display: flex; flex-direction: column; gap: 8px; padding: 11px 12px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); color: inherit; min-width: 0; transition: border-color .15s, transform .15s; }
.subtile:hover { text-decoration: none; border-color: var(--border-strong); transform: translateY(-1px); }
.subtile.attention { border-left: 3px solid var(--warning); }
.subtile.inactive, .student.inactive { border-color: color-mix(in srgb, var(--critical) 55%, transparent); border-left: 3px solid var(--critical); }
.subtile.inactive { background: color-mix(in srgb, var(--critical) 4%, var(--surface-2)); }
.student.inactive { background: color-mix(in srgb, var(--critical) 3%, var(--surface)); }
.subtile.inactive:hover, .student.inactive:hover { border-color: var(--critical); }
.subtile-head { display: flex; gap: 8px; align-items: center; }
.subtile-name { font-weight: 650; font-size: 13px; display: flex; gap: 6px; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.subtile-meta { font-size: 11.5px; color: var(--muted); }
.pill.mini { height: 18px; font-size: 10.5px; padding: 0 6px; }
.fi-progress { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fi-progress-top { display: flex; align-items: center; gap: 10px; }
.fi-progress-top .progress { flex: 1; height: 8px; }
.fi-subbars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; }
.fi-subbars .sub { display: block; height: 7px; border-radius: 3px; background: var(--surface-3); position: relative; overflow: hidden; cursor: pointer; }
.fi-subbars .sub:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.fi-subbars .sub i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--seq-4); }
.fi-subbars .sub.attention i { background: var(--warning); }
.fi-subbars .sub.inactive i { background: var(--critical); }
@media (max-width: 760px) { .fi-group-head { grid-template-columns: auto 1fr; } .fi-group-head .fi-progress { grid-column: 1 / -1; } }

.theory-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px 14px; }
.theory-item { display: grid; grid-template-columns: 18px 1fr 138px; gap: 8px; align-items: center; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.theory-item .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-strong); }
.theory-item.done .dot { background: var(--good); border-color: var(--good); }
.theory-item input { height: 30px; font-size: 12px; padding: 0 6px; }
.habit-row { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.habit-row:last-child { border-bottom: 0; }
.split-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-3); }
.split-bar i { display: block; height: 100%; }
.facts { display: flex; flex-wrap: wrap; gap: 6px; }

.lessons { display: flex; flex-direction: column; }
.stage-block { border-top: 1px solid var(--border); }
.stage-block summary { list-style: none; display: grid; grid-template-columns: 56px 1fr 160px 110px 24px; gap: 12px; align-items: center; padding: 12px 18px; cursor: pointer; }
.stage-block summary::-webkit-details-marker { display: none; }
.stage-block summary:hover { background: var(--surface-2); }
.stage-block .code { font-weight: 700; color: var(--accent-text); }
.stage-block .chev { transition: transform .2s; color: var(--muted); }
.stage-block[open] .chev { transform: rotate(90deg); }
.lesson { display: grid; grid-template-columns: 20px minmax(180px, 1fr) 90px 110px 150px 120px; gap: 12px; padding: 8px 18px 8px 86px; align-items: center; font-size: 13px; border-top: 1px dashed var(--border); }
.lesson .ico { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; color: #fff; }
.lesson .ico.achieved { background: var(--good); } .lesson .ico.partial { background: var(--warning); } .lesson .ico.failed { background: var(--critical); }
.lesson .ico.open { background: transparent; border: 2px solid var(--border-strong); }
.lesson .comment { grid-column: 2 / -1; font-size: 12px; color: var(--text-2); white-space: pre-line; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }

.profile { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 20px; }
.profile .avatar { width: 64px; height: 64px; font-size: 22px; border-radius: 18px; }
.profile h2 { font-size: 22px; }
.ring { --p: 0; width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring > div { width: 74px; height: 74px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 18px; }

.fi-list { display: flex; flex-direction: column; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--border); color: inherit; }
.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }

.empty { display: grid; place-items: center; text-align: center; padding: 40px 20px; color: var(--muted); gap: 6px; }
.empty b { color: var(--text-2); font-size: 14px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at 20% 10%, #33427a 0%, transparent 60%), linear-gradient(160deg, #1b2340 0%, #0e1426 100%); color: #e6ebf5; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero img { height: 46px; filter: brightness(0) invert(1); align-self: flex-start; }
.auth-hero h2 { font-size: 34px; line-height: 1.15; max-width: 460px; font-weight: 700; }
.auth-hero p { color: #aab5d0; max-width: 440px; }
.auth-hero .flightpath { position: absolute; right: -80px; bottom: -40px; width: 520px; opacity: .35; }
.auth-panel { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-size: 24px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .btn { height: 42px; }
.code-input { letter-spacing: .5em; text-align: center; font-size: 22px !important; height: 52px !important; }

.qr svg { display: block; width: 200px; max-width: 100%; height: auto; box-sizing: border-box; border-radius: 12px; background: #fff; padding: 6px; }

/* ---------------------------------------------------------------- Admin */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.perm { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.perm input { margin-top: 3px; }
.perm b { display: block; font-size: 13px; }
.perm small { color: var(--muted); font-size: 12px; }
.page-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.page-tags span { font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
code, .mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; }
.secret { font-size: 20px; padding: 12px 16px; border-radius: 10px; background: var(--surface-3); letter-spacing: .05em; user-select: all; display: inline-block; }

.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; }
.dropdown-menu a, .dropdown-menu button { display: flex; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none; text-align: left; color: var(--text); cursor: pointer; font-size: 13px; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.dropdown-menu .who small { display: block; color: var(--muted); }

.toast { position: fixed; bottom: 20px; right: 20px; z-index: 100; padding: 12px 16px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 500; }

/* ---------------------------------------------------------------- Responsive */
@media (max-width: 1280px) {
  .hide-md { display: none !important; }
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
  .span-3 { grid-column: span 6; }
  .lesson { grid-template-columns: 20px 1fr 90px 110px; padding-left: 40px; }
  .lesson .hide-md { display: none; }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .menu-toggle { display: inline-flex; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}
@media (max-width: 640px) {
  .hide-sm { display: none !important; }
  .topbar p { display: none; }
  .topbar h1 { font-size: 17px; }
  .kpi { padding: 11px 12px; }
  .content { padding: 16px 16px 40px; }
  .topbar { padding: 12px 16px; }
  .demo-banner { margin: 12px 16px 0; }
  .span-3 { grid-column: span 12; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .k-value { font-size: 22px; }
  .stage-block summary { grid-template-columns: 44px 1fr 70px 20px; }
  .stage-block summary .hide-sm { display: none; }
  .lesson { grid-template-columns: 20px 1fr 80px; padding-left: 18px; }
  .lesson .hide-sm { display: none; }
  .profile { grid-template-columns: auto 1fr; }
  .profile .ring { display: none; }
  .range-custom input { width: 120px; }
  .chart { height: 280px; }
}
/* ---------------------------------------------------------------- Technik: Wartung & Techlog */
.maint-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.maint-tile { display: flex; flex-direction: column; gap: 9px; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); border-top: 3px solid var(--good); min-width: 0; }
.maint-tile.attention { border-top-color: var(--warning); }
.maint-tile.inactive { border-top-color: var(--critical); background: color-mix(in srgb, var(--critical) 5%, var(--surface-2)); }
.maint-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.maint-head b { font-size: 16px; letter-spacing: .01em; }
.maint-meta { font-size: 12px; color: var(--muted); }
.maint-item { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px dashed var(--border); cursor: default; }
.maint-item small { color: var(--text-2); font-size: 11.5px; }
.maint-tol { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; background: var(--surface-3); color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.maint-row { display: flex; align-items: center; gap: 7px; min-width: 0; }
.maint-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.dot.attention { background: var(--warning); }
.dot.inactive { background: var(--critical); }
.progress.active > i { background: var(--good); }
.progress.attention > i { background: var(--warning); }
.progress.inactive > i { background: var(--critical); }
.tech-row { display: grid; grid-template-columns: 74px 1fr auto; gap: 12px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--border); color: inherit; }
.tech-row:hover { background: var(--surface-2); text-decoration: none; }
.tech-row small { color: var(--muted); font-size: 12px; }
.tech-counts { display: flex; gap: 6px; }

.runway-legend { display: flex; flex-wrap: wrap; gap: 14px; padding: 4px 0 12px; font-size: 11.5px; color: var(--muted); }
.runway-legend span { display: inline-flex; align-items: center; gap: 6px; }
.runway-legend i { width: 14px; height: 3px; border-radius: 2px; background: var(--good); }
.runway-legend i.warning { background: var(--warning); }
.runway-legend i.critical { background: var(--critical); }
/* Cockpit: Mini-Fluglehrer-Übersicht */
.mini-fi { display: flex; flex-direction: column; }
.mini-fi-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(140px, 1.2fr); gap: 6px 14px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--border); }
.mini-fi-head { display: flex; align-items: center; gap: 9px; color: inherit; min-width: 0; }
.mini-fi-head:hover { text-decoration: none; }
.mini-fi-head b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-fi-head small { display: block; font-size: 11px; color: var(--muted); }
.mini-fi-students { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; }
.mini-fi-students .badge { font-size: 11px; }
/* Ladebalken im Schüler-Toast: gefüllter Anteil = Ausbildungsfortschritt */
.mini-fi-students .badge.progress-fill {
  background-image: linear-gradient(90deg, color-mix(in srgb, currentColor 13%, transparent) var(--p, 0%), transparent var(--p, 0%)); }
.mini-fi-students a.badge:hover { text-decoration: none; filter: brightness(0.96); }
@media (max-width: 640px) { .mini-fi-row { grid-template-columns: 1fr; } }
@media print {
  .sidebar, .topbar .tools, .table-tools { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .card { break-inside: avoid; box-shadow: none; }
}
