/* KI-Zentrale · Prime Solutions Kezic
   Designsprache angelehnt an Produkt-Oberflächen wie Linear: Flächen-Stufen statt Schatten, feine Trennlinien,
   kompakte Typografie, eine Akzentfarbe (Brand-Blau). Systemschrift (keine externen Fonts, DSGVO). */

:root {
  --accent: #0078ad;
  --accent-hover: #00699a;
  --on-accent: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);

  --bg: #f4f5f7;          /* Grundfläche hinter Seitenleiste und Panel */
  --surface: #ffffff;     /* Inhaltsflächen */
  --surface-sunk: #f6f7f8;/* Kopfzeilen, Eingabefelder im Ruhezustand */
  --surface-hover: #f1f2f4;
  --text: #1a1c20;
  --text-muted: #5d636d;
  --text-subtle: #8b909a;
  --border: #e3e5e9;
  --border-strong: #cdd1d7;

  --ok-text: #18794e;  --ok-bg: #e8f5ee;
  --err-text: #c2361f; --err-bg: #fdeeeb;
  --open-text: #9a5b00; --open-bg: #fdf3e1;
  --prio-dringend: #e5484d;
  --prio-hoch: #e8730c;
  --prio-mittel: #c99400;
  --prio-niedrig: #8b909a;

  --focus: #0078ad;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgb(16 24 40 / 0.04);
  --shadow-pop: 0 8px 24px rgb(16 24 40 / 0.12), 0 1px 3px rgb(16 24 40 / 0.08);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #3aa3d9;
    --accent-hover: #63b8e3;
    --on-accent: #04131c;
    --bg: #0e0f11;
    --surface: #16171a;
    --surface-sunk: #1b1c20;
    --surface-hover: #1f2024;
    --text: #eceef1;
    --text-muted: #a0a6b0;
    --text-subtle: #6e737c;
    --border: #26282d;
    --border-strong: #363940;
    --ok-text: #4cc38a;  --ok-bg: #12291e;
    --err-text: #ff7a66; --err-bg: #34160f;
    --open-text: #f0b34a; --open-bg: #302208;
    --prio-niedrig: #6e737c;
    --focus: #3aa3d9;
    --shadow: none;
    --shadow-pop: 0 8px 24px rgb(0 0 0 / 0.5), 0 0 0 1px var(--border-strong);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }
code {
  font: 12.5px/1.4 ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--surface-sunk);
  border: 1px solid var(--border);
  padding: 0 5px;
  border-radius: 4px;
  overflow-wrap: anywhere;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.wrap { overflow-wrap: anywhere; }
.pre { white-space: pre-line; }
.err-text { color: var(--err-text); }

/* ---------- Grundgerüst: Seitenleiste auf der Grundfläche, Inhalt als eingesetztes Panel ---------- */

.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }

.side {
  min-width: 0;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.brand-mark {
  display: inline-grid; place-items: center; flex: none;
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); color: var(--on-accent);
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
}
.brand-mark-lg { width: 40px; height: 40px; border-radius: 10px; font-size: 15px; margin-bottom: 16px; }
.brand-text { display: grid; min-width: 0; line-height: 1.25; }
.brand-name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.brand-sub { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-group { margin: 14px 10px 4px; font-size: 11.5px; font-weight: 500; color: var(--text-subtle); letter-spacing: 0.01em; }
.side nav .nav-group:first-child { margin-top: 0; }
.side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.side nav a {
  display: flex; align-items: center; gap: 9px;
  min-height: 30px; padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px; font-weight: 500;
  text-decoration: none;
  transition: background-color 120ms var(--ease), color 120ms var(--ease);
}
.side nav a span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side nav a:hover { background: var(--surface-hover); color: var(--text); }
.side nav a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border), var(--shadow); }
.side nav a[aria-current="page"] .ico { color: var(--accent); }
.ico { flex: none; color: var(--text-subtle); }
.side nav a:hover .ico { color: var(--text-muted); }

.ich { margin-top: auto; display: grid; gap: 4px; padding-top: 10px; border-top: 1px solid var(--border); }
.ich a { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.ich a:hover, .ich a[aria-current="page"] { background: var(--surface-hover); }
.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 650;
}
.ich-text { display: grid; min-width: 0; line-height: 1.3; }
.ich-text strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ich-text span { font-size: 11.5px; color: var(--text-muted); }
.logout { margin: 0; }
.logout .btn { width: 100%; justify-content: flex-start; color: var(--text-muted); }

.frame {
  min-width: 0;
  margin: 8px 8px 8px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.main { padding: 36px 48px 96px; max-width: 1040px; width: 100%; margin: 0 auto; min-width: 0; }
.main:focus { outline: none; }

/* ---------- Typografie und Kopfbereich ---------- */

.page-head { margin-bottom: 28px; }
.page-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
h1 { font-size: 24px; font-weight: 600; line-height: 1.2; letter-spacing: -0.022em; margin: 0 0 6px; text-wrap: balance; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 12px; text-wrap: balance; }
h3 { font-size: 14px; font-weight: 600; }
.lead { margin: 0; color: var(--text-muted); max-width: 68ch; text-wrap: pretty; }
.crumb { margin: 0 0 6px; font-size: 13px; }
.crumb a { color: var(--text-muted); text-decoration: none; }
.crumb a:hover { color: var(--text); }
.crumb a::after { content: " /"; color: var(--text-subtle); }
.note { font-size: 13px; color: var(--text-muted); max-width: 70ch; margin: 14px 0 0; }
.block { margin-top: 36px; }
.block-first { margin-top: 0; }
.block-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.block-kopf h2 { margin: 0; }
.block-kopf a { font-size: 13px; text-decoration: none; }
.block-kopf a:hover { text-decoration: underline; }
.small-head { font-size: 12.5px; font-weight: 500; color: var(--text-muted); margin: 0 0 8px; }
.vor-liste { margin: 0 0 12px; }

/* ---------- Hinweise und Status ---------- */

.flash, .status {
  display: block; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 20px;
  border: 1px solid transparent; overflow-wrap: anywhere; font-size: 13.5px;
}
.flash-ok, .status-ok { background: var(--ok-bg); color: var(--ok-text); border-color: color-mix(in srgb, var(--ok-text) 18%, transparent); }
.flash-err, .status-err { background: var(--err-bg); color: var(--err-text); border-color: color-mix(in srgb, var(--err-text) 18%, transparent); }
.status-open { background: var(--open-bg); color: var(--open-text); border-color: color-mix(in srgb, var(--open-text) 18%, transparent); }
.status a, .flash a { color: inherit; font-weight: 600; }
.status details { margin-top: 8px; }
.status summary { cursor: pointer; font-weight: 600; }
.status ul { margin: 6px 0 0; padding-left: 20px; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 550; line-height: 18px;
  padding: 0 7px; border-radius: 999px; white-space: nowrap;
  background: var(--surface-sunk); color: var(--text-muted); border: 1px solid var(--border);
}
.badge-ok { background: var(--ok-bg); color: var(--ok-text); border-color: transparent; }
.badge-open { background: var(--open-bg); color: var(--open-text); border-color: transparent; }
.badge-err { background: var(--err-bg); color: var(--err-text); border-color: transparent; }
.badge-info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge-muted { background: var(--surface-sunk); color: var(--text-muted); }

/* ---------- Formulare ---------- */

.settings { display: grid; gap: 20px; }

.group {
  margin: 0;
  padding: 18px 20px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  min-width: 0;
}
/* Legende als Kopfzeile innerhalb des Panels */
.group > legend { float: left; width: 100%; padding: 0; margin: 0 0 14px; font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.group > legend + * { clear: both; }
.group-hint { margin: 0 0 14px; color: var(--text-muted); font-size: 13px; max-width: 70ch; clear: both; }
.group-actions { margin-top: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field-wide { grid-column: 1 / -1; }

label { font-weight: 500; font-size: 13px; }
.req { font-weight: 450; font-size: 11.5px; color: var(--text-subtle); margin-left: 6px; }
.hint { margin: 0; font-size: 12.5px; color: var(--text-muted); text-wrap: pretty; }

input[type="text"], input[type="email"], input[type="url"], input[type="password"],
input[type="number"], input[type="time"], input[type="date"], input[type="file"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 6px 10px;
  min-height: 34px;
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
input[type="file"] { padding: 5px 6px; background: var(--surface-sunk); }
select { background-color: var(--surface); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--text-subtle)); }
textarea { resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent);
}
input[readonly] { background: var(--surface-sunk); color: var(--text-muted); }

.field-toggle { grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; }
.field-toggle .hint { grid-column: 2; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.inline-check { display: flex; gap: 8px; align-items: center; font-weight: 400; font-size: 13px; color: var(--text-muted); }

.savebar {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 12px 0;
  background: linear-gradient(to top, var(--surface) 72%, transparent);
}

/* Wochentage im Berichts-Zeitplan */
.wochentage { border: 0; padding: 0; margin: 0; min-width: 0; }
.wochentage legend { font-weight: 500; font-size: 13px; margin-bottom: 6px; padding: 0; }
.tage { justify-self: start; width: max-content; max-width: 100%; display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.tag { position: relative; }
.tag + .tag { border-left: 1px solid var(--border-strong); }
.tag input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.tag span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 34px; padding: 0 10px;
  background: var(--surface); color: var(--text-muted);
  font-weight: 550; font-size: 13px;
  transition: background-color 120ms var(--ease), color 120ms var(--ease);
}
.tag:hover span { background: var(--surface-hover); color: var(--text); }
.tag input:checked + span { background: var(--accent-soft); color: var(--accent); }
.tag input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: 13.5px; font-weight: 550;
  white-space: nowrap;
  border-radius: var(--radius);
  padding: 6px 13px;
  min-height: 34px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease), transform 80ms var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.12), 0 1px 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow); }
.btn-secondary:hover { background: var(--surface-hover); color: var(--text); }
.btn-quiet { background: transparent; color: var(--text-muted); padding-left: 8px; padding-right: 8px; }
.btn-quiet:hover { color: var(--text); background: var(--surface-hover); }
.btn-danger { background: transparent; color: var(--err-text); border-color: color-mix(in srgb, var(--err-text) 45%, transparent); }
.btn-danger:hover { background: var(--err-bg); }
.btn-sm { min-height: 28px; padding: 3px 10px; font-size: 12.5px; border-radius: var(--radius-sm); }
.btn-icon { min-height: 28px; width: 28px; padding: 0; }
.btn-icon svg { width: 16px; height: 16px; fill: currentColor; }
.danger { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }
.inline-action { margin-top: 8px; }

/* ---------- Panels, Gruppen, Listen ---------- */

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
/* Kein overflow: hidden, damit das Bearbeiten-Menü nicht abgeschnitten wird; Ecken stattdessen an den Rändern runden */
.panel > :first-child, .panel > :first-child > .gruppe-kopf { border-top-left-radius: 11px; border-top-right-radius: 11px; }
.panel .aufgaben > .aufgabe:last-child, .panel > .panel-fuss:last-child { border-bottom-left-radius: 11px; border-bottom-right-radius: 11px; }
details.panel:not([open]) > summary { border-radius: 11px; }
.panel + .panel { margin-top: 14px; }
.gruppe + .gruppe { border-top: 1px solid var(--border); }
.gruppe-kopf {
  display: flex; align-items: center; gap: 8px;
  margin: 0; padding: 7px 16px;
  background: var(--surface-sunk);
  border-bottom: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; color: var(--text);
  letter-spacing: 0;
}
.gruppe-kopf .anzahl { color: var(--text-subtle); font-weight: 500; font-variant-numeric: tabular-nums; }
.gruppe-warn .gruppe-kopf span:first-child { color: var(--err-text); }
details.panel > summary.gruppe-kopf { cursor: pointer; list-style: none; border-bottom: 0; }
details.panel > summary.gruppe-kopf::-webkit-details-marker { display: none; }
details.panel > summary.gruppe-kopf::before { content: ""; width: 0; height: 0; border-left: 4px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent; color: var(--text-subtle); transition: transform 120ms var(--ease); }
details.panel[open] > summary.gruppe-kopf { border-bottom: 1px solid var(--border); }
details.panel[open] > summary.gruppe-kopf::before { transform: rotate(90deg); }
.panel-fuss { display: block; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 13px; text-decoration: none; color: var(--text-muted); }
.panel-fuss:hover { background: var(--surface-hover); color: var(--text); }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.empty { padding: 28px 24px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); text-align: center; }
.empty p { margin: 0 0 4px; }
.empty p:last-child { margin: 0; }

/* ---------- Todo-Zeilen ---------- */

.aufgaben { list-style: none; margin: 0; padding: 0; }
.aufgabe {
  position: relative;
  display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: start; gap: 10px;
  padding: 9px 12px 9px 14px;
  transition: background-color 120ms var(--ease), opacity 200ms var(--ease);
}
.aufgabe + .aufgabe { border-top: 1px solid var(--border); }
.aufgabe:hover { background: var(--surface-hover); }
.aufgabe-haken { margin: 0; }
.haken {
  display: grid; place-items: center;
  width: 18px; height: 18px; margin-top: 1px; padding: 0;
  border: 1.5px solid var(--border-strong); border-radius: 50%;
  background: var(--surface); color: transparent;
  cursor: pointer;
  transition: border-color 120ms var(--ease), background-color 120ms var(--ease), color 120ms var(--ease), transform 80ms var(--ease);
}
/* Größere Trefferfläche ohne größeres Symbol */
.haken { position: relative; }
.haken::after { content: ""; position: absolute; inset: -9px; }
.haken svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.haken:hover { border-color: var(--accent); color: color-mix(in srgb, var(--accent) 55%, transparent); }
.haken:active { transform: scale(0.9); }
.aufgabe-erledigt .haken { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.aufgabe-erledigt { opacity: 0.62; }
.aufgabe-erledigt .aufgabe-titel { text-decoration: line-through; text-decoration-color: var(--text-subtle); }

.prio { display: inline-flex; align-items: center; gap: 4px; min-width: 42px; height: 20px; color: var(--prio-niedrig); }
.prio-ico { width: 14px; height: 14px; flex: none; fill: currentColor; stroke: currentColor; stroke-width: 0; }
.prio-ico .aus { fill: var(--border-strong); }
.prio-ohne .prio-ico { fill: none; stroke-width: 1.5; stroke-linecap: round; color: var(--text-subtle); }
.prio-dringend .prio-flaeche { fill: var(--prio-dringend); }
.prio-dringend .prio-zeichen { stroke: #fff; stroke-width: 1.6; stroke-linecap: round; fill: none; }
.prio-zahl { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.prio-dringend { color: var(--prio-dringend); }
.prio-hoch { color: var(--prio-hoch); }
.prio-mittel { color: var(--prio-mittel); }
.prio-niedrig { color: var(--prio-niedrig); }

.aufgabe-text { display: grid; gap: 1px; min-width: 0; }
.aufgabe-titel { font-weight: 500; font-size: 14px; line-height: 20px; overflow-wrap: anywhere; }
.aufgabe-meta { font-size: 12.5px; color: var(--text-muted); overflow-wrap: anywhere; }
.trenner { margin: 0 6px; color: var(--text-subtle); }
.aufgabe-details {
  font-size: 12.5px; color: var(--text-subtle); white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.aufgabe-rechts { display: flex; align-items: center; gap: 6px; min-height: 20px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-muted);
  font-size: 12px; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chip svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }
.chip-heute { color: var(--open-text); background: var(--open-bg); border-color: transparent; }
.chip-ueberfaellig { color: var(--err-text); background: var(--err-bg); border-color: transparent; }

.aufgabe-edit { position: relative; }
.aufgabe-edit > summary { list-style: none; opacity: 0; transition: opacity 120ms var(--ease); }
.aufgabe-edit > summary::-webkit-details-marker { display: none; }
.aufgabe:hover .aufgabe-edit > summary, .aufgabe-edit > summary:focus-visible, .aufgabe-edit[open] > summary { opacity: 1; }
.aufgabe-edit[open] > summary { background: var(--surface-hover); color: var(--text); }
.aufgabe-datum {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 5;
  display: grid; gap: 6px; width: 230px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
}
.aufgabe-datum label { font-size: 12px; color: var(--text-muted); }
.aufgabe-datum .btn { margin-top: 4px; }

/* Kompakte Kennzahlen-Leiste */
.stats-leiste {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); margin-bottom: 14px; overflow: hidden;
}
.stat { display: grid; gap: 1px; padding: 12px 16px; }
.stat + .stat { border-left: 1px solid var(--border); }
.stat-wert { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-muted); }
.stat-warn .stat-wert { color: var(--err-text); }

/* Eingabezeile für neue Todos */
.composer {
  display: grid; grid-template-columns: auto minmax(0, 1fr) 150px 120px auto; align-items: center; gap: 8px;
  padding: 8px 8px 8px 12px; margin-bottom: 18px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow);
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
}
.composer:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
.composer-plus { width: 16px; height: 16px; fill: none; stroke: var(--text-subtle); stroke-width: 1.6; stroke-linecap: round; }
.composer input[type="text"] { border: 0; box-shadow: none; padding-left: 2px; font-size: 14px; background: transparent; }
.composer input[type="text"]:focus-visible { box-shadow: none; }
.composer input[type="date"], .composer select { min-height: 30px; font-size: 12.5px; background: var(--surface-sunk); border-color: var(--border); }
.composer-details { grid-column: 2 / -1; font-size: 12.5px; color: var(--text-muted); }
.composer-details summary { cursor: pointer; width: max-content; }
.composer-details textarea { margin-top: 6px; }

/* Umschalter Offen / Historie */
.segmente { display: inline-flex; gap: 2px; padding: 2px; margin-bottom: 16px; background: var(--surface-sunk); border: 1px solid var(--border); border-radius: var(--radius); }
.segmente a { padding: 4px 12px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 13px; font-weight: 550; text-decoration: none; }
.segmente a:hover { color: var(--text); }
.segmente a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border), var(--shadow); }

/* Live-Anzeige */
.live {
  display: inline-flex; align-items: center; gap: 7px; margin: 4px 0 0;
  padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 12px; color: var(--text-muted); background: var(--surface);
}
.live-punkt { width: 7px; height: 7px; border-radius: 50%; background: var(--text-subtle); }
.live:has([data-zustand="ok"]) .live-punkt { background: var(--ok-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok-text) 22%, transparent); }
.live:has([data-zustand="err"]) .live-punkt { background: var(--err-text); }

/* Historie */
.historie { list-style: none; margin: 0; padding: 0; }
.historie li { display: grid; grid-template-columns: 3.2em 8.5em minmax(0, 1fr); gap: 10px; align-items: baseline; padding: 8px 16px; }
.historie li + li { border-top: 1px solid var(--border); }
.historie time { font-variant-numeric: tabular-nums; color: var(--text-subtle); font-size: 12.5px; }
.historie .badge { justify-self: start; }
.historie-text { min-width: 0; overflow-wrap: anywhere; }
.historie-text strong { font-weight: 500; }

/* ---------- Übersicht ---------- */

.todo-block .stats-leiste { margin-bottom: 12px; }
.zwei-spalten { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0 28px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0; margin-bottom: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.kpi { display: grid; gap: 2px; padding: 14px 16px; color: var(--text); text-decoration: none; border-left: 1px solid var(--border); margin-left: -1px; }
a.kpi { transition: background-color 120ms var(--ease); }
a.kpi:hover { background: var(--surface-hover); color: var(--text); }
.kpi-wert { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 12px; color: var(--text-muted); }
.kpi-hervor .kpi-wert { color: var(--accent); }
.kpi-warn .kpi-wert { color: var(--err-text); }
.kpis + .kpis { margin-top: 12px; }

.checklist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.check { display: grid; grid-template-columns: 80px auto 1fr; gap: 12px; align-items: center; padding: 10px 16px; }
.check + .check { border-top: 1px solid var(--border); }
.check a { font-weight: 500; text-decoration: none; color: var(--text); }
.check a:hover { color: var(--accent); }
.check .badge { justify-self: start; }

.log { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; font-size: 13px; }
.log li { padding: 8px 16px; }
.log li + li { border-top: 1px solid var(--border); }
.log time { font-variant-numeric: tabular-nums; color: var(--text-subtle); margin-right: 10px; }

details.block > summary { font-weight: 600; cursor: pointer; }
details > summary { cursor: pointer; }
.stats { margin: 0 0 16px; color: var(--text-muted); }
.stats strong { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- Tabellen ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table-wrap > table { border: 0; }
table:not(.table-wrap > table) { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
th, td { text-align: left; padding: 9px 14px; vertical-align: top; }
thead th { background: var(--surface-sunk); font-weight: 500; font-size: 12px; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr + tr td { border-top: 1px solid var(--border); }
tbody tr { transition: background-color 120ms var(--ease); }
table.list tbody tr:hover { background: var(--surface-hover); }
td.right, th.right { text-align: right; }
td.num, td code { font-variant-numeric: tabular-nums; }
tr.inaktiv td { opacity: 0.55; }

/* ---------- Login ---------- */

.login-body { display: grid; place-items: center; min-height: 100dvh; padding: 16px; }
.login { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px 28px 28px; box-shadow: var(--shadow-pop); }
.login h1 { font-size: 20px; margin-bottom: 4px; }
.login > .muted { margin: 0 0 22px; font-size: 13px; }
.login .btn { width: 100%; }
.login-breit { max-width: 460px; }
.login .flash { margin: 0 0 16px; }
.schritt { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--accent); letter-spacing: 0.01em; }
.stack { display: grid; gap: 14px; }

/* ---------- KI-Verbindungen ---------- */

.models { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; max-height: 240px; overflow-y: auto; }
optgroup { font-weight: 600; }
.abo-aktionen { display: flex; gap: 8px; flex-wrap: wrap; }
.anleitung { margin: 0 0 16px; font-size: 13px; }
.anleitung ol, .anleitung-liste { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 4px; }

/* ---------- Postfach ---------- */

.verlauf td { vertical-align: top; }
.verlauf p { margin: 4px 0 0; }
.row-dringend td:first-child { box-shadow: inset 2px 0 0 var(--err-text); }
.mails { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.mail { padding: 12px 16px; transition: background-color 120ms var(--ease); }
.mail + .mail { border-top: 1px solid var(--border); }
.mail:hover { background: var(--surface-hover); }
.mail-dringend { box-shadow: inset 2px 0 0 var(--err-text); }
.mail-kopf { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.mail-titel { display: grid; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
.mail-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.mail p { margin: 6px 0 0; color: var(--text-muted); font-size: 13px; }
.mail-korrektur { margin-top: 8px; }
.korrektur { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 8px; }
.korrektur label { display: grid; gap: 4px; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.korrektur select { width: auto; min-height: 28px; padding: 2px 8px; font-size: 12.5px; }

/* ---------- Ausschreibungen ---------- */

.tabs { display: inline-flex; gap: 2px; padding: 2px; flex-wrap: wrap; margin-bottom: 16px; background: var(--surface-sunk); border: 1px solid var(--border); border-radius: var(--radius); }
.tabs a { padding: 4px 12px; border-radius: var(--radius-sm); color: var(--text-muted); font-size: 13px; font-weight: 550; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border), var(--shadow); }
.tenders { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.tender { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 16px; }
.tender + .tender { border-top: 1px solid var(--border); }
.tender:hover { background: var(--surface-hover); }
.tender h3 { margin: 0 0 4px; font-size: 14px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.tender p { margin: 2px 0; }
.tender-score .score { display: inline-block; min-width: 44px; font-size: 15px; padding: 5px 4px; font-variant-numeric: tabular-nums; }
.tender-status { display: flex; gap: 6px; align-items: center; }
.tender-status select { width: auto; min-height: 28px; padding: 2px 8px; font-size: 12.5px; }

/* ---------- Angebote ---------- */

.offer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; margin-bottom: 16px; }
.offer-head { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; font-size: 13.5px; margin-bottom: 20px; }
.offer-meta { text-align: right; }
.offer h2 { font-size: 17px; }
.offer-text { border: 1px dashed var(--border-strong); margin-bottom: 16px; }
.offer-table tfoot td { border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.offer-table .total td { font-weight: 700; }
.offer-terms { margin-top: 16px; color: var(--text-muted); }
.offer-terms p { margin: 2px 0; }

/* ---------- Kosten ---------- */

.budget { height: 8px; background: var(--surface-sunk); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 16px 0 6px; }
.budget-bar { height: 100%; background: var(--accent); border-radius: 999px; }
.budget-voll { background: var(--err-text); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 96px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.spark-bar { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-width: 3px; opacity: 0.85; }
.spark-bar:hover { opacity: 1; }
.spark-leer { background: var(--border); }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }

/* ---------- Module, Wissen, Schreiben ---------- */

.branchen { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.branche { display: flex; flex-direction: column; gap: 6px; padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); transition: border-color 120ms var(--ease); }
.branche:hover { border-color: var(--border-strong); }
.branche-aktiv { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.branche h3 { margin: 0; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.branche p { margin: 0; }
.branche-form { display: grid; gap: 8px; margin-top: auto; padding-top: 6px; }
.module { display: grid; gap: 14px; }
.antwort { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; }
.antwort h2 { margin-top: 0; }
.antwort-kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.antwort-kopf h2 { margin: 0; }
.antwort-text { line-height: 1.65; max-width: 72ch; }
.quellen { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 8px; font-size: 13px; }
.ergebnis { font-family: inherit; }
.texte { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }

/* ---------- Schmal ---------- */

@media (max-width: 899px) {
  .main { padding: 28px 24px 96px; }
  .composer { grid-template-columns: auto minmax(0, 1fr) auto; }
  .composer input[type="date"], .composer select { grid-row: 2; }
  .composer input[type="date"] { grid-column: 2; }
  .composer select { grid-column: 3; }
  .composer .btn { grid-row: 1; grid-column: 3; }
}

@media (max-width: 767px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; padding: 12px 12px 8px; gap: 8px; border-bottom: 1px solid var(--border); }
  .side nav { display: grid; gap: 4px; }
  .nav-group { display: none; }
  .side ul { display: flex; overflow-x: auto; gap: 2px; padding-bottom: 4px; scrollbar-width: none; }
  .side nav a { white-space: nowrap; }
  .ich { flex-direction: row; display: flex; align-items: center; justify-content: space-between; border-top: 0; padding-top: 0; margin-top: 0; }
  .logout .btn { width: auto; }
  .frame { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .main { padding: 20px 16px 96px; }
  h1 { font-size: 21px; }
  .grid { grid-template-columns: 1fr; }
  .check { grid-template-columns: 76px 1fr; }
  .check .muted { grid-column: 2; }
  .stats-leiste { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aufgabe { grid-template-columns: auto auto minmax(0, 1fr); }
  .aufgabe-rechts { grid-column: 3; }
  .aufgabe-edit > summary { opacity: 1; }
  .btn-icon { min-height: 36px; width: 36px; }
  .aufgabe-datum input { min-height: 40px; }
  .aufgabe-datum { left: -4px; right: auto; }
  .historie li { grid-template-columns: 3.2em minmax(0, 1fr); }
  .historie-text { grid-column: 1 / -1; }
  table.list thead { display: none; }
  table.list tr { display: grid; padding: 8px 0; }
  table.list td { padding: 3px 14px; border: 0 !important; }
  table.list td[data-label] { text-align: left; }
  table.list td[data-label]::before { content: attr(data-label) ": "; color: var(--text-muted); font-size: 12.5px; }
  td.right { text-align: left; }
  .tender { grid-template-columns: 48px minmax(0, 1fr); }
  .tender-status { grid-column: 1 / -1; }
  .offer { padding: 16px; }
  .offer-head { grid-template-columns: 1fr; }
  .offer-meta { text-align: left; }
  .two-col { grid-template-columns: 1fr; }
  .mail-kopf { flex-direction: column; }
  .mail-badges { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}

/* ---------- Druck (Angebot als PDF) ---------- */

@media print {
  :root { --bg: #fff; --surface: #fff; --text: #111; --text-muted: #444; --border: #bbb; color-scheme: light; }
  .side, .no-print, .flash, .skip, .savebar { display: none !important; }
  .shell { display: block; }
  .frame { margin: 0; border: 0; box-shadow: none; }
  .main { padding: 0; max-width: none; }
  .offer { border: 0; padding: 0; }
  .offer-text { border: 0; resize: none; overflow: visible; height: auto; }
}

/* Lizenz (Einrichtung und Module) */
.lizenz-kopf { margin: 0 0 10px; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; display: flex; gap: 8px; align-items: center; }
.lizenz-daten { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 20px; margin: 0; }
.lizenz-daten div { display: grid; gap: 1px; min-width: 0; }
.lizenz-daten dt { font-size: 12px; color: var(--text-muted); }
.lizenz-daten dd { margin: 0; font-weight: 550; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lizenz-fehler { margin-top: 10px; color: var(--err-text); }
.lizenz-manuell { margin-top: 14px; }
.lizenz-manuell summary { cursor: pointer; font-size: 13px; font-weight: 550; color: var(--accent); width: fit-content; }
.lizenz-manuell summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.lizenz-form { display: grid; gap: 8px; margin-top: 10px; max-width: 70ch; }
.lizenz-form label { font-size: 13px; font-weight: 550; }
.lizenz-form textarea { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; word-break: break-all; }
.modul-gesperrt label { color: var(--text-muted); }
.modul-gesperrt input { cursor: not-allowed; }
