/* Hof-System: Gerüst und Bausteine, Grundlage (Review 2, C1, C3, C4).
 *
 * Liest nur die Werte aus werte.css. Gilt für alle Seiten (templates/base.html, body.neu).
 * Trägt den Aufbau der Bausteine (Raster, Abstände, Verhalten am Handy); das Aussehen legen
 * die Dateien unter css/apple/ darüber (Referenz: /stil/). Neues gehört dorthin, nicht hierher.
 * Was keine Vorlage mehr nutzt, fällt weg (Abdeckung der Klassen, PR G).
 */

/* --- Grundlage ------------------------------------------------------------------------ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.neu {
  margin: 0;
  font-family: var(--schrift);
  font-size: var(--text-15);
  line-height: var(--zeile);
  color: var(--text);
  background: var(--grund);
  -webkit-font-smoothing: antialiased;
  /* Lange Wörter ohne Bruchstelle (Mail-Adressen, Pfade, IDs) brechen um, wenn sie nicht
     in ihre Zeile passen, statt die Seite am Handy zu verbreitern (Review 3, Abschluss:
     Schreiben bei 320 px unter Linux). „break-word“ statt „anywhere“: Die Mindestbreite
     von Tabellenspalten und Flex-Elementen bleibt, wie sie ist. */
  overflow-wrap: break-word;
}

.neu h1,
.neu h2,
.neu h3 {
  margin: 0;
  line-height: var(--zeile-eng);
  font-weight: var(--gewicht-fett);
  letter-spacing: -0.01em;
}

.neu h1 {
  font-size: var(--text-24);
}

.neu h2 {
  font-size: var(--text-17);
}

.neu h3 {
  font-size: var(--text-15);
}

.neu p {
  margin: 0 0 var(--a3);
}

.neu a {
  color: var(--link);
  text-underline-offset: 2px;
}

.neu a:not(:hover) {
  text-decoration-color: transparent;
}

.neu :focus-visible {
  outline: 2px solid var(--fokus);
  outline-offset: 2px;
}

.neu img {
  max-width: 100%;
}

.neu code {
  font-family: var(--schrift-mono);
  font-size: var(--text-13);
  /* Lange Pfade ohne Leerzeichen brechen um, statt die Seite am Handy (320 px) zu
     verbreitern (Review 3, Abschluss). */
  overflow-wrap: anywhere;
}

/* Zahlen: gleiche Ziffernbreite, damit Spalten bündig stehen */
.zahl,
.kennzahl-wert,
.zaehler,
.neu time {
  font-variant-numeric: tabular-nums;
}

.leise,
.text-2 {
  color: var(--text-2);
}

.text-3 {
  color: var(--text-3);
}

.klein {
  font-size: var(--text-13);
}

.nur-leser,
.sprung:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sprung:focus {
  position: fixed;
  z-index: 100;
  top: var(--a2);
  left: var(--a2);
  padding: var(--a2) var(--a3);
  background: var(--flaeche);
  border-radius: var(--radius);
  box-shadow: var(--schatten-menue);
}

/* --- Stichtag-Band (Review 1, Punkt 14) ------------------------------------------------ */

.stichtag-band {
  padding: var(--a1) var(--a4);
  font-size: var(--text-13);
  font-weight: var(--gewicht-mittel);
  text-align: center;
  color: var(--band-text);
  background: var(--band);
  border-bottom: 1px solid var(--linie);
}

/* --- Gerüst: Seitenleiste ab 1024 px, am Handy Kopfzeile und Leiste unten --------------- */

.geruest {
  min-height: 100vh;
}

@media (min-width: 1024px) {
  /* Fläche der Seitenleiste über die ganze Seitenhöhe, auch unter dem Ende der Leiste */
  .geruest {
    background: linear-gradient(
      to right,
      var(--flaeche) calc(var(--breite-leiste) - 1px),
      var(--linie) calc(var(--breite-leiste) - 1px) var(--breite-leiste),
      transparent var(--breite-leiste)
    );
  }
}

.haupt {
  min-width: 0; /* ohne das verbreitert eine breite Tabelle die ganze Seite */
  padding: var(--a4) var(--a4) calc(var(--hoehe-unten) + var(--a6) + env(safe-area-inset-bottom));
}

.inhalt-neu {
  max-width: var(--breite-inhalt);
  margin: 0 auto;
}

.inhalt-neu.schmal {
  max-width: var(--breite-formular);
}

.marke {
  display: inline-flex;
  align-items: center;
  gap: var(--a2);
  font-weight: var(--gewicht-fett);
  color: var(--text);
  text-decoration: none;
}

.neu a.marke {
  color: var(--text);
}

.marke-zeichen {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: var(--text-15);
  color: var(--primaer-text);
  background: var(--primaer);
  border-radius: var(--radius-klein);
}

.leiste {
  display: none;
}

.kopf-handy {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  gap: var(--a3);
  height: var(--hoehe-kopf);
  padding: 0 var(--a4);
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
}

.unten {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--flaeche);
  border-top: 1px solid var(--linie);
}

.unten a,
.unten button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--hoehe-unten);
  padding: var(--a1) 2px;
  font: inherit;
  font-size: 11px;
  line-height: 1.2;
  color: var(--text-2);
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
}

.unten [aria-current="page"] {
  color: var(--primaer);
  font-weight: var(--gewicht-mittel);
}

.symbol {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (min-width: 1024px) {
  .geruest {
    display: grid;
    grid-template-columns: var(--breite-leiste) minmax(0, 1fr);
  }

  .leiste {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: var(--a4) var(--a3);
    background: var(--flaeche);
    border-right: 1px solid var(--linie);
  }

  .leiste .marke {
    padding: var(--a1) var(--a2) var(--a3);
  }

  .leiste .suche {
    flex: none;
    margin: 0 0 var(--a4);
  }

  /* Nur die Navigation scrollt: sonst schnitte die Leiste die Treffer der Suche ab. */
  .leiste .nav-neu {
    min-height: 0;
    margin: 0 calc(-1 * var(--a3));
    padding: 0 var(--a3);
    overflow-y: auto;
  }

  .kopf-handy,
  .unten,
  #mehr {
    display: none;
  }

  .haupt {
    padding: var(--a6) var(--a8) var(--a12);
  }
}

.nav-neu {
  flex: 1;
}

.nav-gruppe {
  margin-bottom: var(--a4);
}

.nav-gruppe-titel {
  margin: 0 0 var(--a1);
  padding: 0 var(--a2);
  font-size: 11px;
  font-weight: var(--gewicht-fett);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.nav-neu ul,
.nav-aufklapper ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-neu a {
  display: flex;
  align-items: center;
  gap: var(--a2);
  padding: 6px var(--a2);
  color: var(--text);
  border-radius: var(--radius-klein);
  text-decoration: none;
}

.nav-neu a:hover {
  background: var(--flaeche-2);
}

.nav-neu a[aria-current="page"],
.nav-aufklapper a[aria-current="page"] {
  font-weight: var(--gewicht-mittel);
  color: var(--primaer);
  background: var(--primaer-weich);
}

.nav-marke {
  margin-left: auto;
  padding: 0 6px;
  font-size: 11px;
  font-weight: var(--gewicht-mittel);
  color: var(--neutral);
  background: var(--neutral-grund);
  border: 1px solid var(--linie);
  border-radius: var(--radius-klein);
}

.leiste-fuss {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--a1);
  padding: var(--a3) var(--a2) 0;
  border-top: 1px solid var(--linie);
}

.leiste-benutzer {
  max-width: 100%;
  overflow: hidden;
  font-size: var(--text-13);
  color: var(--text-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* „Mehr“ am Handy: alle Gruppen als Aufklapper */
.nav-aufklapper {
  border-bottom: 1px solid var(--linie);
}

.nav-aufklapper summary {
  display: flex;
  align-items: center;
  min-height: var(--ziel);
  font-weight: var(--gewicht-mittel);
  cursor: pointer;
  list-style: none;
}

.nav-aufklapper summary::-webkit-details-marker {
  display: none;
}

.nav-aufklapper summary::after {
  margin-left: auto;
  content: "▾";
  color: var(--text-3);
}

.nav-aufklapper[open] summary::after {
  content: "▴";
}

.nav-aufklapper a {
  display: flex;
  align-items: center;
  min-height: var(--ziel);
  padding: 0 var(--a3);
  color: var(--text);
  border-radius: var(--radius-klein);
  text-decoration: none;
}

.knopf-voll {
  width: 100%;
  margin-top: var(--a4);
}

/* --- Seitenkopf ---------------------------------------------------------------------- */

.seitenkopf {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--a3) var(--a6);
  margin-bottom: var(--a6);
}

.seitenkopf-text {
  flex: 1 1 320px;
  min-width: 0;
}

.seitenkopf h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--a2) var(--a3);
}

.seitenkopf-meta {
  margin: var(--a1) 0 0;
  color: var(--text-2);
}

.seitenkopf-aktionen {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--a2);
}

@media (min-width: 1024px) {
  .neu h1 {
    font-size: var(--text-30);
  }
}

/* --- Knöpfe: primär (höchstens einer je Ansicht), sekundär, Text, Gefahr --------------- */

.knopf {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--a2);
  min-height: 36px;
  padding: 0 var(--a4);
  font: inherit;
  font-weight: var(--gewicht-mittel);
  line-height: 1.2;
  white-space: nowrap;
  color: var(--text);
  text-decoration: none;
  background: var(--flaeche);
  border: 1px solid var(--linie-stark);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.neu a.knopf {
  color: var(--text);
  text-decoration: none;
}

.knopf:hover {
  background: var(--flaeche-2);
}

.knopf:disabled,
.knopf[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.knopf-primaer,
.neu a.knopf-primaer {
  color: var(--primaer-text);
  background: var(--primaer);
  border-color: var(--primaer);
}

.knopf-primaer:hover {
  background: var(--primaer-stark);
  border-color: var(--primaer-stark);
}

.knopf-zweit {
  background: var(--flaeche);
}

.knopf-text,
.neu a.knopf-text {
  padding: 0 var(--a2);
  color: var(--link);
  background: transparent;
  border-color: transparent;
}

.knopf-text:hover {
  background: var(--flaeche-2);
}

.knopf-gefahr,
.neu a.knopf-gefahr {
  color: var(--gefahr-text);
  background: var(--gefahr);
  border-color: var(--gefahr);
}

.knopf-gefahr:hover {
  filter: brightness(0.92);
}

.knopf-klein {
  min-height: 28px;
  padding: 0 var(--a2);
  font-size: var(--text-13);
}

.knopf-symbol {
  min-width: 36px;
  padding: 0;
  font-size: var(--text-20);
  line-height: 1;
  color: var(--text-2);
}

/* Am Handy und mit Finger: Knöpfe und Ziele mindestens 44 px (Review 2, C4) */
@media (max-width: 1023px), (pointer: coarse) {
  .knopf,
  .knopf-klein,
  .knopf-symbol {
    min-height: var(--ziel);
  }

  .knopf-symbol {
    min-width: var(--ziel);
  }
}

/* Menü „mehr ▾“ */
.menue {
  position: relative;
}

.menue > summary {
  list-style: none;
}

.menue > summary::-webkit-details-marker {
  display: none;
}

.menue-liste {
  position: absolute;
  z-index: 30;
  top: calc(100% + var(--a1));
  right: 0;
  min-width: 240px;
  margin: 0;
  padding: var(--a1);
  list-style: none;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten-menue);
}

.menue-liste li > a,
.menue-liste li > button,
.menue-liste li > form > button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: var(--a1) var(--a3);
  font: inherit;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: var(--radius-klein);
  cursor: pointer;
}

.menue-liste li > a:hover,
.menue-liste li > button:hover,
.menue-liste li > form > button:hover {
  background: var(--flaeche-2);
}

.menue-liste form {
  margin: 0;
}

.menue-trenner {
  height: 1px;
  margin: var(--a1) 0;
  background: var(--linie);
}

@media (max-width: 1023px), (pointer: coarse) {
  .menue-liste li > a,
  .menue-liste li > button,
  .menue-liste li > form > button {
    min-height: var(--ziel);
  }
}

/* Am Handy: Menü als Blatt über der unteren Leiste, nie breiter als der Bildschirm */
@media (max-width: 599px) {
  .menue-liste {
    position: fixed;
    top: auto;
    right: var(--a4);
    bottom: calc(var(--hoehe-unten) + var(--a3) + env(safe-area-inset-bottom));
    left: var(--a4);
    min-width: 0;
  }
}

/* --- Karte --------------------------------------------------------------------------- */

.karte {
  min-width: 0;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.karte-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--a3);
  padding: var(--a3) var(--a4);
  border-bottom: 1px solid var(--linie);
}

.karte-titel {
  display: flex;
  align-items: center;
  gap: var(--a2);
}

.neu .karte-titel {
  font-size: var(--text-15);
}

.karte-link {
  font-size: var(--text-13);
}

a.karte-link {
  white-space: nowrap;
}

.karte-rumpf {
  padding: var(--a3) var(--a4);
}

.karte-rumpf > :last-child {
  margin-bottom: 0;
}

.karte-rumpf:has(> .tabelle-box:only-child),
.karte-rumpf:has(> .liste:only-child) {
  padding: 0;
}

.karte-rumpf > .tabelle-box {
  border: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}

/* Eine Spalte am Handy, nie breiter als der Bildschirm: minmax(0, 1fr) statt der impliziten
   Spalte „auto“, die so breit wird wie das längste Wort oder die breiteste Tabelle (320 px). */
.raster {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--a4);
}

.raster > * {
  min-width: 0;
}

@media (min-width: 1024px) {
  .raster-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .raster-2-1 {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }
}

.stapel > * + * {
  margin-top: var(--a4);
}

/* Liste in einer Karte: Zeilen mit Linie dazwischen */
.liste {
  margin: 0;
  padding: 0;
  list-style: none;
}

.liste > li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--a1) var(--a3);
  padding: var(--a2) var(--a4);
  border-top: 1px solid var(--linie);
}

.liste > li:first-child {
  border-top: 0;
}

.liste-haupt {
  min-width: 0;
  overflow-wrap: anywhere;
}

.liste-neben {
  color: var(--text-2);
  white-space: nowrap;
}

a.liste-zeile {
  display: flex;
  justify-content: space-between;
  gap: var(--a3);
  width: 100%;
  color: var(--text);
  text-decoration: none;
}

/* --- Kennzahl-Kacheln ---------------------------------------------------------------- */

.kennzahlen-reihe {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--a3);
  margin-bottom: var(--a6);
}

@media (min-width: 720px) {
  .kennzahlen-reihe {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

.kennzahl {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: var(--a3) var(--a4);
  color: var(--text);
  text-decoration: none;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.neu a.kennzahl {
  color: var(--text);
}

a.kennzahl:hover {
  border-color: var(--linie-stark);
}

.kennzahl-titel {
  font-size: var(--text-13);
  color: var(--text-2);
}

.kennzahl-wert {
  font-size: var(--text-24);
  font-weight: var(--gewicht-fett);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kennzahl-unter {
  font-size: var(--text-13);
  color: var(--text-3);
}

.kennzahl-ok .kennzahl-wert {
  color: var(--ok);
}

.kennzahl-hinweis .kennzahl-wert {
  color: var(--hinweis);
}

.kennzahl-warnung .kennzahl-wert {
  color: var(--warnung);
}

.kennzahl-fehler .kennzahl-wert {
  color: var(--fehler);
}

/* --- Fachbegriff mit Erklärung (Review 3, Punkt 1) ------------------------------------ */

.begriff {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: help;
}

/* --- Status-Badge und Zähler ---------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px var(--a2);
  font-size: var(--text-13);
  font-weight: var(--gewicht-mittel);
  line-height: 20px;
  white-space: nowrap;
  vertical-align: middle;
  letter-spacing: 0;
  border-radius: var(--radius-rund);
}

.badge::before {
  width: 6px;
  height: 6px;
  content: "";
  background: currentColor;
  border-radius: 50%;
}

.badge-ok {
  color: var(--ok);
  background: var(--ok-grund);
}

.badge-hinweis {
  color: var(--hinweis);
  background: var(--hinweis-grund);
}

.badge-warnung {
  color: var(--warnung);
  background: var(--warnung-grund);
}

.badge-fehler {
  color: var(--fehler);
  background: var(--fehler-grund);
}

.badge-neutral {
  color: var(--neutral);
  background: var(--neutral-grund);
}

.zaehler {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  font-size: var(--text-13);
  font-weight: var(--gewicht-mittel);
  line-height: 20px;
  text-align: center;
  color: var(--text-2);
  background: var(--flaeche-3);
  border-radius: var(--radius-rund);
}

/* --- Tabelle: dicht, Zeilen-Hover, Zahlen rechts, Kopf sticky, Leerzustand -------------- */

.tabelle-box {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.tab {
  width: 100%;
  border-spacing: 0;
  border-collapse: separate;
  font-size: var(--text-15);
}

.tab th,
.tab td {
  padding: var(--a2) var(--a3);
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--linie);
}

.tab thead th {
  position: sticky;
  z-index: 1;
  top: 0;
  font-size: var(--text-13);
  font-weight: var(--gewicht-mittel);
  white-space: nowrap;
  color: var(--text-2);
  background: var(--flaeche-2);
}

.tab thead th:first-child {
  border-top-left-radius: var(--radius);
}

.tab thead th:last-child {
  border-top-right-radius: var(--radius);
}

.tab tbody tr:last-child td {
  border-bottom: 0;
}

.tab tbody tr:hover td {
  background: var(--flaeche-2);
}

.tab .zahl {
  text-align: right;
  white-space: nowrap;
}

.tab tfoot td {
  font-weight: var(--gewicht-fett);
  border-top: 1px solid var(--linie-stark);
  border-bottom: 0;
}

.tab tr.zeile-leise td {
  color: var(--text-3);
}

.tab tr.zeile-markiert td:first-child {
  box-shadow: inset 3px 0 0 var(--fehler);
}

.tab .eng {
  width: 1%;
  white-space: nowrap;
}

.leer {
  padding: var(--a8) var(--a4);
  text-align: center;
}

.leer-text {
  margin: 0;
  font-weight: var(--gewicht-mittel);
  color: var(--text-2);
}

.leer-hilfe {
  margin: var(--a1) 0 0;
  font-size: var(--text-13);
  color: var(--text-3);
}

.tab tr.leer-zeile:hover td {
  background: none;
}

/* Kopf sticky unter der Kopfzeile am Handy; am Handy scrollen breite Tabellen in ihrem
   Kasten, nicht die Seite. */
@media (max-width: 1023px) {
  .tabelle-box {
    overflow-x: auto;
  }

  .tab thead th {
    position: static;
  }

  /* Tabellen mit .tab-karten werden am Handy zu Karten je Zeile */
  .tab-karten thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .tab-karten tr {
    display: block;
    padding: var(--a2) var(--a3);
    border-bottom: 1px solid var(--linie);
  }

  .tab-karten tbody tr:last-child {
    border-bottom: 0;
  }

  .tab-karten td {
    display: flex;
    justify-content: space-between;
    gap: var(--a3);
    padding: 2px 0;
    border: 0;
  }

  /* Die Beschriftung steht links, alles Übrige der Zelle schließt rechts ab. Ohne den
     automatischen Rand verteilt „space-between“ den Platz auch zwischen den Teilen des Werts:
     Bei „Datum + Badge“ (Review 3, Nachtrag) stünde das Datum sonst mittig. */
  .tab-karten td[data-titel]::before {
    content: attr(data-titel);
    margin-right: auto;
    color: var(--text-2);
    font-size: var(--text-13);
  }

  .tab-karten td.zahl {
    text-align: right;
  }

  .tab-karten tbody tr:hover td {
    background: none;
  }
}

/* --- Reiter --------------------------------------------------------------------------- */

.reiter {
  display: flex;
  gap: var(--a1);
  margin: 0 0 var(--a4);
  overflow-x: auto;
  border-bottom: 1px solid var(--linie);
  scrollbar-width: none;
}

.reiter a {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  min-height: var(--ziel);
  margin-bottom: -1px;
  padding: 0 var(--a3);
  font-weight: var(--gewicht-mittel);
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.reiter a:hover {
  color: var(--text);
}

.neu .reiter a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--primaer);
}

/* --- Aufklapper ----------------------------------------------------------------------- */

.aufklapper {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.aufklapper + .aufklapper {
  margin-top: var(--a2);
}

.aufklapper > summary {
  display: flex;
  align-items: center;
  gap: var(--a2);
  min-height: var(--ziel);
  padding: 0 var(--a4);
  font-weight: var(--gewicht-mittel);
  cursor: pointer;
  list-style: none;
}

.aufklapper > summary::-webkit-details-marker {
  display: none;
}

.aufklapper > summary::before {
  width: 0;
  height: 0;
  content: "";
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid var(--text-3);
  transition: transform 0.15s;
}

.aufklapper[open] > summary::before {
  transform: rotate(90deg);
}

.aufklapper-inhalt {
  padding: 0 var(--a4) var(--a4);
}

/* --- Formularfeld: Label oben, Hilfetext, Fehler am Feld ------------------------------- */

.felder {
  display: grid;
  gap: var(--a4);
}

@media (min-width: 600px) {
  .felder-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .felder-2 .feld-breit {
    grid-column: 1 / -1;
  }
}

.feld {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.feld-label {
  font-size: var(--text-13);
  font-weight: var(--gewicht-mittel);
  color: var(--text);
}

.feld-optional {
  font-weight: var(--gewicht-normal);
  color: var(--text-3);
}

.feld-hilfe,
.neu p.feld-hilfe {
  margin: 0;
  font-size: var(--text-13);
  color: var(--text-3);
}

.feld-fehler,
.neu p.feld-fehler {
  display: flex;
  gap: 6px;
  margin: 0;
  font-size: var(--text-13);
  font-weight: var(--gewicht-mittel);
  color: var(--fehler);
}

.feld-fehler::before {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  content: "!";
  color: var(--flaeche);
  background: var(--fehler);
  border-radius: 50%;
}

.feld-eingabe,
.feld-auswahl,
.neu .feld textarea {
  width: 100%;
  min-height: var(--feld-hoehe);
  padding: var(--a2) var(--a3);
  font: inherit;
  color: var(--text);
  background: var(--flaeche);
  border: 1px solid var(--linie-stark);
  border-radius: var(--radius-klein);
  appearance: none;
}

.neu .feld textarea {
  min-height: 88px;
  resize: vertical;
}

.feld-eingabe:hover,
.feld-auswahl:hover {
  border-color: var(--text-3);
}

.feld-eingabe:focus,
.feld-auswahl:focus,
.neu .feld textarea:focus {
  border-color: var(--fokus);
  outline: 2px solid color-mix(in srgb, var(--fokus) 35%, transparent);
  outline-offset: 0;
}

.feld-fehlerhaft .feld-eingabe,
.feld-fehlerhaft .feld-auswahl,
.feld-fehlerhaft textarea {
  border-color: var(--fehler);
}

/* Gestaltete Auswahl: volle Breite, eigener Pfeil */
.feld-auswahl {
  padding-right: var(--a8);
  background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%),
    linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-repeat: no-repeat;
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  cursor: pointer;
}

.feld-auswahl[multiple] {
  padding-right: var(--a3);
  background-image: none;
}

/* Datumsfelder: gleiche Höhe, Kalender-Symbol in der Textfarbe */
.feld-eingabe[type="date"],
.feld-eingabe[type="month"] {
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.feld-eingabe::-webkit-date-and-time-value {
  text-align: left;
}

.feld-eingabe::-webkit-calendar-picker-indicator {
  opacity: 0.7;
  cursor: pointer;
}

.feld-eingabe[inputmode="decimal"],
.feld-eingabe[inputmode="numeric"] {
  font-variant-numeric: tabular-nums;
}

/* Checkbox mit Label in einer Zeile, Ziel 44 px */
.haken-label {
  display: inline-flex;
  align-items: center;
  gap: var(--a3);
  min-height: var(--ziel);
  font-weight: var(--gewicht-normal);
  cursor: pointer;
}

.feld-haken,
.neu input[type="checkbox"],
.neu input[type="radio"] {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--primaer);
  cursor: pointer;
}

@media (max-width: 1023px), (pointer: coarse) {
  .feld-eingabe,
  .feld-auswahl {
    min-height: var(--ziel);
    font-size: 16px; /* iOS zoomt sonst beim Antippen */
  }

  .feld-haken,
  .neu input[type="checkbox"],
  .neu input[type="radio"] {
    width: 24px;
    height: 24px;
  }
}

.formfehler {
  margin-bottom: var(--a4);
  padding: var(--a3) var(--a4);
  color: var(--fehler);
  background: var(--fehler-grund);
  border-radius: var(--radius-klein);
}

.formfehler p {
  margin: 0;
}

.formular-fuss {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--a2);
  margin-top: var(--a6);
}

/* --- Eigene Dateiknöpfe mit Vorschau (C4) ---------------------------------------------- */

.datei-knoepfe {
  display: flex;
  flex-wrap: wrap;
  gap: var(--a2);
}

.datei-knopf {
  position: relative;
  overflow: hidden;
}

.datei-knopf:focus-within {
  outline: 2px solid var(--fokus);
  outline-offset: 2px;
}

.datei-eingabe {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.datei-vorschau {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: var(--a2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.datei-vorschau li {
  display: flex;
  flex-direction: column;
  gap: var(--a1);
  min-width: 0;
  font-size: var(--text-13);
  color: var(--text-2);
}

.datei-vorschau li span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.datei-vorschau img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--flaeche-2);
  border: 1px solid var(--linie);
  border-radius: var(--radius-klein);
}

.datei-vorschau li.datei-leer {
  grid-column: 1 / -1;
  color: var(--text-3);
}

/* --- Dialog --------------------------------------------------------------------------- */

dialog.dialog,
dialog.blatt {
  width: min(560px, calc(100vw - 2 * var(--a4)));
  max-height: calc(100dvh - 2 * var(--a4));
  padding: 0;
  color: var(--text);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten-dialog);
}

dialog.dialog::backdrop,
dialog.blatt::backdrop {
  background: var(--schleier);
}

dialog.dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog-formular {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: inherit;
}

.dialog-kopf {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--a3);
  padding: var(--a3) var(--a3) var(--a3) var(--a5);
  border-bottom: 1px solid var(--linie);
}

.neu .dialog-titel {
  font-size: var(--text-17);
}

.dialog-rumpf {
  padding: var(--a5);
  overflow-y: auto;
}

.dialog-hinweis {
  color: var(--text-2);
}

.dialog-fuss {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--a2);
  padding: var(--a3) var(--a5);
  background: var(--flaeche-2);
  border-top: 1px solid var(--linie);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* Am Handy: Dialog als Blatt von unten */
@media (max-width: 599px) {
  dialog.dialog,
  dialog.blatt {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    border-radius: var(--radius) var(--radius) 0 0;
  }

  .dialog-fuss {
    padding-bottom: calc(var(--a3) + env(safe-area-inset-bottom));
    border-radius: 0;
  }

  .dialog-fuss .knopf {
    flex: 1;
  }
}

/* --- Toast-Meldung mit Link ------------------------------------------------------------ */

.toasts {
  position: fixed;
  z-index: 50;
  right: var(--a4);
  bottom: calc(var(--hoehe-unten) + var(--a3) + env(safe-area-inset-bottom));
  left: var(--a4);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--a2);
  pointer-events: none;
}

@media (min-width: 1024px) {
  .toasts {
    bottom: var(--a6);
    left: auto;
    width: 440px;
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--a3);
  width: 100%;
  padding: var(--a3) var(--a2) var(--a3) var(--a4);
  color: var(--text);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-left: 4px solid var(--ok);
  border-radius: var(--radius);
  box-shadow: var(--schatten-menue);
  pointer-events: auto;
  transition: opacity 0.3s, transform 0.3s;
}

.toast-weg {
  opacity: 0;
  transform: translateY(8px);
}

.toast-hinweis {
  border-left-color: var(--hinweis);
}

.toast-warnung {
  border-left-color: var(--warnung);
}

.toast-fehler {
  border-left-color: var(--fehler);
}

.toast-text {
  flex: 1;
  min-width: 0;
}

.toast-link {
  font-weight: var(--gewicht-mittel);
  white-space: nowrap;
}

.toast-zu {
  flex: none;
  width: var(--ziel);
  height: var(--ziel);
  margin: calc(-1 * var(--a2)) 0;
  font: inherit;
  font-size: var(--text-20);
  color: var(--text-3);
  background: none;
  border: 0;
  border-radius: var(--radius-klein);
  cursor: pointer;
}

/* --- Angaben (Begriff: Wert) ---------------------------------------------------------- */

.angaben-neu {
  display: grid;
  grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
  gap: var(--a2) var(--a4);
  margin: 0;
}

.angaben-neu dt {
  color: var(--text-2);
}

.angaben-neu dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* --- Cockpit: Kacheln aus dem Register (apps.cockpit.kacheln) --------------------------- */

.cockpit-raster {
  display: grid;
  align-items: start;
  gap: var(--a4);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 720px) {
  .cockpit-raster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row dense;
  }
}

@media (min-width: 1280px) {
  .cockpit-raster {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cockpit-raster > .kachel-breit {
    grid-column: span 2;
  }
}

.cockpit-raster > li {
  display: flex;
  min-width: 0;
}

.cockpit-raster > li > .karte {
  flex: 1;
}

/* Zeilen einer Kachel ({% karte … ziel=… %}, PR H): Bezeichnung links, Wert rechts */
.cockpit-raster .kachel-zeilen {
  display: block;
  margin-top: var(--a1);
}

.cockpit-raster .kachel-zeile {
  display: flex;
  justify-content: space-between;
  gap: var(--a3);
  padding: 3px 0;
  font-size: var(--text-13);
  color: var(--text-2);
  border-top: 1px solid var(--linie);
  overflow-wrap: anywhere;
}

.cockpit-raster .kachel-zeile strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.neu .status {
  font-weight: var(--gewicht-mittel);
}

.neu .status-erfolgreich {
  color: var(--ok);
}

.neu .status-mit_fehlern,
.neu .status-laeuft {
  color: var(--warnung);
}

.neu .status-abgebrochen {
  color: var(--fehler);
}

.neu .leise {
  color: var(--text-2);
  font-size: var(--text-13);
}

/* --- Stilseite --------------------------------------------------------------------------- */

.stil-abschnitt {
  margin-bottom: var(--a10);
}

.stil-abschnitt > h2 {
  margin-bottom: var(--a1);
  font-size: var(--text-20);
}

.stil-abschnitt > .stil-zweck {
  margin-bottom: var(--a4);
  color: var(--text-2);
}

.stil-reihe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--a2) var(--a3);
}

.stil-farben {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--a3);
}

.stil-farbe {
  overflow: hidden;
  font-size: var(--text-13);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.stil-farbe-feld {
  height: 48px;
  border-bottom: 1px solid var(--linie);
}

.stil-farbe-text {
  padding: var(--a2) var(--a3);
}

.stil-farbe-text code {
  display: block;
  color: var(--text-2);
}

.stil-schrift > * + * {
  margin-top: var(--a2);
}

.stil-abstaende {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--a3);
}

.stil-abstand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--a1);
  font-size: var(--text-13);
  color: var(--text-2);
}

.stil-abstand span:first-child {
  display: block;
  background: var(--primaer);
  border-radius: 2px;
}

/* Cockpit: Fristen als zwei Listen (überfällig, nächste 14 Tage) */
.fristen-listen {
  display: grid;
}

@media (min-width: 720px) {
  .fristen-listen {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fristen-listen > div + div {
    border-left: 1px solid var(--linie);
  }
}

.fristen-listen > div + div {
  border-top: 1px solid var(--linie);
}

@media (min-width: 720px) {
  .fristen-listen > div + div {
    border-top: 0;
  }
}

.neu .liste-titel {
  display: flex;
  align-items: center;
  gap: var(--a2);
  margin: 0;
  padding: var(--a2) var(--a4);
  font-size: var(--text-13);
  font-weight: var(--gewicht-mittel);
  color: var(--text-2);
  background: var(--flaeche-2);
  border-bottom: 1px solid var(--linie);
}

.neu .liste-leer {
  margin: 0;
  padding: var(--a3) var(--a4);
  color: var(--text-3);
}

.liste > li:has(> a.liste-zeile) {
  padding: 0;
}

.liste a.liste-zeile {
  align-items: center;
  padding: var(--a2) var(--a4);
}

.liste a.liste-zeile:hover {
  background: var(--flaeche-2);
}

.liste-neben .zahl {
  display: inline-block;
  min-width: 2ch;
  text-align: right;
  color: var(--text);
}

/* --- Vertragsseite: Kopf mit Fakten (Review 2, B7) ------------------------------------- */

.neu .kopf-pfad {
  margin: 0 0 var(--a1);
  font-size: var(--text-13);
  color: var(--text-3);
}

.vertrag-kopf {
  margin-bottom: var(--a4);
}

.fakten {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0 0 var(--a6);
  overflow: hidden;
  background: var(--linie);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

@media (min-width: 1024px) {
  .fakten {
    grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr));
  }
}

.fakt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: var(--a3) var(--a4);
  background: var(--flaeche);
}

.fakt-breit {
  grid-column: 1 / -1;
}

@media (min-width: 1024px) {
  .fakt-breit {
    grid-column: auto;
  }
}

.fakt dt {
  font-size: var(--text-13);
  color: var(--text-2);
}

.fakt dd {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin: 0;
}

.neu .fakt-name {
  font-size: var(--text-17);
  font-weight: var(--gewicht-mittel);
  color: var(--text);
}

.fakt-kontakt {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--a3);
  font-size: var(--text-13);
  overflow-wrap: anywhere;
}

.fakt-wert {
  font-size: var(--text-20);
  font-weight: var(--gewicht-fett);
  line-height: 1.25;
}

.neu a.fakt-wert {
  color: var(--text);
}

.neu .fakt-fehler,
.neu a.fakt-fehler,
.text-fehler {
  color: var(--fehler);
}

.neu .fakt-ok,
.neu a.fakt-ok {
  color: var(--ok);
}

.fakt-unter {
  font-size: var(--text-13);
  color: var(--text-3);
}

.tab tr.aktuell td {
  font-weight: var(--gewicht-mittel);
}

/* Checklisten (Vorlage stammdaten/_checklisten.html) */
.neu .checkliste + .checkliste {
  margin-top: var(--a3);
}

.neu .checkliste > summary {
  min-height: var(--ziel);
  padding: var(--a2) 0;
  font-weight: var(--gewicht-mittel);
  cursor: pointer;
}

.neu .checkpunkte {
  margin: 0;
  padding: 0;
  list-style: none;
}

.neu .checkpunkte form {
  display: flex;
  align-items: center;
  gap: var(--a3);
  margin: 0;
  padding: 2px 0;
}

.neu button.haken {
  flex: none;
  width: var(--ziel);
  height: var(--ziel);
  font: inherit;
  font-size: var(--text-17);
  color: var(--primaer-text);
  background: var(--primaer);
  border: 1px solid var(--primaer);
  border-radius: var(--radius);
  cursor: pointer;
}

.neu button.haken.zweitrangig {
  color: var(--text-3);
  background: var(--flaeche);
  border-color: var(--linie-stark);
}

@media (max-width: 1023px) {
  /* Kein leeres Feld, wenn die Zahl der Fakten ungerade aufgeht */
  .fakten > .fakt:last-child:nth-child(even) {
    grid-column: 1 / -1;
  }

  .seitenkopf-aktionen {
    width: 100%;
  }

  .seitenkopf-aktionen > *,
  .seitenkopf-aktionen > form > .knopf,
  .seitenkopf-aktionen > .menue > .knopf {
    flex: 1 1 auto;
  }

  .seitenkopf-aktionen > form,
  .seitenkopf-aktionen > .menue {
    display: flex;
  }
}

@media (max-width: 719px) {
  .kennzahl-wert {
    font-size: var(--text-20);
  }
}

/* Hinweis als Band (z. B. Bonität P8, abweichender Absender) */
.neu .hinweis-band {
  margin: 0 0 var(--a4);
  padding: var(--a3) var(--a4);
  color: var(--hinweis);
  background: var(--hinweis-grund);
  border-radius: var(--radius-klein);
}

.neu .hinweis-band.hinweis-warnung {
  color: var(--warnung);
  background: var(--warnung-grund);
}

/* Auswahl als Optionen (RadioSelect), z. B. Wunschtermin vor dem Fristende */
.feld-optionen > div,
.feld-optionen {
  display: flex;
  flex-direction: column;
  gap: var(--a1);
}

.feld-optionen label {
  display: inline-flex;
  align-items: center;
  gap: var(--a3);
  min-height: var(--ziel);
  cursor: pointer;
}

/* Radio- und Checkbox-Gruppe aus {% feld %} (Review 3, Punkt 2): fieldset ohne Rahmen,
   legend wie ein Label, Optionen untereinander, Label neben dem Feld (ganze Zeile ist die
   Klickfläche, mindestens 44 px), Fehler und Hilfe unter der Gruppe. */
fieldset.feld {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

fieldset.feld > legend {
  margin-bottom: 6px;
  padding: 0;
}

.feld-optionen > .feld-option {
  display: flex;
}

.feld-option > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.feld-fehlerhaft > .feld-optionen {
  padding-left: var(--a3);
  border-left: 2px solid var(--fehler);
}

/* --- Suche in der Kopfzeile (Review 2, B1) ----------------------------------------------
 * Am Desktop oben in der Seitenleiste, am Handy in der Kopfzeile. Strg+K bzw. ⌘K, Pfeile,
 * Enter (static/js/bausteine.js). Die Treffer liegen als Menü über der Seite. */

.suche {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
}

.suche > .symbol {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: var(--text-3);
  pointer-events: none;
}

.suche-eingabe {
  width: 100%;
  min-height: 36px;
  padding: 0 var(--a3) 0 34px;
  font: inherit;
  color: var(--text);
  background: var(--flaeche-2);
  border: 1px solid var(--linie);
  border-radius: var(--radius-klein);
  appearance: none;
}

.suche-eingabe::placeholder {
  color: var(--text-3);
}

.suche-eingabe:hover {
  border-color: var(--linie-stark);
}

.suche-eingabe:focus {
  background: var(--flaeche);
  border-color: var(--fokus);
  outline: 2px solid color-mix(in srgb, var(--fokus) 35%, transparent);
  outline-offset: 0;
}

.suche-taste {
  position: absolute;
  right: var(--a2);
  padding: 0 var(--a1);
  font-family: inherit;
  font-size: 11px;
  line-height: 18px;
  color: var(--text-3);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius-klein);
  pointer-events: none;
}

.suche-eingabe:focus ~ .suche-taste,
.suche-eingabe:not(:placeholder-shown) ~ .suche-taste {
  display: none;
}

.suche-treffer {
  position: absolute;
  z-index: 40;
  top: calc(100% + var(--a1));
  left: 0;
  width: max(100%, 440px);
  max-height: min(70vh, 560px);
  padding: var(--a1);
  overflow-y: auto;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  box-shadow: var(--schatten-menue);
}

.suche-treffer[hidden] {
  display: none;
}

.suche-gruppe + .suche-gruppe {
  margin-top: var(--a1);
  padding-top: var(--a1);
  border-top: 1px solid var(--linie);
}

.neu .suche-gruppe-titel {
  margin: 0;
  padding: var(--a1) var(--a2);
  font-size: 11px;
  font-weight: var(--gewicht-fett);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.neu a.suche-eintrag {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  padding: 6px var(--a2);
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-klein);
}

.neu a.suche-eintrag:hover,
.neu a.suche-eintrag[aria-selected="true"] {
  background: var(--primaer-weich);
}

.suche-eintrag-titel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--a2);
  font-weight: var(--gewicht-mittel);
  font-variant-numeric: tabular-nums;
}

.suche-eintrag-unter {
  overflow: hidden;
  font-size: var(--text-13);
  color: var(--text-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.neu a.suche-mehr {
  font-size: var(--text-13);
  color: var(--link);
}

.neu .suche-leer {
  margin: 0;
  padding: var(--a3);
  font-size: var(--text-13);
  color: var(--text-3);
}

/* Seite „Suche“ (ohne JavaScript oder über „alle … ansehen“) */
.suche-seite {
  display: flex;
  gap: var(--a2);
  margin: 0 0 var(--a6);
}

@media (max-width: 1023px) {
  .kopf-handy .marke-zeichen {
    width: 32px;
    height: 32px;
  }

  .kopf-handy .suche {
    position: static; /* die Treffer richten sich an der ganzen Kopfzeile aus */
  }

  .kopf-handy .suche > .symbol {
    left: calc(var(--a4) + 32px + var(--a3) + 10px);
  }

  .kopf-handy .suche-eingabe {
    min-height: 40px;
    font-size: 16px; /* iOS zoomt sonst beim Antippen */
  }

  .kopf-handy .suche-treffer {
    top: 100%;
    right: 0;
    width: auto;
    max-height: calc(100dvh - var(--hoehe-kopf) - var(--hoehe-unten));
    border-width: 0 0 1px;
    border-radius: 0 0 var(--radius) var(--radius);
  }

  .kopf-handy .suche-taste {
    display: none;
  }

  .neu .kopf-handy a.suche-eintrag {
    min-height: var(--ziel);
    justify-content: center;
  }
}

@media (pointer: coarse) {
  .suche-taste {
    display: none;
  }
}

/* --- Ziele mindestens 44 px am Handy und mit Finger, auf jeder Seite (Review 2, C4) -----
 * Gilt auch für das Markup der alten Seiten (Knöpfe ohne Klasse, Haken mit Label). */

@media (max-width: 1023px), (pointer: coarse) {
  .neu button,
  .neu input[type="submit"],
  .neu input[type="button"],
  .neu input[type="reset"],
  .neu .knopf {
    min-height: var(--ziel);
  }

  /* Haken und Optionen: das Label ist das Ziel, mindestens 44 px hoch */
  .neu label:has(> input[type="checkbox"]),
  .neu label:has(> input[type="radio"]) {
    display: inline-flex;
    align-items: center;
    gap: var(--a2);
    min-height: var(--ziel);
  }

  /* Label neben dem Haken (Django: <p><label for>…</label> <input type=checkbox></p>) */
  .neu :is(p, div, li, td):has(> input[type="checkbox"], > input[type="radio"]) > label {
    display: inline-flex;
    align-items: center;
    min-height: var(--ziel);
  }

  /* Haken ohne Label (etwa in einer Tabellenzeile): das Feld selbst wird zum Ziel */
  .neu input[type="checkbox"]:not(label > *, :is(p, div, li, td):has(> label) > *),
  .neu input[type="radio"]:not(label > *, :is(p, div, li, td):has(> label) > *) {
    width: var(--ziel);
    height: var(--ziel);
    margin: 0;
  }
}

/* Stilseite: die Trefferliste der Suche als Beispiel, ruhend statt als Menü */
.suche-treffer.stil-suche {
  position: static;
  width: auto;
  max-width: 440px;
  box-shadow: none;
}

/* === Bausteine aus R2-7 (Stammdaten): Filterleiste, Fortschritt, Auswahl-Treffer ======== */

/* Ausgeblendete Teile bleiben aus, auch wenn ihre Klasse ein display setzt (data-wenn) */
.neu [hidden] {
  display: none !important;
}

/* Filterleiste über Listen: Suche breit, Auswahlen daneben; am Handy untereinander */
.filterleiste {
  display: flex;
  flex-wrap: wrap;
  gap: var(--a2);
  margin: 0 0 var(--a3);
}

.filterleiste > .feld-eingabe,
.filterleiste > .feld-auswahl {
  width: auto;
  min-width: 0;
  flex: 1 1 160px;
}

.filterleiste > .filterleiste-suche {
  flex: 3 1 240px;
}

.neu .filterleiste-ergebnis {
  margin: 0 0 var(--a2);
}

/* Gruppe von Feldern ohne Rahmen (fieldset), z. B. „Mieter“ im neuen Vertrag */
.feld-gruppe {
  display: flex;
  flex-direction: column;
  gap: var(--a2);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.feld-gruppe > legend {
  margin-bottom: 6px;
  padding: 0;
}

.feld-einzug {
  padding: var(--a3) 0 0 var(--a4);
  border-left: 2px solid var(--linie);
}

/* Checkbox auf Höhe des Nachbarfelds (felder-2) */
@media (min-width: 600px) {
  .feld-unten {
    align-self: end;
  }
}

/* Treffer einer Auswahl als Zeilen mit Radio (Parteisuche) */
.partei-treffer {
  display: flex;
  align-items: center;
  gap: var(--a3);
  min-height: var(--ziel);
  padding: var(--a1) var(--a3);
  cursor: pointer;
  border: 1px solid var(--linie);
  border-radius: var(--radius-klein);
}

.partei-treffer:has(input:checked) {
  background: var(--primaer-weich);
  border-color: var(--primaer);
}

.partei-name {
  font-weight: var(--gewicht-mittel);
}

/* Fortschrittsleiste eines Assistenten (Übergabe am Handy, Review 2, B8) */
.fortschritt {
  display: flex;
  gap: var(--a1);
  margin: 0 0 var(--a3);
  padding: 0;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
}

.fortschritt li {
  flex: 1 0 auto;
  min-width: 0;
}

.neu .fortschritt a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--a1);
  min-height: var(--ziel);
  padding: var(--a1) var(--a1) var(--a2);
  font-size: var(--text-13);
  color: var(--text-3);
  text-align: center;
  text-decoration: none;
  border-bottom: 3px solid var(--linie);
}

.fortschritt-nummer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-weight: var(--gewicht-fett);
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  background: var(--flaeche-2);
  border-radius: var(--radius-rund);
}

.neu .fortschritt-erledigt a {
  color: var(--text-2);
  border-bottom-color: var(--primaer);
}

.fortschritt-erledigt .fortschritt-nummer {
  color: var(--primaer-text);
  background: var(--primaer);
}

.neu .fortschritt-luecke a {
  color: var(--warnung);
  border-bottom-color: var(--warnung);
}

.fortschritt-luecke .fortschritt-nummer {
  color: var(--warnung);
  background: var(--warnung-grund);
}

.neu .fortschritt-aktuell a {
  font-weight: var(--gewicht-mittel);
  color: var(--text);
  border-bottom-color: var(--text);
}

.fortschritt-aktuell .fortschritt-nummer {
  color: var(--flaeche);
  background: var(--text);
}

/* Am Handy nur die Nummern, der Titel des Schritts steht darunter */
@media (max-width: 599px) {
  .fortschritt-titel {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

.neu .schritt-zeile {
  margin: 0 0 var(--a3);
}

/* Knöpfe des Assistenten: am Handy unten fest, mit dem Daumen erreichbar */
@media (max-width: 1023px) {
  .schritt-fuss {
    position: sticky;
    bottom: calc(var(--hoehe-unten) + env(safe-area-inset-bottom));
    z-index: 5;
    margin-top: var(--a4);
    padding: var(--a3) 0;
    background: var(--grund);
    border-top: 1px solid var(--linie);
  }

  .schritt-fuss .knopf {
    flex: 1;
  }
}

.neu .zaehler-eingabe {
  margin: 0;
  padding: var(--a3) var(--a4) var(--a4);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.neu .zaehler-eingabe legend {
  padding: 0 var(--a1);
  font-weight: var(--gewicht-mittel);
}

.neu .zusammenfassung-titel {
  margin: var(--a5) 0 var(--a2);
}

/* Bilder als Raster (Einheit, Übergabe) */
.bilder-raster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--a2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.bilder-raster li {
  display: flex;
  flex-direction: column;
  gap: var(--a1);
}

.bilder-raster img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-klein);
}

/* --- Filterleiste (R2-9): Felder nebeneinander über einer Liste ----------------------------
   <form class="filterleiste">{% feld f.suche %}…<div class="filterleiste-knoepfe">…</div></form>
   Am Desktop eine Zeile, am Handy brechen die Felder um; der Knopf steht unten. */

.filterleiste {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--a3);
  margin: 0 0 var(--a4);
}

/* Felder schmal genug, dass am Desktop fünf Felder, Suche und Knopf in eine Zeile passen und
   am Handy (390 px) zwei nebeneinander; die Suche (.feld-breit) wächst dreimal so stark. */
.filterleiste > .feld {
  flex: 1 1 9rem;
  min-width: 0;
  margin: 0;
}

.filterleiste > .feld-breit {
  flex: 3 1 16rem;
}

.filterleiste-knoepfe {
  display: flex;
  gap: var(--a2);
}

/* Filter sind immer freiwillig: kein „optional“ an jedem Feld. Dasselbe für Formulare, in
   denen jedes Feld freiwillig ist (z. B. die Ablesung: leere Felder bleiben unverändert). */
.filterleiste .feld-optional,
.ohne-optional .feld-optional {
  display: none;
}

/* Aktiver Filter als Zeile über der Liste: „Nur Vorgänge zu V-0005 · alle zeigen“ */
.filter-aktiv {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--a2);
  margin: 0 0 var(--a4);
  color: var(--text-2);
}

@media (max-width: 599px) {
  .filterleiste-knoepfe,
  .filterleiste-knoepfe .knopf {
    flex: 1 1 auto;
  }
}

/* --- Druck (R2-9): Seiten wie die Besuchsliste der Zähler ohne Leiste und Knöpfe ----------
   .nur-bildschirm verschwindet beim Drucken, .nur-druck erscheint nur dort. */

.neu .nur-druck {
  display: none;
}

@media print {
  .neu .leiste,
  .neu .kopf-handy,
  .neu .unten,
  .neu .stichtag-band,
  .neu .toasts,
  .neu .nur-bildschirm {
    display: none !important;
  }

  .neu .nur-druck {
    display: table-cell;
  }

  body.neu,
  .neu .haupt {
    padding: 0;
    color: #000;
    background: #fff;
  }

  .neu .geruest {
    display: block;
    background: none;
  }

  .neu .karte,
  .neu .tabelle-box {
    border-color: #000;
    break-inside: avoid-page;
  }

  .neu .tab th,
  .neu .tab td {
    border: 1px solid #000;
  }

  .neu .tab-karten thead {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
  }

  .neu .tab-karten tr {
    display: table-row;
  }

  .neu .tab-karten td {
    display: table-cell;
  }

  .neu .tab-karten td[data-titel]::before {
    content: none;
  }

  .neu a {
    color: inherit;
    text-decoration: none;
  }

  .neu .schreibfeld {
    min-width: 7rem;
  }
}

/* Karten-Tabellen am Handy (R2-9): Die Tabelle wird nie breiter als der Bildschirm. Ein
   langer Wert (Meldung, Zweck) rutscht unter seine Beschriftung, statt nach rechts aus dem
   Bild zu laufen. Mehrere Teile einer Zelle stehen in einem Element (span/div). */
@media (max-width: 1023px) {
  .tab-karten,
  .tab-karten tbody {
    display: block;
    width: 100%;
  }

  .tab-karten td {
    flex-wrap: wrap;
    min-width: 0;
  }

  .tab-karten td > * {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .tab-karten td.eng {
    width: auto;
  }

  .tab-karten td > .aufklapper {
    flex: 1 1 100%;
  }
}

/* --- R2-8: geteilte Ansicht, PDF groß, Zeilenaktionen, Filterleiste -------------------- */

/* Geteilte Ansicht (Review 2, B9 und B13): links das PDF (mindestens die halbe Breite,
   läuft beim Scrollen mit), rechts Formular oder Text. Am Handy untereinander. */
.geteilt {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--a6);
}

@media (min-width: 1024px) {
  .geteilt {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: start;
  }

  .geteilt-vorschau {
    position: sticky;
    top: var(--a4);
  }

  .geteilt-vorschau .pdf-rahmen {
    height: calc(100vh - 120px);
    min-height: 480px;
    aspect-ratio: auto;
  }
}

.pdf-vorschau-gross {
  margin: 0;
}

.pdf-rahmen {
  display: block;
  width: 100%;
  aspect-ratio: 210 / 297;
  background: var(--flaeche-2);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.pdf-vorschau-gross figcaption {
  margin-top: var(--a2);
  font-size: var(--text-13);
}

/* Mailtext neben dem PDF (B13) */
.mailtext {
  margin: 0;
  padding: var(--a4);
  font: inherit;
  font-size: var(--text-15);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

/* Filterleiste (R2-7) mit beschrifteten Feldern: Suche und Monat sichtbar, alles Weitere
   im Aufklapper (B11) */
.filterleiste:has(> .feld) {
  gap: var(--a3);
  align-items: end;
  margin-bottom: var(--a4);
}

.filterleiste > .aufklapper {
  flex: 1 1 100%;
}

.filterleiste .felder {
  margin-bottom: var(--a3);
}

/* Aktionen in einer Tabellenzeile (Fristen: erledigt, verschieben) */
.zeilen-aktionen {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--a2);
  justify-content: flex-end;
}

.zeilen-aktionen form {
  margin: 0;
}

/* Datum im Menü (Frist verschieben): Feld und Knopf in einer Zeile */
.menue-liste .menue-datum > span {
  display: flex;
  gap: var(--a2);
  padding: var(--a2) var(--a3);
}

.menue-liste .menue-datum input {
  min-width: 0;
}

/* Auswahl in einer Zeile (Abbuchung verknüpfen, Empfänger einer Serie) */
.wahl-zeile {
  display: flex;
  align-items: center;
  gap: var(--a3);
  min-height: var(--ziel);
  cursor: pointer;
}

/* „mehr laden“ unter einer Tabelle (B11) */
.mehr-laden td {
  text-align: center;
}

/* Bündel in einer Tabelle (z. B. 14 Eichfristen): der Aufklapper füllt die Zeile */
.tab td.buendel {
  padding: 0;
}

.tab td.buendel > .aufklapper {
  border: 0;
  border-radius: 0;
}

.tab td.buendel .tab {
  font-size: var(--text-15);
}

form.sendet .datei-knoepfe {
  opacity: 0.6;
  pointer-events: none;
}

/* Mehrteiliges Feld (Monat und Jahr) in einer Zeile */
.feld-mehrteilig {
  display: flex;
  gap: var(--a2);
}

.feld-mehrteilig > * {
  flex: 1 1 0;
  min-width: 0;
}

/* Am Handy (Review 2, C5): Die verborgene Kopfzeile von .tab-karten ist absolut gesetzt.
   Ohne eigenen Bezugsrahmen ragte sie aus dem scrollenden Kasten und machte die Seite
   breiter (Datenstand bei 390 px mit breiterer Schrift). Knöpfe in Karten und Zeilen
   dürfen umbrechen. */
.tabelle-box {
  position: relative;
}

@media (max-width: 1023px) {
  .zeilen-aktionen {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .karte-rumpf .knopf,
  .liste-neben .knopf {
    max-width: 100%;
    white-space: normal;
  }
}

/* --- Raster 1:2 (schmale Spalte links), z. B. Klärfall: Umsatz links, Karten rechts ------ */

@media (min-width: 1024px) {
  .raster-1-2 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }
}

/* --- Posteingang (Review 2, B2): links die Arten, rechts die Posten ---------------------
 * Am Desktop zwei Spalten. Am Handy erst die Arten; nach der Wahl (.posteingang-gewaehlt)
 * nur die Liste mit „← Arten“. Die Zeile: Wahl, Inhalt mit Arbeitsfläche, Knöpfe rechts. */

.posteingang {
  display: grid;
  gap: var(--a4);
  align-items: start;
  /* Lädt die Liste neu (posteingangNeu), ersetzt HTMX den ganzen Posteingang. Mit dem
     Scroll-Anker des Browsers sprang die Seite dann ans Ende (Review 3, Punkt 3). */
  overflow-anchor: none;
}

@media (min-width: 1024px) {
  .posteingang {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .posteingang-arten {
    position: sticky;
    top: var(--a4);
  }

  .posteingang-zurueck {
    display: none;
  }
}

@media (max-width: 1023px) {
  .posteingang:not(.posteingang-gewaehlt) .posteingang-liste,
  .posteingang.posteingang-gewaehlt .posteingang-arten {
    display: none;
  }
}

.arten-liste {
  margin: 0;
  padding: var(--a1);
  list-style: none;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.neu .arten-liste a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--a2);
  min-height: 36px;
  padding: var(--a1) var(--a3);
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-klein);
}

.neu .arten-liste a:hover {
  background: var(--flaeche-2);
}

.neu .arten-liste a[aria-current="page"] {
  font-weight: var(--gewicht-mittel);
  background: var(--primaer-weich);
}

.arten-trenner {
  margin-top: var(--a1);
  padding-top: var(--a1);
  border-top: 1px solid var(--linie);
}

@media (max-width: 1023px), (pointer: coarse) {
  .neu .arten-liste a {
    min-height: var(--ziel);
  }
}

.posteingang-liste {
  min-width: 0;
}

.posteingang-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--a2) var(--a4);
  margin-bottom: var(--a3);
}

.neu .posteingang-kopf h2 {
  margin: 0;
  margin-right: auto;
  font-size: var(--text-17);
}

.posteingang-sammel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--a2);
}

.posten-liste {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.posten-liste .posten-liste {
  border: 0;
  border-top: 1px solid var(--linie);
  border-radius: 0;
}

.posten-zeile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: var(--a1) var(--a3);
  padding: var(--a3) var(--a4);
  border-top: 1px solid var(--linie);
  outline: 0;
}

.posten-liste > li:first-child {
  border-top: 0;
}

.posten-zeile:hover {
  background: color-mix(in srgb, var(--flaeche-2) 50%, var(--flaeche));
}

/* Die Auswahl (j/k): Streifen links und weicher Grund */
.posten-zeile.posten-aktiv {
  background: var(--flaeche-2);
  box-shadow: inset 3px 0 0 var(--primaer);
}

.posten-fehlerhaft {
  box-shadow: inset 3px 0 0 var(--fehler);
}

.posten-wahl {
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
  cursor: pointer;
}

@media (max-width: 1023px), (pointer: coarse) {
  .posten-wahl {
    align-items: center;
    justify-content: center;
    min-width: var(--ziel);
    min-height: var(--ziel);
    margin: -10px 0 0 -10px;
    padding-top: 0;
  }
}

.posten-inhalt {
  min-width: 0;
}

.neu .posten-titel {
  margin: 0;
  overflow-wrap: anywhere;
}

.posten-art {
  margin-right: var(--a1);
  font-size: var(--text-13);
  color: var(--text-2);
}

.neu .posten-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--a3);
  margin: 0;
  font-size: var(--text-13);
  color: var(--text-2);
}

.neu .posten-hinweis {
  margin: var(--a1) 0 0;
  font-size: var(--text-13);
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.posten-knoepfe {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: var(--a1);
}

/* Übernehmen: in der gewählten Zeile die Hauptaktion (eine je Ansicht) */
.posten-aktiv .knopf-uebernehmen {
  color: var(--primaer-text);
  background: var(--primaer);
  border-color: var(--primaer);
}

@media (max-width: 1023px) {
  .posten-zeile {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .posten-knoepfe {
    grid-column: 2;
    justify-content: flex-start;
  }
}

/* Arbeitsfläche in der Zeile: Umsatz, Felder, Vorschlag */
.posten-arbeit {
  margin-top: var(--a2);
}

.neu .posten-umsatz {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--a3);
  margin: 0 0 var(--a2);
}

.posten-zweck {
  min-width: 0;
  overflow-wrap: anywhere;
}

.neu .posten-vorschlag {
  margin: var(--a1) 0 0;
  font-size: var(--text-13);
  color: var(--text-3);
}

/* Felder in einer Zeile (Umsatz einordnen, Kopf einer Gruppe); am Handy untereinander */
.zeile-formular {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--a2) var(--a3);
}

.zeile-formular .feld-auswahl,
.zeile-formular .feld-eingabe {
  width: auto;
  min-width: 140px;
  max-width: 100%;
  flex: 0 1 200px;
}

@media (min-width: 1024px) and (pointer: fine) {
  .zeile-formular .haken-label {
    min-height: 36px;
  }
}

@media (max-width: 599px) {
  .zeile-formular .feld-auswahl,
  .zeile-formular .feld-eingabe {
    flex-basis: 100%;
  }
}

/* Gruppe gleicher Ursache (Review 1, Punkt 5) */
.posten-gruppe {
  border-top: 1px solid var(--linie);
}

.posten-gruppe > .aufklapper {
  border: 0;
  border-radius: 0;
  background: color-mix(in srgb, var(--primaer-weich) 40%, var(--flaeche));
}

.posten-gruppe-kopf {
  padding: 0 var(--a4) var(--a3);
}

/* --- Wahl-Karten (Review 2, B4): Vorschlag und Alternativen, ein Klick wählt ------------- */

.wahl-karten {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--a3);
  margin: var(--a2) 0;
}

.wahl-karten:empty {
  display: none;
}

.wahl-karte {
  display: flex;
  flex-direction: column;
  gap: var(--a1);
  min-width: 0;
  padding: var(--a3);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
}

.wahl-karte-vorschlag {
  border-color: var(--primaer);
  box-shadow: inset 0 0 0 1px var(--primaer);
}

.wahl-karte-kopf {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--a2);
}

.wahl-karte-marke {
  margin-left: auto;
  font-size: var(--text-13);
  font-weight: var(--gewicht-mittel);
  color: var(--primaer);
}

.neu .wahl-karte-name {
  margin: 0;
  font-weight: var(--gewicht-mittel);
  overflow-wrap: anywhere;
}

.neu .wahl-karte-einheit,
.neu .wahl-karte-hinweis {
  margin: 0;
  font-size: var(--text-13);
  color: var(--text-2);
}

.wahl-karte-posten {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-13);
}

.wahl-karte-posten li {
  display: flex;
  justify-content: space-between;
  gap: var(--a2);
}

.neu .wahl-karte-summe {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding-top: var(--a1);
  border-top: 1px solid var(--linie);
}

.wahl-karte .knopf {
  margin-top: auto;
}

.vertrag-suche {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--a3);
}

/* Abweichung am Feld (Review 3, Punkt 7): Hinweis, bevor man bestätigt (bausteine.js) */
.feld-abweichung,
.neu p.feld-abweichung {
  margin: 0;
  padding: var(--a1) var(--a2);
  font-size: var(--text-13);
  color: var(--warnung);
  background: var(--warnung-grund);
  border-radius: var(--radius-klein);
}

/* Gelesener Wert (Review 3, Punkt 7): aus dem PDF, noch nicht bestätigt */
.gelesen {
  color: var(--text-3);
}

.gelesen-zusatz {
  font-size: var(--text-13);
  font-style: italic;
}

/* Mauerwerk (Review 3, Punkt 10): [data-mauerwerk] am Raster, bausteine.js setzt je Kachel
   die Zahl der 4-px-Zeilen. Der Abstand nach unten steckt in dieser Zahl. */
.mauerwerk-an {
  grid-auto-rows: 4px;
  row-gap: 0;
}

.mauerwerk-an > li {
  align-self: start;
}
