:root {
  --grund: #ffffff;
  --leiste: #f8fafc;
  --flaeche: #ffffff;
  --flaeche-2: #f8fafc;
  --text: #0f172a;
  --leise: #64748b;
  --linie: #e2e8f0;
  --primaer: #0f172a;
  --primaer-text: #ffffff;
  --aktiv: #f1f5f9;
  --link: #1d4ed8;
  --warnung: #b91c1c;
  --warnung-flaeche: #fef2f2;
  --gut: #15803d;
  --schatten: 0 1px 2px rgb(15 23 42 / 6%);
  --schatten-gross: 0 12px 32px rgb(15 23 42 / 18%);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #0b1220;
    --leiste: #0f172a;
    --flaeche: #111a2e;
    --flaeche-2: #16213a;
    --text: #e2e8f0;
    --leise: #94a3b8;
    --linie: #24304a;
    --primaer: #e2e8f0;
    --primaer-text: #0f172a;
    --aktiv: #1e293b;
    --link: #93c5fd;
    --warnung: #fca5a5;
    --warnung-flaeche: #3b1717;
    --gut: #86efac;
    --schatten: none;
    --schatten-gross: 0 12px 32px rgb(0 0 0 / 50%);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 15px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}

.symbol { flex: none; }

/* ---- Rahmen: Seitenleiste links, Inhalt rechts ---- */

.rahmen { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.rahmen.ohne-leiste { grid-template-columns: minmax(0, 1fr); }
.rahmen.ohne-leiste .seitenleiste { display: none; }

.seitenleiste {
  background: var(--leiste);
  border-right: 1px solid var(--linie);
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.seitenleiste nav { flex: 1; }
.leiste-fuss { display: grid; gap: 2px; padding: 8px; border-top: 1px solid var(--linie); }
.leiste-fuss button { justify-content: flex-start; gap: 10px; padding: 6px 8px; font-weight: 400; }

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

.anmeldung { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--leiste); }
.anmeldung .karte { width: min(380px, 100%); margin: 0; }
.anmeldung .marke-block { padding: 0 0 16px; margin-bottom: 18px; }
.anmeldung form { display: grid; gap: 14px; }
.anmeldung label { display: grid; gap: 5px; }
.anmeldung label > span { font-size: 14px; font-weight: 600; }
.anmeldung input { width: 100%; }
.anmeldung button { justify-content: center; }
.anmeldung .kasten { margin: 0; }
.anmeldung .fehler { color: var(--warnung); margin: 0; }
.anmeldung .fehler:empty { display: none; }
dialog form > button.haupt { justify-content: center; }

.marke-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--linie);
}
.logo {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--primaer);
  color: var(--primaer-text);
  flex: none;
}
.marke-name { font-weight: 700; line-height: 1.2; }
.marke-unter { font-size: 13px; color: var(--leise); }
.marke {
  background: var(--warnung-flaeche);
  color: var(--warnung);
  border-radius: 999px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 600;
}

nav { padding: 12px 8px; }
.nav-gruppe { margin-bottom: 16px; }
.nav-titel { font-size: 13px; font-weight: 600; color: var(--leise); padding: 4px 8px 6px; }
nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
}
nav a:hover { background: var(--aktiv); }
nav a[aria-current="page"] { background: var(--aktiv); font-weight: 700; }

.oben {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 12px;
  border-bottom: 1px solid var(--linie);
}
.oben button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; color: var(--text); }
/* Der Name steht oben nur, solange die Seitenleiste nicht zu sehen ist. */
.oben-titel { display: none; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rahmen.ohne-leiste .oben-titel { display: block; }
.leiste-schleier { display: none; }

main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 32px 48px; }

/* ---- Überschriften und Seitenkopf ---- */

h2 { font-size: 26px; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h3 { font-size: 17px; margin: 0 0 8px; }
h4 { font-size: 14px; margin: 18px 0 6px; }
.erklaerung { color: var(--leise); margin: 0 0 16px; max-width: 72ch; }

/* Bescheinigung: Anschriften nebeneinander, Unterschriftszeile */
.anschriften { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.unterschrift { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin: 48px 0 16px; font-size: 13px; color: var(--leise); }
.unterschrift div { border-top: 1px solid var(--text); padding-top: 4px; }

/* Einzelabrechnung: Angaben im Kopf (je Zeile zwei Paare aus Name und Wert) und besondere Tabellenzeilen */
.angaben { display: grid; grid-template-columns: max-content 1fr max-content 1fr; gap: 6px 16px; margin: 14px 0 18px; }
.angaben dt { color: var(--leise); font-size: 13px; padding-top: 2px; }
.angaben dd { margin: 0; }
tr.gruppe td { font-weight: 700; background: var(--flaeche-2); }
tr.zwischensumme td { font-weight: 600; }
tr.summe td { font-weight: 700; }
tr.zur-info td { color: var(--leise); font-size: 13px; }
.karte-kopf + .kasten { margin-top: 12px; }

/* Automatischer Import: Vorlage zum Kopieren, Zugangsschlüssel, nummerierte Schritte */
pre.vorlage {
  margin: 0 0 12px;
  padding: 12px;
  max-height: 46vh;
  overflow: auto;
  background: var(--flaeche-2);
  border: 1px solid var(--linie);
  border-radius: 8px;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}
input.schluessel { width: 100%; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; margin-bottom: 8px; }
ol.schritte { margin: 0 0 12px; padding-left: 22px; }
ol.schritte li { margin-bottom: 4px; }

.seitenkopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.seitenkopf .erklaerung { margin: 2px 0 0; }
.kopf-aktionen { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Karten und Kacheln ---- */

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 12px;
  box-shadow: var(--schatten);
  padding: 20px;
  margin-bottom: 20px;
}
.karte h3:not(:first-child) { margin-top: 18px; }
.karte-kopf { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kachel { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; box-shadow: var(--schatten); padding: 16px 18px; }
.kachel .name { color: var(--leise); font-size: 13px; }
.kachel .wert { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }

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

.tabelle-rahmen { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--linie); vertical-align: middle; }
th { font-size: 13px; color: var(--leise); font-weight: 600; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 700; border-top: 1px solid var(--linie); border-bottom: 0; }
.rechts { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.leise { color: var(--leise); }
.klein { font-size: 13px; }
.nowrap { white-space: nowrap; }
.minus { color: var(--warnung); }
.plus { color: var(--gut); }
.leer { color: var(--leise); padding: 20px 0; text-align: center; }
a { color: var(--link); }

/* ---- Knöpfe und Eingabefelder ---- */

button, .knopf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--linie);
  background: var(--flaeche);
  color: var(--text);
  box-shadow: var(--schatten);
  cursor: pointer;
  text-decoration: none;
}
button:hover, .knopf:hover { background: var(--aktiv); }
button.haupt { background: var(--primaer); color: var(--primaer-text); border-color: var(--primaer); }
button.haupt:hover { opacity: .9; background: var(--primaer); }
:is(button, .knopf).schlicht { border-color: transparent; background: none; box-shadow: none; padding: 4px 8px; color: var(--text); }
:is(button, .knopf).schlicht:hover { background: var(--aktiv); }
button.gefahr, button.schlicht.gefahr { color: var(--warnung); }
button:disabled { opacity: .5; cursor: default; }

input, select, textarea {
  font: inherit;
  padding: 7px 10px;
  border: 1px solid var(--linie);
  border-radius: 8px;
  background: var(--flaeche);
  color: var(--text);
  box-shadow: var(--schatten);
  max-width: 100%;
}
textarea { width: 100%; resize: vertical; }
input[type="checkbox"] { box-shadow: none; padding: 0; width: 16px; height: 16px; accent-color: var(--primaer); }
input::placeholder { color: var(--leise); }
:is(input, select, textarea, button, a, [tabindex]):focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
td input.betrag { width: 9em; text-align: right; }
td select { width: 100%; min-width: 11em; }

.leiste { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.leiste label { display: flex; align-items: center; gap: 6px; color: var(--leise); }
.platz { flex: 1; }

.suche-feld { position: relative; flex: 1; min-width: 200px; }
.suche-feld .symbol { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--leise); }
.suche-feld input { width: 100%; padding-left: 34px; }

/* Umschalter aus mehreren Knöpfen, z. B. Filter */
.wahl-knoepfe { display: inline-flex; gap: 2px; }
.wahl-knoepfe button { border-color: transparent; background: none; box-shadow: none; }
.wahl-knoepfe button[aria-pressed="true"] { background: var(--aktiv); }

/* ---- Hinweise, Abzeichen, Status ---- */

.hinweise { list-style: none; margin: 0; padding: 0; }
.hinweise li { padding: 9px 0; border-bottom: 1px solid var(--linie); display: flex; justify-content: space-between; gap: 12px; }
.hinweise li:last-child { border-bottom: 0; }
.hinweise a { white-space: nowrap; font-weight: 600; }

.kasten { background: var(--warnung-flaeche); color: var(--warnung); border-radius: 8px; padding: 10px 14px; margin: 0 0 14px; }
.kasten ul { margin: 4px 0 0; padding-left: 20px; }

.status, .abzeichen {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 1px 9px;
  border-radius: 999px;
  border: 1px solid var(--linie);
  background: var(--flaeche);
  white-space: nowrap;
}
.status.fest { color: var(--gut); border-color: var(--gut); }
.abzeichen.warn { color: var(--warnung); border-color: var(--warnung); }

.belege { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.belege span { display: inline-flex; align-items: baseline; }
.belege button { padding: 0 4px; }

.notiz { display: grid; gap: 8px; justify-items: start; margin-top: 12px; }
.notiz label { display: grid; gap: 4px; width: 100%; }
.nur-druck { display: none; }

/* ---- Dialoge ---- */

dialog {
  border: 1px solid var(--linie);
  border-radius: 12px;
  background: var(--flaeche);
  color: var(--text);
  box-shadow: var(--schatten-gross);
  padding: 22px;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
dialog::backdrop { background: rgb(15 23 42 / 55%); }
dialog h3 { font-size: 18px; margin: 0 28px 12px 0; }
dialog .schliessen { position: absolute; top: 12px; right: 12px; border-color: transparent; background: none; box-shadow: none; padding: 5px; border-radius: 999px; }
dialog .schliessen:hover { background: var(--aktiv); }
dialog form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
dialog form > * { grid-column: 1 / -1; }
dialog form > label.halb { grid-column: auto; }
dialog label { display: grid; gap: 5px; align-content: start; }
dialog label > span { font-size: 14px; font-weight: 600; }
dialog label :is(input, select, textarea) { width: 100%; }
dialog label.haken { display: flex; align-items: center; gap: 8px; }
dialog label.haken input { order: -1; width: 16px; }
dialog label.haken > span { font-weight: 400; }
dialog label.haken small { display: none; }
dialog small { color: var(--leise); }
dialog .knoepfe { display: flex; gap: 8px; align-items: center; }
dialog .fehler { color: var(--warnung); margin: 0; }
dialog .fehler:empty { display: none; }

/* Seitenfenster rechts, z. B. für einen Vorgang */
dialog.panel {
  margin: 0 0 0 auto;
  height: 100vh;
  max-height: 100vh;
  width: min(580px, 100vw);
  border-radius: 0;
  border-width: 0 0 0 1px;
}
dialog.panel section { border-top: 1px solid var(--linie); margin-top: 18px; padding-top: 16px; }
dialog.panel .karte { margin: 16px 0 0; }

/* ---- Dokumente ---- */

.ablage {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 26px 16px;
  margin-bottom: 20px;
  border: 2px dashed var(--linie);
  border-radius: 12px;
  color: var(--leise);
  text-align: center;
}
.ablage.aktiv { border-color: var(--link); background: var(--aktiv); color: var(--text); }
.datei-titel { font-weight: 600; }

/* ---- Zähler ---- */

.zaehler-gruppe { font-weight: 600; color: var(--leise); margin: 16px 0 8px; }
.zaehler-gruppe:first-of-type { margin-top: 0; }
.zaehler-zeile {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border: 1px solid var(--linie);
  border-radius: 10px;
  margin-bottom: 8px;
}
.zaehler-zeile .symbol { color: var(--leise); }
.zaehler-zeile .angaben { flex: 1; min-width: 180px; }
.zaehler-zeile .name { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---- Vorgänge ---- */

.brett { display: grid; grid-template-columns: repeat(4, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; }
.spalte { background: var(--flaeche-2); border-radius: 12px; padding: 10px; min-height: 280px; }
.spalte.ziel { outline: 2px dashed var(--link); }
.spalte-kopf {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--leise);
  padding: 2px 4px 10px;
}
.vorgang-karte {
  display: block;
  width: 100%;
  text-align: left;
  font-weight: 400;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-left: 4px solid #3b82f6;
  border-radius: 10px;
  box-shadow: var(--schatten);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
}
.vorgang-karte.prio-hoch { border-left-color: #dc2626; }
.vorgang-karte.prio-niedrig { border-left-color: #94a3b8; }
.vorgang-karte .titel { font-weight: 600; display: block; }
.vorgang-karte .unter { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 12px; color: var(--leise); margin-top: 2px; }
.notizen { list-style: none; margin: 0 0 12px; padding: 0; }
.notizen li { padding: 8px 0; border-bottom: 1px solid var(--linie); white-space: pre-wrap; }
.notizen time { display: block; font-size: 12px; color: var(--leise); }
.zeile { display: flex; gap: 8px; align-items: flex-start; }

/* ---- Beschluss-Sammlung ---- */

.beschluss .wortlaut { white-space: pre-wrap; margin: 8px 0; max-width: 80ch; }
.beschluss .vermerk { border-left: 3px solid var(--linie); padding-left: 10px; margin: 8px 0; }
.beschluss.geloescht { background: var(--flaeche-2); color: var(--leise); }
[hidden] { display: none !important; }

/* ---- Meldung unten ---- */

#meldung {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--primaer);
  color: var(--primaer-text);
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: var(--schatten-gross);
  max-width: calc(100vw - 32px);
  display: none;
  z-index: 10;
}
#meldung.sichtbar { display: block; }
#meldung.fehler { background: #b91c1c; color: #fff; }

/* Druck: jede Einzelabrechnung auf einer eigenen Seite, ohne Bedienelemente. */
@media print {
  :root {
    --grund: #fff; --flaeche: #fff; --text: #000; --leise: #444; --linie: #999;
    --warnung: #000; --gut: #000; --warnung-flaeche: #fff; --flaeche-2: #fff; --schatten: none;
  }
  body { font-size: 11pt; }
  .seitenleiste, .oben, button, #meldung, .kein-druck { display: none !important; }
  .nur-druck { display: block; }
  .rahmen { display: block; }
  main { max-width: none; padding: 0; }
  .karte { border: 0; padding: 0; break-inside: avoid; }
  .einzel { break-before: page; }
  .kasten { border: 1px solid #000; }
  /* Tabellen im Ausdruck: enger gesetzt, nie abgeschnitten (lange Spaltennamen brechen um),
     die Summenzeile nur einmal am Ende statt auf jeder Seite, keine Zeile über einen Seitenwechsel. */
  th, td { padding: 4px 8px; }
  th { white-space: normal; vertical-align: bottom; }
  .tabelle-rahmen { overflow: visible; margin-bottom: 6pt; }
  tfoot { display: table-row-group; }
  tr { break-inside: avoid; }
  tr.gruppe, h3, h4 { break-after: avoid; }
  tr.gruppe td { border-bottom: 1.5px solid #000; }
  .erklaerung { max-width: none; }
  /* „Nur diese Abrechnung drucken“ (app.js: druckeEinzeln): alles andere auf der Seite bleibt weg. */
  body.druck-auswahl main > :not(.druck-nur) { display: none !important; }
  body.druck-auswahl .druck-nur > .einzel:first-child { break-before: auto; }
}

/* Schmale Fenster (Handy, Tablet hochkant): Die Seitenleiste ist zu und schiebt sich
   über den Menüknopf von links über den Inhalt. Die Breite steht auch in app.js. */
@media (max-width: 900px) {
  .rahmen, .rahmen.ohne-leiste { display: block; }
  .seitenleiste, .rahmen.ohne-leiste .seitenleiste {
    display: flex;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: min(290px, 86vw);
    height: 100dvh;
    box-shadow: var(--schatten-gross);
    transform: translateX(-100%);
    visibility: hidden; /* zugeklappt auch für Tastatur und Vorleseprogramme weg */
    transition: transform .2s ease, visibility 0s .2s;
  }
  .rahmen.leiste-offen .seitenleiste { transform: none; visibility: visible; transition: transform .2s ease; }
  .rahmen.leiste-offen .leiste-schleier { display: block; position: fixed; inset: 0; z-index: 20; background: rgb(15 23 42 / 55%); }
  .oben { position: sticky; top: 0; z-index: 10; background: var(--grund); }
  .oben-titel, .rahmen.ohne-leiste .oben-titel { display: block; }
  nav a, .leiste-fuss button { padding: 10px; }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .seitenleiste, .rahmen.leiste-offen .seitenleiste { transition: none; }
}

/* Handy: weniger Rand, alles untereinander, Felder groß genug zum Tippen. */
@media (max-width: 640px) {
  main { padding: 18px 14px 40px; }
  h2 { font-size: 22px; }
  .karte { padding: 14px; margin-bottom: 14px; }
  .kacheln { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .kachel .wert { font-size: 20px; }
  .seitenkopf { margin-bottom: 14px; }
  .anschriften, .unterschrift { grid-template-columns: 1fr; }
  .angaben { grid-template-columns: max-content 1fr; }
  .brett { grid-template-columns: repeat(4, min(78vw, 260px)); scroll-snap-type: x proximity; }
  .spalte { scroll-snap-align: start; }
  /* Ab 16 Pixeln Schriftgröße zoomt das iPhone beim Antippen eines Feldes nicht hinein. */
  input, select, textarea { font-size: 16px; }
  .leiste label { flex-wrap: wrap; }
  dialog { padding: 18px 16px; }
  dialog form { grid-template-columns: 1fr; }
  dialog form > label.halb { grid-column: 1 / -1; }
  dialog .knoepfe { flex-wrap: wrap; }
}

/* Handy: Tabellen ab drei Spalten (in basis.js: tabelle) werden zu Karten statt seitlich zu rollen.
   Jede Zeile ist ein Block: oben die Titelzelle, darunter je Zelle links der Spaltenname, rechts der Wert.
   Nur am Bildschirm, damit der Ausdruck vom Handy aus eine richtige Tabelle bleibt. */
@media screen and (max-width: 640px) {
  .stapel, .stapel tbody, .stapel tfoot { display: block; }
  .stapel thead { display: none; }
  .stapel tr { display: flex; flex-direction: column; gap: 5px; padding: 12px 0; border-bottom: 1px solid var(--linie); }
  .stapel tbody tr:first-child { padding-top: 2px; }
  .stapel > :last-child > tr:last-child { border-bottom: 0; padding-bottom: 0; }
  .stapel td {
    display: grid;
    grid-template-columns: fit-content(50%) minmax(0, 1fr);
    column-gap: 16px;
    align-items: baseline;
    padding: 0;
    border: 0;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .stapel td:empty { display: none; }
  .stapel td[data-label]::before {
    content: attr(data-label);
    grid-column: 1;
    grid-row: 1;
    text-align: left;
    color: var(--leise);
    font-size: 13px;
    font-weight: 400;
  }
  .stapel td[data-label] > * { grid-column: 2; justify-self: end; }
  .stapel td[data-label] > select { justify-self: stretch; min-width: 0; }
  .stapel td.titelzelle { order: -1; display: block; text-align: left; font-weight: 600; }
  .stapel td.titelzelle .leise { font-weight: 400; }
  /* Zellen ohne Spaltennamen: die Knöpfe einer Zeile oder ein Hinweis über die ganze Breite */
  .stapel td:not([data-label], .titelzelle) { display: flex; flex-wrap: wrap; gap: 2px 4px; text-align: left; }
  .stapel td:not([data-label], .titelzelle):has(> .schlicht) { margin: 2px 0 0 -8px; }
  .tabelle-rahmen:has(> .stapel) { overflow: visible; margin-bottom: 12px; }
  /* Überschrift eines Blocks, zum Beispiel „1 Umlagefähig“ in der Einzelabrechnung */
  .stapel tr.gruppe { margin-top: 10px; padding: 8px 10px; border-bottom: 0; border-radius: 8px; background: var(--flaeche-2); }
  .stapel tr.gruppe td { background: none; }

  /* Buchungen sind viele: Datum und Betrag teilen sich die erste Zeile, darunter der Zahler. */
  .stapel tr:has(> .bu-datum) { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; }
  .stapel tr:has(> .bu-datum) > td { grid-column: 1 / -1; }
  .stapel td.bu-datum { grid-area: 1 / 1; display: block; text-align: left; color: var(--leise); font-size: 13px; }
  .stapel td.bu-betrag { grid-area: 1 / 2; display: block; font-weight: 600; }
  .stapel td:is(.bu-datum, .bu-betrag)::before { content: none; }
}
