/* Bietwerk – Grundgestaltung und gemeinsame Komponenten.
   Dokumentation: docs/design-system.md, lebende Seite /_design (nicht in prod).
   Module ergänzen eigene Dateien unter public/css/<modul>.css bzw. public/<modul>/ und verwenden diese Tokens. */

/* ---------- Schriften (OFL, lokal) ---------- */
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("/fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: normal; font-weight: 400 900; font-display: swap;
  src: url("/fonts/schibsted-grotesk-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Schibsted Grotesk";
  font-style: italic; font-weight: 400 900; font-display: swap;
  src: url("/fonts/schibsted-grotesk-latin-wght-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/fonts/source-serif-4-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: normal; font-weight: 200 900; font-display: swap;
  src: url("/fonts/source-serif-4-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic; font-weight: 200 900; font-display: swap;
  src: url("/fonts/source-serif-4-latin-wght-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  /* Farben: kühles Konzeptpapier, Tinte, Petrol als Handlungsfarbe.
     Signalfarben tragen Bedeutung: Bernstein = Frist läuft, Rot = Frist verpasst/Fehler, Grün = erledigt/Zuschlag,
     Graphitblau = KI-Randnotiz. Nie zur Dekoration verwenden. */
  --c-papier: #f3f5f3;
  --c-flaeche: #ffffff;
  --c-flaeche-2: #f8f9f8;
  --c-tinte: #16212c;
  --c-tinte-2: #4a5764;
  --c-tinte-3: #6d7984;
  --c-linie: #d9dfdc;
  --c-linie-stark: #b3bcb8;
  --c-petrol: #0e5a57;
  --c-petrol-tief: #093e3c;
  --c-petrol-hell: #e2eeec;
  --c-petrol-text: #0b4c49;
  --c-frist: #8a5300;
  --c-frist-hell: #fbefd8;
  --c-frist-linie: #e4c48c;
  --c-rot: #a3241b;
  --c-rot-hell: #fbe8e5;
  --c-rot-linie: #e6b1aa;
  --c-gruen: #276238;
  --c-gruen-hell: #e3f0e5;
  --c-gruen-linie: #a9cdb1;
  --c-ki: #3a4c96;
  --c-ki-hell: #eef0fa;
  --c-ki-linie: #9ba7d6;
  --c-leiste: #16212c;
  --c-leiste-text: #c7d0d6;
  --c-fokus: #1f7bd1;

  /* Schrift */
  --f-ui: "Schibsted Grotesk", ui-sans-serif, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-dokument: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --f-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  /* Skala 1,2 (kleine Terz) ab 16 px */
  --t-xs: 0.8125rem;   /* 13 */
  --t-s: 0.875rem;     /* 14 */
  --t-m: 1rem;         /* 16 */
  --t-l: 1.2rem;       /* 19,2 */
  --t-xl: 1.44rem;     /* 23 */
  --t-2xl: 1.728rem;   /* 27,6 */
  --t-3xl: 2.0736rem;  /* 33,2 */
  --t-4xl: 2.986rem;   /* 47,8 */
  --lh-text: 1.55;
  --lh-dokument: 1.65;
  --lh-titel: 1.15;

  /* Abstände (4er-Raster) */
  --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem; --s-5: 1.5rem; --s-6: 2rem; --s-7: 3rem; --s-8: 4.5rem;

  /* Form: Bedienelemente knapp gerundet, Flächen etwas mehr; Marken als Etikett, nicht als Pille */
  --r-s: 3px; --r-m: 5px; --r-l: 8px;
  --schatten-1: 0 1px 0 rgba(22, 33, 44, 0.04), 0 1px 2px rgba(22, 33, 44, 0.06);
  --schatten-2: 0 2px 4px rgba(22, 33, 44, 0.06), 0 8px 24px rgba(22, 33, 44, 0.1);
  --schatten-3: 0 12px 40px rgba(22, 33, 44, 0.22);
  --breite-text: 68ch;
  --breite-site: 72rem;
  --leiste-breite: 15.5rem;
  --dauer: 160ms;
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-ui);
  font-size: var(--t-m);
  line-height: var(--lh-text);
  color: var(--c-tinte);
  background: var(--c-papier);
  font-feature-settings: "ss01" 0;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
svg.icon, .icon { display: inline-block; flex: none; width: 1.25em; height: 1.25em; vertical-align: -0.25em; }
a { color: var(--c-petrol-text); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--c-petrol-tief); text-decoration-thickness: 2px; }
h1, h2, h3, h4 { margin: 0 0 var(--s-3); line-height: var(--lh-titel); font-weight: 650; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: var(--t-3xl); letter-spacing: -0.02em; }
h2 { font-size: var(--t-xl); }
h3 { font-size: var(--t-l); }
h4 { font-size: var(--t-m); }
p { margin: 0 0 var(--s-4); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
hr { border: 0; border-top: 1px solid var(--c-linie); margin: var(--s-5) 0; }
small, .klein { font-size: var(--t-s); }
.leise { color: var(--c-tinte-2); }
.tabular { font-variant-numeric: tabular-nums; }
code, kbd { font-family: var(--f-mono); font-size: 0.9em; }
:focus-visible { outline: 2px solid var(--c-fokus); outline-offset: 2px; }
::selection { background: var(--c-petrol-hell); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.sprung { position: absolute; left: var(--s-3); top: -3rem; z-index: 100; background: var(--c-tinte); color: #fff; padding: var(--s-2) var(--s-3); border-radius: var(--r-s); }
.sprung:focus { top: var(--s-3); color: #fff; }

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

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--c-tinte); text-decoration: none; }
.logo:hover { color: var(--c-tinte); }
.logo__zeichen { width: 28px; height: 28px; }
.logo__wort { font-weight: 750; font-size: 1.2rem; letter-spacing: -0.025em; }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 2.5rem; padding: 0.5rem 1rem;
  font: inherit; font-size: var(--t-s); font-weight: 600; line-height: 1.2;
  color: var(--c-tinte); background: var(--c-flaeche);
  border: 1px solid var(--c-linie-stark); border-radius: var(--r-s);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background var(--dauer), border-color var(--dauer), color var(--dauer);
}
.btn:hover { background: var(--c-flaeche-2); border-color: var(--c-tinte-3); color: var(--c-tinte); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn--primaer { color: #fff; background: var(--c-petrol); border-color: var(--c-petrol); }
.btn--primaer:hover { color: #fff; background: var(--c-petrol-tief); border-color: var(--c-petrol-tief); }
.btn--sekundaer { color: var(--c-petrol-text); border-color: var(--c-petrol); }
.btn--sekundaer:hover { color: var(--c-petrol-tief); background: var(--c-petrol-hell); border-color: var(--c-petrol); }
.btn--leise { background: transparent; border-color: transparent; color: var(--c-petrol-text); }
.btn--leise:hover { background: var(--c-petrol-hell); border-color: transparent; }
.btn--gefahr { color: #fff; background: var(--c-rot); border-color: var(--c-rot); }
.btn--gefahr:hover { color: #fff; background: #861c15; border-color: #861c15; }
.btn--klein { min-height: 2rem; padding: 0.3rem 0.65rem; font-size: var(--t-xs); }
.btn--gross { min-height: 3rem; padding: 0.7rem 1.4rem; font-size: var(--t-m); }
.btn--block { display: flex; width: 100%; }
.knopf-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem;
  padding: 0; color: inherit; background: transparent; border: 0; border-radius: var(--r-s); cursor: pointer;
}
.knopf-icon:hover { background: rgba(22, 33, 44, 0.06); }
.knopfreihe { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }

/* ---------- Formulare ---------- */
.formular { display: grid; gap: var(--s-4); }
.formular--zweispaltig { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.feld { display: grid; gap: var(--s-1); min-width: 0; margin: 0; padding: 0; border: 0; }
.feld__label { font-size: var(--t-s); font-weight: 600; color: var(--c-tinte); padding: 0; }
.feld__hilfe { margin: 0; font-size: var(--t-xs); color: var(--c-tinte-2); }
.feld__fehler { margin: 0; font-size: var(--t-xs); font-weight: 600; color: var(--c-rot); }
.feld--gruppe { gap: var(--s-2); }
.eingabe, .auswahl, .textfeld {
  width: 100%; min-height: 2.5rem; padding: 0.45rem 0.7rem;
  font: inherit; font-size: var(--t-m); color: var(--c-tinte);
  background: var(--c-flaeche); border: 1px solid var(--c-linie-stark); border-radius: var(--r-s);
  transition: border-color var(--dauer), box-shadow var(--dauer);
}
.textfeld { min-height: 7rem; resize: vertical; line-height: var(--lh-text); }
.auswahl { appearance: none; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a5764' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.55rem center; background-size: 1rem; }
.eingabe:hover, .auswahl:hover, .textfeld:hover { border-color: var(--c-tinte-3); }
.eingabe:focus, .auswahl:focus, .textfeld:focus { outline: none; border-color: var(--c-petrol); box-shadow: 0 0 0 3px rgba(14, 90, 87, 0.18); }
.feld--fehler .eingabe, .feld--fehler .auswahl, .feld--fehler .textfeld, [aria-invalid="true"] { border-color: var(--c-rot); }
.check { display: flex; gap: var(--s-2); align-items: flex-start; font-size: var(--t-s); line-height: 1.45; cursor: pointer; }
.check input { flex: none; width: 1.05rem; height: 1.05rem; margin: 0.1rem 0 0; accent-color: var(--c-petrol); }
.formular__aktionen { display: flex; gap: var(--s-2); flex-wrap: wrap; padding-top: var(--s-2); }

/* ---------- Tabellen ---------- */
.tabelle-rahmen { overflow-x: auto; background: var(--c-flaeche); border: 1px solid var(--c-linie); border-radius: var(--r-m); }
.tabelle { width: 100%; border-collapse: collapse; font-size: var(--t-s); }
.tabelle th, .tabelle td { padding: 0.7rem 0.9rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--c-linie); }
.tabelle thead th { font-size: var(--t-xs); font-weight: 600; color: var(--c-tinte-2); background: var(--c-flaeche-2); white-space: nowrap; }
.tabelle tbody tr:last-child td { border-bottom: 0; }
.tabelle tbody tr:hover { background: #fafbfa; }
/* Keine Tabellenziffern: in Schibsted Grotesk werden Punkt und Komma dabei so breit wie Ziffern („1 . 490 , 00"). */
.tabelle .zahl, .tabelle th.zahl { text-align: right; white-space: nowrap; }
.tabelle--dicht th, .tabelle--dicht td { padding: 0.45rem 0.7rem; }
.tabelle__titel { font-weight: 600; color: var(--c-tinte); text-decoration: none; }
.tabelle__titel:hover { text-decoration: underline; }
.tabelle__unter { display: block; margin-top: 0.15rem; font-size: var(--t-xs); color: var(--c-tinte-2); }

/* ---------- Karten ---------- */
.karte { background: var(--c-flaeche); border: 1px solid var(--c-linie); border-radius: var(--r-m); }
.karte__kopf { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5) 0; }
.karte__titel { margin: 0; font-size: var(--t-m); font-weight: 650; }
.karte__inhalt { padding: var(--s-4) var(--s-5) var(--s-5); }
.karte__fuss { padding: var(--s-3) var(--s-5); border-top: 1px solid var(--c-linie); background: var(--c-flaeche-2); border-radius: 0 0 var(--r-m) var(--r-m); font-size: var(--t-s); }
.raster { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.spalten { display: grid; gap: var(--s-5); grid-template-columns: minmax(0, 1fr) 20rem; align-items: start; }
@media (max-width: 960px) { .spalten { grid-template-columns: 1fr; } }
.stapel { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); align-content: start; }

/* ---------- Marken (Status-Etiketten) ---------- */
.marke {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.1rem 0.45rem; min-height: 1.4rem;
  font-size: var(--t-xs); font-weight: 600; line-height: 1.3; white-space: nowrap;
  color: var(--c-tinte-2); background: var(--c-flaeche-2);
  border: 1px solid var(--c-linie); border-radius: var(--r-s);
}
.marke--neutral { color: var(--c-tinte-2); }
.marke--info { color: var(--c-petrol-text); background: var(--c-petrol-hell); border-color: #b5d3cf; }
.marke--ok { color: var(--c-gruen); background: var(--c-gruen-hell); border-color: var(--c-gruen-linie); }
.marke--warnung, .marke--frist { color: var(--c-frist); background: var(--c-frist-hell); border-color: var(--c-frist-linie); }
.marke--gefahr { color: var(--c-rot); background: var(--c-rot-hell); border-color: var(--c-rot-linie); }
.marke--ki { color: var(--c-ki); background: var(--c-ki-hell); border-color: var(--c-ki-linie); border-style: dashed; }
.marke__punkt { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; }

/* Frist: Datum + verbleibende Zeit. Kennzeichnung über Klasse, die der Server nach Restzeit setzt. */
.frist { display: inline-flex; align-items: baseline; gap: var(--s-2); }
.frist__datum { font-weight: 600; }
.frist__rest { font-size: var(--t-xs); color: var(--c-tinte-2); }
.frist--knapp .frist__rest { color: var(--c-frist); font-weight: 600; }
.frist--vorbei { color: var(--c-tinte-3); }
.frist--vorbei .frist__datum { text-decoration: line-through; font-weight: 500; }

/* Quellenangabe (Pflicht bei amtlichen Daten) */
.quelle { display: flex; flex-wrap: wrap; gap: 0.2rem var(--s-2); align-items: baseline; font-size: var(--t-xs); color: var(--c-tinte-2); }
.quelle a { color: inherit; }

/* ---------- Reiter ---------- */
.reiter { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--c-linie); margin-bottom: var(--s-5); overflow-x: auto; }
.reiter__link {
  position: relative; padding: 0.6rem 0.85rem; font-size: var(--t-s); font-weight: 600; white-space: nowrap;
  color: var(--c-tinte-2); text-decoration: none; background: none; border: 0; cursor: pointer; font-family: inherit;
}
.reiter__link:hover { color: var(--c-tinte); }
.reiter__link[aria-current="page"], .reiter__link[aria-selected="true"] { color: var(--c-tinte); }
.reiter__link[aria-current="page"]::after, .reiter__link[aria-selected="true"]::after {
  content: ""; position: absolute; left: 0.5rem; right: 0.5rem; bottom: -1px; height: 3px; background: var(--c-petrol); border-radius: 2px 2px 0 0;
}
.reiter__zahl { margin-left: 0.35rem; font-weight: 500; color: var(--c-tinte-3); }
[role="tabpanel"][hidden] { display: none; }

/* ---------- Hinweise ---------- */
.hinweis {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3) var(--s-4); font-size: var(--t-s);
  background: var(--c-petrol-hell); border: 1px solid #b5d3cf; border-left-width: 4px; border-left-color: var(--c-petrol);
  border-radius: var(--r-s);
}
.hinweis > :first-child { flex: 1; }
.hinweis p { margin: 0 0 var(--s-2); }
.hinweis p:last-child { margin: 0; }
.hinweis--warnung { background: var(--c-frist-hell); border-color: var(--c-frist-linie); border-left-color: var(--c-frist); }
.hinweis--fehler { background: var(--c-rot-hell); border-color: var(--c-rot-linie); border-left-color: var(--c-rot); }
.hinweis--ok { background: var(--c-gruen-hell); border-color: var(--c-gruen-linie); border-left-color: var(--c-gruen); }
.hinweis--balken { border-radius: 0; border-width: 0 0 1px; border-left-width: 0; padding: var(--s-2) var(--s-5); align-items: center; flex-wrap: wrap; }

/* KI-Randnotiz: alles, was ein Modell geschrieben hat. Gestrichelte Randlinie wie eine Bleistiftnotiz,
   Kopfzeile nennt Herkunft und Grundlage. Pflicht für jede KI-Ausgabe (Regel 2). */
.ki-notiz {
  position: relative;
  padding: var(--s-4) var(--s-5) var(--s-4) calc(var(--s-5) + 2px);
  background: linear-gradient(var(--c-ki-hell), var(--c-ki-hell)) left / 3px 100% no-repeat, var(--c-flaeche);
  border: 1px dashed var(--c-ki-linie); border-radius: var(--r-m);
}
.ki-notiz__kopf { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; margin-bottom: var(--s-3); font-size: var(--t-xs); color: var(--c-ki); }
.ki-notiz__kopf strong { font-weight: 650; }
.ki-notiz__text { font-family: var(--f-dokument); font-size: 1.03rem; line-height: var(--lh-dokument); }
.ki-notiz__text ul, .ki-notiz__text ol { padding-left: 1.2rem; margin: 0 0 var(--s-3); }
.ki-notiz__grundlage { margin-top: var(--s-3); padding-top: var(--s-2); border-top: 1px dotted var(--c-ki-linie); font-size: var(--t-xs); color: var(--c-tinte-2); }
.ki-notiz--aus { color: var(--c-tinte-2); background: var(--c-flaeche-2); }

/* ---------- Leere Zustände ---------- */
.leer {
  display: grid; justify-items: start; gap: var(--s-3);
  padding: var(--s-6) var(--s-5); max-width: 40rem;
  border: 1px dashed var(--c-linie-stark); border-radius: var(--r-m); background: var(--c-flaeche);
}
.leer__icon { color: var(--c-tinte-3); }
.leer__icon .icon { width: 2rem; height: 2rem; }
.leer__titel { margin: 0; font-size: var(--t-l); }
.leer__text { margin: 0; color: var(--c-tinte-2); max-width: 52ch; }

/* ---------- Seitennummern ---------- */
.seiten { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1); margin-top: var(--s-5); font-size: var(--t-s); }
.seiten__link, .seiten__aktuell, .seiten__luecke {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.25rem; height: 2.25rem; padding: 0 0.6rem;
  border-radius: var(--r-s);
}
.seiten__link { color: var(--c-tinte); text-decoration: none; border: 1px solid var(--c-linie); background: var(--c-flaeche); }
.seiten__link:hover { border-color: var(--c-tinte-3); color: var(--c-tinte); }
.seiten__aktuell { color: #fff; background: var(--c-tinte); font-weight: 650; }
.seiten__luecke { color: var(--c-tinte-3); }
.seiten__info { margin-left: auto; color: var(--c-tinte-2); }

/* ---------- Kanban (Angebots-Pipeline) ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(16rem, 1fr); gap: var(--s-3); overflow-x: auto; padding-bottom: var(--s-3); align-items: start; }
.kanban__spalte { display: grid; gap: var(--s-2); align-content: start; min-height: 12rem; padding: var(--s-3); background: #e9ecea; border-radius: var(--r-m); }
.kanban__kopf { display: flex; justify-content: space-between; align-items: baseline; padding: 0 var(--s-1) var(--s-1); font-size: var(--t-s); font-weight: 650; }
.kanban__zahl { font-weight: 500; color: var(--c-tinte-2); font-variant-numeric: tabular-nums; }
.kanban__karte {
  display: grid; gap: var(--s-2); padding: var(--s-3); font-size: var(--t-s);
  background: var(--c-flaeche); border: 1px solid var(--c-linie); border-radius: var(--r-s); box-shadow: var(--schatten-1);
}
.kanban__karte[draggable="true"] { cursor: grab; }
.kanban__karte.zieht { opacity: 0.5; }
.kanban__spalte.ziel { outline: 2px dashed var(--c-petrol); outline-offset: -4px; }
.kanban__titel { font-weight: 600; color: var(--c-tinte); text-decoration: none; line-height: 1.35; }
.kanban__meta { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; color: var(--c-tinte-2); font-size: var(--t-xs); }

/* ---------- Kennzahlen ---------- */
.kennzahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0; background: var(--c-flaeche); border: 1px solid var(--c-linie); border-radius: var(--r-m); }
.kennzahl { padding: var(--s-4) var(--s-5); border-left: 1px solid var(--c-linie); }
.kennzahl:first-child { border-left: 0; }
.kennzahl__wert { display: block; font-size: var(--t-2xl); font-weight: 650; line-height: 1.1; letter-spacing: -0.02em; }
.kennzahl__label { display: block; margin-top: var(--s-1); font-size: var(--t-s); color: var(--c-tinte-2); }
.kennzahl__zusatz { display: block; margin-top: var(--s-1); font-size: var(--t-xs); color: var(--c-tinte-3); }
@media (max-width: 640px) { .kennzahl { border-left: 0; border-top: 1px solid var(--c-linie); } .kennzahl:first-child { border-top: 0; } }

/* ---------- Seitenkopf ---------- */
.seitenkopf { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-3) var(--s-5); margin-bottom: var(--s-5); }
.seitenkopf__text { min-width: 0; max-width: 52rem; }
.seitenkopf__zurueck { display: inline-block; margin-bottom: var(--s-2); font-size: var(--t-s); }
.seitenkopf__titel { margin: 0; font-size: var(--t-2xl); }
.seitenkopf__unter { margin: var(--s-2) 0 0; color: var(--c-tinte-2); }
.seitenkopf__aktionen { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ---------- Dialog ---------- */
.dialog {
  width: min(32rem, calc(100vw - 2rem)); padding: 0; color: var(--c-tinte);
  border: 1px solid var(--c-linie); border-radius: var(--r-l); box-shadow: var(--schatten-3);
}
.dialog::backdrop { background: rgba(22, 33, 44, 0.45); }
.dialog__kopf { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--c-linie); }
.dialog__titel { margin: 0; font-size: var(--t-l); }
.dialog__inhalt { padding: var(--s-5); }
.dialog__fuss { display: flex; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-5); background: var(--c-flaeche-2); border-top: 1px solid var(--c-linie); }

/* ---------- Toast ---------- */
.toast-bereich { position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 60; display: grid; gap: var(--s-2); max-width: min(26rem, calc(100vw - 2rem)); }
.toast {
  display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-2) var(--s-3) var(--s-4);
  font-size: var(--t-s); color: #fff; background: var(--c-tinte); border-radius: var(--r-m); box-shadow: var(--schatten-2);
  border-left: 4px solid var(--c-petrol-hell);
  animation: toast-ein 220ms ease-out;
}
.toast > span { flex: 1; }
.toast--ok { border-left-color: #7cc08d; }
.toast--warnung { border-left-color: #e8b45c; }
.toast--fehler { border-left-color: #ef8a7f; }
.toast__zu { display: inline-flex; padding: 0.3rem; color: inherit; background: none; border: 0; border-radius: var(--r-s); cursor: pointer; opacity: 0.75; }
.toast__zu:hover { opacity: 1; }
.toast.weg { opacity: 0; transform: translateY(6px); transition: opacity 200ms, transform 200ms; }
@keyframes toast-ein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Score-Ring (0–100) ----------
   <span class="ring" style="--wert: 72">…</span>  – Farbe nach Stufe: ring--hoch (≥70), ring--mittel (40–69), ring--niedrig */
.ring {
  --wert: 0; --farbe: var(--c-tinte-3);
  display: inline-grid; place-items: center; flex: none;
  width: 3rem; height: 3rem; border-radius: 50%;
  background:
    radial-gradient(closest-side, var(--c-flaeche) 76%, transparent 78%),
    conic-gradient(var(--farbe) calc(var(--wert) * 1%), var(--c-linie) 0);
  font-size: var(--t-s); font-weight: 700; color: var(--c-tinte);
}
.ring--hoch { --farbe: var(--c-gruen); }
.ring--mittel { --farbe: #b07a17; }
.ring--niedrig { --farbe: var(--c-rot); }
.ring--gross { width: 4.5rem; height: 4.5rem; font-size: var(--t-l); }
.fortschritt { height: 0.5rem; background: var(--c-linie); border-radius: 999px; overflow: hidden; }
.fortschritt__balken { height: 100%; width: calc(var(--wert, 0) * 1%); background: var(--c-petrol); border-radius: inherit; }
.fortschritt--warnung .fortschritt__balken { background: var(--c-frist); }
.fortschritt--voll .fortschritt__balken { background: var(--c-rot); }

/* ---------- Filterleiste ---------- */
.filterleiste {
  display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end;
  padding: var(--s-3) var(--s-4); margin-bottom: var(--s-4);
  background: var(--c-flaeche); border: 1px solid var(--c-linie); border-radius: var(--r-m);
}
.filterleiste .feld { flex: 1 1 10rem; }
.filterleiste .feld--breit { flex: 3 1 18rem; }
.filterleiste__aktionen { display: flex; gap: var(--s-2); }
.filterleiste__aktiv { display: flex; flex-wrap: wrap; gap: var(--s-2); width: 100%; padding-top: var(--s-2); border-top: 1px solid var(--c-linie); font-size: var(--t-xs); }
.filter-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.15rem 0.3rem 0.15rem 0.55rem; background: var(--c-petrol-hell); color: var(--c-petrol-text); border-radius: var(--r-s); font-weight: 600; text-decoration: none; }
.filter-chip .icon { width: 0.9rem; height: 0.9rem; }

/* ---------- Beschreibungsliste (Eckdaten) ---------- */
.eckdaten { display: grid; grid-template-columns: max-content 1fr; gap: var(--s-2) var(--s-4); margin: 0; font-size: var(--t-s); }
.eckdaten dt { color: var(--c-tinte-2); }
.eckdaten dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------- Dokumenttext (Rechtstexte, Unterlagen, Entwürfe) ---------- */
.dokument { max-width: var(--breite-text); font-family: var(--f-dokument); font-size: 1.0625rem; line-height: var(--lh-dokument); }
.dokument h1, .dokument h2, .dokument h3 { font-family: var(--f-ui); }
.dokument h2 { margin-top: var(--s-6); }
.dokument h3 { margin-top: var(--s-5); }
.dokument ul, .dokument ol { padding-left: 1.4rem; margin: 0 0 var(--s-4); }
.dokument li { margin-bottom: var(--s-1); }
.dokument table { border-collapse: collapse; font-family: var(--f-ui); font-size: var(--t-s); margin: var(--s-4) 0; }
.dokument th, .dokument td { border: 1px solid var(--c-linie); padding: var(--s-2) var(--s-3); text-align: left; vertical-align: top; }

/* ---------- App-Rahmen ---------- */
body.app { background: var(--c-papier); }
.shell { display: grid; grid-template-columns: var(--leiste-breite) minmax(0, 1fr); min-height: 100vh; }
.leiste {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--s-4);
  padding: var(--s-4) var(--s-3); background: var(--c-leiste); color: var(--c-leiste-text);
}
.leiste__kopf { display: flex; justify-content: space-between; align-items: center; padding: var(--s-1) var(--s-2); }
.leiste .logo, .leiste .logo:hover { color: #fff; }
.leiste__zu { display: none; color: var(--c-leiste-text); }
.leiste__nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.leiste__link {
  display: flex; align-items: center; gap: var(--s-3); padding: 0.55rem var(--s-3);
  font-size: var(--t-s); font-weight: 550; color: var(--c-leiste-text); text-decoration: none; border-radius: var(--r-s);
}
.leiste__link:hover { color: #fff; background: rgba(255, 255, 255, 0.06); text-decoration: none; }
.leiste__link[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.09); box-shadow: inset 3px 0 0 #5fb3ab; }
.leiste__link .icon { opacity: 0.85; }
.leiste__fuss { margin-top: auto; padding-top: var(--s-3); border-top: 1px solid rgba(255, 255, 255, 0.1); }
.leiste-hintergrund { display: none; }
.hauptbereich { min-width: 0; display: flex; flex-direction: column; }
.kopf {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--s-3); min-height: 3.5rem; padding: 0 var(--s-5);
  background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--c-linie);
}
.kopf__menue { display: none; }
.kopf__firma { display: flex; align-items: center; gap: var(--s-3); min-width: 0; margin-right: auto; }
.kopf__firmenname { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nutzermenue { position: relative; }
.nutzermenue__knopf { display: flex; align-items: center; gap: var(--s-2); padding: 0.3rem 0.4rem; border-radius: var(--r-s); cursor: pointer; list-style: none; font-size: var(--t-s); }
.nutzermenue__knopf::-webkit-details-marker { display: none; }
.nutzermenue__knopf:hover { background: rgba(22, 33, 44, 0.05); }
.avatar { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--c-petrol-hell); color: var(--c-petrol-text); font-size: var(--t-xs); font-weight: 700; }
.nutzermenue__liste {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 15rem;
  display: grid; padding: var(--s-2); background: var(--c-flaeche); border: 1px solid var(--c-linie); border-radius: var(--r-m); box-shadow: var(--schatten-2);
}
.nutzermenue__wer { display: grid; padding: var(--s-2) var(--s-3) var(--s-3); margin-bottom: var(--s-1); border-bottom: 1px solid var(--c-linie); font-size: var(--t-s); }
.nutzermenue__wer span { color: var(--c-tinte-2); font-size: var(--t-xs); overflow-wrap: anywhere; }
.nutzermenue__liste a, .nutzermenue__liste button {
  display: flex; align-items: center; gap: var(--s-2); width: 100%; padding: 0.5rem var(--s-3);
  font: inherit; font-size: var(--t-s); color: var(--c-tinte); text-align: left; text-decoration: none;
  background: none; border: 0; border-radius: var(--r-s); cursor: pointer;
}
.nutzermenue__liste a:hover, .nutzermenue__liste button:hover { background: var(--c-flaeche-2); }
.inhalt { flex: 1; width: 100%; max-width: 88rem; padding: var(--s-6) var(--s-5) var(--s-8); }

@media (max-width: 900px) {
  /* minmax(0, …): sonst sprengen breite Tabellen/Kanban die Spalte, statt im eigenen Rahmen zu scrollen. */
  .shell { grid-template-columns: minmax(0, 1fr); }
  .leiste {
    position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(18rem, 85vw);
    transform: translateX(-100%); transition: transform 200ms ease-out;
  }
  .leiste.offen { transform: none; box-shadow: var(--schatten-3); }
  .leiste.offen + .leiste-hintergrund { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(22, 33, 44, 0.4); }
  .leiste__zu, .kopf__menue { display: inline-flex; }
  .kopf { padding: 0 var(--s-3); }
  .nutzermenue__name { display: none; }
  .inhalt { padding: var(--s-5) var(--s-4) var(--s-7); }
}
/* Am Handy hat der Firmenname Vorrang vor der Tarifmarke (sonst bleibt nur „Revie…“); „Zahlung offen“ bleibt sichtbar. */
@media (max-width: 480px) {
  .kopf__firma .marke:not(.marke--warnung) { display: none; }
}

/* ---------- Website-Rahmen ---------- */
body.site { background: var(--c-flaeche); display: flex; flex-direction: column; min-height: 100vh; }
.site-kopf { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(6px); border-bottom: 1px solid var(--c-linie); }
.site-kopf__innen { display: flex; align-items: center; gap: var(--s-6); max-width: var(--breite-site); min-height: 4rem; margin: 0 auto; padding: 0 var(--s-5); }
.site-nav { display: flex; gap: var(--s-5); margin-right: auto; font-size: var(--t-s); font-weight: 550; }
.site-nav a, .site-kopf__anmelden { color: var(--c-tinte); text-decoration: none; }
.site-nav a:hover, .site-kopf__anmelden:hover { color: var(--c-petrol-text); text-decoration: underline; }
.site-kopf__aktionen { display: flex; align-items: center; gap: var(--s-4); font-size: var(--t-s); font-weight: 550; }
.site-inhalt { flex: 1; display: flex; flex-direction: column; }
.site-inhalt > * { flex: none; }
.site-inhalt > .auth { flex: 1; }
.site-fuss { background: var(--c-papier); border-top: 1px solid var(--c-linie); font-size: var(--t-s); }
.site-fuss__innen { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-5); max-width: var(--breite-site); margin: 0 auto; padding: var(--s-6) var(--s-5) var(--s-4); }
.site-fuss__marke p { margin-top: var(--s-2); max-width: 30ch; color: var(--c-tinte-2); }
.site-fuss__nav { display: flex; flex-direction: column; gap: var(--s-2); min-width: 9rem; }
.site-fuss__titel { margin: 0 0 var(--s-1); font-size: var(--t-xs); font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--c-tinte-2); }
.site-menue { display: none; position: relative; }
.site-menue > summary { list-style: none; cursor: pointer; }
.site-menue > summary::-webkit-details-marker { display: none; }
.site-menue__liste { position: absolute; right: 0; top: calc(100% + var(--s-2)); display: flex; flex-direction: column; min-width: 13rem; padding: var(--s-2); background: #fff; border: 1px solid var(--c-linie); border-radius: var(--r-m, 8px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); }
.site-menue__liste a { padding: var(--s-2) var(--s-3); color: var(--c-tinte); text-decoration: none; font-weight: 550; }
.site-menue__liste a:hover { background: var(--c-papier); }
.site-fuss__nav a { color: var(--c-tinte); text-decoration: none; }
.site-fuss__nav a:hover { text-decoration: underline; }
.site-fuss__betreiber { max-width: var(--breite-site); margin: 0 auto; padding: var(--s-3) var(--s-5) var(--s-6); color: var(--c-tinte-2); font-size: var(--t-xs); }
.site-abschnitt { max-width: var(--breite-site); margin: 0 auto; padding: var(--s-7) var(--s-5); }
.site-abschnitt--schmal { max-width: calc(var(--breite-text) + 2 * var(--s-5)); }
@media (max-width: 480px) {
  .site-kopf__anmelden { display: none; }
}
@media (max-width: 720px) {
  .site-kopf__innen { gap: var(--s-3); padding: 0 var(--s-4); }
  .site-nav { display: none; }
  .site-menue { display: block; }
  .site-kopf__innen > .logo { flex: none; }
  .site-kopf__aktionen { gap: var(--s-3); margin-left: auto; }
  .site-kopf__aktionen .btn { padding: 0.45rem 0.7rem; }
  .site-abschnitt { padding: var(--s-6) var(--s-4); }
}

/* Anmeldeseiten */
.auth { display: grid; place-items: start center; padding: var(--s-7) var(--s-4); background: var(--c-papier); }
.auth__karte { width: min(28rem, 100%); padding: var(--s-6); background: var(--c-flaeche); border: 1px solid var(--c-linie); border-radius: var(--r-l); box-shadow: var(--schatten-1); display: grid; gap: var(--s-4); }
.auth__titel { margin: 0; font-size: var(--t-2xl); }
.auth__lead { margin: 0; color: var(--c-tinte-2); }
.auth__fuss { margin: 0; font-size: var(--t-s); color: var(--c-tinte-2); }

/* Fehlerseiten und Platzhalter des Fundaments */
.status-seite { max-width: 40rem; margin: 0 auto; padding: var(--s-8) var(--s-5); }
.status-seite__code { font-size: var(--t-4xl); font-weight: 750; letter-spacing: -0.03em; color: var(--c-petrol); margin: 0; font-variant-numeric: tabular-nums; }
.start-platzhalter { max-width: 46rem; margin: 0 auto; padding: var(--s-8) var(--s-5) var(--s-7); }
.start-platzhalter h1 { font-size: var(--t-4xl); letter-spacing: -0.03em; }
.start-platzhalter p { font-size: var(--t-l); color: var(--c-tinte-2); max-width: 40ch; }

/* ---------- Designseite ---------- */
.design-beispiel { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); padding: var(--s-5) 0; border-top: 1px solid var(--c-linie); }
.design-beispiel__vorschau { padding: var(--s-5); background: var(--c-papier); border-radius: var(--r-m); }
.design-beispiel__code { margin: 0; padding: var(--s-3) var(--s-4); overflow-x: auto; font-size: var(--t-xs); background: var(--c-tinte); color: #e3e9ee; border-radius: var(--r-m); }
.farbfelder { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: var(--s-3); }
.farbfeld { border: 1px solid var(--c-linie); border-radius: var(--r-m); overflow: hidden; font-size: var(--t-xs); background: var(--c-flaeche); }
.farbfeld__flaeche { height: 3.5rem; }
.farbfeld__name { padding: var(--s-2); }

/* ---------- Druck ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  body, body.app, body.site { background: #fff; color: #000; font-size: 10.5pt; }
  .leiste, .leiste-hintergrund, .kopf, .site-kopf, .site-fuss, .toast-bereich, .sprung, .seitenkopf__aktionen, .filterleiste,
  .seiten, .btn, .knopf-icon, .hinweis--balken, form button { display: none !important; }
  .shell { display: block; }
  .inhalt { padding: 0; max-width: none; }
  .karte, .tabelle-rahmen, .kennzahlen, .ki-notiz { border-color: #999; box-shadow: none; break-inside: avoid; }
  .tabelle thead { display: table-header-group; }
  .tabelle tr { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
  .dokument a[href^="http"]::after, .quelle a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; overflow-wrap: anywhere; }
  .ki-notiz { background: #fff; }
}
