/* Abrechnung – ruhiges, schlichtes Layout. Keine externen Schriften oder Skripte. */
:root {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-size: 15px; color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--flaeche); line-height: 1.4; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.35rem; margin: 0.4rem 0 1rem; }
h2 { font-size: 1.1rem; margin: 1.2rem 0 0.5rem; }
a { color: var(--haupt); }

.kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 16px; background: var(--karte);
  border-bottom: 1px solid var(--linie); }
.marke { font-weight: 600; }
.kopf nav { display: flex; flex-wrap: wrap; gap: 4px 14px; flex: 1; }
.kopf nav a { text-decoration: none; padding: 4px 0; }
.konto { display: flex; gap: 6px; margin-left: auto; }

button, .knopf { display: inline-block; white-space: nowrap; overflow-wrap: normal; font: inherit; font-size: 0.93rem; padding: 5px 12px; border: 1px solid var(--linie);
  border-radius: 6px; background: var(--karte); color: var(--text); cursor: pointer; text-decoration: none; line-height: 1.3; }
button:hover, .knopf:hover { border-color: var(--haupt); }
button.haupt, .knopf.haupt { background: var(--haupt); border-color: var(--haupt); color: var(--haupt-text); }
button.gefahr { color: var(--fehler); border-color: var(--fehler); }
button.klein { font-size: 0.85rem; padding: 2px 8px; }
button:disabled { opacity: 0.6; cursor: default; }

input, select, textarea { font: inherit; padding: 5px 7px; border: 1px solid var(--linie); border-radius: 5px; background: #fff;
  max-width: 100%; }
input.kurz { width: 6.5em; }
textarea { width: 100%; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 0.9rem; color: var(--leise); }
label > input, label > select, label > textarea { color: var(--text); }
label.haken { flex-direction: row; align-items: center; gap: 6px; color: var(--text); margin: 4px 0; }

fieldset { border: 1px solid var(--linie); border-radius: 8px; background: var(--karte); padding: 10px 14px 14px; margin: 0 0 14px; }
legend { font-weight: 600; padding: 0 4px; }
.formular { display: flex; flex-direction: column; gap: 10px; }
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 14px; }
.zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; }
.navi { display: flex; justify-content: space-between; gap: 8px; }
.aktionen { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 0; }
.block { margin: 18px 0; }

.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 8px; padding: 16px 18px; }
.schmal { max-width: 440px; margin: 24px auto; }
.karten { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kennzahl { background: var(--karte); border: 1px solid var(--linie); border-radius: 8px; padding: 10px 14px;
  display: flex; flex-direction: column; }
.kennzahl span { color: var(--leise); font-size: 0.88rem; }
.kennzahl strong { font-size: 1.25rem; }
.kennzahl small { color: var(--leise); }

.tabelle { width: 100%; border-collapse: collapse; background: var(--karte); margin: 6px 0; }
.tabelle th, .tabelle td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--linie); vertical-align: top; }
.tabelle th { font-weight: 600; font-size: 0.88rem; color: var(--leise); }
.tabelle .zahl { text-align: right; white-space: nowrap; }
.tabelle small { color: var(--leise); }
.tabelle tfoot td { border-bottom: none; }
main { overflow-wrap: anywhere; }
.tabelle { display: block; overflow-x: auto; }
@media (min-width: 700px) { .tabelle { display: table; } }

.meldung { background: #e8f0f7; border: 1px solid #c3d6e8; border-radius: 6px; padding: 8px 12px; }
.warnung { color: var(--warn); }
.fehler { color: var(--fehler); font-weight: 600; }
.ok { color: var(--ok); }
.hinweis { color: var(--leise); font-size: 0.88rem; margin: 4px 0; }
.hinweise { color: var(--warn); font-size: 0.9rem; }
.fehlertext { color: var(--fehler); }
.leer { color: var(--leise); }
.treffer { list-style: none; padding: 0; margin: 6px 0; }
.treffer li { padding: 3px 0; }
.schluessel { font-family: ui-monospace, Consolas, monospace; font-size: 1.15rem; letter-spacing: 0.05em;
  background: var(--flaeche); padding: 10px; border-radius: 6px; text-align: center; overflow-wrap: anywhere; }
.unterschrift { max-height: 70px; background: #fff; border: 1px solid var(--linie); padding: 4px; }

.schritte { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 8px; }
.schritte .aktiv .schrittknopf { background: var(--haupt); color: var(--haupt-text); border-color: var(--haupt); opacity: 1; }
.typzeile { color: var(--leise); margin: 0 0 10px; }

.angaben { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; background: var(--karte);
  border: 1px solid var(--linie); border-radius: 8px; padding: 10px 14px; }
.angaben dt { color: var(--leise); }
.angaben dd { margin: 0; }
.marke-st { font-size: 0.8rem; font-weight: normal; padding: 2px 8px; border-radius: 10px; background: var(--flaeche);
  border: 1px solid var(--linie); vertical-align: middle; }
.st-bezahlt .marke-st, .marke-st.st-bezahlt { color: var(--ok); }
.marke-st.st-ueberfaellig, tr.st-ueberfaellig td:last-child { color: var(--fehler); }
tr.st-storniert td { color: var(--leise); text-decoration: line-through; }

/* Google Drive: deutlicher Hinweis, solange nicht abgeglichen */
.drive-warnung { background: #fff4e0; border: 1px solid #e6c27a; border-left: 5px solid var(--warn); border-radius: 6px;
  padding: 8px 12px; margin: 0 0 12px; color: var(--text); }
.drive-warnung.konflikt { background: #fdecea; border-color: #e3a19c; border-left-color: var(--fehler); }

/* Einsatzsuche (Kartei der KVB-Wegegeldprotokolle) */
main.breit { max-width: 1600px; }
.reiter { display: flex; gap: 4px; border-bottom: 1px solid var(--linie); margin: 0 0 12px; }
.reiter a { padding: 6px 14px; text-decoration: none; border: 1px solid transparent; border-bottom: none;
  border-radius: 6px 6px 0 0; color: var(--leise); }
.reiter a.aktiv { background: var(--karte); border-color: var(--linie); color: var(--text); font-weight: 600;
  margin-bottom: -1px; }
.kartei-warnung { background: #fdecea; border: 1px solid #e3a19c; border-left: 5px solid var(--fehler); border-radius: 6px;
  padding: 8px 12px; margin: 0 0 12px; }
.kartei-warnung ul { margin: 4px 0 0; padding-left: 20px; }
.ablage { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px; }
.ablage-feld { flex: 1 1 340px; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px;
  border: 2px dashed var(--linie); border-radius: 8px; background: var(--karte); color: var(--leise); }
.ablage-feld.ueber { border-color: var(--haupt); background: #eef4fa; }
.suche .suchfeld { flex: 1 1 260px; font-size: 1.05rem; padding: 7px 10px; }
.nw { white-space: nowrap; }

.kartei { font-size: 0.9rem; }
.kartei td { padding: 5px 7px; }
.kartei th, .kartei td.name { white-space: nowrap; overflow-wrap: normal; }
.kartei tbody tr:nth-child(even) td { background: #eef1f5; }
.kartei th.gruen { background: #d6ecd9; color: #1f4d2b; }
.kartei td.gruen { background: #e7f4e9; }
.kartei tbody tr:nth-child(even) td.gruen { background: #d3ead7; }
.kartei tr.nacht td:first-child { box-shadow: inset 5px 0 0 #34477a; padding-left: 12px; }
.kartei tr.trenner td { border-top: 2px solid #8a96a3; }
.kartei td.name { font-weight: 600; }
.kartei mark { background: #ffe58a; color: inherit; border-radius: 2px; padding: 0 1px; }
.kartei td.diagnose { min-width: 180px; }
.diagnose-feld { width: 100%; min-width: 160px; background: rgba(255, 255, 255, 0.85); }
.diagnose-status { display: block; font-size: 0.78rem; min-height: 1em; }
.diagnose-status.ok { color: var(--ok); }
.diagnose-status.laeuft { color: var(--leise); }
.diagnose-status.fehler { color: var(--fehler); font-weight: 600; }
.statistik { max-width: 900px; }
.kartei th.marke, .kartei td.marke { text-align: center; }
.kartei td.marke input { width: 18px; height: 18px; margin: 0; }
.name-dialog { border: 1px solid var(--linie); border-radius: 8px; max-width: 480px; width: calc(100% - 32px); }
.name-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.name-dialog h2 { margin-top: 0; }
.kartei td.marke .diagnose-status { white-space: nowrap; }
.tabelle td.vorgemerkt { background: #fff7e0; }
.marke-vorgemerkt { display: inline-block; padding: 1px 8px; border-radius: 10px; background: #f2c14e; color: #3d2c00;
  font-weight: 600; font-size: 0.85rem; }
[hidden] { display: none !important; }

/* ======================================================================================================
   Telefon-Darstellung (Bildschirme unter 900 px). Dieselben Seiten und Tabellenzeilen wie am Rechner; nur
   die Anordnung ändert sich (Karten per grid/flex). Vorlage: docs/referenz/design_telefon.html (nicht im Repository).
   Helles und dunkles Design über prefers-color-scheme. Keine Inline-Stile, keine externen Ressourcen.
   ====================================================================================================== */

/* Rechner (ab 900 px): Telefon-Teile aus, sonst alles wie bisher */
@media (min-width: 900px) {
  .nur-telefon { display: none !important; }
  .filter-chips { display: contents; }
  #liste-such-form .filter-chips > button { order: 2; }
  #liste-such-form #liste-q { order: 1; }
  .navi-patient { justify-content: flex-start; }
  label.auswahl { display: contents; }
  label.auswahl > select { font-size: 1rem; }
  /* Einsätze: das HTML steht in der Telefon-Reihenfolge; am Rechner dieselbe Anordnung wie bisher */
  main:has(> .ein-oben) { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; }
  main:has(> .ein-oben) > * { flex: 0 0 100%; min-width: 0; order: 10; }
  main:has(> .ein-oben) > :is(h1, .reiter, .kartei-warnung, .meldung, .drive-warnung) { order: 0; }
  .ein-oben, .daten-feld, div.such-kleber { display: contents; }
  main:has(> .ein-oben) #einlesen-form { flex: 0 0 100%; order: 1; }
  main:has(> .ein-oben) .abhol-zeile { flex: 0 0 100%; order: 2; margin-top: 0; }
  main:has(> .ein-oben) #such-form { flex: 0 0 100%; order: 3; margin-top: 0; }
  main:has(> .ein-oben) #kartei-anzahl { flex: 0 0 auto; order: 4; margin: 0 0 6px; }
  main:has(> .ein-oben) #csv-export { flex: 0 0 auto; order: 5; margin: 0 0 6px; }
  main:has(> .ein-oben) .daten-feld > .gefahr { flex: 0 0 auto; order: 6; margin: 0 0 6px; }
}

/* ======================================================================================================
   Gemeinsame Gestaltung (Telefon und Rechner): eine Palette als CSS-Variablen, hell und dunkel über
   prefers-color-scheme. Vorlagen: docs/referenz/design_telefon.html und design_vorschlag.html.
   ====================================================================================================== */
:root {

    --bg: #f3f5f9; --surface: #ffffff; --surface-2: #f7f9fc; --ink: #121a26; --muted: #5b6778; --line: #e1e6ee; --line-2: #cfd7e2;
    --accent: #0f766e; --accent-2: #0e9aa7; --accent-ink: #ffffff; --accent-soft: #d5f2ee;
    --rech: #1d4ed8; --rech-s: #dde8ff; --pat: #4f46e5; --pat-s: #e5e4fd; --ein: #c2410c; --ein-s: #ffe8d4;
    --set: #475569; --set-s: #e6eaf0; --sich: #15803d; --sich-s: #d9f3e1;
    --ok: #157a3d; --ok-bg: #dff5e6; --warn: #92580a; --warn-bg: #fff0d0; --bad: #b42318; --bad-bg: #fde8e6;
    --info: #1d4ed8; --info-bg: #e1ebff; --vorg: #f59e0b;
    --zebra: #f2f5f9; --hi: #dcefe0; --hi-ink: #14532d; --night: #0f766e; --mark: #ffe58a; --auf-farbe: #ffffff;
    --shadow-m: 0 1px 2px rgba(18, 26, 38, .05), 0 8px 24px -8px rgba(18, 26, 38, .12);
    --focus: #2563eb;
    --such-bild: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6778' stroke-width='1.9' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E");
    --pfeil-bild: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6778' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    --hi2: #c6e3cd; --hover: #e9f3f2;
    --shadow-s: 0 1px 2px rgba(18, 26, 38, .06);
    --shadow-l: 0 2px 4px rgba(18, 26, 38, .06), 0 18px 40px -12px rgba(18, 26, 38, .22);
    --r: 14px;
    /* bisherige Namen auf die gemeinsamen Werte */
    --text: var(--ink); --leise: var(--muted); --linie: var(--line); --flaeche: var(--bg); --karte: var(--surface);
    --haupt: var(--accent); --haupt-text: var(--accent-ink); --fehler: var(--bad);
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {

    --bg: #0d1218; --surface: #151c25; --surface-2: #1a232d; --ink: #e9eef4; --muted: #98a5b5; --line: #263140; --line-2: #344356;
    --accent: #2dd4bf; --accent-2: #38bdf8; --accent-ink: #05302b; --accent-soft: #12372f;
    --rech: #93b4ff; --rech-s: #1b2b52; --pat: #a5a1ff; --pat-s: #25254f; --ein: #fdba74; --ein-s: #40250f;
    --set: #b4c0cf; --set-s: #263140; --sich: #6ee7a0; --sich-s: #133a24;
    --ok: #6ee7a0; --ok-bg: #133a24; --warn: #f6c76a; --warn-bg: #3a2d0f; --bad: #ff9d92; --bad-bg: #43201d;
    --info: #93b4ff; --info-bg: #1b2b52; --vorg: #f6c76a;
    --zebra: #19222c; --hi: #1f3a2a; --hi-ink: #b7e4c7; --night: #2dd4bf; --mark: #6b5a12; --auf-farbe: #06201c;
    --shadow-m: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -10px rgba(0, 0, 0, .6);
    --focus: #7bb8ea;
    --such-bild: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a5b5' stroke-width='1.9' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E");
    --pfeil-bild: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2398a5b5' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    --hi2: #29492f; --hover: #1a2f33;
    --shadow-s: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-l: 0 2px 4px rgba(0, 0, 0, .4), 0 20px 44px -12px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
@media (max-width: 899.98px) {
  :root { font-size: 16px; }
  .nur-rechner { display: none !important; }
  .seitenkopf { flex-wrap: wrap; row-gap: 0; }
  .seitenkopf .unterzeile { flex: 0 0 100%; margin: 4px 0 4px; }
  .seitenkopf .unterzeile .chip { display: inline; height: auto; padding: 0; border-radius: 0; background: none; color: inherit; font: inherit; }
  .seitenkopf .unterzeile .chip::before { display: none; }
  .seitenkopf .unterzeile .chip + .chip::before { display: inline; content: " · "; width: auto; height: auto; border-radius: 0; background: none; }
}

@media (max-width: 899.98px) {
  /* ---------- Grundlagen ---------- */
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 76px; scroll-padding-bottom: 120px; }
  body { font-size: 16px; line-height: 1.5; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
  body.mit-leiste { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
  body.fokus { padding-top: calc(62px + env(safe-area-inset-top, 0px)); padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  main { padding: 14px 14px 24px; overflow-wrap: anywhere; }
  h1 { display: flex; align-items: center; gap: 10px; font-size: 23px; font-weight: 800; letter-spacing: -.3px; margin: 4px 0 12px; }
  h2 { font-size: 18px; font-weight: 750; }
  a { color: var(--accent); }
  :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
  .sym { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round;
    stroke-linejoin: round; flex: none; }
  .titel-sym { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--c); color: var(--auf-farbe); flex: none; }
  .titel-sym.rech { --c: var(--rech); } .titel-sym.ein { --c: var(--ein); } .titel-sym.pat { --c: var(--pat); }

  /* ---------- Felder und Schaltflächen ---------- */
  input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
    border: 1px solid var(--line-2); border-radius: 14px; min-height: 50px; padding: 0 14px; max-width: 100%; }
  textarea { padding: 12px 14px; min-height: 100px; }
  input[type="file"] { padding: 12px 14px; min-height: 50px; width: 100%; }
  input[type="checkbox"], input[type="radio"] { min-height: 0; width: 24px; height: 24px; padding: 0; margin: 0;
    accent-color: var(--accent); flex: none; }
  input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
  select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: var(--pfeil-bild);
    background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; }
  input.kurz { width: 100%; }
  label { font-size: 14px; font-weight: 700; color: var(--muted); gap: 6px; }
  label > input, label > select, label > textarea { width: 100%; font-weight: 400; }
  label.haken { min-height: 46px; gap: 12px; font-size: 16px; font-weight: 500; color: var(--ink); }
  button, .knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
    padding: 0 18px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
    font-size: 16px; font-weight: 700; white-space: normal; text-align: center; line-height: 1.25; }
  button.klein { min-height: 44px; padding: 0 14px; font-size: 15px; }
  button.haupt, .knopf.haupt { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent;
    color: var(--auf-farbe); box-shadow: 0 10px 20px -12px var(--accent); }
  button.gefahr { color: var(--bad); border-color: var(--bad); background: var(--surface); }
  fieldset { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 12px 16px 16px;
    box-shadow: var(--shadow-m); min-width: 0; }
  legend { font-size: 15px; font-weight: 800; padding: 0 6px; }
  .formular { gap: 14px; }
  .raster { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .zeile { gap: 10px; }
  .zeile > input:not([type="checkbox"]):not([type="radio"]), .zeile > select { flex: 1 1 180px; min-width: 0; }
  .karte { border-radius: 16px; border-color: var(--line); background: var(--surface); padding: 16px; box-shadow: var(--shadow-m); }
  .schmal { max-width: none; margin: 8px 0; }
  .schmal .formular > button, .formular > button.haupt { width: 100%; min-height: 52px; }
  .aktionen { gap: 10px; }
  .aktionen > .knopf, .aktionen > form, .aktionen > form > button { width: 100%; }
  .aktionen > form.zeile { display: grid; gap: 10px; }
  details > summary { min-height: 46px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }
  .hinweis { font-size: 14px; }

  /* Meldungen */
  .meldung { background: var(--info-bg); color: var(--info); border: 0; border-radius: 14px; padding: 12px 14px; font-weight: 600; }
  .drive-warnung { background: var(--warn-bg); color: var(--ink); border-color: transparent; border-left-color: var(--warn); border-radius: 14px; }
  .drive-warnung.konflikt, .kartei-warnung { background: var(--bad-bg); color: var(--ink); border-color: transparent; border-left-color: var(--bad); border-radius: 14px; }
  .schluessel { background: var(--zebra); }

  /* ---------- Kopfzeile: Marke + Einstellungen + Sicherung ---------- */
  .kopf { position: sticky; top: 0; z-index: 40; flex-wrap: nowrap; gap: 10px; min-height: 62px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 10px; background: var(--surface); border-bottom: 0; }
  .kopf::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
    background: linear-gradient(90deg, var(--rech), var(--pat), var(--ein)); opacity: .55; }
  .kopf .marke { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
  .logo { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
  .logo .sym { width: 19px; height: 19px; }
  .kopf .konto { display: none; }                 /* Sperren/Abmelden stehen am Telefon unter Einstellungen */
  body.mit-leiste .kopf .marke { padding-right: 104px; } /* Platz für die beiden Symbol-Schaltflächen */

  /* ---------- Untere Leiste (Hauptmenü) ---------- */
  .kopf nav.hauptmenue { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid;
    grid-template-columns: 1fr 1fr 92px 1fr; gap: 8px; align-items: end; flex: none;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); background: color-mix(in srgb, var(--surface) 96%, transparent); border-top: 1px solid var(--line); }
  .nb { --c: var(--set); --cs: var(--set-s); position: relative; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 4px; min-height: 60px; padding: 4px 2px; border-radius: 16px; background: var(--cs);
    color: var(--ink); font-size: 12px; font-weight: 700; line-height: 1.1; text-decoration: none; text-align: center;
    border: 1px solid var(--c); border: 1px solid color-mix(in srgb, var(--c) 18%, transparent); overflow-wrap: normal; }
  .kopf nav a.nb { padding: 4px 2px; }
  .nb .sym { color: var(--c); }
  .nb.rech { --c: var(--rech); --cs: var(--rech-s); order: 1; }
  .nb.ein { --c: var(--ein); --cs: var(--ein-s); order: 2; }
  .nb.neu { order: 3; }
  .nb.pat { --c: var(--pat); --cs: var(--pat-s); order: 4; }
  .nb.set { --c: var(--set); --cs: var(--set-s); }
  .nb.sich { --c: var(--sich); --cs: var(--sich-s); }
  .nb[aria-current="page"] { background: var(--c); color: var(--auf-farbe); border-color: transparent; box-shadow: 0 8px 16px -8px var(--c); }
  .nb[aria-current="page"] .sym { color: var(--auf-farbe); }
  #nav-rechnungen, .nb.neu .nb-text, .nb.set .nb-text, .nb.sich .nb-text {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .nb .badge { position: absolute; top: 4px; right: calc(50% - 30px); min-width: 19px; height: 19px; padding: 0 5px;
    border-radius: 10px; background: var(--c); color: var(--auf-farbe); font-size: 11px; font-weight: 800; display: grid; place-items: center; }
  .nb[aria-current="page"] .badge { background: var(--auf-farbe); color: var(--c); }
  .kopf nav a.nb.neu { justify-self: center; width: 70px; height: 70px; min-height: 0; margin-top: -24px; padding: 0;
    border-radius: 50%; border: 0; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 14px 26px -8px var(--accent), 0 0 0 6px var(--surface); box-shadow: 0 14px 26px -8px var(--accent), 0 0 0 6px color-mix(in srgb, var(--surface) 96%, transparent); }
  .nb.neu .sym { color: inherit; width: 30px; height: 30px; stroke-width: 2.3; }
  /* Einstellungen und Sicherung: Symbol-Schaltflächen oben rechts in der Kopfzeile */
  .kopf nav a.nb.set, .kopf nav a.nb.sich { position: fixed; top: calc(8px + env(safe-area-inset-top, 0px)); z-index: 51;
    width: 46px; height: 46px; min-height: 0; padding: 0; border-radius: 14px; color: var(--c); }
  .kopf nav a.nb.sich { right: 14px; }
  .kopf nav a.nb.set { right: 68px; }

  /* ---------- Fokus-Modus (Assistent, Patient bearbeiten): ohne untere Leiste, feste Aktionsleiste ---------- */
  body.fokus .kopf { display: none; }
  body.fokus main > h1 { display: none; }
  .fokus-kopf { position: fixed; top: 0; left: 0; right: 0; z-index: 45; display: flex; align-items: center; gap: 12px;
    min-height: 62px; padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 8px; background: var(--surface);
    border-bottom: 1px solid var(--line); }
  .fokus-kopf b { font-size: 18px; font-weight: 800; flex: 1; min-width: 0; }
  .zurueck-pfeil { width: 46px; height: 46px; min-height: 0; padding: 0; border-radius: 14px; display: grid; place-items: center;
    background: var(--zebra); border: 1px solid var(--line); color: var(--ink); flex: none; }
  /* Fortschritt: vier Segmente (die bisherigen Schritt-Schaltflächen) */
  .schritte { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; }
  .schritte li { display: block; }
  .schritte .schrittknopf { position: relative; display: block; width: 100%; min-height: 44px; padding: 0; border: 0;
    background: transparent; color: transparent; font-size: 0; opacity: 1; overflow: hidden; }
  .schritte .schrittknopf::before { content: ""; position: absolute; left: 0; right: 0; top: 19px; height: 6px;
    border-radius: 3px; background: var(--line-2); }
  .schritte li:has(~ li.aktiv) .schrittknopf::before { background: var(--ok); }
  .schritte .aktiv .schrittknopf { background: transparent; border: 0; }
  .schritte .aktiv .schrittknopf::before { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
  .schritt-text { margin: 0 0 6px; font-weight: 700; font-size: 14px; color: var(--muted); }
  .schritt-text b { color: var(--ink); }
  .typzeile { font-size: 14px; }
  /* Rechnungsart als Auswahlkarten */
  label.art-karte { position: relative; display: flex; align-items: center; gap: 14px; min-height: 64px; margin: 0 0 10px;
    padding: 14px 52px 14px 16px; border: 1.5px solid var(--line-2); border-radius: 16px; background: var(--surface);
    font-size: 17px; font-weight: 750; color: var(--ink); }
  label.art-karte input { position: absolute; opacity: 0; width: 1px; height: 1px; }
  label.art-karte:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); background: color-mix(in srgb, var(--accent) 8%, var(--surface));
    box-shadow: 0 0 0 4px var(--accent-soft); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
  label.art-karte:has(input:checked)::after { content: "✓"; position: absolute; top: 50%; right: 14px; margin-top: -12px;
    width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
    display: grid; place-items: center; font-size: 14px; font-weight: 800; }
  label.art-karte:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
  /* Feste Aktionsleiste unten: „Abbrechen“ schmal, „Weiter“/„Speichern“ breit */
  body.fokus .navi { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: 1fr 2fr;
    gap: 10px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface);
    border-top: 1px solid var(--line); box-shadow: 0 -10px 24px -16px rgba(0, 0, 0, .3); }
  body.fokus .navi > * { width: 100%; min-height: 52px; margin: 0; }
  body.fokus .navi > .zurueck { display: none; }
  body.fokus .navi > .knopf:not(.haupt) { order: -1; }
  /* Beim Tippen (Bildschirmtastatur offen) steht die Leiste am Ende des Formulars statt fest unten:
     so verdeckt sie nie ein Eingabefeld. */
  body.fokus:has(:is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea):focus) .navi {
    position: static; padding: 4px 0 0; background: transparent; border: 0; box-shadow: none; }
  body.fokus:has(:is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea):focus) { padding-bottom: 24px; }

  /* ---------- Suche und Auswahlfelder (Version 2: nichts scrollt waagerecht) ---------- */
  #liste-such-form, #such-form { display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: 8px; margin: 0; }
  input.suchfeld, #such-form .suchfeld { order: -1; width: 100%; min-width: 0; min-height: 50px; font-size: 16px;
    padding-left: 44px; background: var(--surface) var(--such-bild) no-repeat 14px center / 20px; }
  .filter-chips { display: contents; }
  #liste-such-form .filter-chips { display: none; }   /* Rechnungen: Jahr im Kopf, Status als Auswahlfeld */
  #liste-such-form > .tel-anzeigen { grid-column: 1 / -1; }
  #such-form label.haken, #such-form select[name="sort"], #such-form #such-knopf, #such-form #such-zurueck { display: none; }
  /* Auswahlfeld mit kleiner Überschrift („Status“, „Dienst“) */
  label.auswahl { position: relative; display: block; min-width: 0; margin: 0; }
  label.auswahl > small { position: absolute; left: 13px; top: 6px; z-index: 1; font-size: 10.5px; line-height: 1.1;
    letter-spacing: .5px; text-transform: uppercase; font-weight: 750; color: var(--muted); pointer-events: none; }
  label.auswahl > select { width: 100%; min-height: 50px; padding: 14px 32px 0 12px; font-weight: 650; background-position: right 8px center;
    text-overflow: ellipsis; }
  .reiter { gap: 8px; border: 0; margin: 0 0 12px; flex-wrap: wrap; }
  .reiter a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-2);
    border-radius: 22px; background: var(--surface); color: var(--ink); font-weight: 650; }
  .reiter a.aktiv { background: var(--ink); color: var(--surface); border-color: var(--ink); margin: 0; }

  /* Suchzeile bleibt beim Scrollen unter der Kopfzeile stehen (Einsätze, Patienten) */
  .such-kleber { position: sticky; top: calc(62px + env(safe-area-inset-top, 0px)); z-index: 30; margin: 0 -14px 8px;
    padding: 8px 14px; background: var(--bg); box-shadow: 0 8px 14px -12px rgba(0, 0, 0, .35); }
  #kartei-anzahl { display: block; margin: 4px 2px 0; font-size: 12.5px; }
  form.such-kleber { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .ohne-telefon { display: none !important; }
  a.pat-neu { min-height: 50px; padding: 0 14px; }

  /* ---------- Rechnungen: Jahr im Kopf, Quartals-Kacheln, Einnahmen ---------- */
  .seitenkopf { display: flex; align-items: center; gap: 0 10px; margin: 4px 0 4px; }
  .seitenkopf h1 { flex: 1 1 auto; min-width: 0; margin: 0; }
  .jahr-wahl { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 22px;
    background-color: var(--surface); border: 1px solid var(--line-2); font-weight: 750; font-size: 16px; color: var(--ink); }
  select.jahr-wahl { width: auto; padding-right: 36px; background-position: right 10px center; }
  .unterzeile { margin: 4px 0 8px; color: var(--muted); font-size: 14px; }
  .quartale { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 4px; }
  .quartal { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 56px;
    padding: 6px 2px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink);
    text-decoration: none; text-align: center; overflow-wrap: normal; }
  .quartal b { font-size: 15px; }
  .quartal small { font-size: 11.5px; line-height: 1.25; color: var(--muted); font-variant-numeric: tabular-nums; }
  a.quartal.an { background: var(--rech); border-color: var(--rech); color: var(--auf-farbe); }
  a.quartal.an small { color: inherit; opacity: .9; }
  .kachel-hinweis { margin: 0 2px 8px; font-size: 12px; color: var(--muted); }
  details.einnahmen { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 0 12px; }
  details.einnahmen > summary { min-height: 46px; gap: 8px; font-size: 15px; }
  details.einnahmen > summary b { margin-left: auto; font-variant-numeric: tabular-nums; }
  details.einnahmen .quartale { margin-top: 2px; }
  details.einnahmen .quartal { background: var(--zebra); border-color: var(--line); }
  .karten { display: none; }                                /* Kennzahlen: am Telefon als Kacheln */

  /* ---------- Einsätze: Abholen + „⋯“, einklappbares Feld „Daten“ (ohne JavaScript) ---------- */
  main:has(> .ein-oben) > h1, main:has(> .ein-oben) > .reiter { display: none; }
  .abhol-zeile { display: grid; grid-template-columns: minmax(0, 1fr) 54px; gap: 8px; margin: 0 0 10px; }
  #kvb-abholen { width: 100%; min-height: 52px; background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-color: transparent; color: var(--auf-farbe); box-shadow: 0 10px 20px -12px var(--accent); }
  .daten-knopf { position: relative; display: grid; place-items: center; min-height: 52px; margin: 0; border-radius: 14px;
    background: var(--set-s); border: 1px solid var(--line-2); color: var(--set); cursor: pointer; }
  .daten-knopf input.daten-schalter { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
  .daten-knopf:has(input:checked) { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
  .daten-knopf:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
  .daten-feld { display: none; }
  main:has(#daten-auf:checked) .daten-feld { display: grid; gap: 8px; margin: 0 0 10px; padding: 10px; border: 1px solid var(--line-2);
    border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-m); }
  .daten-titel { margin: 2px 4px 0; font-size: 12px; letter-spacing: .6px; text-transform: uppercase; font-weight: 750; color: var(--muted); }
  .daten-feld .knopf, .ablage-knopf { justify-content: flex-start; width: 100%; min-height: 48px; }
  .daten-feld .knopf.gefahr { color: var(--bad); border-color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line-2)); background: var(--bad-bg); }
  .ablage { display: grid; gap: 8px; margin: 0; }
  .ablage-feld { position: relative; display: block; padding: 0; border: 0; background: transparent; }
  .ablage-feld .ablage-text { display: none; }
  .ablage-knopf { display: flex; align-items: center; gap: 8px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line-2);
    background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 700; cursor: pointer; }
  .ablage-feld input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; opacity: 0; cursor: pointer; }
  .ablage-feld:has(input:focus-visible) .ablage-knopf { outline: 3px solid var(--focus); outline-offset: 2px; }
  .ablage-feld.ueber .ablage-knopf { background: var(--accent-soft); }
  #einlesen-form.auto > button { display: none; }        /* mit JavaScript: Einlesen gleich nach der Auswahl */
  .knopf .sym, button .sym { width: 20px; height: 20px; }

  /* ---------- Tabellen als gestapelte Karten (Positionen, Rechnung, Statistik, Einstellungen) ---------- */
  .tabelle { display: block; overflow-x: visible; background: var(--surface); border-radius: 14px; border: 1px solid var(--line); }
  .tabelle th, .tabelle td { border-bottom-color: var(--line); padding: 10px; white-space: normal; }
  table.stapel { display: block; border: 0; border-radius: 0; background: transparent; margin: 6px 0; }
  table.stapel thead { display: none; }
  table.stapel tbody, table.stapel tfoot { display: grid; gap: 10px; }
  table.stapel tfoot { margin-top: 10px; }
  table.stapel tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 14px; border: 1px solid var(--line);
    border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-m); }
  table.stapel td { display: block; min-width: 0; padding: 0; border: 0; }
  table.stapel td:empty { display: none; }
  table.stapel td:has(> select) { flex: 1 1 40%; }
  table.stapel td > select { width: 100%; }
  table.stapel tfoot tr { justify-content: space-between; font-weight: 750; box-shadow: none; background: var(--zebra); }
  /* Positionen (Vorschau in Schritt 4 und Rechnungsansicht): Ziffer · Bezeichnung, Rechenweg darunter, Betrag rechts */
  table.positionen.stapel tbody tr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 8px; row-gap: 6px; align-items: start; }
  .positionen.stapel td:first-child { grid-column: 1; grid-row: 1; font-weight: 800; }
  .positionen.stapel td:first-child::after { content: " ·"; }
  .positionen.stapel td.p-text { grid-column: 2; grid-row: 1; font-weight: 700; line-height: 1.3; }
  .positionen.stapel td.p-text small { display: block; font-weight: 600; }
  .positionen.stapel td.p-text br { display: none; }
  .positionen.stapel .rechenweg { margin-top: 2px; font-weight: 500 !important; font-variant-numeric: tabular-nums; }
  .positionen.stapel td.p-summe { grid-column: 3; grid-row: 1; font-weight: 800; text-align: right; }
  .positionen.stapel td.p-faktor, .positionen.stapel td.p-anzahl { display: none; }
  .positionen.stapel td.p-weg { grid-column: 1 / -1; justify-self: end; }
  /* Ziffern zum Bearbeiten (Schritt 4): Kästchen „An“, Ziffer und Bezeichnung, darunter Faktor, Anzahl, Begründung */
  table.ziffern.stapel tbody tr { display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(0, 96px); column-gap: 8px; row-gap: 8px; align-items: start; }
  .ziffern.stapel td.z-an { grid-column: 1; grid-row: 1; }
  .ziffern.stapel label.an-feld { display: grid; place-items: center; width: 44px; height: 44px; margin: 0; }
  .ziffern.stapel td.z-text { grid-column: 2; grid-row: 1; line-height: 1.3; padding-top: 4px; }
  .ziffern.stapel td.z-text br { display: none; }
  .ziffern.stapel td.z-text small { display: block; font-weight: 600; }
  .ziffern.stapel td.z-weg { grid-column: 3; grid-row: 1; justify-self: end; }
  .ziffern.stapel td.z-weg button { padding: 0 10px; }
  .ziffern.stapel td.z-faktor { grid-column: 1 / 3; grid-row: 2; }
  .ziffern.stapel td.z-anzahl { grid-column: 3; grid-row: 2; }
  .ziffern.stapel td.z-grund { grid-column: 1 / -1; grid-row: 3; }
  .ziffern.stapel td[data-titel]::before { content: attr(data-titel); display: block; margin: 0 0 4px; font-size: 13px; font-weight: 750; color: var(--muted); }
  .ziffern.stapel td.z-faktor br { display: none; }
  .ziffern.stapel td.z-faktor small { display: block; margin-top: 2px; }
  .ziffern.stapel input { width: 100%; }
  /* Statistik der Dienste */
  .statistik.stapel td.s-datum { font-weight: 800; }
  .statistik.stapel td.s-bereich { flex: 1 1 100%; color: var(--muted); font-size: 14px; order: 3; }
  .statistik.stapel td.s-zeit { color: var(--muted); font-size: 14px; }
  .statistik.stapel td.s-zahl { margin-left: auto; font-weight: 800; }
  .statistik.stapel td.s-zahl::before { content: attr(data-titel) ":\00a0"; font-weight: 600; color: var(--muted); }
  /* Startpunkte (Einstellungen) */
  .startpunkte.stapel td.sp-name { font-weight: 800; }
  .startpunkte.stapel td.sp-adresse { flex: 1 1 100%; color: var(--muted); }
  .startpunkte.stapel td.sp-weg { margin-left: auto; }
  /* Schritt 4: feste Leiste mit Summe und „Speichern“ */
  .navi-summe { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
  .navi-summe small { color: var(--muted); font-weight: 700; font-size: 12px; }
  .navi-summe b { font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
  body.fokus .navi:has(> .navi-summe) > .abbrechen { display: none; }
  body.fokus .navi:has(> .navi-summe) { grid-template-columns: 1fr 1.3fr; align-items: center; }

  /* ---------- Listen als Karten (Rechnungen, Einsätze, Patienten): gleiche Zeilen, andere Anordnung ---------- */
  table.karten-liste { display: block; overflow: visible; background: transparent; border: 0; border-radius: 0; margin: 0; }
  table.karten-liste thead { display: none; }
  table.karten-liste tbody { display: grid; gap: 12px; }
  table.karten-liste tbody tr { position: relative; background: var(--surface); border: 1px solid var(--line);
    border-radius: 16px; box-shadow: var(--shadow-m); padding: 14px 16px; }
  table.karten-liste td { display: block; padding: 0; border: 0; background: transparent !important; min-width: 0; }
  a.karten-link::after { content: ""; position: absolute; inset: 0; border-radius: 16px; }

  /* Rechnungen: Patient und Betrag oben, Nr./Datum/Art und Status darunter, Aktion volle Breite */
  table.rechnungsliste tbody tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: 6px; row-gap: 4px; }
  table.rechnungsliste tbody tr::before { content: ""; order: 3; flex: 0 0 100%; height: 0; }
  .rechnungsliste td.c-pat { order: 1; flex: 1 1 0; font-size: 17px; font-weight: 800; color: var(--ink); }
  .rechnungsliste td.c-pat a { color: inherit; text-decoration: none; }
  .rechnungsliste td.c-betrag { order: 2; flex: none; text-align: right; font-size: 17px; font-weight: 800; }
  .rechnungsliste td.c-nr { order: 4; flex: none; font-weight: 750; font-size: 14px; }
  .rechnungsliste td.c-nr a { color: var(--ink); text-decoration: none; }
  .rechnungsliste td.c-dat { order: 5; flex: none; color: var(--muted); font-size: 14px; }
  .rechnungsliste td.c-art { order: 6; flex: 0 1 auto; color: var(--muted); font-size: 14px; }
  .rechnungsliste tr:not(:has(td.vorgemerkt)) td.c-dat::before, .rechnungsliste td.c-art::before { content: "· "; }
  .rechnungsliste td.c-art br { display: none; }
  .rechnungsliste td.c-art small { display: block; font-size: 12.5px; }
  .rechnungsliste td.c-status { order: 7; flex: none; margin-left: auto; }
  .rechnungsliste td.c-aktion { order: 8; flex: 0 0 100%; margin-top: 8px; position: relative; z-index: 1; }
  .rechnungsliste td.c-aktion:empty, .rechnungsliste td.c-aktion:not(:has(> :not(.nur-rechner))) { display: none; }
  .rechnungsliste td.c-aktion button { width: 100%; min-height: 50px; font-size: 16px; }
  .rechnungsliste tr:has(td.vorgemerkt) { box-shadow: inset 4px 0 0 var(--vorg), var(--shadow-m); }
  .rechnungsliste td.vorgemerkt.c-nr, .rechnungsliste .c-dat-titel, .rechnungsliste td.c-dat br { display: none; }
  .st-text, .marke-vorgemerkt { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px;
    border-radius: 13px; font-size: 12.5px; font-weight: 750; white-space: nowrap; background: var(--warn-bg); color: var(--warn); }
  .st-text::before, .marke-vorgemerkt::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
  tr.st-offen .st-text, tr.st-ueberfaellig .st-text { background: var(--bad-bg); color: var(--bad); }
  tr.st-bezahlt .st-text { background: var(--ok-bg); color: var(--ok); }
  tr.st-storniert .st-text { background: var(--zebra); color: var(--muted); }

  /* Einsätze: eine Karte pro Einsatz (Reihenfolge der Zellen bleibt; nur die Anordnung über order) */
  #kartei { margin: 0; }
  table.kartei.karten-liste { font-size: 16px; }
  table.kartei.karten-liste tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  table.kartei.karten-liste tbody tr::before { content: ""; order: 7; flex: 0 0 100%; height: 0; }
  table.kartei.karten-liste tbody tr.nacht { box-shadow: inset 5px 0 0 var(--night), var(--shadow-m); }
  table.kartei.karten-liste tbody tr.trenner { margin-top: 8px; }
  .kartei.karten-liste th, .kartei.karten-liste td, .kartei.karten-liste td.name { white-space: normal; }
  .kartei.karten-liste tr.nacht td:first-child { box-shadow: none; padding-left: 0; }
  .kartei.karten-liste tr.trenner td { border-top: 0; }
  .kartei.karten-liste td.name { order: 1; flex: 1 1 auto; font-size: 18px; font-weight: 800; }
  .kartei.karten-liste td.k-besuch { order: 2; flex: none; height: 26px; display: inline-flex; align-items: center; padding: 0 11px;
    border-radius: 13px; font-size: 12.5px; font-weight: 750; background: var(--info-bg) !important; color: var(--info); }
  .kartei.karten-liste td.k-besuch::before { content: attr(data-titel) "\00a0"; }
  .kartei.karten-liste td.k-besuch.einzel { display: none; }
  .kartei.karten-liste td.k-adr { order: 3; flex: 0 0 100%; margin-top: -6px; color: var(--muted); font-size: 14px; }
  .kartei.karten-liste td:nth-child(3), .kartei.karten-liste td.k-dienst, .kartei.karten-liste td.k-km { flex: none; color: var(--muted); font-size: 14px; }
  .kartei.karten-liste td:nth-child(3) { order: 4; }
  .kartei.karten-liste td.k-dienst { order: 5; }
  .kartei.karten-liste td.k-km { order: 6; }
  .kartei.karten-liste td.k-dienst::before, .kartei.karten-liste td.k-km:not(:empty)::before { content: "· "; }
  .kartei.karten-liste td.k-zeit { flex: 1 1 calc((100% - 16px) / 3); border-radius: 12px; padding: 8px 10px;
    background: var(--zebra) !important; border: 1px solid var(--line); font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; }
  .kartei.karten-liste td.k-zeit::before { content: attr(data-titel); display: block; font-size: 11.5px; letter-spacing: .5px;
    text-transform: uppercase; font-weight: 750; color: var(--muted); }
  .kartei.karten-liste td.k-aus { order: 8; background: var(--hi) !important; border-color: transparent; color: var(--hi-ink); }
  .kartei.karten-liste td.k-aus::before { color: var(--hi-ink); }
  .kartei.karten-liste td.k-an { order: 9; }
  .kartei.karten-liste td.k-frei { order: 10; }
  .kartei.karten-liste td.k-marke { flex: none; padding: 6px 12px; border-radius: 10px; background: var(--hi) !important;
    color: var(--hi-ink); font-weight: 750; font-size: 14.5px; }
  .kartei.karten-liste td.k-marke:empty { display: none; }
  .kartei.karten-liste td.k-gop { order: 11; } .kartei.karten-liste td.k-zusatz { order: 12; } .kartei.karten-liste td.k-tn { order: 13; }
  .kartei.karten-liste td.diagnose { order: 14; flex: 0 0 100%; min-width: 0; margin-top: 4px; }
  .kartei.karten-liste td.diagnose::before { content: attr(data-titel); display: block; font-weight: 750; font-size: 13.5px; margin: 0 0 6px; }
  .kartei.karten-liste .diagnose-feld { width: 100%; min-width: 0; min-height: 52px; background: var(--hi); border-color: transparent;
    color: var(--hi-ink); font-weight: 600; }
  .kartei.karten-liste td.marke { position: relative; flex: 1 1 calc(50% - 4px); text-align: center; margin-top: 4px; }
  .kartei.karten-liste td.k-hausbesuch { order: 15; --c: var(--pat); }
  .kartei.karten-liste td.k-leichenschau { order: 16; --c: var(--set); }
  .kartei.karten-liste td.marke input.markierung { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 54px;
    margin: 0; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer; }
  .kartei.karten-liste td.marke::before { content: attr(data-titel); position: absolute; top: 0; left: 0; right: 0; height: 54px;
    display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 750; color: var(--ink); pointer-events: none; }
  .kartei.karten-liste td.marke:has(input:checked) input.markierung { background: var(--c); border-color: var(--c); }
  .kartei.karten-liste td.marke:has(input:checked)::before { content: "✓\00a0\00a0" attr(data-titel); color: var(--auf-farbe); }
  .kartei.karten-liste td.marke input.markierung:disabled { opacity: .75; cursor: default; }
  .kartei.karten-liste td.marke input.markierung:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
  .kartei.karten-liste td.marke .diagnose-status { font-size: 13px; color: var(--muted); margin-top: 4px; white-space: normal; }
  .kartei.karten-liste td.marke .diagnose-status.ok { color: var(--ok); }
  .kartei.karten-liste td.marke .diagnose-status.fehler { color: var(--bad); }
  .kartei.karten-liste td.k-akut, .kartei.karten-liste td.k-nr { flex: none; font-size: 12.5px; color: var(--muted); }
  .kartei.karten-liste td.k-akut { order: 17; }
  .kartei.karten-liste td.k-akut::before { content: attr(data-titel) ":\00a0"; }
  .kartei.karten-liste td.k-nr { order: 18; margin-left: auto; }
  .kartei mark { background: var(--mark); color: inherit; }
  .ablage > button { width: 100%; }
  .statistik { font-size: 15px; }

  /* Patienten: Initialen-Kreis, Name, Ort */
  table.patientenliste { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-m); overflow: hidden; }
  table.patientenliste tbody { gap: 0; }
  table.patientenliste tbody tr { display: grid; grid-template-columns: 44px max-content minmax(0, 1fr) auto; column-gap: 6px; row-gap: 0;
    align-items: center; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; padding: 12px 14px; }
  table.patientenliste tbody tr:last-child { border-bottom: 0; }
  .patientenliste td.p-name { display: contents; }
  .patientenliste .initialen { grid-column: 1; grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 50%; display: grid;
    place-items: center; font-weight: 800; background: var(--pat-s); color: var(--pat); margin-right: 6px; }
  .patientenliste a.karten-link { grid-column: 2; grid-row: 1; padding-left: 6px; font-weight: 750; color: var(--ink); text-decoration: none; }
  .patientenliste a.karten-link::after { border-radius: 0; }
  .patientenliste td.p-vorname { grid-column: 3; grid-row: 1; font-weight: 750; }
  .patientenliste td.p-ort { grid-column: 2 / 4; grid-row: 2; padding-left: 6px; color: var(--muted); font-size: 13.5px; }
  .patientenliste td.p-geb { grid-column: 4; grid-row: 1 / 3; color: var(--muted); font-size: 13px; text-align: right; }

  /* ---------- Namensfenster als Bottom-Sheet ---------- */
  dialog.name-dialog { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92vh; border: 0; border-radius: 26px 26px 0 0;
    padding: 10px 18px calc(22px + env(safe-area-inset-bottom, 0px)); background: var(--surface); color: var(--ink);
    box-shadow: 0 -20px 40px -10px rgba(0, 0, 0, .45); }
  dialog.name-dialog::backdrop { background: rgba(8, 12, 18, .55); }
  dialog.name-dialog form::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px;
    background: var(--line-2); margin: 0 auto 6px; }
  dialog.name-dialog h2 { font-size: 20px; margin: 0; }
  dialog.name-dialog #name-original { display: block; margin-top: 10px; padding: 10px 14px; border-radius: 12px;
    background: var(--zebra); border: 1px solid var(--line); }
  dialog.name-dialog .zeile { display: grid; gap: 10px; }
  dialog.name-dialog .zeile button { width: 100%; min-height: 52px; }

  /* ---------- Einzelseiten ---------- */
  .angaben { grid-template-columns: minmax(0, max-content) minmax(0, 1fr); border-radius: 14px; background: var(--surface); border-color: var(--line); }
  .navi-patient { display: flex; gap: 10px; }
  .unterschrift { background: #fff; }
  .tabelle td.vorgemerkt { background: var(--warn-bg); }
}

/* Sitzung (Sperren/Abmelden) am Telefon unter Einstellungen */
.konto-telefon { display: grid; gap: 10px; }
.konto-telefon button { width: 100%; }

/* ======================================================================================================
   Rechner (ab 900 px): Kopfzeile mit Reitern und Symbol-Schaltflächen, Karten, Tabellen, Statusmarken.
   Vorlage: docs/referenz/design_vorschlag.html (Version 2). Farben aus den gemeinsamen Variablen oben.
   color-mix/backdrop-filter jeweils mit einfacher Ersatzfarbe davor.
   ====================================================================================================== */
.chip { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px; border-radius: 13px;
  font-size: 12.5px; font-weight: 750; white-space: nowrap; background: var(--zebra); color: var(--muted); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-bg); color: var(--ok); } .chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); } .chip.info { background: var(--info-bg); color: var(--info); }

@media (min-width: 900px) {
  .sym { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
  body { font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
  main { max-width: 1320px; padding: 22px; }
  main.breit { max-width: 1600px; }
  a { color: var(--accent); }
  :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
  ::selection { background: var(--accent-soft); }
  .sicher-unsichtbar, #nav-rechnungen, .konto-knopf .nb-text {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

  /* ---------- Kopfzeile ---------- */
  .kopf { position: sticky; top: 0; z-index: 40; flex-wrap: nowrap; gap: 7px; min-height: 68px; padding: 10px 18px 12px;
    background: var(--surface); border-bottom: 0; }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .kopf { background: var(--surface); background: color-mix(in srgb, var(--surface) 88%, transparent);
      -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); }
  }
  .kopf::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; opacity: .55;
    background: linear-gradient(90deg, var(--rech), var(--pat), var(--ein)); }
  .kopf .marke { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 18px; letter-spacing: -.2px; margin-right: 6px; white-space: nowrap; }
  .logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 14px -6px var(--accent); }
  .logo .sym { width: 20px; height: 20px; }
  .kopf nav.hauptmenue { display: contents; }
  .kopf nav a { padding: 0; }
  .nb { --c: var(--set); --cs: var(--set-s); position: relative; display: inline-flex; align-items: center; gap: 9px; min-height: 46px;
    padding: 0 14px 0 7px; border-radius: 14px; background: var(--cs); color: var(--ink); font-weight: 650; white-space: nowrap;
    text-decoration: none; border: 1px solid var(--line); border: 1px solid color-mix(in srgb, var(--c) 18%, transparent);
    transition: transform .14s ease, box-shadow .14s ease, background .14s ease; }
  .kopf nav a.nb { padding: 0 14px 0 7px; }
  .nb .sym { width: 33px; height: 33px; padding: 6.5px; border-radius: 10px; background: var(--surface); color: var(--c); box-shadow: var(--shadow-s); }
  .nb:hover { transform: translateY(-1px); box-shadow: var(--shadow-m); }
  .nb[aria-current="page"] { background: var(--c); color: var(--auf-farbe); border-color: transparent; box-shadow: 0 8px 18px -8px var(--c); }
  .nb[aria-current="page"] .sym { background: rgba(255, 255, 255, .22); color: inherit; box-shadow: none; }
  .nb.rech { --c: var(--rech); --cs: var(--rech-s); order: 1; }
  .nb.pat { --c: var(--pat); --cs: var(--pat-s); order: 2; }
  .nb.ein { --c: var(--ein); --cs: var(--ein-s); order: 3; }
  .nb.set { --c: var(--set); --cs: var(--set-s); order: 6; }
  .nb.sich { --c: var(--sich); --cs: var(--sich-s); order: 7; }
  .nb .badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--c); color: var(--auf-farbe);
    font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }
  .nb[aria-current="page"] .badge { background: var(--auf-farbe); color: var(--c); }
  /* Hauptschaltfläche „Neue Rechnung“ rechts */
  .kopf nav a.nb.neu { order: 5; margin-left: auto; padding: 0 16px 0 8px; border: 0; color: #fff; font-weight: 750;
    background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 10px 22px -10px var(--accent); }
  .nb.neu .sym { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: rgba(255, 255, 255, .22); color: inherit; box-shadow: none; }
  .nb.neu[aria-current="page"] { color: #fff; }
  /* Einstellungen, Sicherung: Beschriftung erst ab 1280 px; Tresor sperren, Abmelden: Symbol-Schaltflächen */
  .kopf nav a.nb.set, .kopf nav a.nb.sich { padding: 0 6px; }
  .nb.set .nb-text, .nb.sich .nb-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .konto { order: 8; display: flex; gap: 8px; margin-left: 0; }
  .kopf:not(:has(nav)) .konto { margin-left: auto; }
  .konto form { margin: 0; }
  button.konto-knopf { --c: var(--set); width: 46px; height: 46px; min-height: 0; padding: 0; border-radius: 14px; display: grid; place-items: center;
    background: var(--set-s); color: var(--set); border: 1px solid var(--line); }
  button.konto-knopf:hover { background: var(--surface); }

  /* ---------- Seitenkopf ---------- */
  h1 { display: flex; align-items: center; gap: 14px; font-size: 26px; line-height: 1.15; font-weight: 800; letter-spacing: -.4px; margin: 6px 0 18px; }
  h2 { font-size: 17px; font-weight: 750; }
  .titel-sym { --c: var(--accent); --cs: var(--accent-soft); flex: none; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
    background: var(--cs); color: var(--c); }
  .titel-sym .sym { width: 24px; height: 24px; }
  .titel-sym.rech { --c: var(--rech); --cs: var(--rech-s); } .titel-sym.pat { --c: var(--pat); --cs: var(--pat-s); }
  .titel-sym.ein { --c: var(--ein); --cs: var(--ein-s); } .titel-sym.set { --c: var(--set); --cs: var(--set-s); }
  .titel-sym.sich { --c: var(--sich); --cs: var(--sich-s); }
  .seitenkopf { display: flex; align-items: center; gap: 14px; margin: 6px 0 18px; }
  .seitenkopf h1 { margin: 0; flex: 1 1 auto; }
  .unterzeile { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
  h1 .marke-st { margin-left: 4px; }

  /* ---------- Felder und Schaltflächen ---------- */
  input, select, textarea { min-height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 12px;
    background-color: var(--surface); color: var(--ink); transition: box-shadow .14s, border-color .14s; }
  textarea { padding: 10px 12px; }
  input[type="checkbox"], input[type="radio"] { min-height: 0; width: 18px; height: 18px; padding: 0; accent-color: var(--accent); }
  input[type="file"] { padding: 6px 10px; }
  input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
  label { font-size: 13.5px; font-weight: 700; color: var(--muted); gap: 6px; }
  label > input, label > select, label > textarea { font-weight: 400; font-size: 15px; }
  label.haken { font-size: 15px; font-weight: 500; color: var(--ink); }
  button, .knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px;
    border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 650;
    transition: background .14s, transform .14s, box-shadow .14s; }
  button:hover, .knopf:hover { background: var(--zebra); border-color: var(--line-2); }
  button:active, .knopf:active { transform: translateY(1px); }
  button.haupt, .knopf.haupt { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 14px -8px var(--accent); }
  button.haupt:hover, .knopf.haupt:hover { background: var(--accent); filter: brightness(1.08); }
  button.gefahr, .knopf.gefahr { color: var(--bad); background: var(--bad-bg); border-color: var(--bad);
    border-color: color-mix(in srgb, var(--bad) 40%, var(--line-2)); }
  button.klein { min-height: 32px; padding: 0 10px; font-size: 14px; border-radius: 9px; }
  button:disabled { opacity: .6; }
  .knopf .sym, button .sym { width: 18px; height: 18px; }

  /* ---------- Karten, Hinweise, Meldungen ---------- */
  fieldset, .karte, .angaben, .kennzahl { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-m); }
  fieldset { padding: 14px 18px 18px; margin: 0 0 16px; }
  legend { font-weight: 800; padding: 0 6px; }
  .karte { padding: 20px 22px; }
  .karten { gap: 14px; margin-bottom: 18px; }
  .kennzahl { padding: 12px 16px; }
  .kennzahl strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
  .angaben { padding: 14px 18px; }
  .meldung { background: var(--info-bg); color: var(--info); border: 0; border-radius: 12px; padding: 12px 14px; font-weight: 600; }
  .drive-warnung { background: var(--warn-bg); color: var(--ink); border: 0; border-left: 5px solid var(--warn); border-radius: 12px; }
  .drive-warnung.konflikt, .kartei-warnung { background: var(--bad-bg); color: var(--ink); border: 0; border-left: 5px solid var(--bad); border-radius: 12px; }
  .warnung { color: var(--warn); } .fehler, .fehlertext { color: var(--bad); } .ok { color: var(--ok); }
  .hinweise { color: var(--warn); }
  p.hinweis { color: var(--muted); }
  .schluessel { background: var(--zebra); }

  /* ---------- Tabellen ---------- */
  .tabelle { display: table; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r); box-shadow: var(--shadow-m); margin: 6px 0 18px; }
  .tabelle th { font-size: 12px; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); font-weight: 750; padding: 12px 14px;
    background: var(--surface); border-bottom: 1px solid var(--line-2); white-space: nowrap; }
  .tabelle td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
  .tabelle thead th:first-child { border-top-left-radius: var(--r); } .tabelle thead th:last-child { border-top-right-radius: var(--r); }
  .tabelle tbody tr:nth-child(even) td { background: var(--zebra); }
  .tabelle tbody tr:hover td { background: var(--hover); }
  .tabelle tbody tr:last-child td, .tabelle tfoot td { border-bottom: 0; }
  .tabelle .zahl, .zahl { text-align: right; font-variant-numeric: tabular-nums; }
  .tabelle tfoot td { background: var(--surface-2); font-weight: 700; }
  .rechnungsliste td.c-pat { font-weight: 700; }
  .tabelle td.vorgemerkt { background: transparent; }
  .rechnungsliste tr:has(td.vorgemerkt) td:first-child { box-shadow: inset 4px 0 0 var(--vorg); }
  .rechnungsliste td.c-dat-titel, .rechnungsliste .c-dat-titel { color: var(--muted); }
  /* Statusmarken */
  .st-text, .marke-vorgemerkt, .marke-st { display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px; border-radius: 13px;
    font-size: 12.5px; font-weight: 750; white-space: nowrap; border: 0; background: var(--bad-bg); color: var(--bad); vertical-align: middle; }
  .st-text::before, .marke-vorgemerkt::before, .marke-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
  .marke-vorgemerkt { background: var(--warn-bg); color: var(--warn); }
  tr.st-bezahlt .st-text, .marke-st.st-bezahlt { background: var(--ok-bg); color: var(--ok); }
  tr.st-storniert .st-text, .marke-st.st-storniert { background: var(--zebra); color: var(--muted); }
  .marke-st.st-ueberfaellig, tr.st-ueberfaellig td:last-child { color: var(--bad); }

  /* ---------- Einsatzsuche: grüne Spalten, Zeilentönung, Nachtbalken; nur die Tabelle scrollt waagerecht ---------- */
  #kartei { overflow-x: auto; border-radius: var(--r); box-shadow: var(--shadow-m); margin: 6px 0 14px; }
  #kartei .tabelle { margin: 0; box-shadow: none; }
  .kartei th.gruen, .kartei td.gruen { background: var(--hi); color: var(--hi-ink); }
  .kartei td.gruen { font-weight: 700; }
  .kartei tbody tr:nth-child(even) td { background: var(--zebra); }
  .kartei tbody tr:nth-child(even) td.gruen { background: var(--hi2); }
  .kartei tbody tr:hover td { background: var(--hover); }
  .kartei tr.nacht td:first-child { box-shadow: inset 5px 0 0 var(--night); padding-left: 14px; }
  .kartei tr.trenner td { border-top: 2px solid var(--muted); }
  .kartei mark { background: var(--mark); color: inherit; }
  .diagnose-feld { min-height: 38px; border-radius: 9px; background: var(--surface); font-weight: 500; }
  .kartei td.marke input { width: 22px; height: 22px; }
  .ablage-feld { border: 2px dashed var(--line-2); border-radius: var(--r); background: var(--surface); color: var(--muted); }
  .ablage-feld.ueber { border-color: var(--accent); background: var(--accent-soft); }
  .reiter { border-bottom: 1px solid var(--line); }
  .reiter a { color: var(--muted); }
  .reiter a.aktiv { background: var(--surface); border-color: var(--line); color: var(--ink); }
  dialog.name-dialog { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-l); }

  /* ---------- Assistent: Schrittanzeige mit Verbindungslinien, erledigte Schritte mit Haken ---------- */
  .schritte { display: flex; align-items: center; gap: 0; flex-wrap: nowrap; padding: 16px 20px; margin: 0 0 16px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-m); }
  .schritte li { display: flex; align-items: center; flex: 1 1 auto; min-width: 0; }
  .schritte li:last-child { flex: 0 0 auto; }
  .schritte li:not(:last-child)::after { content: ""; flex: 1 1 auto; min-width: 20px; height: 2px; margin: 0 12px; border-radius: 2px; background: var(--line-2); }
  .schritte li:has(~ li.aktiv)::after { background: var(--ok); }
  .schritte .schrittknopf { display: inline-flex; gap: 10px; min-height: 0; padding: 0; border: 0; background: transparent; color: var(--muted);
    font-weight: 650; white-space: nowrap; box-shadow: none; }
  .schritte .schrittknopf:hover { background: transparent; color: var(--ink); }
  .schrittknopf .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800;
    background: var(--zebra); border: 1px solid var(--line-2); color: var(--muted); }
  .schritte li:has(~ li.aktiv) .n { font-size: 0; background: var(--ok-bg); color: var(--ok); border-color: transparent; }
  .schritte li:has(~ li.aktiv) .n::before { content: "✓"; font-size: 14px; }
  .schritte .aktiv .schrittknopf, .schritte .aktiv .schrittknopf:disabled { background: transparent; color: var(--ink); opacity: 1; border: 0; }
  .schritte .aktiv .n { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent;
    box-shadow: 0 6px 14px -6px var(--accent); }
  /* Rechnungsart als Auswahlkarten */
  fieldset:has(> label.art-karte) { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
  fieldset:has(> label.art-karte) > :not(label) { grid-column: 1 / -1; }
  label.art-karte { position: relative; display: flex; align-items: center; gap: 12px; min-height: 64px; margin: 0; padding: 14px 44px 14px 16px;
    border: 1.5px solid var(--line-2); border-radius: var(--r); background: var(--surface); font-size: 15.5px; font-weight: 750; color: var(--ink);
    cursor: pointer; transition: border-color .14s, box-shadow .14s, transform .14s; }
  label.art-karte:hover { transform: translateY(-1px); box-shadow: var(--shadow-m); }
  label.art-karte input { position: absolute; opacity: 0; width: 1px; height: 1px; }
  label.art-karte:has(input:checked) { border-color: var(--accent); background: var(--accent-soft);
    background: color-mix(in srgb, var(--accent) 7%, var(--surface)); box-shadow: 0 0 0 4px var(--accent-soft);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
  label.art-karte:has(input:checked)::after { content: "✓"; position: absolute; top: 50%; right: 12px; margin-top: -11px; width: 22px; height: 22px;
    border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 13px; font-weight: 800; }
  label.art-karte:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
  .navi { padding: 14px 0 0; }
}
@media (min-width: 900px) and (max-width: 1279.98px) {
  .kopf { gap: 6px; padding-left: 16px; padding-right: 16px; }
  .kopf .marke { margin-right: 2px; }
  .kopf .marke-text { display: none; }
  .kopf nav a.nb { padding: 0 12px 0 6px; gap: 8px; }
  .kopf nav a.nb.neu { padding: 0 14px 0 8px; }
  .kopf nav a.nb.set, .kopf nav a.nb.sich { padding: 0 6px; }
  .nb .sym { width: 30px; height: 30px; padding: 5.5px; }
  button.konto-knopf { width: 44px; height: 44px; }
}
@media (min-width: 1280px) {
  .nb.set .nb-text, .nb.sich .nb-text { position: static; width: auto; height: auto; overflow: visible; clip: auto; clip-path: none; }
  .kopf nav a.nb.set, .kopf nav a.nb.sich { padding: 0 14px 0 7px; }
}

/* ---------- Dateiauswahl mit deutscher Beschriftung (Telefon und Rechner) ---------- */
label.datei-wahl, .ablage-feld { position: relative; }
input.datei-feld { position: absolute; left: 0; top: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
label.datei-wahl { display: inline-flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); cursor: pointer; }
.datei-knopf { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 650; white-space: nowrap; }
.datei-name { font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
label.datei-wahl:has(input:focus-visible) .datei-knopf, .ablage-feld:has(input:focus-visible) .datei-knopf {
  outline: 3px solid var(--focus); outline-offset: 2px; }
label.datei-wahl:hover .datei-knopf, .ablage-feld:hover .datei-knopf { background: var(--zebra); }
@media (max-width: 899.98px) {
  label.datei-wahl { flex: 1 1 100%; }
  .datei-knopf { min-height: 48px; padding: 0 18px; border-radius: 14px; font-size: 16px; font-weight: 700; }
}

/* ======================================================================================================
   Disposition-SMS: Eingabe, Prüfansicht, „Zuordnung bestätigen“, „Ohne Protokoll“ und vorläufige Einsätze in der
   Einsatzsuche. Farben aus den gemeinsamen Variablen (hell/dunkel über prefers-color-scheme).
   ====================================================================================================== */
.sms-karte, .sms-zuordnung, .sms-ohne { background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; margin: 0 0 14px; box-shadow: var(--shadow-m); min-width: 0; }
.sms-karte.mit-fehler { border-color: var(--bad); }
.sms-karte h2 { margin: 0 0 10px; font-size: 1.05rem; }
.sms-nr { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.sms-warnungen { list-style: none; margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--warn-bg); color: var(--ink);
  border-left: 4px solid var(--warn); }
.sms-warnungen li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.sms-info { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--info-bg); color: var(--info); font-weight: 600; }
.sms-karte label.breit { grid-column: 1 / -1; }
.sms-karte input.unsicher { border-color: var(--warn); background-color: var(--warn-bg); }
.sms-kaestchen { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0 0; }
.sms-art { padding: 0 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); }
.sms-art:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.sms-vorschlag-hinweis { margin: 10px 0 0; font-size: .9rem; color: var(--muted); }
.sms-aktionen { margin-top: 14px; }
.sms-ziele { display: grid; gap: 8px; }
.sms-ziel { align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.sms-ziel:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.sms-ziel small { color: var(--muted); }
.sms-ablage { align-self: flex-start; }
.sms-feld textarea { min-height: 220px; font-size: 16px; line-height: 1.45; }
.sms-hinweise .knopf { border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.zuordnung-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 12px; }
.zuordnung-seite { border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); min-width: 0; }
.zuordnung-seite h2 { margin: 0 0 8px; font-size: 1rem; }
.zuordnung-seite p, .sms-ohne p { margin: 4px 0; }
.z-name { font-weight: 800; font-size: 1.05rem; }
.kartei td.k-sms { white-space: nowrap; }
.kartei td.k-sms .chip { vertical-align: middle; }
a.tel-link { font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (min-width: 900px) {
  main:has(> .ein-oben) > .sms-hinweise { order: 0; }
  .kartei tr.vorl td:first-child { box-shadow: inset 5px 0 0 var(--warn); padding-left: 14px; }
  .sms-pruefen, .sms-eingabe { max-width: 920px; }
  .sms-karte .raster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sms-art { min-height: 40px; }
}

@media (max-width: 899.98px) {
  /* Einsätze: „SMS einfügen“ hervorgehoben in der oberen Zeile, „Wegeprotokolle abholen“ daneben schlichter */
  .abhol-zeile #sms-einfuegen { grid-column: 1 / -1; width: 100%; min-height: 56px; font-size: 17px; background: var(--ein);
    border-color: transparent; color: var(--auf-farbe); box-shadow: 0 10px 20px -12px var(--ein); }
  .abhol-zeile #kvb-abholen { background: var(--surface); border-color: var(--line-2); color: var(--ink); box-shadow: none; }
  table.kartei.karten-liste tbody tr.vorl { box-shadow: inset 5px 0 0 var(--warn), var(--shadow-m); }
  table.kartei.karten-liste tbody tr.vorl.nacht { box-shadow: inset 5px 0 0 var(--warn), var(--shadow-m); }
  .kartei.karten-liste tr.vorl td.k-dienst, .kartei.karten-liste tr.vorl td.k-akut { display: none; }
  .kartei.karten-liste td.k-besuch.k-sms { height: auto; padding: 0; background: none !important; border: 0; gap: 6px; }
  .kartei.karten-liste td.k-besuch.k-sms::before { content: none; }
  .sms-hinweise { display: grid; gap: 8px; margin: 0 0 10px; }
  .sms-hinweise .knopf { width: 100%; }
  .sms-ablage { width: 100%; min-height: 52px; }
  .sms-kaestchen .sms-art { flex: 1 1 calc(50% - 5px); min-height: 52px; }
  .sms-aktionen { display: grid; grid-template-columns: 1fr 1fr; }
  .sms-aktionen > button { width: 100%; }
  .zuordnung-seite form button, .sms-zuordnung > form button { width: 100%; }
  .sms-ohne .zeile { display: grid; grid-template-columns: 1fr 1fr; }
  .sms-ohne .zeile > form > button, .sms-ohne .zeile > .knopf { width: 100%; }
  .sms-warnungen button.klein { min-height: 44px; }
  .kartei.karten-liste td.k-adr a.tel-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; margin-top: 6px;
    border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--accent); font-size: 16px; font-weight: 700;
    text-decoration: none; }
}

/* ---------------------------------------------------------------- Kartendienst („Strecke berechnen“, Schritt 3)
   Farben aus den gemeinsamen Variablen (hell/dunkel über prefers-color-scheme). */
.feld-kopf { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.marke-berechnet { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 700;
  background: var(--ok-bg); color: var(--ok); }
#kilometer .raster > label { justify-content: flex-end; }   /* Felder bleiben auf einer Höhe, auch wenn die Marke umbricht */
.strecke { margin-top: 10px; }
.strecke-ergebnis { margin: 8px 0 4px; font-weight: 600; color: var(--text); }
.strecke-ergebnis.ok { color: var(--ok); }
.strecke-ergebnis.laeuft { color: var(--leise); font-weight: normal; }
.strecke-ergebnis.fehler { color: var(--fehler); }
.karten-status { margin: 4px 0 8px; }
@media (max-width: 899.98px) {
  #strecke-berechnen { width: 100%; min-height: 52px; }
  .strecke-ergebnis { font-size: 16px; }
}

/* ---------------------------------------------------------------- Startpunkte aus dem Wegeprotokoll (Einstellungen) */
.marke-protokoll { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 700;
  background: var(--ok-bg); color: var(--ok); vertical-align: middle; }
.sp-umbenennen summary { cursor: pointer; color: var(--leise); min-height: 32px; line-height: 32px; }
.sp-umbenennen form { margin-top: 6px; gap: 6px; }
.sp-umbenennen input { min-width: 0; flex: 1 1 12em; }
@media (max-width: 899.98px) {
  .startpunkte.stapel td.sp-umbenennen { flex: 1 1 100%; }
  .sp-umbenennen summary { min-height: 44px; line-height: 44px; }
}
