/* Konto-Seite „Rechnungen“ (konto/rechnungen.html): ergänzt konto.css, nutzt deren Tokens und Klassen.
   Ruhig: keine farbigen Hinweisbalken, Farbe nur in kleinen Punkten und Chips. */

.r-raster { display: flex; flex-direction: column; gap: 16px; }
.r-raster > .k-karte + .k-karte { margin-top: 0; }
.r-email { min-width: 0; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--text-3); }
/* .r-titel: Baustein .k-kartentitel in konto.css */
.r-zahl { text-align: right !important; font-variant-numeric: tabular-nums; }

/* ---------- Kopf mit Summen ---------- */
/* „Neue Rechnung“ steht schon in der Navigation (Seitenleiste ab 900 px, darunter der runde Knopf): hier nicht doppelt */
.k-seite--nav .r-neu { display: none; }
.r-kopfzeile { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.r-neu { flex: none; }
.r-summen { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.r-summe { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface-2); }
.r-summe dt { font-size: 13px; font-weight: 500; color: var(--text-3); }
.r-summe dd { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text); overflow-wrap: anywhere; }
.r-summen.hat-ueberfaellige .r-summe--ueberfaellig dd { color: var(--error-text); }
.r-summen:not(.hat-ueberfaellige) .r-summe--ueberfaellig dd { color: var(--text-3); }

/* Rechnungen-Kopf: Titel und zwei kleine Kennzahlen in einer Zeile (keine Kacheln).
   .r-summe/.r-filter selbst nutzt auch export.html als Kachel bzw. Segmente: darum hier nur eingeschränkt. */
.r-kopf { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 0; }
.r-kopf .r-summen { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.r-kopf .r-summe { flex-direction: column; gap: 0; padding: 0; border-radius: 0; background: none; }
.r-kopf .r-summe dt { font-size: 13px; font-weight: 500; color: var(--text-3); }
.r-kopf .r-summe dd { font-size: 20px; font-weight: 650; letter-spacing: -.015em; }
.r-kopf .r-summe + .r-summe { padding-left: 28px; border-left: 1px solid var(--border); }

/* ---------- Filter und Suche ---------- */
.r-werkzeuge { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.r-filter {
  display: inline-flex; flex-wrap: wrap; gap: 2px; margin: 0; padding: 3px; min-width: 0;
  border: 0; border-radius: 10px; background: var(--surface-2);
}
.r-filter label { position: relative; cursor: pointer; }
.r-filter input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.r-filter label > span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px;
  border-radius: 7px; font-size: 14px; font-weight: 500; color: var(--text-3); white-space: nowrap;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.r-filter label:hover > span { color: var(--text); }
.r-filter input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.r-filter input:focus-visible + span { box-shadow: var(--ring); }
.r-filter-zahl { font-size: 12px; font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }
.r-filter-zahl:empty { display: none; }

/* Rechnungsliste: Chip-Leiste (Pillen) statt Segmentfeld, eine Zeile, am Handy seitlich scrollbar */
.r-werkzeuge .r-filter {
  order: -1; display: flex; flex-wrap: nowrap; gap: 8px; padding: 0; border-radius: 0; background: none; min-inline-size: 0; max-width: 100%;
  overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; scroll-padding-inline: 4px;
}
.r-werkzeuge .r-filter::-webkit-scrollbar { display: none; }
.r-werkzeuge .r-filter label { flex: none; }
.r-werkzeuge .r-filter label > span {
  min-height: 36px; padding: 0 14px; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--border-strong);
  color: var(--text-2); background: var(--surface);
}
.r-werkzeuge .r-filter label:hover > span { background: var(--surface-2); }
.r-werkzeuge .r-filter input:checked + span { background: var(--text); color: var(--surface); box-shadow: none; }
.r-werkzeuge .r-filter input:checked + span .r-filter-zahl { color: inherit; opacity: .7; }
.r-werkzeuge .r-filter input:focus-visible + span { box-shadow: var(--ring); }

.r-suche { position: relative; flex: 0 1 280px; min-width: 0; }
.r-suche .k-ikon, .r-suche .k-ikon-platz { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; color: var(--text-3); pointer-events: none; }
.r-suche .k-eingabe { min-height: 38px; padding: 6px 12px 6px 38px; font-size: 15px; }
.r-suche .k-eingabe::-webkit-search-cancel-button { cursor: pointer; }

/* Ruhiger Plan-Hinweis: nur Text und Link */
.r-plan { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 14px; color: var(--text-2); }
.r-plan p { margin: 0; }

/* ---------- Liste ---------- */
/* Die Liste richtet sich nach ihrer eigenen Breite (nicht nach dem Fenster): mit der Seitenleiste ab 900 px
   ist sie deutlich schmaler als das Fenster. Darum Container-Abfragen statt Media-Abfragen. */
.r-liste-karte { container: r-liste / inline-size; }
.r-tabelle { width: 100%; border-collapse: collapse; font-size: 14px; }
.r-tabelle th { padding: 0 10px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3); white-space: nowrap; }
.r-tabelle td { padding: 12px 10px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.r-tabelle th:first-child, .r-tabelle td:first-child { padding-left: 0; }
.r-tabelle th:last-child, .r-tabelle td:last-child { padding-right: 0; }
.r-tabelle tbody tr:last-child td { border-bottom: 0; }
/* Die ganze Zeile ist Tipp-Bereich (öffnet den Verlauf); Knöpfe und Menü darin behalten ihre eigene Aktion */
.r-tabelle tbody tr { cursor: pointer; transition: background-color .15s; }
@media (hover: hover) {
  .r-tabelle tbody tr:hover { background: var(--surface-2); }
}
@media (prefers-reduced-motion: no-preference) {
  .r-tabelle tbody tr { animation: k-einblenden .22s var(--ease) both; }
}

.r-rechnung { min-width: 0; }
.r-zeile-knopf {
  display: block; max-width: 100%; padding: 0; margin: 0; border: 0; border-radius: 4px; background: none;
  font: inherit; text-align: left; color: inherit; cursor: pointer;
}
.r-zeile-knopf:focus-visible { outline: none; box-shadow: var(--ring); }
.r-kunde { display: block; color: var(--text); font-size: 15px; font-weight: 550; overflow-wrap: anywhere; }
.r-meta { display: block; margin-top: 2px; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.r-nummer { color: var(--text-3); font-variant-numeric: tabular-nums; }
.r-meta-faellig { display: none; white-space: nowrap; }
tr[data-status="ueberfaellig"] .r-meta-faellig, tr[data-status="ueberfaellig"] .r-faellig { color: var(--error-text); }
.r-zusatz { display: block; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.r-faellig { white-space: nowrap; font-variant-numeric: tabular-nums; }
.r-betrag-zelle { white-space: nowrap; }
.r-betrag-haupt { display: block; color: var(--text); font-size: 15px; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.r-status { white-space: nowrap; }
.r-status .k-chip { font-size: 12px; min-height: 22px; }

/* Status-Chip: Baustein .k-chip in konto.css */

/* ---------- Aktionen ---------- */
.r-aktionen-zelle { width: 1%; white-space: nowrap; cursor: default; }
.r-aktionen { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.r-menue-huelle { position: relative; }
.r-mehr, .r-schnell {
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: var(--radius-md); background: none; color: var(--text-3); cursor: pointer;
  transition: background-color .15s, color .15s;
}
.r-mehr .k-ikon, .r-schnell .k-ikon { width: 20px; height: 20px; }
.r-mehr:hover, .r-mehr[aria-expanded="true"], .r-schnell:hover { background: var(--surface-3, var(--border)); color: var(--text); }
.r-schnell { color: var(--primary); }
.r-mehr:focus-visible, .r-schnell:focus-visible { outline: none; box-shadow: var(--ring); }
.r-menue {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 228px; padding: 6px;
  display: flex; flex-direction: column; cursor: default;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.r-menue.nach-oben { top: auto; bottom: calc(100% + 6px); }
@media (prefers-reduced-motion: no-preference) {
  .r-menue:not([hidden]) { animation: r-menue-auf .14s var(--ease); }
}
@keyframes r-menue-auf { from { opacity: 0; scale: .97; } }
.r-menue-punkt {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-2); font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.r-menue-punkt .k-ikon { width: 16px; height: 16px; color: var(--text-3); }
.r-menue-punkt:hover, .r-menue-punkt:focus-visible { background: var(--surface-2); color: var(--text); box-shadow: none; outline: none; }
.r-menue-punkt:hover .k-ikon, .r-menue-punkt:focus-visible .k-ikon { color: var(--text-2); }
.r-menue-trenner { height: 1px; margin: 4px 2px; background: var(--border); }

/* ---------- Info-Knopf und Sprechblase (wie in der App) ---------- */
.r-info {
  position: relative; flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0;
  margin: 0 0 0 4px; border: 0; border-radius: 50%; background: none; color: var(--text-3); cursor: help; vertical-align: -4px;
}
.r-info .k-ikon { width: 16px; height: 16px; stroke-width: 2; }
.r-info:hover, .r-info[aria-describedby] { color: var(--primary); }
.r-info:focus-visible { outline: none; box-shadow: var(--ring); }
.r-info::after { content: ""; position: absolute; inset: -12px; } /* Trefferfläche 44 × 44 px */
/* Info-Knopf direkt nach einem Kontrollkästchen (label.k-haken): das i sitzt auf der ersten Textzeile
   (14 px Text, Zeile 21 px, Mitte bei 10,5 px) wie das Kästchen, nicht auf der Mitte der 44 px hohen Zeile */
.k-haken + .r-info { align-self: flex-start; margin-top: 1px; vertical-align: top; }
.r-tipp {
  position: fixed; inset: auto; margin: 0; z-index: 1000; max-width: min(280px, calc(100vw - 16px)); padding: 8px 11px;
  border: 0; border-radius: 8px; background: #1D2939; color: #fff; box-shadow: 0 6px 20px rgb(16 24 40 / .2);
  font: 500 13px/1.45 var(--font); text-align: left; white-space: normal; overflow: visible; pointer-events: none;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .r-tipp { background: #F4F4F5; color: #18181B; } }
:root[data-theme="dark"] .r-tipp { background: #F4F4F5; color: #18181B; }
.r-tipp::after {
  content: ""; position: absolute; left: calc(var(--pfeil-x, 50%) - 6px); width: 12px; height: 12px;
  background: inherit; transform: rotate(45deg); border-radius: 2px;
}
.r-tipp[data-seite="oben"]::after { bottom: -5px; }
.r-tipp[data-seite="unten"]::after { top: -5px; }
@media (prefers-reduced-motion: no-preference) {
  .r-tipp { animation: r-tipp-auf 120ms ease-out; }
}
@keyframes r-tipp-auf { from { opacity: 0; transform: translateY(2px); } }

/* ---------- Automatische Erinnerungen ---------- */
.r-er-form { display: flex; flex-direction: column; gap: 20px; }
.r-schalter-zeile { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.r-schalter-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; cursor: pointer; }
.r-schalter-titel { font-size: 15px; font-weight: 550; color: var(--text); }
/* Schalter .r-schalter: allgemein in konto.css (auch auf der Übersicht) */

.r-er-felder {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px;
  padding-top: 20px; border-top: 1px solid var(--border); transition: opacity .2s;
}
.r-zahl-feld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.r-zahl-eingabe { display: flex; align-items: center; gap: 8px; min-width: 0; }
.r-zahl-eingabe .k-eingabe { width: 76px; flex: none; text-align: right; font-variant-numeric: tabular-nums; }
.r-zahl-eingabe .k-klein { min-width: 0; }
.r-er-kopie { grid-column: 1 / -1; }
.r-er-fuss { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; }
.r-bald-zeile { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.r-bald {
  display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; border-radius: 99px;
  background: var(--surface-2); color: var(--text-3); font-size: 12px; font-weight: 600;
}
.r-er-status:empty { display: none; }
.r-er-fuss:has(.r-er-status:empty) { display: none; }

/* ---------- Kurze Meldung unten ---------- */
.r-meldung {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 50; translate: -50% 0;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 99px;
  background: #1D2939; color: #fff; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 500; text-align: center;
  transition: opacity .25s, translate .25s var(--ease);
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .r-meldung { background: #F4F4F5; color: #18181B; } }
:root[data-theme="dark"] .r-meldung { background: #F4F4F5; color: #18181B; }
.r-meldung.ist-weg { opacity: 0; translate: -50% 6px; }
@media (prefers-reduced-motion: no-preference) {
  .r-meldung:not([hidden]) { animation: r-meldung-auf .22s var(--ease); }
}
@keyframes r-meldung-auf { from { opacity: 0; translate: -50% 8px; } }

/* ---------- Dialoge ---------- */
.r-dialog {
  width: min(460px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); padding: 0; border: 0;
  border-radius: var(--radius-xl); background: var(--surface); color: var(--text);
  box-shadow: 0 24px 48px -12px rgb(16 24 40 / .25); overflow: hidden;
}
.r-dialog--breit { width: min(560px, calc(100vw - 24px)); }
.r-dialog::backdrop { background: rgb(12 17 29 / .45); backdrop-filter: blur(3px); }
@media (prefers-reduced-motion: no-preference) {
  .r-dialog[open] { animation: r-dialog-auf .18s var(--ease); }
}
@keyframes r-dialog-auf { from { opacity: 0; scale: .97; } }
.r-dialog-form { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.r-dialog-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 4px 24px; }
.r-dialog-titel { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.r-dialog-titel h2 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.r-dialog-titel .k-klein { overflow-wrap: anywhere; }
.r-schliessen {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none; margin: -4px -6px 0 0; padding: 0;
  border: 0; border-radius: var(--radius-md); background: none; color: var(--text-3); cursor: pointer;
}
.r-schliessen:hover { background: var(--surface-2); color: var(--text); }
.r-schliessen .k-ikon { width: 20px; height: 20px; }
.r-dialog-inhalt { display: flex; flex-direction: column; gap: 16px; padding: 16px 24px 8px; overflow-y: auto; overscroll-behavior: contain; }
.r-dialog-fuss { display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; gap: 10px; padding: 16px 24px 24px; }
.r-dialog-fuss .k-knopf { flex: 0 1 auto; }
.r-dialog-fehler { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--error-text); }
.r-dialog-fehler::before { /* Lucide alert aus konto.css (--k-maske-fehler), 20 px wie alle Meldungen */
  content: ""; flex: none; width: 20px; height: 20px; background: var(--error);
  -webkit-mask: var(--k-maske-fehler) center / 20px no-repeat; mask: var(--k-maske-fehler) center / 20px no-repeat;
}
.r-textfeld { min-height: 132px; resize: vertical; line-height: 1.5; }

/* Prüf-Ampel: drei kleine Lichter, das aktive leuchtet */
.r-ampel { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.r-ampel-kopf { display: flex; align-items: center; gap: 14px; }
.r-ampel-licht {
  display: inline-flex; flex-direction: column; gap: 4px; flex: none; padding: 6px;
  border-radius: 99px; background: var(--surface-2);
}
.r-licht { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); transition: background-color .25s, box-shadow .25s; }
.r-ampel[data-stufe="rot"] .r-licht--rot { background: #F04438; box-shadow: 0 0 0 3px rgb(240 68 56 / .18); }
.r-ampel[data-stufe="gelb"] .r-licht--gelb { background: #F79009; box-shadow: 0 0 0 3px rgb(247 144 9 / .2); }
.r-ampel[data-stufe="gruen"] .r-licht--gruen { background: #17B26A; box-shadow: 0 0 0 3px rgb(23 178 106 / .18); }
@media (prefers-reduced-motion: no-preference) {
  .r-ampel[data-stufe="laeuft"] .r-licht { animation: r-licht-puls 1.2s ease-in-out infinite; }
  .r-ampel[data-stufe="laeuft"] .r-licht--gelb { animation-delay: .2s; }
  .r-ampel[data-stufe="laeuft"] .r-licht--gruen { animation-delay: .4s; }
}
@keyframes r-licht-puls { 50% { background: var(--border-strong); } }
.r-ampel-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.r-ampel-titel { font-size: 15px; font-weight: 600; color: var(--text); }
.r-ampel-text .k-klein:empty { display: none; }
.r-ampel-punkte { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.r-punkt { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); }
.r-punkt-zeichen { width: 8px; height: 8px; flex: none; margin-left: 7px; margin-right: 11px; border-radius: 50%; }
.r-punkt--rot .r-punkt-zeichen { background: #F04438; }
.r-punkt--gelb .r-punkt-zeichen { background: #F79009; }
.r-punkt--rot .r-punkt-text { color: var(--text); font-weight: 500; }
.r-punkt-text { min-width: 0; overflow-wrap: anywhere; }
.r-punkt .r-info { margin-left: 0; }
.r-ampel-sperre { font-size: 14px; color: var(--text-2); padding-top: 12px; border-top: 1px solid var(--border); }

.r-felder { display: flex; flex-direction: column; gap: 14px; }
.r-anhang { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.r-anhang legend { display: flex; align-items: center; padding: 0; margin-bottom: 8px; }
.r-optionen { display: flex; flex-wrap: wrap; gap: 6px; }
.r-option { position: relative; cursor: pointer; }
.r-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.r-option span {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 99px; font-size: 14px; font-weight: 500; color: var(--text-2);
  transition: background-color .15s, color .15s, border-color .15s;
}
.r-option:hover span { background: var(--surface-2); }
.r-option input:checked + span { background: var(--primary-soft); border-color: var(--primary-soft-2); color: var(--primary); }
.r-option input:focus-visible + span { box-shadow: var(--ring); }

/* Senden: Anhang und Kopie eingeklappt unter „Weitere Optionen“ (Standard: PDF) */
.r-weitere { border-top: 1px solid var(--border); }
.r-weitere-kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; cursor: pointer;
  list-style: none; font-size: 14px; font-weight: 600; color: var(--text-2); border-radius: var(--radius-md);
}
.r-weitere-kopf::-webkit-details-marker { display: none; }
.r-weitere-kopf:focus-visible { outline: none; box-shadow: var(--ring); }
.r-weitere-kopf .k-ikon { width: 20px; height: 20px; color: var(--text-3); transition: rotate .2s var(--ease); }
.r-weitere[open] .r-weitere-kopf .k-ikon { rotate: 180deg; }
.r-weitere-inhalt { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 4px; }

/* Betrag mit Währung */
.r-betrag { position: relative; display: flex; }
.r-betrag .k-eingabe { padding-right: 36px; text-align: right; font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 600; }
.r-betrag-waehrung { position: absolute; right: 12px; top: 50%; translate: 0 -50%; color: var(--text-3); font-size: 15px; pointer-events: none; }

/* Verlauf */
.r-verlauf-teil { display: flex; flex-direction: column; gap: 6px; }
.r-verlauf-titel { font-size: 13px; font-weight: 600; color: var(--text-3); }
.r-verlauf-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.r-verlauf-liste:empty { display: none; }
.r-verlauf-eintrag { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.r-verlauf-eintrag:first-child { border-top: 0; padding-top: 2px; }
.r-verlauf-haupt { display: flex; flex-direction: column; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
.r-verlauf-betrag, .r-verlauf-was { font-size: 14px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.r-verlauf-fehler { margin-left: 8px; font-weight: 500; color: var(--error-text); }
.r-mini-knopf {
  /* Maße wie .k-knopf--klein + --zweit (konto.css) */
  flex: none; display: inline-flex; align-items: center; min-height: var(--knopf-klein); padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text-2); font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.r-mini-knopf:hover { background: var(--surface-2); color: var(--text); }
.r-mini-knopf.ist-gefahr { border-color: var(--error-border); color: var(--error-text); background: var(--error-soft); }
.r-mini-knopf:disabled { opacity: .6; cursor: progress; }
#verlauf-status:empty { display: none; }

/* ---------- Touch, Handy und Tablet: Trefferflächen mindestens 44 px ---------- */
@media (pointer: coarse), (max-width: 899.98px) {
  /* Info-Knopf: Feld 44 × 44 px, sichtbar bleibt das kleine i; negative Ränder halten die Zeile ruhig */
  .r-info { width: 44px; height: 44px; margin: -12px -12px -12px -8px; }
  .r-info::after { display: none; }
  /* nach .k-haken (am Handy 2 px Abstand oben, Kästchen-Mitte bei 13 px): Mitte des 44-px-Felds ebenfalls bei 13 px */
  .k-haken + .r-info { margin-top: -9px; }
  .r-mehr, .r-schnell { width: 44px; height: 44px; }
  .r-filter label > span { min-height: 44px; }
  .r-suche .k-eingabe { min-height: 44px; font-size: 16px; }
  .r-menue-punkt { min-height: 44px; font-size: 15px; }
  .r-schliessen { width: 44px; height: 44px; margin: -8px -10px 0 0; }
  .r-mini-knopf { min-height: 44px; padding: 0 14px; }
  .r-option span { min-height: 44px; padding: 0 14px; }
}

/* ---------- Schmale Liste (bis etwa 720 px Innenbreite): Zeile wie in Qonto ----------
   links Kunde, darunter Nummer · Fälligkeit | rechts Betrag, darunter Status | ganz rechts Senden und Menü */
@container r-liste (max-width: 719px) {
  .r-tabelle thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .r-tabelle, .r-tabelle tbody { display: block; width: 100%; }
  .r-tabelle tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; column-gap: 8px; row-gap: 4px;
    margin: 0 -8px; padding: 12px 8px; border-bottom: 1px solid var(--border); border-radius: var(--radius-md);
  }
  .r-tabelle tbody tr:last-child { border-bottom: 0; }
  .r-tabelle td, .r-tabelle td:first-child, .r-tabelle td:last-child, .r-tabelle tbody tr:last-child td { display: block; padding: 0; border: 0; }
  .r-rechnung { grid-column: 1; grid-row: 1 / span 2; }
  .r-betrag-zelle { grid-column: 2; grid-row: 1; align-self: end; }
  .r-status { grid-column: 2; grid-row: 2; align-self: start; text-align: right; }
  .r-aktionen-zelle { grid-column: 3; grid-row: 1 / span 2; width: auto; margin-right: -8px; }
  .r-aktionen { gap: 0; }
  .r-meta-faellig { display: inline; }
  /* Trenner hängt an der Nummer: bricht die Zeile um, steht der Punkt nie vorn */
  .r-nummer:has(+ .r-meta-faellig)::after { content: "\00a0·"; }
  .r-faellig { display: none !important; }
}

@media (max-width: 640px) {
  .r-email { display: none; }
  .r-werkzeuge { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
  .r-filter { display: grid; grid-template-columns: repeat(4, auto); justify-content: stretch; }
  .r-filter label > span { justify-content: center; width: 100%; padding: 0 6px; }
  .r-werkzeuge .r-filter { display: flex; max-width: none; margin: 0 -20px; padding: 0 20px; }
  .r-werkzeuge .r-filter label > span { width: auto; padding: 0 14px; }
  .r-suche { flex: none; }
  .r-summe dd { font-size: 19px; }
  .r-kopf .r-summe dd { font-size: 18px; }
  .r-kopf .r-summen { gap: 8px 20px; }
  .r-kopf .r-summe + .r-summe { padding-left: 20px; }
  .r-er-felder { grid-template-columns: 1fr; gap: 14px; }

  /* Dialoge: als Blatt von unten, Knöpfe fest unten und gleich breit */
  .r-dialog, .r-dialog--breit {
    width: 100%; max-width: 100%; margin: auto 0 0; max-height: calc(100dvh - 16px);
    border-radius: 20px 20px 0 0; box-shadow: 0 -8px 32px -8px rgb(16 24 40 / .25);
  }
  .r-dialog-form { max-height: calc(100dvh - 16px); }
  .r-dialog-kopf { padding: 18px 12px 4px 20px; }
  .r-dialog-inhalt { padding: 14px 20px 16px; }
  .r-dialog-fuss {
    flex-wrap: nowrap; padding: 12px 20px max(16px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border); background: var(--surface);
  }
  .r-dialog-fuss .k-knopf { flex: 1 1 0; min-width: 0; }
  .r-dialog-fuss .k-knopf:only-child { flex-basis: 100%; }
  @media (prefers-reduced-motion: no-preference) {
    .r-dialog[open] { animation: r-blatt-auf .24s var(--ease); }
  }

  /* Verlauf: Knopf unter den Text, wenn es eng wird */
  .r-verlauf-eintrag { flex-wrap: wrap; gap: 8px 12px; }
  .r-verlauf-haupt { flex: 1 1 180px; }
}
@keyframes r-blatt-auf { from { translate: 0 24px; opacity: .4; } }

/* Galaxy Fold zugeklappt (280 px): alles untereinander */
@media (max-width: 360px) {
  .r-summen { grid-template-columns: 1fr; gap: 8px; }
  .r-summe { padding: 10px 12px; flex-direction: row; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0 8px; }
  .r-summe dd { font-size: 17px; }
  .r-neu { width: 100%; }
  .r-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .r-werkzeuge .r-filter { display: flex; }
  .r-kopf .r-summe + .r-summe { padding-left: 0; border-left: 0; }
  /* Menü über die ganze Zeilenbreite, damit es nicht links aus dem Bild ragt */
  .r-tabelle tr { position: relative; }
  .r-menue-huelle, .r-aktionen-zelle { position: static; }
  .r-menue { left: 0; right: 0; min-width: 0; }
  .r-menue-punkt { white-space: normal; }
  .r-zahl-eingabe { flex-wrap: wrap; }
  .r-dialog-fuss { flex-direction: column-reverse; flex-wrap: nowrap; }
  .r-dialog-fuss .k-knopf { width: 100%; flex: none; }
  .r-dialog-kopf { padding-left: 16px; }
  .r-dialog-inhalt { padding-left: 16px; padding-right: 16px; }
  .r-dialog-fuss { padding-left: 16px; padding-right: 16px; }
  .r-ampel { padding: 12px; }
  .r-ampel-kopf { gap: 10px; }
  .r-punkt { gap: 6px; }
  .r-punkt-zeichen { margin: 0 6px 0 4px; }
}

/* ---------- Mahnungen (Pro) ---------- */
/* Mahnstufe als kleines, ruhiges Etikett neben dem Status: nur Rahmen, keine Farbe */
.r-etikett {
  display: inline-flex; align-items: center; min-height: 22px; margin-left: 6px; padding: 0 8px;
  border: 1px solid var(--border-strong); border-radius: 99px; color: var(--text-2);
  font-size: 12px; font-weight: 500; white-space: nowrap; vertical-align: middle;
}
.r-mahn-zeile {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding-top: 20px; border-top: 1px solid var(--border);
}
.r-mahn-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.r-mahn-text .r-schalter-titel { display: inline-flex; align-items: center; }

/* Aufstellung im Mahnungs-Dialog */
.r-aufstellung { display: flex; flex-direction: column; margin: 0; padding: 4px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.r-posten { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; }
.r-posten:first-child { border-top: 0; }
.r-posten dt { display: flex; flex-wrap: wrap; align-items: center; gap: 0 2px; min-width: 0; color: var(--text-2); }
.r-posten dd { margin: 0; flex: none; color: var(--text); font-weight: 550; font-variant-numeric: tabular-nums; text-align: right; }
.r-posten-zusatz { flex-basis: 100%; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.r-posten-zusatz:empty { display: none; }
.r-posten--summe { border-top-color: var(--border-strong); }
.r-posten--summe dt, .r-posten--summe dd { color: var(--text); font-weight: 650; font-size: 15px; }
.r-posten--klein dt, .r-posten--klein dd { font-size: 13px; font-weight: 500; color: var(--text-3); }
.r-pdf-link { align-self: flex-start; font-size: 14px; }
.r-mini-link { display: inline-flex; align-items: center; text-decoration: none; }

/* Einstellungen der Mahnungen */
.r-me-felder { display: flex; flex-direction: column; gap: 18px; }
.r-stufen { width: 100%; border-collapse: collapse; font-size: 14px; }
.r-stufen th { padding: 0 8px 8px 0; text-align: left; font-size: 12px; font-weight: 500; color: var(--text-3); white-space: nowrap; }
.r-stufen tbody th { padding: 6px 8px 6px 0; font-size: 14px; font-weight: 500; color: var(--text-2); }
.r-stufen td { padding: 6px 8px 6px 0; }
.r-stufen td:last-child, .r-stufen th:last-child { padding-right: 0; }
.r-stufen .r-info { margin-left: 2px; }
.r-klein-eingabe { width: 76px; text-align: right; font-variant-numeric: tabular-nums; }
.r-betrag--klein { max-width: 120px; }
.r-betrag--klein .k-eingabe { font-size: 16px; font-weight: 500; padding-right: 30px; }
.r-betrag--klein .r-betrag-waehrung { right: 10px; font-size: 14px; }
.r-stufe-label { display: none; }
.r-me-haken { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Offenes Menü liegt über den folgenden Zeilen (die Zeilen-Animation bildet eigene Ebenen) */
.r-tabelle tr:has(.r-menue:not([hidden])) { position: relative; z-index: 5; }

/* Steuerberater: ohne schreibende Punkte kein Trenner im Menü */
[data-rolle="accountant"] .r-menue-trenner { display: none; }

@media (max-width: 360px) {
  .r-etikett { margin-left: 0; }
  .r-aufstellung { padding: 2px 12px; }
  .r-posten { flex-wrap: wrap; }
  .r-posten dd { flex: 1 0 auto; }
  .r-stufen thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .r-stufen, .r-stufen tbody { display: block; }
  .r-stufen tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 8px; padding: 8px 0; border-top: 1px solid var(--border); }
  .r-stufen tbody tr:first-child { border-top: 0; padding-top: 0; }
  .r-stufen tbody th { grid-column: 1 / -1; padding: 0; }
  .r-stufen td { padding: 0; display: flex; flex-direction: column; gap: 4px; }
  .r-stufe-label { display: block; font-size: 12px; color: var(--text-3); }
  .r-betrag--klein { max-width: none; }
  .r-klein-eingabe { width: 100%; }
  .r-mahn-zeile .k-knopf { width: 100%; }
}

@media print {
  .r-aktionen-zelle, .r-werkzeuge, #erinnerungen-karte, .r-meldung { display: none; }
}

/* Erinnerungen und Mahnungen: nur der Stand, eingestellt wird unter Einstellungen */
.r-auto-karte { padding-top: 14px; padding-bottom: 14px; }
.r-auto-zeile { display: flex; align-items: center; gap: 12px; }
.r-auto-zeile .r-schalter-text { flex: 1 1 auto; cursor: default; }
.r-auto-zeile .r-schalter-titel { margin: 0; }
.r-auto-zeichen {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2);
}
.r-auto-zeichen .k-ikon { width: 20px; height: 20px; }
.r-auto-link { flex: none; gap: 2px; padding-right: 6px; }
.r-auto-link .k-ikon { width: 16px; height: 16px; }
