/* Wabenkern Demo-Werkstatt – Gestaltung nach dem Design-System „Kontor“.
   Schlichtes, seriöses Erscheinungsbild für Unternehmenswerkzeuge: ruhige Graustufen, ein Petrol-Akzent,
   Linien statt Schatten, dichte Tabellen, 4px-Raster. IBM Plex Sans / Mono, lokal eingebunden (OFL).
   Helles Theme Standard, dunkles über data-theme="dark" oder die Systemeinstellung.
   Eigenes CSS ohne Build-Schritt; die Klassennamen der Templates bleiben, die Optik kommt aus den Tokens. */

@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-display: swap; src: url("fonts/plex-sans-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-display: swap; src: url("fonts/plex-sans-500.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-display: swap; src: url("fonts/plex-sans-600.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("fonts/plex-mono-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("fonts/plex-mono-500.woff2") format("woff2"); }

/* ---------- Tokens (Kontor tokens.json) ---------- */
:root {
  color-scheme: light;
  --surface: #f5f6f8;
  --surface-raised: #ffffff;
  --surface-sunken: #eef0f3;
  --line: #e1e5ea;
  --line-control: #7f8993;
  --ink: #141a1f;
  --ink-muted: #566069;
  --accent: #0d6570;
  --accent-hover: #0a4f58;
  --accent-soft: #e2f0f1;
  --on-accent: #ffffff;
  --success: #1d6f45;
  --success-soft: #e3f3ea;
  --warning: #8a5300;
  --warning-soft: #fbf0dc;
  --danger: #b0222d;
  --danger-soft: #fae6e7;
  --on-danger: #ffffff;
  --overlay: #141a1f66;
  --link: var(--accent);
  --focus: var(--accent);
  --shadow-sm: 0 1px 2px #141a1f0f;
  --shadow-lg: 0 4px 12px #141a1f14, 0 16px 32px -8px #141a1f29;
  --focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #0d6570;

  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px;
  --space-8: 32px; --space-12: 48px;
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 8px; --radius-full: 9999px;
  --control-sm: 28px; --control-md: 34px; --row-height: 40px; --topbar-height: 56px; --sidebar-width: 232px;
  --panel-w: 380px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface: #0e1113; --surface-raised: #161a1d; --surface-sunken: #0a0c0e;
  --line: #262c31; --line-control: #5f6a74; --ink: #e7ebee; --ink-muted: #9aa5ae;
  --accent: #4cb5bf; --accent-hover: #6fcad2; --accent-soft: #0f2a2d; --on-accent: #071416;
  --success: #5cc48c; --success-soft: #11291c; --warning: #e6a64a; --warning-soft: #2d2110;
  --danger: #f07d85; --danger-soft: #33171a; --on-danger: #1a0709; --overlay: #000000a6;
  --shadow-sm: 0 1px 2px #00000066; --shadow-lg: 0 16px 32px -8px #000000cc;
  --focus-ring: 0 0 0 2px #161a1d, 0 0 0 4px #4cb5bf;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface: #0e1113; --surface-raised: #161a1d; --surface-sunken: #0a0c0e;
    --line: #262c31; --line-control: #5f6a74; --ink: #e7ebee; --ink-muted: #9aa5ae;
    --accent: #4cb5bf; --accent-hover: #6fcad2; --accent-soft: #0f2a2d; --on-accent: #071416;
    --success: #5cc48c; --success-soft: #11291c; --warning: #e6a64a; --warning-soft: #2d2110;
    --danger: #f07d85; --danger-soft: #33171a; --on-danger: #1a0709; --overlay: #000000a6;
    --shadow-sm: 0 1px 2px #00000066; --shadow-lg: 0 16px 32px -8px #000000cc;
    --focus-ring: 0 0 0 2px #161a1d, 0 0 0 4px #4cb5bf;
  }
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--surface); color: var(--ink); font: 400 14px/20px var(--font-sans);
  -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0 0 var(--space-2); font-weight: 600; }
h1 { font-size: 28px; line-height: 36px; letter-spacing: -0.01em; }   /* display */
h2 { font-size: 20px; line-height: 28px; }                           /* title */
h3 { font-size: 15px; line-height: 22px; }                           /* heading */
h4 { font-size: 14px; line-height: 20px; }
p { margin: 0 0 var(--space-3); }
a { color: var(--link); text-underline-offset: 3px; }
:focus { outline: none; }
:focus-visible { outline: 2px solid transparent; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
::selection { background: var(--accent-soft); }
.muted { color: var(--ink-muted); }
.small { font-size: 13px; line-height: 18px; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.kicker { display: inline-block; font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-muted); }
.kicker.neutral { color: var(--ink-muted); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-weight: 500; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.kt-icon { flex: none; display: block; }

/* ---------- Panel (Klasse .blueprint aus den Templates) ---------- */
.blueprint { position: relative; background: var(--surface-raised); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: var(--space-4); min-width: 0; }
.blueprint.flush { padding: 0; overflow: hidden; }
.blueprint > .corner { display: none; }
.block-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
  margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) var(--space-4); padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line); }
.block-head h2, .block-head h3 { margin: 0; font-size: 15px; line-height: 22px; }
.blueprint.flush > .block-head { margin: 0; }

/* ---------- App-Shell: Sidebar + Topbar ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface-raised);
  border-right: 1px solid var(--line); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-4); }
.sidebar-brand { display: flex; align-items: flex-start; gap: 10px; padding: var(--space-1) var(--space-2); text-decoration: none; color: var(--ink); }
.sidebar-mark { width: 18px; height: 18px; border-radius: var(--radius-sm); background: var(--accent); flex: none; margin-top: 2px; }
.sidebar-brand b { display: block; font-size: 15px; line-height: 22px; font-weight: 600; }
.sidebar-brand span { display: block; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
.sidebar-section { display: grid; gap: 2px; }
.sidebar-heading { padding: 0 var(--space-2) var(--space-1); font-size: 12px; font-weight: 500; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-muted); }
.nav-item { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 var(--space-2); border-radius: var(--radius-md);
  color: var(--ink-muted); text-decoration: none; font-weight: 500; transition: background-color .12s, color .12s; }
.nav-item:hover { background: var(--surface-sunken); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.nav-item .code { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }
.sidebar-foot { margin-top: auto; display: grid; gap: 2px; padding-top: var(--space-3); border-top: 1px solid var(--line); }
.sidebar-foot form { margin: 0; }
.sidebar-foot .nav-item { width: 100%; background: none; border: 0; font: inherit; font-weight: 500; cursor: pointer; text-align: left; }
.sidebar-foot .nav-item:hover { background: var(--surface-sunken); }
.sidebar-note { padding: var(--space-2); font-size: 12px; line-height: 16px; color: var(--ink-muted); }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.topbar { height: var(--topbar-height); display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-6);
  background: var(--surface-raised); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.crumbs { display: flex; gap: var(--space-2); color: var(--ink-muted); white-space: nowrap; overflow: hidden; min-width: 0; }
.crumbs .is-current { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.crumbs .sep { color: var(--line-control); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.iconbtn { width: var(--control-md); height: var(--control-md); display: grid; place-items: center; border: 0;
  border-radius: var(--radius-md); background: transparent; color: var(--ink-muted); cursor: pointer; }
.iconbtn:hover { background: var(--surface-sunken); color: var(--ink); }
.menu-btn { display: none; }

.shell { display: flex; flex: 1; min-height: 0; }
.main { flex: 1; min-width: 0; padding: var(--space-6); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--space-4); margin-bottom: var(--space-5); flex-wrap: wrap; }
.page-head h1 { margin: 2px 0 0; }
.page-head .actions { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.tiles { gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.grid.split { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
.grid.side { grid-template-columns: minmax(0, 1fr) 340px; }
.stack { display: flex; flex-direction: column; gap: var(--space-5); }
.row { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { height: var(--space-3); }
footer.foot { padding: var(--space-4) var(--space-6) var(--space-8); display: flex; gap: var(--space-4); align-items: center;
  justify-content: space-between; color: var(--ink-muted); font-size: 13px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn { font: inherit; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: var(--control-md); padding: 0 var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--line-control);
  background: var(--surface-raised); color: var(--ink); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color .12s, border-color .12s; }
.btn:hover { background: var(--surface-sunken); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; opacity: .5; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-muted); padding: 0 var(--space-3); }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--ink); }
.btn-danger { color: var(--danger); }
.btn-sm { height: var(--control-sm); padding: 0 var(--space-3); font-size: 13px; }
.btn-lg { height: 48px; padding: 0 var(--space-5); font-size: 16px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--control-md); padding: 0; }

/* ---------- Formulare ---------- */
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .label { font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink); }
.input { width: 100%; height: var(--control-md); padding: 0 var(--space-3); font: inherit; color: var(--ink);
  background: var(--surface-raised); border: 1px solid var(--line-control); border-radius: var(--radius-md);
  transition: border-color .12s, box-shadow .12s; }
.input::placeholder { color: var(--ink-muted); }
.input:focus, .input:focus-visible { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); outline: 0; border-radius: var(--radius-md); }
textarea.input { height: auto; min-height: 90px; padding: var(--space-2) var(--space-3); resize: vertical; line-height: 20px; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23566069' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
select.input option { background: var(--surface-raised); color: var(--ink); }
input.input[type="file"] { padding: 5px var(--space-2); }
.input.sm { height: var(--control-sm); font-size: 13px; padding: 0 var(--space-2); }
select.input.sm { padding-right: 28px; }
.input.right { text-align: right; font-family: var(--font-mono); font-size: 13px; }
.form-grid { display: grid; gap: var(--space-3) var(--space-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .wide { grid-column: 1 / -1; }
.check { display: flex; gap: var(--space-2); align-items: flex-start; cursor: pointer; }
.check input, .m-check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
/* Sicherheit der Erfassung: Rahmen und getönte Fläche, nie Farbe allein (Legende daneben) */
.input.conf-high, .conf-high .input { border-color: var(--success); }
.input.conf-mid, .conf-mid .input { border-color: var(--warning); background: var(--warning-soft); }
.input.conf-low, .conf-low .input { border-color: var(--danger); background: var(--danger-soft); }
tr.conf-mid td { background: var(--warning-soft); }
tr.conf-low td { background: var(--danger-soft); }
.conf-legend { display: flex; gap: var(--space-3); font-size: 12px; color: var(--ink-muted); }
.conf-legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: var(--radius-full); margin-right: 6px; vertical-align: 1px; }
.conf-legend .h::before { background: var(--success); } .conf-legend .m::before { background: var(--warning); } .conf-legend .l::before { background: var(--danger); }

/* ---------- Segment (Tabs-Optik) und Schalter ---------- */
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius-md); background: var(--surface-sunken); flex-wrap: wrap; }
.seg a, .seg button { display: inline-flex; align-items: center; height: 28px; padding: 0 var(--space-3); border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; font-weight: 500; color: var(--ink-muted); text-decoration: none; background: none; border: 0; cursor: pointer; }
.seg a:hover, .seg button:hover { color: var(--ink); }
.seg .on { background: var(--surface-raised); color: var(--ink); box-shadow: var(--shadow-sm); }
.switch { display: inline-flex; gap: var(--space-2); align-items: center; height: var(--control-md); padding: 0 var(--space-3) 0 var(--space-2);
  font: inherit; font-weight: 500; color: var(--ink); background: var(--surface-raised); border: 1px solid var(--line-control);
  border-radius: var(--radius-md); cursor: pointer; }
.switch:hover { background: var(--surface-sunken); }
.switch .knob { width: 28px; height: 16px; border-radius: var(--radius-full); background: var(--line-control); position: relative; flex: none; transition: background-color .12s; }
.switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: var(--radius-full); background: var(--surface-raised); transition: left .12s; }
.switch.on .knob { background: var(--accent); }
.switch.on .knob::after { left: 14px; }

/* ---------- Badges (Klasse .tag) ---------- */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 var(--space-2); border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500; line-height: 16px; white-space: nowrap; background: var(--surface-sunken); color: var(--ink-muted); }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-outline { background: transparent; border: 1px solid var(--line-control); color: var(--ink); }
.tag-overdue { background: var(--danger-soft); color: var(--danger); }
.tag-today { background: var(--warning-soft); color: var(--warning); }
.tag-done { background: var(--success-soft); color: var(--success); }
.badge-ai { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 var(--space-2); border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500; background: var(--surface-sunken); color: var(--ink-muted); white-space: nowrap; }
.badge-ai .dot { width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--ink-muted); }
.badge-ai.live { background: var(--success-soft); color: var(--success); } .badge-ai.live .dot { background: var(--success); }
.badge-ai.demo { background: var(--warning-soft); color: var(--warning); } .badge-ai.demo .dot { background: var(--warning); }
.due { font-size: 13px; font-weight: 500; color: var(--ink-muted); }
.due.overdue { color: var(--danger); } .due.today { color: var(--warning); } .due.done { color: var(--success); }
.dot8 { width: 8px; height: 8px; border-radius: var(--radius-full); display: inline-block; flex: none; background: var(--ink-muted); }
.dot8.ok { background: var(--success); } .dot8.warn { background: var(--warning); } .dot8.bad { background: var(--danger); } .dot8.acc { background: var(--accent); }
.channel { display: inline-flex; align-items: center; justify-content: center; min-width: 72px; height: 22px; padding: 0 var(--space-2);
  border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 12px; font-weight: 500; color: var(--ink-muted); background: var(--surface); }

/* ---------- Kennzahlen (Kontor KpiStat) ---------- */
.tile { display: grid; gap: var(--space-1); text-decoration: none; color: inherit; transition: border-color .12s; }
a.tile:hover { border-color: var(--line-control); }
.tile-value { font-family: var(--font-mono); font-size: 24px; line-height: 32px; font-weight: 500; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile-value.overdue { color: var(--danger); } .tile-value.today { color: var(--warning); }
.tile-sub { font-size: 13px; line-height: 18px; color: var(--ink-muted); }

/* ---------- Tabellen und Listen ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { height: 36px; padding: 0 var(--space-3); text-align: left; font-size: 12px; line-height: 16px; font-weight: 500;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); background: var(--surface-sunken);
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { height: var(--row-height); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface-sunken); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-family: var(--font-mono); font-size: 13px; font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.num { font-family: var(--font-sans); font-size: 12px; }
.table tr.sum td { font-weight: 600; background: var(--surface-sunken); }
.table tr.selected td { background: var(--accent-soft); }
.blueprint:not(.flush) .table th:first-child, .blueprint:not(.flush) .table td:first-child { padding-left: var(--space-2); }
.list-row { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-2); margin: 0 calc(-1 * var(--space-2));
  border-radius: var(--radius-md); color: inherit; text-decoration: none; border-top: 1px solid var(--line); }
.list-row:first-of-type { border-top: 0; }
a.list-row:hover, .list-row:hover { background: var(--surface-sunken); }
.list-row.active { background: var(--accent-soft); border-top-color: transparent; }
.list-row.active + .list-row { border-top-color: transparent; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.empty { padding: var(--space-12) var(--space-4); text-align: center; color: var(--ink-muted); border: 1px dashed var(--line-control);
  border-radius: var(--radius-lg); background: var(--surface-raised); }

/* ---------- Rohtext, Vorschau, Hinweise (Kontor Alert) ---------- */
.raw { white-space: pre-wrap; font: 13px/20px var(--font-mono); background: var(--surface-sunken); padding: var(--space-3);
  border-radius: var(--radius-md); max-height: 520px; overflow: auto; color: var(--ink); }
.preview { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-3); white-space: pre-wrap; }
.preview .meta { font-size: 13px; color: var(--ink-muted); border-bottom: 1px solid var(--line); padding-bottom: var(--space-2); margin-bottom: var(--space-2); white-space: normal; }
.sms { max-width: 320px; background: var(--accent-soft); color: var(--ink); border-radius: var(--radius-lg); padding: var(--space-3); white-space: pre-wrap; }
.notice { display: block; padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); border: 1px solid var(--line);
  background: var(--surface-raised); color: var(--ink); }
.notice b:first-child { font-weight: 600; }
.notice.warn { background: var(--warning-soft); border-color: transparent; }
.notice.bad { background: var(--danger-soft); border-color: transparent; }
.notice.ok { background: var(--success-soft); border-color: transparent; }
.notice.warn::before, .notice.bad::before, .notice.ok::before { font-weight: 600; margin-right: 6px; }
.notice.warn::before { content: "Hinweis:"; color: var(--warning); }
.notice.bad::before { content: "Achtung:"; color: var(--danger); }
.notice.ok::before { content: "Erledigt:"; color: var(--success); }
ul.issues { margin: var(--space-1) 0 0; padding-left: 18px; }
ul.issues li { margin: 2px 0; }

/* ---------- Aktivitätsprotokoll ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 48px 10px 1fr; gap: var(--space-2); padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline .t { color: var(--ink-muted); font-family: var(--font-mono); font-size: 13px; }
.timeline .m { width: 8px; height: 8px; margin-top: 6px; border-radius: var(--radius-full); background: var(--accent); }
.timeline .m.manual { background: var(--line-control); }
.timeline .d { color: var(--ink-muted); font-size: 13px; line-height: 18px; }

/* ---------- Balken ---------- */
.bar { height: 6px; border-radius: var(--radius-full); background: var(--surface-sunken); position: relative; min-width: 60px; overflow: hidden; }
.bar > span { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.bar.over > span { background: var(--danger); }

/* ---------- Plantafel ---------- */
.board { display: grid; min-width: 860px; }
.board > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: var(--space-2); min-height: 76px; }
.board > div:nth-child(-n+6) { border-top: 0; }
.board .hd { min-height: 0; height: 36px; display: flex; align-items: center; padding: 0 var(--space-2); font-size: 12px; font-weight: 500;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); background: var(--surface-sunken); }
.board .hd.today { color: var(--accent); background: var(--accent-soft); }
.board .res { font-weight: 500; }
.board .res small { display: block; font-size: 12px; line-height: 16px; font-weight: 400; color: var(--ink-muted); }
.board .cell { display: flex; flex-direction: column; gap: 6px; }
.board .cell.conflict { background: var(--danger-soft); }
.board .cell.free:hover { background: var(--accent-soft); }
.appt { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-raised); padding: 6px var(--space-2);
  font-size: 13px; line-height: 18px; position: relative; transition: border-color .12s; }
.appt:hover { border-color: var(--line-control); }
.appt.confirmed .ti::after { content: "bestätigt"; margin-left: 6px; font-family: var(--font-sans); font-size: 11px; font-weight: 500; color: var(--success); }
.appt.conflict { border-color: var(--danger); }
.appt.highlight { border-color: var(--accent); background: var(--accent-soft); }
.appt.done { opacity: .6; }
.appt .ti { display: block; font-family: var(--font-mono); font-size: 12px; color: var(--ink-muted); }
.appt .ti b { font-family: var(--font-sans); color: var(--accent); }
.appt .meta { color: var(--ink-muted); font-size: 12px; line-height: 16px; }
.appt .moves { display: none; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.appt:hover .moves, .appt:focus-within .moves, .appt.highlight .moves { display: flex; }
.appt .moves button { height: 24px; min-width: 24px; padding: 0 6px; font: inherit; font-size: 12px; font-weight: 500; border: 1px solid var(--line-control);
  border-radius: var(--radius-sm); background: var(--surface-raised); color: var(--ink); cursor: pointer; }
.appt .moves button:hover { background: var(--surface-sunken); }
.conflict-note { color: var(--danger); font-size: 12px; line-height: 16px; font-weight: 500; }

/* ---------- Dialog ---------- */
.dialog-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: var(--space-4); background: var(--overlay); z-index: 50; }
.dialog { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: var(--space-3);
  padding: var(--space-5); background: var(--surface-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); position: relative; }
.dialog-title { margin: 0; font-size: 20px; line-height: 28px; font-weight: 600; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: var(--space-6); transform: translateX(-50%); background: var(--ink); color: var(--surface-raised);
  padding: var(--space-2) var(--space-4); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 60; display: none; max-width: calc(100vw - 32px); }
#toast.show { display: block; }

/* ---------- HTMX-Ladeanzeige ---------- */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: var(--radius-full); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-line { gap: var(--space-2); align-items: center; font-size: 13px; color: var(--ink-muted); }

/* ---------- Startseite (Branchenwahl) ---------- */
.hero { max-width: 1080px; margin: 0 auto; padding: var(--space-12) var(--space-6) var(--space-6); }
.hero-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; margin-bottom: var(--space-8); }
.hero h1 { max-width: 760px; }
.choice { display: flex; flex-direction: column; gap: var(--space-2); text-decoration: none; color: inherit; min-height: 210px; transition: border-color .12s; }
.choice:hover { border-color: var(--accent); }
.choice h2 { margin: 0; font-size: 20px; line-height: 28px; }
.choice .go { margin-top: auto; align-self: flex-start; }

/* ---------- Interner Modus ---------- */
body.intern { box-shadow: inset 0 0 0 3px var(--warning); }
.intern-flag { display: inline-flex; align-items: center; height: 22px; padding: 0 var(--space-2); border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--warning); background: var(--warning-soft); }
.panel { width: var(--panel-w); flex: none; border-left: 1px solid var(--line); background: var(--surface-raised); position: sticky;
  top: var(--topbar-height); align-self: flex-start; max-height: calc(100vh - var(--topbar-height)); overflow: auto; }
.panel.collapsed { width: 44px; }
.panel.collapsed .panel-body { display: none; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); }
.panel-tabs { display: flex; flex-wrap: wrap; gap: var(--space-3); border-bottom: 1px solid var(--line); margin: var(--space-2) 0; }
.panel-tabs button { font: inherit; font-size: 13px; font-weight: 500; background: none; border: 0; padding: var(--space-2) 0; margin-bottom: -1px;
  border-bottom: 2px solid transparent; color: var(--ink-muted); cursor: pointer; }
.panel-tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.panel-body { padding: var(--space-3) var(--space-4); font-size: 13px; line-height: 18px; }
.panel-body h3 { font-size: 14px; margin-top: var(--space-3); }
.panel-body table { border-collapse: collapse; width: 100%; font-size: 12px; margin: 6px 0; }
.panel-body th, .panel-body td { border-bottom: 1px solid var(--line); padding: 4px; text-align: left; vertical-align: top; }
.panel-body ul, .panel-body ol { padding-left: 18px; }
.q { border-top: 1px solid var(--line); padding: var(--space-2) 0; }
.q textarea { min-height: 44px; margin-top: var(--space-1); font-size: 13px; }
.figures { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin-bottom: var(--space-3); }
.figures div { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 6px var(--space-2); background: var(--surface); }
.figures b { display: block; font-family: var(--font-mono); font-size: 16px; font-weight: 500; }

/* ---------- Diagramme ---------- */
.chart svg { width: 100%; height: auto; display: block; }
.chart text { font-family: var(--font-sans); }

/* ---------- Mobil (Handy im Hochformat) ---------- */
.mobile { max-width: 480px; margin: 0 auto; padding: var(--space-4) var(--space-4) var(--space-12); }
.mobile-head { display: flex; justify-content: space-between; align-items: center; height: var(--topbar-height); padding: 0 var(--space-4);
  background: var(--surface-raised); border-bottom: 1px solid var(--line); }
.mobile-head .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); text-decoration: none; }
.m-card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-3); }
.m-card.active { border-color: var(--accent); }
.m-card h3 { margin: 0; }
.m-time { font-family: var(--font-mono); font-size: 20px; line-height: 28px; font-weight: 500; }
.m-status { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
.m-status .btn { height: 48px; font-size: 15px; padding: 0; }
.m-status .btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.m-check { display: flex; gap: var(--space-3); align-items: center; font-size: 15px; padding: var(--space-3) 0; border-top: 1px solid var(--line); cursor: pointer; }
.m-check input { width: 22px; height: 22px; margin: 0; }
.sig { width: 100%; height: 160px; border: 1px dashed var(--line-control); border-radius: var(--radius-md); background: #ffffff; touch-action: none; display: block; }
.photo-slot { border: 1px dashed var(--line-control); border-radius: var(--radius-md); height: 84px; display: grid; place-items: center; color: var(--ink-muted); font-size: 13px; }
.timer { font-family: var(--font-mono); font-size: 32px; line-height: 40px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* Erfassungs- und Kalkulationstabellen: Bezeichnung bleibt lesbar */
#pos-table td:first-child, #rows td:first-child { min-width: 180px; }

@media (max-width: 1100px) {
  .grid.split, .grid.side, .grid.two { grid-template-columns: minmax(0, 1fr); }
  .panel { position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; max-height: none; box-shadow: var(--shadow-lg); width: min(var(--panel-w), 92vw); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); z-index: 45; transform: translateX(-100%); transition: transform .12s; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--overlay); z-index: 44; }
  .menu-btn { display: grid; }
  .topbar { padding: 0 var(--space-4); }
  .main { padding: var(--space-4); }
}
@media (max-width: 480px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .btn { height: 44px; }
  .input { height: 44px; font-size: 16px; }
  .badge-ai span.label { display: none; }
  h1 { font-size: 24px; line-height: 32px; }
}
