/* Verwaltung
   Neutrales Design der Vorlage (übernommen von der Demo «Studio Balance»): dunkle Kopfleiste oben,
   helle Seitenleiste links, Inhalt in weissen Karten auf warmem Grund. Systemschrift, ruhiger
   Oliv-Akzent. Wer das Aussehen für eine Kundin anpasst, ändert in der Regel nur die Variablen im
   :root-Block (Hausfarbe = --akzent und seine Abstufungen). Kein Darkmode. */

:root {
  color-scheme: light;
  --grund: #f6f5f3;
  --flaeche: #ffffff;
  --flaeche-2: #faf9f7;
  --linie: #e7e3de;
  --rahmen: #d4cec6;
  --text: #2a2724;
  --text-2: #57504a;
  --leise: #8f867d;
  --akzent: #c27400;
  --akzent-dunkel: #9a5c00;
  --akzent-hell: #fdf3e4;
  --akzent-rand: #f1d3a6;
  --kopf: #4a4744;
  --kopf-text: #ffffff;
  --gruen: #16a34a;
  --gruen-hell: #f0fdf4;
  --gruen-text: #15803d;
  --rot: #dc2626;
  --rot-hell: #fef2f2;
  --rot-text: #b91c1c;
  --bernstein: #d97706;
  --bernstein-hell: #fffbeb;
  --bernstein-text: #b45309;
  --radius: 6px;
  --radius-klein: 4px;
  --schatten: 0 1px 3px rgba(60, 50, 35, .07);
  --schatten-gross: 0 4px 18px rgba(60, 50, 35, .12);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --kopfhoehe: 54px;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--grund); -webkit-font-smoothing: antialiased; }
a { color: var(--akzent-dunkel); text-decoration: none; }
a:hover { color: var(--akzent-dunkel); text-decoration: underline; text-underline-offset: 3px; }
h1 { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -.2px; }
h2 { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.3; }
small { font-size: 12px; color: var(--text-2); }
strong { font-weight: 600; }
[hidden] { display: none !important; }

/* Kopfleiste */
.kopfleiste { position: sticky; top: 0; z-index: 100; display: flex; align-items: center; gap: 14px; height: var(--kopfhoehe); padding: 0 18px; background: var(--kopf); color: var(--kopf-text); box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.logo { display: flex; align-items: center; flex: none; text-decoration: none; }
.logo:hover { text-decoration: none; }
.kopfleiste .logo img { display: block; height: 32px; width: auto; }
.firma { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopfleiste-rechts { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.kopfleiste-rechts .person { display: flex; align-items: center; gap: 7px; color: rgba(253, 252, 249, .9); white-space: nowrap; }
.kopfleiste-rechts .person svg { width: 17px; height: 17px; }
.kopfleiste-rechts form { margin: 0; }
button.abmelden { min-height: 0; padding: 6px; border: 0; border-radius: var(--radius-klein); background: none; color: rgba(253, 252, 249, .75); }
button.abmelden:hover { background: rgba(255, 255, 255, .12); color: var(--kopf-text); }
button.abmelden svg { display: block; width: 18px; height: 18px; }

/* Rahmen: Seitenleiste und Inhalt */
.rahmen { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: calc(100vh - var(--kopfhoehe)); }
.seitenleiste { position: sticky; top: var(--kopfhoehe); height: calc(100vh - var(--kopfhoehe)); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 18px 12px 14px; background: var(--flaeche); border-right: 1px solid var(--linie); }
.module { display: flex; flex-direction: column; gap: 2px; }
.module a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-klein); color: var(--text-2); font-size: 13.5px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.module a svg { flex: none; width: 18px; height: 18px; }
.module a:hover { background: var(--flaeche-2); color: var(--text); text-decoration: none; }
.module a[aria-current] { background: var(--akzent-hell); color: var(--akzent-dunkel); font-weight: 600; }
.module-titel { margin: 10px 0 2px; padding: 10px 12px 2px; border-top: 1px solid var(--linie); font-size: 10.5px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--leise); }
.aktionen { display: flex; flex-direction: column; gap: 6px; }
.aktionen a { display: flex; align-items: center; padding: 9px 12px; border: 1px solid var(--akzent-rand); border-radius: var(--radius-klein); background: var(--akzent-hell); color: var(--akzent-dunkel); font-size: 13px; font-weight: 600; text-decoration: none; }
.aktionen a:hover { background: var(--flaeche); border-color: var(--akzent); color: var(--akzent-dunkel); text-decoration: none; }
.aktionen a.haupt { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.aktionen a.haupt:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); color: #fff; }
.fuss { margin: auto 0 0; padding: 8px 12px 0; font-size: 11px; line-height: 1.5; color: var(--leise); }

main { display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 1240px; padding: 22px 26px 44px; }
main > * { margin: 0; }
main > h2, main > .abschnitt, main > .spalten { margin-top: 10px; }
.kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.abschnitt { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.abschnitt > .button { flex-shrink: 0; white-space: nowrap; }
.flash { padding: 10px 14px; border: 1px solid #bbf7d0; border-radius: var(--radius); background: var(--gruen-hell); color: var(--gruen-text); font-size: 13.5px; white-space: pre-line; }
.achtung { padding: 10px 14px; border: 1px solid #fde68a; border-left: 4px solid var(--bernstein); border-radius: var(--radius); background: var(--bernstein-hell); color: var(--bernstein-text); font-size: 13.5px; }
.achtung a { color: inherit; text-decoration: underline; }

/* Bedienelemente */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 0 14px; border: 1px solid var(--akzent); border-radius: var(--radius-klein); background: var(--akzent); color: #fff; font: inherit; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
button:hover, .button:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); color: #fff; text-decoration: none; }
button:active, .button:active { transform: scale(.98); }
button.zweit { background: var(--flaeche); border-color: var(--rahmen); color: var(--text); }
button.zweit:hover { background: var(--flaeche-2); border-color: var(--text-2); color: var(--text); }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--akzent-dunkel); font-size: 13px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
button.link:hover { background: none; color: var(--text); }
button.link:active { transform: none; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { min-height: 36px; padding: 0 10px; border: 1.5px solid var(--rahmen); border-radius: var(--radius-klein); background: var(--flaeche); color: var(--text); font: inherit; font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-rand); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--akzent); vertical-align: middle; }
.suche { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.suche input[type=search] { width: 240px; }
.box { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 16px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); }

/* Tabellen */
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); overflow: hidden; font-size: 13.5px; }
th { padding: 10px 12px; background: var(--kopf); color: var(--kopf-text); text-align: left; font-size: 12px; font-weight: 600; white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid var(--linie); vertical-align: middle; }
tbody tr:first-child td, table > tr:first-child td { border-top: 0; }
thead + tbody tr:first-child td { border-top: 0; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
tbody tr:nth-child(even) td, table > tr:nth-child(even) td { background: var(--flaeche-2); }
tbody tr:hover td, table > tr:hover td { background: var(--akzent-hell); }
tr:has(input[name=rechnung]:checked) td, tr:has(input[name=kunde]:checked) td { background: var(--akzent-hell); }
th input[type=checkbox] { accent-color: var(--akzent-rand); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
td.betrag { font-weight: 600; font-size: 14.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
td .name { font-weight: 600; }
tr.inaktiv td { color: var(--leise); }
td form { margin: 0; }

/* Icon-Knöpfe (Rechnung/Beleg ansehen, Herunterladen, E-Mail, Löschen …) */
.symbol { width: 17px; height: 17px; display: block; }
.knopfleiste { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
/* als Tabellenzelle bleibt sie eine Zelle (sonst reichen Linie und Zebra-Grund nicht über die ganze Zeile) */
td.knopfleiste { display: table-cell; }
td.knopfleiste > * { display: inline-flex; margin: 2px 0; vertical-align: middle; }
.knopf-symbol { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; min-height: 0; padding: 0; border: 1px solid var(--rahmen); border-radius: var(--radius-klein); background: var(--flaeche); color: var(--text-2); text-decoration: none; font: inherit; cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.knopf-symbol:hover { border-color: var(--akzent); background: var(--akzent-hell); color: var(--akzent-dunkel); }
.knopf-symbol:focus-visible { outline: 2px solid var(--akzent); outline-offset: 1px; }

/* Kacheln mit Statusbalken */
.kacheln { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kachel { display: block; padding: 14px 16px 16px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); color: inherit; text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease; }
a.kachel:hover { color: inherit; text-decoration: none; border-color: var(--rahmen); box-shadow: var(--schatten-gross); }
.kachel.aktiv { border-color: var(--akzent); box-shadow: 0 0 0 1px var(--akzent); }
.kachel.gesamt { background: var(--flaeche-2); }
.kachel .titel { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--leise); }
.kachel .wert { display: block; margin-top: 6px; font-weight: 800; font-size: clamp(19px, 1.9vw, 23px); line-height: 1.1; letter-spacing: -.4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kachel .wert.leer { color: var(--leise); }
.kachel small { display: block; margin: 4px 0 12px; }
.spur { display: block; height: 5px; border-radius: 99px; background: var(--linie); overflow: hidden; }
.spur span { display: block; height: 5px; border-radius: 99px; }
.punkt { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; }
.offen { background: var(--bernstein); }
.ausgaben { background: var(--rahmen); }
.gemahnt, .warnung { background: var(--rot); }
.bezahlt { background: var(--gruen); }
.einnahmen, .alle { background: var(--akzent); }

/* Status */
.pille { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.pille.offen { background: var(--bernstein-hell); color: var(--bernstein-text); }
.pille.gemahnt, .pille.warnung { background: var(--rot-hell); color: var(--rot-text); }
.pille.bezahlt { background: var(--gruen-hell); color: var(--gruen-text); }
.pille.storniert { background: var(--flaeche-2); border: 1px solid var(--linie); color: var(--leise); text-decoration: line-through; }
tr.storniert td { color: var(--leise); }
tr.storniert .betrag { text-decoration: line-through; }
td.status small { display: block; margin-top: 4px; }
.ueberfaellig, .hinweis { color: var(--rot-text); }
small.gesendet { color: var(--gruen-text); }
small.nicht-gesendet { color: var(--bernstein-text); }

/* Rechnungsliste */
.filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter a { display: flex; align-items: center; min-height: 32px; padding: 0 13px; border: 1px solid var(--rahmen); border-radius: 99px; background: var(--flaeche); color: var(--text-2); font-size: 13px; font-weight: 500; text-decoration: none; }
.filter a:hover { border-color: var(--akzent); color: var(--akzent-dunkel); text-decoration: none; }
.filter a[aria-current] { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.filter a.zuruecksetzen { min-height: 0; padding: 0 4px; border: 0; background: none; color: var(--akzent-dunkel); text-decoration: underline; text-underline-offset: 3px; }
.filter .angezeigt { margin-left: auto; font-size: 12.5px; color: var(--text-2); }
.liste { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); overflow: hidden; }
.liste table { border: 0; border-radius: 0; box-shadow: none; }
.sammel { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0; padding: 12px 16px; background: var(--akzent-hell); border-bottom: 1px solid var(--akzent-rand); color: var(--akzent-dunkel); font-size: 13.5px; }
.sammel label { display: flex; align-items: center; gap: 8px; }
.sammel input[type=date] { min-height: 34px; }
.sammel button { min-height: 34px; font-size: 12.5px; }
form.zahlung { display: flex; gap: 6px; align-items: center; }
form.zahlung input { min-height: 32px; padding: 0 8px; font-size: 13px; }
form.zahlung button { min-height: 32px; padding: 0 11px; font-size: 12.5px; }

/* Formulare */
.form { max-width: 640px; padding: 20px 22px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); }
.form.breit { max-width: 920px; }
.form label { display: block; margin-bottom: 13px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.form label:has(> input[type=checkbox]) { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 400; color: var(--text); }
.form input:not([type=checkbox]):not([type=radio]), .form select { display: block; width: 100%; margin-top: 5px; font-weight: 400; }
.form h2 { margin: 24px 0 12px; padding-top: 16px; border-top: 1px solid var(--linie); font-size: 12.5px; letter-spacing: .4px; text-transform: uppercase; color: var(--text-2); }
.form h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form p { margin: 0 0 13px; }
.form .row { display: flex; gap: 12px; }
.form .row label { flex: 1; }
.form .row .plz { flex: 0 0 120px; }
.form .row .datum { flex: 0 0 240px; }
/* Zahlenfelder ohne Auf-/Ab-Pfeile (zu klein zum Anklicken) – Wert eintippen */
.form input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.form input[type=number]::-webkit-inner-spin-button, .form input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.form .actions { display: flex; gap: 14px; align-items: center; margin-top: 20px; }

/* Weitere Rechnungen: Eingabetabellen ohne Kopfbalken */
.positionen { background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.positionen th { padding: 4px 6px; background: none; color: var(--text-2); font-size: 11.5px; font-weight: 600; }
.positionen td { padding: 4px 6px; border: 0; }
.positionen tbody tr:nth-child(even) td, .positionen tbody tr:hover td { background: none; }
.form .positionen input, .form .positionen select { margin: 0; }
.form .positionen input.num { text-align: right; }
.positionen td:nth-child(1) { width: 22%; }
.positionen td:nth-child(3) { width: 9%; }
.positionen td:nth-child(4) { width: 12%; }
.positionen td:nth-child(5) { width: 22%; }
/* Rechnung mit Artikelstamm: Ziffer | Leistung | Betrag */
.positionen-artikel td:nth-child(1) { width: 56px; white-space: nowrap; }
.positionen-artikel td:nth-child(2) { width: auto; }
.positionen-artikel td:nth-child(3) { width: 16%; white-space: nowrap; }
.positionen-artikel td:nth-child(4) { width: 36px; }
.positionen-artikel tfoot td { padding-top: 8px; border-top: 1px solid var(--linie); font-weight: 600; }
.form .positionen input[readonly] { background: var(--flaeche-2); color: var(--leise); }
/* Behandlungsrechnung Tarif 590: Datum | Leistung (breit, lange Ziffertexte) | Minuten | Preis | Text */
.leistungen-590 td:nth-child(1) { width: 15%; }
.leistungen-590 td:nth-child(2) { width: 42%; }
.leistungen-590 td:nth-child(3) { width: 9%; }
.leistungen-590 td:nth-child(4) { width: 10%; }
.leistungen-590 td:nth-child(5) { width: 24%; }
.leistungen-590 input.ohne-text { background: transparent; border-style: dashed; }
/* Artikelstamm (Einstellungen › Preise): Art | Beschreibung | Preis | Tarifziffer 590 (Suche) | Minuten */
.vorlagen td:nth-child(1) { width: 17%; }
.vorlagen td:nth-child(3) { width: 10%; }
.vorlagen td:nth-child(4) { width: 33%; }
.vorlagen td:nth-child(5) { width: 8%; }

/* Abo-Rechnungen erstellen */
.schritt .nr { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--akzent); color: #fff; font-size: 13px; font-weight: 700; }
.schritt label { display: flex; align-items: center; gap: 8px; }
.schritt input[type=search] { flex: 1; }
.schritt strong { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }

/* Dokumentenablage */
.ablage-form { flex-direction: column; align-items: stretch; }
.ablage { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 28px; border: 2px dashed var(--rahmen); border-radius: var(--radius); background: var(--flaeche-2); color: var(--text-2); cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.ablage strong { font-size: 17px; color: var(--text); }
.ablage:hover { border-color: var(--akzent); }
.ablage:hover .button { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); }
.ablage.aktiv { border-color: var(--akzent); background: var(--akzent-hell); }
.ablage input[type=file] { display: none; }
#namen label { display: block; margin: 8px 0; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
#namen input { display: block; width: 100%; margin-top: 5px; }
#ablegen { align-self: flex-start; }

/* E-Mail-Versand */
.email-logo-vorschau { margin: -6px 0 18px; }
.email-logo-vorschau img { display: block; margin-top: 6px; }
.email-vorschau { display: flex; gap: 14px; flex-wrap: wrap; margin: 4px 0 18px; }
.email-vorschau-datei { flex: 1 1 320px; display: flex; flex-direction: column; gap: 6px; }
.email-vorschau-datei > a:first-child { font-size: 13px; }
.email-vorschau-datei embed { display: block; width: 100%; height: 420px; border: 1px solid var(--linie); border-radius: var(--radius-klein); background: var(--flaeche-2); pointer-events: none; }
.email-vorschau-datei a:has(embed) { cursor: pointer; }

/* Aktuelles: Liste */
.neuer-artikel { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; padding: 18px 20px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); scroll-margin-top: calc(var(--kopfhoehe) + 16px); }
.neuer-artikel:target { border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-rand); }
.neuer-artikel h2 { flex-basis: 100%; }
.neuer-artikel label { flex: 1 1 320px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.neuer-artikel input { display: block; width: 100%; margin-top: 5px; font-weight: 400; }
.neuer-artikel small { flex-basis: 100%; }
.miniatur { display: block; width: 76px; height: 57px; object-fit: cover; border-radius: var(--radius-klein); background: var(--flaeche-2); }
.artikel-titel { font-weight: 600; font-size: 14.5px; }
.artikel-teaser { display: block; max-width: 60ch; margin-top: 3px; }
.artikel-aktionen { display: flex; gap: 14px; align-items: center; justify-content: flex-end; }
.artikel-aktionen form { margin: 0; }

/* Aktuelles: Artikel bearbeiten (Textfläche in Georgia wie die Titel der Webseite) */
.form textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 10px; border: 1.5px solid var(--rahmen); border-radius: var(--radius-klein); background: var(--flaeche); color: var(--text); font: inherit; font-weight: 400; font-size: 14px; resize: vertical; }
.titelbild { display: grid; grid-template-columns: minmax(0, 260px) minmax(0, 1fr); gap: 20px; align-items: start; }
.titelbild-vorschau, .titelbild-leer { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; border-radius: var(--radius-klein); background: var(--flaeche-2); }
.titelbild-leer { display: flex; align-items: center; justify-content: center; border: 1px dashed var(--rahmen); color: var(--leise); font-size: 13px; }
.editor-werkzeuge { position: sticky; top: var(--kopfhoehe); z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 7px; background: var(--flaeche-2); border: 1px solid var(--rahmen); border-bottom: 0; border-radius: var(--radius-klein) var(--radius-klein) 0 0; }
.editor-werkzeuge button { min-height: 32px; padding: 0 10px; border-color: var(--rahmen); background: var(--flaeche); color: var(--text); font-size: 12px; font-weight: 500; }
.editor-werkzeuge button b, .editor-werkzeuge button i { font-family: var(--serif); font-size: 15px; }
.editor-werkzeuge button:hover { background: var(--akzent-hell); border-color: var(--akzent); color: var(--akzent-dunkel); }
.editor-werkzeuge button.bild-knopf { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.editor-werkzeuge button.bild-knopf:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); color: #fff; }
.editor-werkzeuge .trenner { align-self: stretch; width: 1px; margin: 0 4px; background: var(--rahmen); }
.editor-rahmen { position: relative; }
.editor-flaeche { min-height: 420px; padding: 28px 34px; border: 1px solid var(--rahmen); border-radius: 0 0 var(--radius-klein) var(--radius-klein); background: var(--flaeche); font-family: var(--serif); font-size: 17px; line-height: 1.65; overflow-wrap: break-word; }
.editor-flaeche::after { content: ""; display: block; clear: both; }
.editor-flaeche:focus-visible { outline: 2px solid var(--akzent); outline-offset: -2px; }
.editor-rahmen.ziehen .editor-flaeche { outline: 2px dashed var(--akzent); outline-offset: -10px; background: var(--akzent-hell); }
.editor-flaeche > :first-child { margin-top: 0; }
.editor-flaeche h2 { clear: both; margin: 30px 0 12px; font-size: 26px; font-weight: 400; }
.editor-flaeche h3 { clear: both; margin: 24px 0 8px; font-size: 20px; font-weight: 400; }
.editor-flaeche p { margin: 0 0 16px; }
.editor-flaeche ul, .editor-flaeche ol { display: flow-root; margin: 0 0 16px; padding-left: 24px; }
.editor-flaeche li { margin-bottom: 4px; }
.editor-flaeche blockquote { clear: both; margin: 26px 0; padding-left: 18px; border-left: 3px solid var(--akzent); color: var(--text-2); font-style: italic; }
.editor-flaeche figure { margin: 26px 0; cursor: pointer; }
.editor-flaeche figure img { display: block; width: 100%; height: auto; border-radius: var(--radius-klein); }
.editor-flaeche figure.bild-links { float: left; width: 45%; margin: 6px 28px 16px 0; }
.editor-flaeche figure.bild-rechts { float: right; width: 45%; margin: 6px 0 16px 28px; }
.editor-flaeche figure.ausgewaehlt { outline: 3px solid var(--akzent); outline-offset: 3px; }
.editor-flaeche figcaption { min-height: 1.5em; margin-top: 8px; font-family: var(--sans); font-size: 13px; line-height: 1.5; color: var(--text-2); cursor: text; }
.editor-flaeche figcaption:empty::before { content: attr(data-platzhalter); color: var(--leise); }
.editor-flaeche figcaption:focus-visible { outline: 1px dashed var(--rahmen); outline-offset: 2px; }
.bild-werkzeuge { position: absolute; z-index: 3; display: flex; flex-wrap: wrap; gap: 4px; max-width: calc(100% - 16px); padding: 6px; border-radius: var(--radius-klein); background: var(--kopf); box-shadow: var(--schatten-gross); }
.bild-werkzeuge button { min-height: 30px; padding: 0 9px; border-color: rgba(253, 252, 249, .3); background: transparent; color: var(--kopf-text); font-size: 12px; font-weight: 500; }
.bild-werkzeuge button:hover { background: rgba(253, 252, 249, .12); border-color: var(--kopf-text); color: var(--kopf-text); }
.bild-werkzeuge button[aria-pressed="true"] { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.editor-hinweis { margin: 8px 0 0 !important; font-size: 12.5px; color: var(--text-2); }

/* Buchhaltung */
.bereiche { padding: 4px 16px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); }
.bereiche p { margin: 12px 0; }
.bereich { display: grid; grid-template-columns: minmax(120px, 240px) minmax(60px, 1fr) 130px 100px; gap: 16px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--linie); }
.bereich:last-child { border-bottom: 0; }
.spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.spalten section { display: flex; flex-direction: column; gap: 10px; }
.spalten p { margin: 0; }

/* Anmeldung und Fehlerseite: weisse Karte auf dunklem Grund */
.anmeldung { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; background: var(--kopf); }
.anmeldung .form { width: 100%; max-width: 390px; padding: 28px; border: 0; box-shadow: var(--schatten-gross); }
.anmeldung .logo { justify-content: center; margin: 0 auto 20px; }
.anmeldung .logo img { display: block; width: 160px; height: auto; }
.anmeldung h1 { margin-bottom: 18px; font-size: 19px; text-align: center; }
.anmeldung .actions button { width: 100%; min-height: 40px; }

/* Startseite: Schnellzugriff – Kacheln in Grösse und Stil wie die Status-Kacheln der Rechnungen (.kachel) */
.schnell { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.schnell-kachel { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); color: var(--text); font-size: 15px; font-weight: 700; text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease; }
.schnell-kachel svg { flex: none; width: 22px; height: 22px; color: var(--akzent-dunkel); }
.schnell-kachel span { display: flex; flex-direction: column; }
.schnell-kachel small { font-size: 12.5px; font-weight: 400; color: var(--text-2); }
.schnell-kachel:hover { color: var(--text); text-decoration: none; border-color: var(--rahmen); box-shadow: var(--schatten-gross); }
.schnell-kachel.haupt { border-color: var(--akzent); box-shadow: 0 0 0 1px var(--akzent); }
.schnell-kartei { max-width: 640px; padding: 20px 22px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); }
.schnell-kartei h2 { margin-bottom: 12px; }
.schnell-kartei label { display: block; margin-bottom: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.schnell-kartei .suche { display: block; }
.schnell-kartei input[type=search] { width: 100%; }
.schnell-zuletzt-titel { margin: 16px 0 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.schnell-zuletzt { display: flex; flex-wrap: wrap; gap: 8px; }
.schnell-zuletzt a { padding: 7px 12px; border: 1px solid var(--akzent-rand); border-radius: var(--radius-klein); background: var(--akzent-hell); color: var(--akzent-dunkel); font-size: 13px; font-weight: 600; text-decoration: none; }
.schnell-zuletzt a:hover { border-color: var(--akzent); background: var(--flaeche); text-decoration: none; }

/* Schmale Bildschirme: Seitenleiste wird Leiste unter der Kopfleiste */
@media (max-width: 900px) {
  .rahmen { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .seitenleiste { position: static; height: auto; gap: 10px; padding: 8px 12px 10px; border-right: 0; border-bottom: 1px solid var(--linie); }
  .module { flex-direction: row; overflow-x: auto; }
  .module a { padding: 7px 10px; font-size: 13px; }
  .module-titel { display: none; }
  .aktionen { flex-direction: row; flex-wrap: wrap; }
  .aktionen a { flex: 1 1 160px; justify-content: center; }
  .fuss, .kopfleiste-rechts .person span { display: none; }
  main { padding: 18px 14px 36px; }
  .kacheln, .schnell { grid-template-columns: repeat(2, 1fr); }
  .spalten { grid-template-columns: 1fr; }
  /* Tabellen scrollen seitlich; als Block ist der Rahmen durchsichtig, Kopf und Zeilen tragen die Farbe */
  table { display: block; overflow-x: auto; background: none; border: 0; box-shadow: none; }
  td { background: var(--flaeche); }
  /* Eingabetabellen (Rechnungspositionen, Preisvorlagen) scrollen seitlich statt die Felder zu quetschen */
  .positionen { overflow-x: auto; }  /* sonst gilt overflow: visible von oben, die Tabelle ragt aus der Seite */
  .positionen select, .positionen input { min-width: 96px; }
  .positionen td:nth-child(1) select { min-width: 160px; }
  .positionen td:nth-child(2) input { min-width: 220px; }
  .leistungen-590 td:nth-child(1) input { min-width: 140px; }
  .leistungen-590 td:nth-child(2) select { min-width: 300px; }
  .leistungen-590 td:nth-child(5) input { min-width: 220px; }
  .form .row { flex-direction: column; gap: 0; }
  .form .row .plz, .form .row .datum { flex: auto; }
  .bereich { grid-template-columns: 1fr 1fr; }
  .filter .angezeigt { margin-left: 0; }
  .form.artikel-form { padding: 16px 14px; }
  .titelbild { grid-template-columns: 1fr; gap: 12px; }
  .editor-flaeche { padding: 18px 16px; font-size: 16px; }
}

/* Smartphone: Bilder im Editor wie auf der Webseite immer in ganzer Breite */
@media (max-width: 640px) {
  .kopfleiste { padding: 0 12px; gap: 10px; }
  .kopfleiste .logo img { height: 28px; }
  .firma { font-size: 14.5px; }
  .kopfleiste-rechts .person { display: none; }
  .editor-flaeche figure.bild-links, .editor-flaeche figure.bild-rechts { float: none; width: auto; margin: 26px 0; }
  .editor-werkzeuge .trenner { display: none; }
  .neuer-artikel button { width: 100%; }
}

@media print {
  .no-print { display: none !important; }
  .rahmen { display: block; }
  body, main { background: #fff; }
  table, .liste, .form, .kachel { box-shadow: none; }
}

/* Behandlungsrechnung Tarif 590: eine Spalte mehr (Vorlage), schmalere Felder */
.leistungen-590 { table-layout: fixed; width: 100%; }
.leistungen-590 td:nth-child(n) { width: auto; }
.leistungen-590 th:nth-child(1), .leistungen-590 td:nth-child(1) { width: 17%; }
.leistungen-590 th:nth-child(2), .leistungen-590 td:nth-child(2) { width: 17%; }
.leistungen-590 th:nth-child(3), .leistungen-590 td:nth-child(3) { width: 21%; }
.leistungen-590 th:nth-child(4), .leistungen-590 td:nth-child(4) { width: 11%; }
.leistungen-590 th:nth-child(5), .leistungen-590 td:nth-child(5) { width: 11%; }
.leistungen-590 select, .leistungen-590 input { width: 100%; min-width: 0; }

/* Rechnungsliste: eine Zeile je Rechnung, gleiche Höhe, nichts bricht um */
table.rechnungen td, table.rechnungen th { white-space: nowrap; }
table.rechnungen td.empfaenger { white-space: normal; min-width: 150px; }
table.rechnungen td { padding-top: 9px; padding-bottom: 9px; }
table.rechnungen .nummer { display: block; font-weight: 600; font-variant-numeric: tabular-nums; }
table.rechnungen td small { display: block; color: var(--text-2); font-size: 12px; margin-top: 2px; }
table.rechnungen td.status small { margin-top: 3px; }
table.rechnungen td.status small.ueberfaellig { color: var(--rot-text); font-weight: 600; }
table.rechnungen td.dokumente { display: table-cell; }
.dok { display: inline-block; padding: 3px 10px; margin-right: 4px; border: 1px solid var(--rahmen); border-radius: 99px; background: var(--flaeche); color: var(--text-2); font-size: 12.5px; text-decoration: none; }
.dok:hover { border-color: var(--akzent); background: var(--akzent-hell); color: var(--akzent-dunkel); }
.knopf-symbol.klein { width: 28px; height: 28px; vertical-align: middle; }
.knopf-symbol.klein .symbol { width: 15px; height: 15px; }
.knopf-symbol.gesendet { border-color: var(--gruen); color: var(--gruen-text); background: var(--gruen-hell); }
table.rechnungen td.aktion { text-align: right; }
table.rechnungen td.aktion form { display: inline-flex; vertical-align: middle; margin-left: 6px; }
table.rechnungen td.aktion form.zahlung button { min-height: 28px; padding: 0 12px; font-size: 12.5px; }

/* Kundenkartei: Einträge als schlichte Liste, neuester zuoberst */
.kartei-kopf { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.kartei-angaben { margin: 2px 0 0; color: var(--text-2); font-size: 13.5px; }
.kartei-form textarea { min-height: 110px; }
.kartei-form .art { display: flex; gap: 16px; align-items: center; margin: 2px 0 12px; }
.kartei-form .art label { display: inline-flex; gap: 6px; align-items: center; margin: 0; font-weight: 500; }
.kartei-liste { list-style: none; max-width: 820px; margin: 18px 0 0; padding: 0; }
.kartei-eintrag { margin: 0 0 10px; padding: 12px 16px; background: var(--flaeche); border: 1px solid var(--linie); border-left: 4px solid var(--rahmen); border-radius: var(--radius); box-shadow: var(--schatten); }
.kartei-eintrag.befund { border-left-color: var(--akzent); }
.kartei-eintrag-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; font-size: 13px; color: var(--text-2); }
.kartei-eintrag-kopf .knopfleiste { margin-left: auto; }
.kartei-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.pille.befund { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.pille.notiz { background: var(--flaeche-2); border: 1px solid var(--linie); color: var(--text-2); }

/* Datensicherung */
.sicherung + .sicherung { margin-top: 16px; }
.sicherung ul { margin: 0 0 14px; padding-left: 20px; font-size: 13.5px; line-height: 1.6; }
.sicherung .actions { flex-wrap: wrap; margin-top: 14px; }
.sicherung .actions .button { white-space: normal; text-align: center; padding: 6px 14px; }
.sicherung .pdf-auswahl select { display: block; width: 100%; max-width: 380px; margin-top: 5px; }

/* Buchhaltung: Export für den Treuhänder */
.treuhaender-export { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 16px; border: 1px solid var(--akzent-rand); border-radius: var(--radius); background: var(--akzent-hell); }
.treuhaender-export > div { flex: 1 1 320px; display: flex; flex-direction: column; gap: 2px; }
.treuhaender-export strong { color: var(--akzent-dunkel); }

/* Rückfrage vor Löschen, Stornieren … (static/app.js) – statt des grauen Browser-Fensters */
dialog.rueckfrage { max-width: 420px; width: calc(100% - 32px); padding: 20px 22px; border: 1px solid var(--linie); border-radius: var(--radius); background: var(--flaeche); color: var(--text); box-shadow: var(--schatten-gross); }
dialog.rueckfrage::backdrop { background: rgba(42, 39, 36, .35); }
dialog.rueckfrage form { margin: 0; }
dialog.rueckfrage p { margin: 0 0 18px; font-size: 14px; line-height: 1.5; }
dialog.rueckfrage .actions { display: flex; flex-direction: row-reverse; justify-content: flex-start; gap: 10px; }

/* Suchfeld mit Trefferliste (Tarifziffer oder Name, static/app.js) */
.suche { position: relative; }
.suche-liste { position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 3px); min-width: 280px; max-height: 280px; margin: 0; padding: 4px 0; overflow-y: auto; list-style: none; background: var(--flaeche); border: 1px solid var(--rahmen); border-radius: var(--radius-klein); box-shadow: var(--schatten-gross); font-size: 13px; font-weight: 400; }
.suche-liste li { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px; cursor: pointer; color: var(--text); }
.suche-liste li small { font-size: 11.5px; color: var(--leise); }
.suche-liste li.aktiv { background: var(--akzent-hell); color: var(--akzent-dunkel); }
.suche-liste li.leer { color: var(--leise); cursor: default; }
.ziffer-anzeige { display: inline-block; min-width: 3.5em; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.ziffer-anzeige:empty::before { content: "–"; font-weight: 400; color: var(--leise); }
