:root {
  color-scheme: light;
  --seite: #f6f7f9; --flaeche: #ffffff; --text: #191919; --text-2: #666666; --linie: #e3e5e8; --achse: #c2c2c2; --raster: #e7e7e7;
  --akzent: #1b64be; --akzent-hell: #e8f1fc;
  --s1: #257de0; --s2: #f47230;
  --gut: #0aac23; --warn: #fbb315; --ernst: #f18a59; --kritisch: #dc3c3d;
  --q100: #cce3fd; --q200: #9dc8f7; --q300: #6aabf1; --q400: #338ced; --q500: #2370cd; --q600: #1757ac; --q700: #0e3d7e;
  --r: 8px; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { color-scheme: dark; --seite: #0b0b0b; --flaeche: #191919; --text: #efefef; --text-2: #9c9c9c; --linie: #303030; --achse: #474747;
    --raster: #303030; --akzent: #519ced; --akzent-hell: #16263a; --s1: #338ced; --s2: #e76624; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--seite); color: var(--text); }
h1 { font-size: 20px; margin: 0 0 12px; } h2 { font-size: 16px; margin: 0 0 10px; } h3 { font-size: 14px; margin: 0 0 8px; color: var(--text-2); font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 6px; padding: 6px 8px; }
textarea { width: 100%; min-height: 90px; resize: vertical; }
label { display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 12px; }
label > input, label > select, label > textarea { color: var(--text); font-size: 14px; }
label.haken { flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--text); }
button { border: 1px solid var(--linie); background: var(--flaeche); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button:hover { border-color: var(--akzent); }
button.primaer { background: var(--akzent); color: #fff; border-color: var(--akzent); }
button.gefahr { color: var(--kritisch); border-color: var(--kritisch); }
button.klein { padding: 2px 8px; font-size: 12px; }
button:disabled { opacity: .5; cursor: default; }
a { color: var(--akzent); }

.kopf { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; background: var(--flaeche); border-bottom: 1px solid var(--linie); }
.marke { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.marke small { font-weight: 400; color: var(--text-2); }
.logo { background: var(--akzent); color: #fff; border-radius: 6px; padding: 2px 6px; font-size: 13px; }
.benutzer { display: flex; gap: 10px; align-items: center; color: var(--text-2); }
.reiter { display: flex; gap: 2px; padding: 0 20px; background: var(--flaeche); border-bottom: 1px solid var(--linie); overflow-x: auto; }
.reiter button { border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 14px; background: none; white-space: nowrap; color: var(--text-2); }
.reiter button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--akzent); font-weight: 600; }
.inhalt { padding: 20px; max-width: 1500px; margin: 0 auto; }
.anmeldung { display: grid; place-items: center; min-height: 70vh; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r); padding: 16px; }
.schmal { width: 340px; display: flex; flex-direction: column; gap: 12px; }
.meldung { color: var(--kritisch); min-height: 1em; margin: 0; }
.raster { display: grid; gap: 16px; }
.r2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.r3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.zeile { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.zeile.mitte { align-items: center; }
.abstand { margin-top: 16px; }
.rechts { margin-left: auto; }
.leise { color: var(--text-2); font-size: 12px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--r); padding: 12px 14px; }
.kpi .wert { font-size: 26px; font-weight: 600; }
.kpi .titel { color: var(--text-2); font-size: 12px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { color: var(--text-2); font-weight: 600; font-size: 12px; white-space: nowrap; }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
tr.ausgewaehlt { background: var(--akzent-hell); }
.tabelle-rahmen { overflow-x: auto; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--linie); border-radius: 999px; padding: 1px 8px; font-size: 12px; margin: 1px 2px; white-space: nowrap; }
.chip.kat { border-color: var(--akzent); color: var(--akzent); }
.chip.aus { opacity: .5; text-decoration: line-through; }
.status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--text-2); }
.status.aktiv::before, .status.fertig::before { background: var(--gut); }
.status.ocr_ausstehend::before, .status.laeuft::before, .status.in_arbeit::before { background: var(--warn); }
.status.fehler::before { background: var(--kritisch); }
.schalter { position: relative; width: 36px; height: 20px; border-radius: 999px; border: none; background: var(--achse); padding: 0; }
.schalter::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.schalter[aria-checked="true"] { background: var(--gut); }
.schalter[aria-checked="true"]::after { left: 18px; }
.massen { background: var(--akzent-hell); border: 1px solid var(--linie); border-radius: var(--r); padding: 12px; }
.massen select[multiple] { min-width: 260px; min-height: 96px; }
.seiten { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 8px; }

/* Diagramme */
.diagramm { width: 100%; display: block; }
.diagramm text { fill: var(--text-2); font-size: 11px; }
.diagramm .achse { stroke: var(--achse); }
.diagramm .gitter { stroke: var(--raster); }
.balken-h { display: grid; grid-template-columns: minmax(90px, 32%) 1fr auto; gap: 6px 8px; align-items: center; }
.balken-h .bez { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.balken-h .spur { height: 14px; }
.balken-h .bar { height: 14px; background: var(--s1); border-radius: 0 4px 4px 0; min-width: 2px; }
.balken-h .wert { font-variant-numeric: tabular-nums; color: var(--text); font-size: 12px; }
.legende { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.legende span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; background: var(--farbe); }
.heat { border-collapse: separate; border-spacing: 2px; width: auto; }
.heat th { font-size: 11px; font-weight: 500; padding: 2px 4px; border: none; }
.heat th.senk { writing-mode: vertical-rl; transform: rotate(180deg); height: 90px; text-align: left; vertical-align: bottom; }
.heat td { width: 34px; height: 28px; text-align: center; font-size: 11px; border: none; border-radius: 3px; padding: 0; font-variant-numeric: tabular-nums; }
.skala { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-2); margin-top: 6px; }
.skala i { width: 22px; height: 10px; border-radius: 2px; display: inline-block; }
.leer { color: var(--text-2); padding: 20px; text-align: center; }
.tooltip { position: fixed; z-index: 50; background: var(--text); color: var(--flaeche); padding: 6px 9px; border-radius: 6px; font-size: 12px; pointer-events: none; max-width: 320px; white-space: pre-line; }

/* Fragen */
.chat { display: flex; flex-direction: column; gap: 12px; min-height: 320px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.nachricht { max-width: 80%; padding: 10px 12px; border-radius: 10px; white-space: pre-wrap; line-height: 1.45; }
.nachricht.ich { align-self: flex-end; background: var(--akzent); color: #fff; }
.nachricht.ki { align-self: flex-start; background: var(--seite); border: 1px solid var(--linie); }
.nachricht .quellen { margin-top: 8px; font-size: 12px; color: var(--text-2); }

.dialog-hinten { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: grid; place-items: center; z-index: 40; }
.dialog { width: min(820px, 94vw); max-height: 88vh; overflow-y: auto; }
.auszug { background: var(--seite); border-radius: 6px; padding: 8px; font-size: 12px; white-space: pre-wrap; margin: 6px 0; }
.hinweis { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: var(--flaeche); padding: 10px 14px; border-radius: 8px; z-index: 60; max-width: 420px; }
.hinweis.fehler { background: var(--kritisch); color: #fff; }
pre.konf { margin: 0; font-size: 12px; white-space: pre-wrap; }
