/* LI-Dashboard: gemeinsame Gestaltung
 *
 * Hier stehen alle Farben, Maße und Grundbausteine. Die Seitenmodule unter
 * seiten/ nutzen dieselben Variablen und Bausteine und bringen nur mit, was
 * es allein bei ihnen gibt. Kriterien: CLAUDE.md, Abschnitt "Gestaltung".
 *
 * Aufbau: Kopfleiste in Navy mit den Hauptbereichen, darunter ein weißes
 * Blatt: links die Seitenleiste mit den Unterseiten des Bereichs, rechts der
 * Inhalt. Jeder Bereich hat eine eigene Farbe (--bereich), die in Kopfleiste,
 * Seitenleiste und auf der Startseite wiederkehrt.
 * Bausteine: Kennzahlenstreifen (.kacheln) mit Pille (.aussage), Block je
 * Bereich (.bereichsblock), Tabelle (.tabelle), Auswahl (.wahl), Unterreiter
 * innerhalb einer Seite (.unterreiter), Ampel als Punkt mit Wort (.ampel).
 * Linien von 1 px statt Schatten. Am Desktop passt jede Seite auf einen
 * Bildschirm: Die Tabelle scrollt in sich, nie die ganze Seite.
 */
:root {
  color-scheme: light;

  /* Hausfarben. Gelb nur als sparsamer Akzent. */
  --navy: #001d3d;
  --navy-hell: #0b2d54;
  --gelb: #fdc500;
  --blau: #2761be;

  /* Flächen */
  --grund: #eef2f7;
  --flaeche: #ffffff;
  --kopf: #dce5ef;        /* Tabellenkopf und Summenzeile */
  --zebra: #fafbfd;
  --gruppe: #f1f5fa;      /* Gruppenzeile in Tabellen */
  --maus: #edf2f9;        /* Zeile oder Knopf unter der Maus */
  --markiert: #fff6d6;    /* gewählte Zeile: warm, nie Ton in Ton mit dem Kopf */

  /* Schrift */
  --text: #26303c;
  --gedaempft: #5f6b7a;
  --leise: #8e99a7;
  --auf-navy: #b9c5d4;

  /* Linien */
  --linie: rgba(0, 29, 61, .16);
  --linie-hell: rgba(0, 29, 61, .08);

  /* Ampel: kleiner Punkt, das Wort in gedecktem Ton. Die Pille trägt denselben
     Ton auf einem klaren hellen Grund. */
  --rot: #a71f1f;     --rot-punkt: #cb3a32;   --rot-grund: #fbf1f1;   --rot-pille: #fbe0dd;
  --amber: #7a5200;   --amber-punkt: #e0a800; --amber-grund: #fffaea; --amber-pille: #fdefc0;
  --gruen: #1e6d36;   --gruen-punkt: #258542; --gruen-grund: #f1f8f3; --gruen-pille: #d9f1e0;
  --grau-punkt: #b6c0cc;                                              --grau-pille: #e8edf3;

  /* Bereichsfarben: nie Rot, Gelb oder Grün, damit sie keiner mit der Ampel
     verwechselt. --bereich trägt Linie, Punkt und Namen, --bereich-hell den
     Grund (aktive Zeile, Kopf des Blocks), --bereich-licht den Punkt auf Navy.
     Ohne Angabe gilt Schiefer. */
  --bereich: #465468;
  --bereich-hell: #f1f3f6;
  --bereich-licht: #a3afbf;

  /* Maße: Raster 4 px, zwei Radien */
  --a1: 4px;  --a2: 8px;  --a3: 12px;  --a4: 16px;  --a5: 20px;  --a6: 24px;  --a7: 32px;
  --radius: 10px;
  --radius-klein: 7px;
  --leiste: 248px;        /* Breite der Seitenleiste */

  /* Eine Schrift: die des Systems. Ziffern überall gleich breit. */
  --schrift: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --festbreit: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body {
  background: var(--grund);
  color: var(--text);
  font: 14px/1.5 var(--schrift);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--blau); }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.laedt { margin: 0; padding: var(--a7); color: var(--gedaempft); }

/* ---------- Knöpfe und Felder ---------- */

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 var(--a4);
  border: 1px solid var(--navy); border-radius: var(--radius-klein);
  background: var(--navy); color: #fff;
  font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.knopf:hover { background: var(--navy-hell); border-color: var(--navy-hell); }
.knopf:disabled { opacity: .4; cursor: default; }
.knopf.leise, .knopf.warnung { background: var(--flaeche); border-color: var(--linie); color: var(--navy); font-weight: 400; }
.knopf.leise:hover, .knopf.warnung:hover { background: var(--maus); border-color: var(--linie); }
.knopf.warnung { color: var(--rot); }
.knopf.warnung:hover { background: var(--rot-grund); }
.knopf.leise:disabled:hover, .knopf.warnung:disabled:hover, .knopf:disabled:hover { background: var(--flaeche); }
.knopf:disabled:not(.leise):not(.warnung):hover { background: var(--navy); }
.knopf.klein { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.knopf.leise.stark { font-weight: 600; }
.verweis { background: none; border: 0; padding: 0; color: var(--blau); cursor: pointer; text-decoration: none; }
.verweis:hover { text-decoration: underline; }

label.feld { display: block; margin: 0 0 var(--a4); }
label.feld span { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 600; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=date], select {
  width: 100%; height: 40px; padding: 0 var(--a3);
  border: 1px solid var(--linie); border-radius: var(--radius-klein); background: var(--flaeche);
}
input:focus, select:focus, button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid rgba(39, 97, 190, .45); outline-offset: 1px;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus, input[type=date]:focus, select:focus { border-color: var(--blau); }
input[type=checkbox] { width: 15px; height: 15px; margin: 0; accent-color: var(--navy); flex: none; }
label.haken { display: flex; gap: var(--a2); align-items: center; margin: 0 0 var(--a4); font-size: 13.5px; }

/* Meldungen: schmale Linie links in der Farbe, sehr heller Grund */
.meldung {
  margin: 0 0 var(--a4); padding: 10px 14px;
  border: 1px solid var(--linie); border-left: 3px solid var(--grau-punkt); border-radius: var(--radius-klein);
  font-size: 13.5px; color: var(--text);
}
.meldung.fehler { border-left-color: var(--rot-punkt); background: var(--rot-grund); }
.meldung.ok { border-left-color: var(--gruen-punkt); background: var(--gruen-grund); }
.meldung.hinweis { border-left-color: var(--amber-punkt); background: var(--amber-grund); }
.klein-grau { font-size: 12.5px; color: var(--gedaempft); font-weight: 400; }

/* ---------- Ampel: Punkt mit Wort ---------- */

.ampel { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; color: var(--gedaempft); }
.ampel::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--grau-punkt); }
.ampel.rot { color: var(--rot); }
.ampel.rot::before { background: var(--rot-punkt); }
.ampel.gelb { color: var(--amber); }
.ampel.gelb::before { background: var(--amber-punkt); }
.ampel.gruen { color: var(--gruen); }
.ampel.gruen::before { background: var(--gruen-punkt); }
.ampel.grau { color: var(--leise); font-weight: 400; }
.ampel.ruhig { color: var(--gedaempft); font-weight: 400; }   /* Wort bleibt grau, nur der Punkt trägt die Farbe */

/* ---------- Pille: die eine Aussage unter einer Kennzahl ----------
   Farbe und Dreieck sagen dasselbe: Grün mit Dreieck nach oben steht gut, Gelb
   mit Dreieck zur Seite braucht einen Blick, Rot mit Dreieck nach unten steht
   schlecht. Grau ohne Dreieck ist eine Angabe ohne Urteil. */

.aussage {
  display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%;
  padding: 3px 10px; border-radius: 12px; background: var(--grau-pille);
  font-size: 12px; font-weight: 600; line-height: 1.4; color: var(--gedaempft); text-align: left;
}
.aussage::before { flex: none; width: 8px; height: 7px; background: currentColor; }
.aussage.gruen { background: var(--gruen-pille); color: var(--gruen); }
.aussage.gruen::before { content: ""; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.aussage.gelb { background: var(--amber-pille); color: var(--amber); }
.aussage.gelb::before { content: ""; width: 7px; height: 8px; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.aussage.rot { background: var(--rot-pille); color: var(--rot); }
.aussage.rot::before { content: ""; clip-path: polygon(0 0, 100% 0, 50% 100%); }

/* ---------- Bereichsfarben ----------
   Wer data-bereich trägt, gibt die Farbe an alles darin weiter. Der Bereich
   zeigt sich als kleines Quadrat mit Namen, die Ampel als runder Punkt oder
   Pille: zwei Formen, damit sie niemand verwechselt. */

[data-bereich="start"]       { --bereich: #001d3d; --bereich-hell: #eef1f5; --bereich-licht: #c3cedb; }
[data-bereich="marketing"]   { --bereich: #2b6fd4; --bereich-hell: #ecf2fb; --bereich-licht: #8ab0e7; }
[data-bereich="sales"]       { --bereich: #5b3aa6; --bereich-hell: #f0edf7; --bereich-licht: #a593ce; }
[data-bereich="finanzen"]    { --bereich: #0b7f8f; --bereich-hell: #e9f3f5; --bereich-licht: #79b9c1; }
[data-bereich="fulfillment"] { --bereich: #7d4a2a; --bereich-hell: #f3efec; --bereich-licht: #b89b8a; }
[data-bereich="social"]      { --bereich: #bd3c8a; --bereich-hell: #f9edf4; --bereich-licht: #db94bf; }
[data-bereich="steuerung"]   { --bereich: #465468; --bereich-hell: #f1f3f6; --bereich-licht: #a3afbf; }
.bereichspunkt { display: inline-block; flex: none; width: 8px; height: 8px; margin-right: var(--a2); border-radius: 2px; background: var(--bereich); }

/* Linien-Symbole: ein Stil, 18 px, Strich 1,5 px, Farbe der Schrift */
.symbol { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Anmeldung ---------- */

.anmeldung { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--a7) var(--a4); }
.anmeldung .marke { display: flex; align-items: center; gap: 10px; margin-bottom: var(--a6); color: var(--navy); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.zeichen {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--navy); color: var(--gelb); font-size: 11px; font-weight: 700; letter-spacing: .03em;
}
.karte { width: 100%; max-width: 400px; padding: var(--a7); background: var(--flaeche); border: 1px solid var(--linie); border-radius: 14px; }
.karte.breit { max-width: 520px; }
.karte h1 { margin: 0 0 6px; font-size: 20px; font-weight: 600; letter-spacing: -.015em; line-height: 1.3; color: var(--navy); }
.karte p.unter { margin: 0 0 var(--a6); color: var(--gedaempft); }
.karte .knopf.voll { width: 100%; height: 42px; font-size: 14px; margin-top: var(--a1); }
.karte .fuss { margin: var(--a4) 0 0; font-size: 12.5px; color: var(--gedaempft); text-align: center; }
.karte .fuss + .fuss { margin-top: var(--a2); }
.schritte { margin: 0 0 var(--a5); padding-left: 20px; }
.schritte li { margin-bottom: 6px; padding-left: 2px; }
.schritte li::marker { color: var(--gedaempft); }
.qr { display: flex; gap: var(--a5); align-items: center; flex-wrap: wrap; margin: 0 0 var(--a5); }
.qr svg { width: 168px; height: 168px; padding: 6px; border: 1px solid var(--linie); border-radius: var(--radius); }
.qr > div { flex: 1 1 200px; min-width: 0; }
.qr p { margin: var(--a3) 0 0; font-size: 13px; }
.schluessel {
  margin-top: 6px; padding: 8px 12px; border: 1px solid var(--linie-hell); border-radius: var(--radius-klein); background: var(--zebra);
  font: 500 14px/1.6 var(--festbreit); color: var(--navy); word-break: break-all;
}
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--a2); margin: 0 0 var(--a4); padding: 0; list-style: none; }
.codes li {
  padding: 9px; border: 1px solid var(--linie-hell); border-radius: var(--radius-klein); background: var(--zebra);
  font: 500 15px var(--festbreit); letter-spacing: .06em; text-align: center; color: var(--navy);
}
.reihe { display: flex; gap: var(--a2); flex-wrap: wrap; margin-bottom: var(--a5); }

/* ---------- Rahmen des Dashboards ---------- */

.rahmen { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.kopfleiste { display: flex; align-items: stretch; gap: var(--a7); height: 56px; padding: 0 28px; background: var(--navy); color: #fff; }
.kopfleiste .marke { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.kopfleiste .zeichen { width: 24px; height: 24px; border-radius: 6px; background: var(--gelb); color: var(--navy); }

/* Hauptbereiche: feine gelbe Linie unter dem aktiven Bereich */
.hauptnav { display: flex; gap: var(--a1); flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.hauptnav::-webkit-scrollbar, .unterreiter::-webkit-scrollbar { display: none; }
.hauptnav a { position: relative; display: flex; align-items: center; padding: 0 var(--a3); color: var(--auf-navy); text-decoration: none; white-space: nowrap; }
.hauptnav a::before { content: ""; flex: none; width: 6px; height: 6px; margin-right: var(--a2); border-radius: 2px; background: var(--bereich-licht); opacity: .75; }
.hauptnav a:hover { color: #fff; }
.hauptnav a:hover::before, .hauptnav a.aktiv::before { opacity: 1; }
.hauptnav a.aktiv { color: #fff; font-weight: 600; }
.hauptnav a.aktiv::after { content: ""; position: absolute; left: var(--a3); right: var(--a3); bottom: 0; height: 2px; background: var(--gelb); }
.hauptnav a:focus-visible, .konto a:focus-visible, .konto button:focus-visible { outline-color: rgba(255, 255, 255, .7); outline-offset: -3px; }
/* Passen nicht alle Bereiche hinein, ist die Leiste wischbar und blendet am Rand
   mit weiteren Bereichen dezent aus (Klassen setzt seite.js) */
.hauptnav { --rand-links: #000; --rand-rechts: #000; scroll-padding-inline: var(--a7); }
.hauptnav.mehr-links { --rand-links: transparent; }
.hauptnav.mehr-rechts { --rand-rechts: transparent; }
.hauptnav.mehr-links, .hauptnav.mehr-rechts {
  -webkit-mask-image: linear-gradient(to right, var(--rand-links), #000 var(--a7), #000 calc(100% - var(--a7)), var(--rand-rechts));
  mask-image: linear-gradient(to right, var(--rand-links), #000 var(--a7), #000 calc(100% - var(--a7)), var(--rand-rechts));
}

.konto { display: flex; align-items: center; gap: var(--a5); font-size: 13px; white-space: nowrap; }
.konto .name { color: #8497ad; }
.konto a, .konto button { padding: 0; border: 0; background: none; color: var(--auf-navy); font-size: 13px; text-decoration: none; cursor: pointer; }
.konto a:hover, .konto button:hover { color: #fff; }
.konto a.aktiv { color: #fff; font-weight: 600; }

/* Das Blatt: eine weiße Fläche je Seite, links die Seitenleiste, rechts der Inhalt */
.koerper { min-height: 0; display: flex; justify-content: center; align-items: flex-start; padding: var(--a5) 28px var(--a6); }
.blatt {
  display: flex; width: 100%; max-width: 1580px; min-height: 0; height: 100%;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 14px; overflow: hidden;
}

/* Seitenleiste: Bereichsname klein mit Quadrat in Bereichsfarbe über der Liste
   der Unterseiten, vom Inhalt durch eine Linie getrennt. Je Unterseite ein
   feines Symbol. Aktive Unterseite: Grund in heller Bereichsfarbe, Schrift
   halbfett, Symbol in Bereichsfarbe. */
.seitenleiste { flex: none; width: var(--leiste); padding: var(--a5) var(--a3) var(--a4); border-right: 1px solid var(--linie); background: var(--zebra); overflow-y: auto; }
.seitenleiste .schalter { display: none; }
.seitenleiste .bereich { display: flex; align-items: center; padding: var(--a1) 10px var(--a3); font-size: 11.5px; font-weight: 600; letter-spacing: .07em; line-height: 1.4; text-transform: uppercase; color: var(--bereich); }
.seitenleiste .liste { display: flex; flex-direction: column; gap: 2px; }
.seitenleiste .liste a {
  display: flex; align-items: center; gap: 10px; min-height: 36px;
  padding: 7px 10px; border-radius: var(--radius-klein);
  font-size: 13.5px; line-height: 1.4; color: var(--text); text-decoration: none; overflow-wrap: break-word; hyphens: auto;
}
.seitenleiste .liste a > span { flex: 1 1 auto; min-width: 0; }
.seitenleiste .liste a > .marke-klein { flex: none; }
.seitenleiste .symbol { color: var(--leise); }
.seitenleiste .liste a:hover { background: var(--maus); color: var(--navy); }
.seitenleiste .liste a:hover .symbol { color: var(--gedaempft); }
.seitenleiste .liste a.aktiv { background: var(--bereich-hell); color: var(--navy); font-weight: 600; }
.seitenleiste .liste a.aktiv .symbol { color: var(--bereich); }
.seitenleiste .liste a.folgt:not(.aktiv) { color: var(--leise); }
.seitenleiste .liste a.folgt:not(.aktiv) .symbol { color: var(--grau-punkt); }
.seitenleiste .liste a:focus-visible, .seitenleiste .schalter:focus-visible { outline-offset: -2px; }

/* Unterreiter innerhalb einer Seite (etwa Spaltengruppen einer Tabelle):
   2 px Unterstreichung in Navy, sonst nichts */
.unterreiter { display: flex; flex: none; gap: var(--a1); overflow-x: auto; scrollbar-width: none; box-shadow: inset 0 -1px 0 var(--linie); }
.unterreiter button {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  padding: 13px var(--a3) 11px; border: 0; border-bottom: 2px solid transparent; background: none;
  font-size: 13.5px; color: var(--gedaempft); white-space: nowrap; cursor: pointer;
}
.unterreiter button:hover { color: var(--navy); }
.unterreiter button.aktiv { color: var(--navy); font-weight: 600; border-bottom-color: var(--navy); }
.unterreiter button:focus-visible { outline-offset: -3px; }
.marke-klein { padding: 0 6px; border: 1px solid var(--linie); border-radius: 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .04em; line-height: 16px; color: var(--gedaempft); white-space: nowrap; text-transform: uppercase; }

.inhalt { flex: 1 1 auto; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: var(--a5); padding: var(--a6) 28px var(--a5); overflow-x: hidden; overflow-y: auto; }
.inhalt > .meldung { margin: 0; }
.platz:empty { display: none; }
.platz > .meldung { margin: 0; }

/* ---------- Seitenmuster ---------- */

.seitenkopf { display: flex; justify-content: space-between; align-items: baseline; gap: var(--a2) var(--a6); flex-wrap: wrap; }
.seitenkopf h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; color: var(--navy); }
.stand { display: flex; align-items: center; gap: var(--a3); flex-wrap: wrap; font-size: 12.5px; color: var(--gedaempft); }
.stand strong { font-weight: 400; color: var(--text); }
.beispiel { padding: 1px 10px; border-radius: 999px; background: var(--amber-pille); color: var(--amber); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Auswahl: schlichte Pillen, aktiv in Navy. Seltenes steckt im Menü "Weitere". */
.filter { display: flex; align-items: center; gap: var(--a2) var(--a3); flex-wrap: wrap; }
.wahl { display: flex; flex-wrap: wrap; gap: 6px; }
.wahl button, select.pille {
  height: 30px; padding: 0 14px; border: 1px solid var(--linie); border-radius: 999px; background: var(--flaeche);
  font-size: 13px; line-height: 1; color: var(--text); white-space: nowrap; cursor: pointer;
}
.wahl button:hover, select.pille:hover { background-color: var(--maus); }
.wahl button.aktiv, select.pille.aktiv { background-color: var(--navy); border-color: var(--navy); color: #fff; }
select.pille {
  width: auto; padding-right: 30px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%235f6b7a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select.pille.aktiv { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E"); }
select.pille.weitere:not(.aktiv) { width: 104px; }
select.pille option { color: var(--text); background: var(--flaeche); }
.vonbis { display: inline-flex; align-items: center; gap: var(--a2); font-size: 13px; color: var(--gedaempft); }
.vonbis input[type=date] { width: 142px; height: 30px; padding: 0 10px; border-radius: 999px; font-size: 13px; }
.filter .hinweis { margin-left: auto; font-size: 12.5px; color: var(--leise); }
.filter .bezug { margin-left: auto; font-size: 13px; color: var(--gedaempft); }
.filter .bezug b { font-weight: 600; color: var(--navy); }

/* Kennzahlenstreifen: ein gemeinsamer Rahmen, Felder durch 1-px-Linien getrennt.
   Je Feld kleine Beschriftung, eine große fette Zahl in Navy, darunter eine Pille
   mit der einen Aussage. Keine zweite Zahl daneben. */
.kacheln {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-rows: repeat(3, auto);
  flex: none; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); overflow: hidden;
}
.kacheln.zeilen-4 { grid-template-rows: repeat(4, auto); }
/* Mehr als sechs Felder: je vier in einer Reihe */
.kacheln.umbruch { grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: none; }
.kacheln.umbruch .kachel { grid-row: span 3; }
.kacheln.umbruch.zeilen-4 .kachel { grid-row: span 4; }
.kacheln.umbruch .kachel:nth-child(4n+1) { border-left: 0; }
.kacheln.umbruch .kachel:nth-child(n+5) { border-top: 1px solid var(--linie); }
.kacheln.schmal { max-width: 560px; }
.kachel {
  display: grid; grid-template-rows: subgrid; grid-row: 1 / -1; align-content: start; min-width: 0; margin: 0;
  padding: var(--a4) var(--a5) 15px; border: 0; border-left: 1px solid var(--linie); border-radius: 0; background: none; text-align: left;
}
.kachel:first-child { border-left: 0; }
button.kachel { cursor: pointer; }
button.kachel:hover { background: var(--zebra); }
button.kachel:focus-visible { outline-offset: -3px; }
.kachel .titel { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; line-height: 1.4; text-transform: uppercase; color: var(--gedaempft); }
.kachel .wert { margin-top: var(--a1); font-size: 30px; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; color: var(--navy); white-space: nowrap; }
.kachel .vergleich { display: block; margin-top: var(--a2); font-size: 12.5px; line-height: 1.5; color: var(--gedaempft); }
.kachel .vergleich:empty { margin-top: 0; }
.kachel.leer .wert { color: var(--leise); font-weight: 400; letter-spacing: 0; font-size: 15px; line-height: 36px; }
.kachel.wort .wert { padding: 5px 0; font-size: 20px; letter-spacing: -.015em; line-height: 1.3; white-space: normal; overflow-wrap: anywhere; }
.kachel.leer .vergleich { color: var(--leise); }

/* Block je Bereich (Startseite): oben eine Linie und der Name in Bereichsfarbe
   auf hellem Grund, rechts die Ampel des Bereichs, darunter bis zu drei
   Hauptkennzahlen als Felder wie im Kennzahlenstreifen. Ohne Daten grau,
   aber gleich aufgebaut. */
.bloecke { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--a3); flex: none; }
.bereichsblock {
  display: flex; flex-direction: column; min-width: 0; margin: 0; padding: 0;
  border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); overflow: hidden;
  font: inherit; color: inherit; text-align: left;
}
button.bereichsblock { cursor: pointer; }
button.bereichsblock:hover { border-color: var(--bereich); }
button.bereichsblock:focus-visible { outline-offset: 2px; }
.bereichsblock::before { content: ""; flex: none; height: 3px; background: var(--bereich); }
.bereichsblock .kopf {
  display: flex; align-items: center; justify-content: space-between; gap: var(--a3); flex: none;
  padding: var(--a2) var(--a4); background: var(--bereich-hell); border-bottom: 1px solid var(--linie-hell);
}
.bereichsblock .name { display: flex; align-items: center; min-width: 0; font-size: 12.5px; font-weight: 600; letter-spacing: .07em; line-height: 1.4; text-transform: uppercase; color: var(--bereich); }
.bereichsblock .kacheln { flex: 1 1 auto; grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 0; border-radius: 0; background: none; }
.bereichsblock .kachel { grid-row: 1 / -1; padding: var(--a3) var(--a4) 14px; border-left-color: var(--linie-hell); }
.bereichsblock .kachel .titel { font-size: 11px; letter-spacing: .05em; }
.bereichsblock .kachel .wert { font-size: 28px; }
.bereichsblock .kachel.leer .wert { font-size: 15px; line-height: 34px; }
.bereichsblock .kachel.breit { grid-column: 1 / -1; }
.bereichsblock.leer { --bereich: #8e99a7; --bereich-hell: #f4f6f8; }
.bereichsblock.leer .kachel .titel { color: var(--leise); }

/* Tabelle: Kopf und Summe im selben klaren Ton, sehr helles Zebra, feine Linien */
.tabelle { flex: 0 1 auto; min-height: 132px; overflow: auto; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); -webkit-overflow-scrolling: touch; }
.tabelle table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.tabelle th, .tabelle td { padding: 8px 14px; text-align: left; font-weight: 400; white-space: nowrap; vertical-align: middle; }
.tabelle thead th { position: sticky; top: 0; z-index: 2; background: var(--kopf); border-bottom: 1px solid var(--linie); font-weight: 600; color: var(--navy); }
.tabelle tbody > tr > * { border-top: 1px solid var(--linie-hell); background: var(--flaeche); }
.tabelle tbody > tr:first-child > * { border-top: 0; }
.tabelle tbody > tr:nth-child(even) > * { background: var(--zebra); }
.tabelle tbody > tr:hover > * { background: var(--maus); }
.tabelle tbody > tr > :first-child { font-weight: 600; color: var(--navy); }
.tabelle.schlicht tbody > tr > :first-child { font-weight: 400; color: inherit; }
.tabelle tfoot > tr > * { position: sticky; bottom: 0; z-index: 2; background: var(--kopf); border-top: 1px solid var(--linie); font-weight: 600; color: var(--navy); }
.tabelle .zahl { text-align: right; }
.tabelle tbody > tr.gruppe > * { background: var(--gruppe); border-top-color: var(--linie); font-weight: 600; color: var(--navy); }
.tabelle tbody > tr.gruppe:hover > * { background: var(--gruppe); }
.tabelle tbody > tr.ohne-daten > td { color: var(--leise); }
.tabelle tbody > tr > td.leer, .tabelle tbody > tr:hover > td.leer { padding: var(--a7) var(--a4); background: var(--flaeche); text-align: center; font-weight: 400; color: var(--gedaempft); white-space: normal; }
.tabelle .blass { color: var(--leise); }

/* Leerer Zustand außerhalb von Tabellen */
.leer-hinweis { margin: 0; padding: var(--a7) var(--a4); border: 1px solid var(--linie); border-radius: var(--radius); text-align: center; color: var(--gedaempft); }

/* "So wird gezählt": ruhige Zeile zum Aufklappen */
details.zaehlweise { font-size: 13px; color: var(--gedaempft); }
details.zaehlweise summary { display: inline-flex; align-items: center; gap: var(--a2); cursor: pointer; list-style: none; border-radius: 4px; }
details.zaehlweise summary::-webkit-details-marker { display: none; }
details.zaehlweise summary::before { content: ""; width: 6px; height: 6px; margin: 0 3px 2px 2px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
details.zaehlweise[open] summary::before { transform: rotate(45deg); margin-bottom: 4px; }
details.zaehlweise summary:hover { color: var(--navy); }
details.zaehlweise p { margin: var(--a2) 0 0; max-width: 92ch; color: var(--text); }
details.zaehlweise .raster { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--a7); margin-top: var(--a1); }
details.zaehlweise b { font-weight: 600; color: var(--navy); }

/* Seitenmodule: füllen den Platz unter dem Seitenkopf, ihre Tabelle scrollt in sich.
   Den Stand der Daten zeigt hier schon der Seitenkopf. */
.modul { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
.modul > * { flex: 0 1 auto; min-height: 0; }
.modul .li-start-stand, .modul .li-mt-stand { display: none; }

/* ---------- Benutzerverwaltung ---------- */

.verwaltung { display: flex; flex-direction: column; gap: var(--a5); min-height: 0; flex: 0 1 auto; }
.verwaltung .block { padding: var(--a5); border: 1px solid var(--linie); border-radius: var(--radius); }
.verwaltung h2 { margin: 0 0 var(--a4); font-size: 15px; font-weight: 600; color: var(--navy); }
.einladen form { display: grid; grid-template-columns: 1fr 1fr 240px; gap: 0 var(--a4); align-items: end; }
.einladen form > .breit { grid-column: 1 / -1; }
.einladen form > .breit:empty { display: none; }
.einladen form .knopf.voll { justify-self: start; }
.einladen label.feld { margin-bottom: var(--a4); }
.einladen .klein-grau.breit { margin-bottom: var(--a2); }
.freigaben { display: flex; flex-wrap: wrap; gap: var(--a2) var(--a5); margin-bottom: var(--a4); }
.freigaben label, .freigaben-zeile label { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; white-space: nowrap; }
.link-feld { display: flex; gap: var(--a2); margin-top: var(--a2); }
.link-feld input { height: 28px; font-size: 12px; font-family: var(--festbreit); }
.verwaltung .tabelle th, .verwaltung .tabelle td { padding-left: var(--a3); padding-right: var(--a3); }
.tabelle td.umbruch { white-space: normal; }
.tabelle td .freigaben-zeile { display: flex; flex-wrap: wrap; gap: 5px var(--a4); min-width: 300px; max-width: 420px; font-weight: 400; color: var(--text); }
.tabelle td .freigaben-zeile label { font-size: 12.5px; }
.tabelle td select { width: auto; height: 30px; padding: 0 var(--a2); font-size: 13px; }
.tabelle td .aktionen { display: flex; flex-wrap: wrap; gap: 6px; min-width: 232px; max-width: 300px; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--grau-punkt); }
.status.aktiv::before { background: var(--gruen-punkt); }
.status.eingeladen::before { background: var(--amber-punkt); }
.status.gesperrt::before { background: var(--rot-punkt); }
.status.gesperrt { color: var(--rot); }

/* ---------- Niedriger Bildschirm ----------
   Unter 780 px Höhe bliebe für die Tabelle zu wenig. Dann behält sie ihre Höhe
   (höchstens 26rem, darin scrollt sie) und das Blatt scrollt das kurze Stück. */

@media (min-width: 821px) and (max-height: 780px) {
  .tabelle { flex-shrink: 0; max-height: 26rem; }
  .modul, .modul > *, .verwaltung { flex-shrink: 0; }
  .bloecke { gap: var(--a2); }
  .bereichsblock .kopf { padding-top: 6px; padding-bottom: 6px; }
  .bereichsblock .kachel { padding-top: 10px; padding-bottom: 10px; }
}

/* Hoher Bildschirm mit zwei Blöcken nebeneinander: alle Blöcke gleich hoch */
@media (min-width: 1280px) and (min-height: 781px) {
  .bloecke { grid-auto-rows: 1fr; }
}

/* ---------- Mittlere Breite ----------
   Die Seitenleiste nimmt dem Inhalt ihre Breite. Die Schwellen sind so gesetzt,
   dass die Zahl im Kennzahlenstreifen immer in ihr Feld passt. */

@media (max-width: 1320px) {
  .kopfleiste { gap: var(--a5); padding: 0 var(--a5); }
  .koerper { padding: var(--a4) var(--a4) var(--a5); }
  .inhalt { padding: var(--a5) var(--a5) var(--a4); }
  .kachel { padding: 14px var(--a4) 13px; }
}

/* Unter 1200 px braucht die Kopfleiste den Platz für die Hauptbereiche: Der
   Name des Benutzers tritt zurück (wie am Handy) */
@media (max-width: 1200px) {
  .konto .name { display: none; }
}

@media (max-width: 1240px) {
  /* Streifen mit fünf oder sechs Feldern: drei je Reihe */
  .kacheln.n5, .kacheln.n6 { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none; }
  .kacheln.n5 .kachel, .kacheln.n6 .kachel { grid-row: span 3; }
  .kacheln.n5.zeilen-4 .kachel, .kacheln.n6.zeilen-4 .kachel { grid-row: span 4; }
  .kacheln.n5 .kachel:nth-child(3n+1), .kacheln.n6 .kachel:nth-child(3n+1) { border-left: 0; }
  .kacheln.n5 .kachel:nth-child(n+4), .kacheln.n6 .kachel:nth-child(n+4) { border-top: 1px solid var(--linie); }
  .kacheln.n5 .kachel:last-child { grid-column: span 2; }
  .einladen form { grid-template-columns: 1fr 1fr; }
  details.zaehlweise .raster { grid-template-columns: minmax(0, 1fr); }
}

/* Unter 1280 px stehen die Blöcke der Startseite untereinander: So bleibt je
   Feld Platz für Zahl und Pille */
@media (max-width: 1279px) {
  .bloecke { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1000px) {
  .kachel .wert, .bereichsblock .kachel .wert { font-size: 24px; }
  .kachel.leer .wert, .bereichsblock .kachel.leer .wert { font-size: 14px; line-height: 29px; }
  .kachel.wort .wert { padding: 3px 0; font-size: 17px; }
}

/* ---------- Handy ---------- */

@media (max-width: 820px) {
  html, body, #app { height: auto; min-height: 100%; }
  .rahmen { display: block; height: auto; min-height: 100vh; background: var(--flaeche); }
  .kopfleiste { flex-wrap: wrap; height: auto; padding: 0; gap: 0; }
  .kopfleiste .marke { flex: 1; height: 48px; padding: 0 var(--a4); }
  .konto { height: 48px; padding: 0 var(--a4); gap: var(--a4); }
  .konto .name { display: none; }
  .hauptnav { order: 3; flex-basis: 100%; height: 42px; padding: 0 var(--a1); border-top: 1px solid rgba(255, 255, 255, .12); scroll-snap-type: x proximity; }
  .hauptnav a { scroll-snap-align: start; }
  .koerper { display: block; padding: 0; }
  .blatt { display: block; max-width: none; height: auto; border: 0; border-radius: 0; overflow: visible; }

  /* Seitenleiste eingeklappt: oben im Blatt eine Zeile mit dem Namen der
     aktuellen Unterseite, ein Tipp darauf klappt die Liste darunter auf */
  .seitenleiste { width: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--linie); overflow: visible; }
  .seitenleiste .bereich { display: none; }
  .seitenleiste .schalter {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: var(--a2) var(--a4);
    border: 0; background: none; font-size: 14px; font-weight: 600; line-height: 1.4; color: var(--navy); text-align: left; cursor: pointer;
  }
  .seitenleiste .schalter .symbol { color: var(--bereich); }
  .seitenleiste .schalter .seite { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .seitenleiste .schalter::after { content: ""; flex: none; width: 7px; height: 7px; margin: 0 var(--a1) 3px; border-right: 1.5px solid var(--gedaempft); border-bottom: 1.5px solid var(--gedaempft); transform: rotate(45deg); }
  .seitenleiste.offen .schalter::after { margin-bottom: -4px; transform: rotate(-135deg); }
  .seitenleiste .liste { display: none; padding: 0 var(--a2) var(--a2); }
  .seitenleiste.offen .liste { display: flex; }
  .seitenleiste .liste a { min-height: 42px; padding: 10px; font-size: 14px; }
  .inhalt { overflow: visible; padding: var(--a5) var(--a4) var(--a7); gap: var(--a4); }
  .seitenkopf h1 { font-size: 19px; }
  .filter .hinweis, .filter .bezug { margin-left: 0; flex-basis: 100%; }
  .vonbis { flex-basis: 100%; }
  .vonbis input[type=date] { flex: 1; width: auto; min-width: 0; }

  /* Streifen: zwei Felder je Reihe, ein einzelnes letztes Feld über die ganze Breite */
  .kacheln, .kacheln.n5, .kacheln.n6 { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; }
  .kacheln.schmal { max-width: none; }
  .kacheln .kachel, .kacheln.n5 .kachel, .kacheln.n6 .kachel { grid-row: span 3; grid-column: auto; padding: var(--a3) 14px; border-left: 1px solid var(--linie); border-top: 0; }
  .kacheln.zeilen-4 .kachel, .kacheln.n5.zeilen-4 .kachel, .kacheln.n6.zeilen-4 .kachel { grid-row: span 4; }
  .kacheln .kachel:nth-child(odd), .kacheln.n5 .kachel:nth-child(odd), .kacheln.n6 .kachel:nth-child(odd) { border-left: 0; }
  .kacheln .kachel:nth-child(n+3), .kacheln.n5 .kachel:nth-child(n+3), .kacheln.n6 .kachel:nth-child(n+3) { border-top: 1px solid var(--linie); }
  /* Die Regel für drei je Reihe nimmt dem vierten Feld die Linie links: hier steht es rechts und braucht sie */
  .kacheln.n5 .kachel:nth-child(even), .kacheln.n6 .kachel:nth-child(even) { border-left: 1px solid var(--linie); }
  .kacheln .kachel:last-child:nth-child(odd), .kacheln.n5 .kachel:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kachel .titel { font-size: 11px; }
  .kachel .wert, .bereichsblock .kachel .wert { font-size: 24px; }
  .kachel.leer .wert, .bereichsblock .kachel.leer .wert { font-size: 14px; line-height: 29px; }
  .kachel.wort .wert { padding: 3px 0; font-size: 17px; }
  .kachel .vergleich { font-size: 12px; }
  .aussage { font-size: 11.5px; padding: 3px 9px; }

  /* Im Block je Kennzahl eine Zeile: Beschriftung, darunter die Zahl links und die Pille rechts */
  .bereichsblock .kacheln { grid-template-columns: minmax(0, 1fr); }
  .bereichsblock .kacheln .kachel:nth-child(n) {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; column-gap: var(--a3);
    grid-row: auto; grid-column: auto; padding: 10px var(--a4) var(--a3); border-left: 0; border-top: 1px solid var(--linie-hell);
  }
  .bereichsblock .kacheln .kachel:first-child { border-top: 0; }
  .bereichsblock .kachel .titel { grid-column: 1 / -1; }
  .bereichsblock .kachel .wert { margin-top: 2px; }
  .bereichsblock .kachel .vergleich { margin-top: 2px; justify-self: end; text-align: right; }
  .bereichsblock .kachel.leer .vergleich:not(:empty) { grid-column: 1 / -1; justify-self: start; text-align: left; }

  .tabelle { max-height: 68vh; }
  .tabelle table { font-size: 13px; }
  .tabelle th, .tabelle td { padding: 8px 12px; }
  .einladen form { grid-template-columns: 1fr; }
  .karte { padding: var(--a6) var(--a5); }
  .qr { justify-content: center; }
}
