/* Gestaltung der App – gleiche Sprache wie die Website: warmes Off-White, Tinte, Haarlinien,
 * Newsreader für Titel, Instrument Sans für Text, Linien-Symbole (Lucide). Mobil zuerst.
 * Die Akzentfarbe kommt aus dem Praxisprofil (basis.html setzt --akzent & Co.).
 */
@font-face { font-family: "Newsreader"; src: url(/static/schriften/newsreader-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url(/static/schriften/newsreader-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url(/static/schriften/instrument-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url(/static/schriften/instrument-sans-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url(/static/schriften/instrument-sans-latin-600-normal.woff2) format("woff2"); font-weight: 600 700; font-style: normal; font-display: swap; }
:root {
  --akzent: #2e7d6b;
  --akzent-dunkel: #24614f;
  --akzent-hell: #cfe7df;
  --hintergrund: #f7f4ee;
  --hintergrund-tief: #efeae1;
  --rahmen: #e3dcd0;
  --rahmen-stark: #cdc3b3;
  --feldrand: #8c8478;           /* Formularfelder: ≥ 3:1 zum Grund (WCAG 1.4.11) */
  --flaeche: #fffdf9;
  --text: #1c2421;
  --text-leise: #575f5b;
  --rot: #b4232f;
  --rot-hell: #fdecee;
  --gruen: #1e7a43;
  --gruen-hell: #e7f6ec;
  --gelb: #8a5a00;
  --gelb-hell: #fff4d6;
  --radius: 10px;
  --schatten: none;
  --schatten-hoch: 0 24px 48px -24px rgba(28, 36, 33, .3), 0 10px 20px -14px rgba(28, 36, 33, .16);
  --schrift: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  /* Brücke für ältere Seiten mit eigenen Variablen */
  --gold: var(--akzent); --gold-d: var(--akzent-dunkel); --gold-l: var(--akzent-hell);
  --primary: var(--akzent); --primary-dark: var(--akzent-dunkel);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--schrift); font-size: 16px; line-height: 1.55;
  color: var(--text); background: var(--hintergrund); -webkit-font-smoothing: antialiased;
}
a { color: var(--akzent-dunkel); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-family: var(--serif); font-weight: 400; letter-spacing: -.012em; color: var(--text); }
h1 { font-size: 2.1rem; line-height: 1.1; letter-spacing: -.02em; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.12rem; font-weight: 500; }
p { margin: 0 0 .8em; }
.leise { color: var(--text-leise); }
.klein { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--akzent-dunkel); outline-offset: 3px; border-radius: 4px; }

/* ── Rahmen der App ─────────────────────────────────────────────────────── */
.app-rahmen { min-height: 100dvh; }
.seitenleiste {
  display: none; position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--flaeche);
  border-right: 1px solid var(--rahmen); padding: 20px 14px; flex-direction: column; gap: 4px; z-index: 50;
  overflow-y: auto;
}
.marke { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; text-decoration: none; color: var(--text); }
.marke-logo { width: 38px; height: 38px; border-radius: 8px; object-fit: contain; background: var(--akzent-hell); }
.marke-initialen {
  width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--akzent-dunkel); color: #fff; font-family: var(--serif); font-size: 1.05rem; font-weight: 500;
}
.marke-name { font-family: var(--serif); font-weight: 500; font-size: 1.08rem; line-height: 1.2; }
.marke-produkt { font-size: .75rem; color: var(--text-leise); }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 6px;
  color: var(--text); text-decoration: none; font-weight: 500; border-left: 2px solid transparent;
}
.nav-link svg { width: 20px; height: 20px; flex: none; color: var(--text-leise); }
.nav-link:hover { background: var(--hintergrund); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--hintergrund-tief); color: var(--text); font-weight: 600; border-left-color: var(--akzent-dunkel); border-radius: 0 6px 6px 0; }
.nav-link[aria-current="page"] svg { color: var(--akzent-dunkel); }
.nav-abstand { flex: 1; }
.nav-knopf { background: none; border: 0; width: 100%; font: inherit; cursor: pointer; text-align: left; }

.kopf-mobil {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 16px; background: var(--flaeche); border-bottom: 1px solid var(--rahmen);
}
.kopf-mobil .marke { padding: 0; }
.unten-nav {
  position: fixed; inset: auto 0 0 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--flaeche); border-top: 1px solid var(--rahmen); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
}
.unten-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: .7rem;
  color: var(--text-leise); text-decoration: none; border-radius: 10px;
}
.unten-nav a svg { width: 22px; height: 22px; }
.unten-nav a[aria-current="page"] { color: var(--akzent-dunkel); font-weight: 600; }
.inhalt { max-width: 1040px; margin: 0 auto; padding: 22px 16px 96px; }
.menue-offen .seitenleiste { display: flex; box-shadow: var(--schatten-hoch); }

@media (min-width: 960px) {
  .seitenleiste { display: flex; }
  .kopf-mobil, .unten-nav { display: none; }
  .app-rahmen { padding-left: 248px; }
  .inhalt { padding: 40px 40px 56px; }
}

/* ── Bausteine ──────────────────────────────────────────────────────────── */
.seitenkopf { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--rahmen); }
.seitenkopf h1 { margin: 0; }
.karte { background: var(--flaeche); border: 1px solid var(--rahmen); border-radius: var(--radius); padding: 22px; }
.karte + .karte { margin-top: 16px; }
.karte h2 { margin-bottom: 12px; }
.raster { display: grid; gap: 16px; }
@media (min-width: 720px) { .raster-2 { grid-template-columns: 1fr 1fr; } .raster-3 { grid-template-columns: repeat(3, 1fr); } }
.stapel > * + * { margin-top: 12px; }
.zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.zeile-zwischen { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  padding: 10px 20px; border-radius: 6px; border: 1px solid var(--akzent-dunkel); font: inherit; font-weight: 500;
  background: var(--akzent-dunkel); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.knopf:hover { background: color-mix(in srgb, var(--akzent-dunkel) 82%, #000); color: #fff; }
.knopf-zweit { background: transparent; color: var(--text); border-color: var(--rahmen-stark); }
.knopf-zweit:hover { background: var(--flaeche); color: var(--text); border-color: var(--text-leise); }
.knopf-gefahr { background: transparent; color: var(--rot); border-color: #e3b5ba; }
.knopf-gefahr:hover { background: var(--rot-hell); color: var(--rot); }
.knopf-klein { min-height: 36px; padding: 6px 14px; font-size: .92rem; }
.knopf[disabled] { opacity: .55; cursor: not-allowed; }
.knopf-link { background: none; border: 0; color: var(--akzent-dunkel); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }

.feld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.feld label, .feld .bezeichnung { font-weight: 500; font-size: .93rem; }
.feld .hilfe { font-size: .84rem; color: var(--text-leise); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=url], input[type=number],
input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--text);
  background: #fff; border: 1px solid var(--feldrand); border-radius: 6px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--akzent-dunkel); outline-offset: 1px; border-color: var(--akzent-dunkel); }
input[type=color] { width: 56px; height: 44px; padding: 2px; border: 1px solid var(--feldrand); border-radius: 6px; background: #fff; }
.feld-fehler input, .feld-fehler select, .feld-fehler textarea { border-color: var(--rot); }
.feld-fehler .hilfe { color: var(--rot); }
.feldgruppe { display: grid; gap: 0 14px; }
@media (min-width: 600px) { .feldgruppe-2 { grid-template-columns: 1fr 1fr; } .feldgruppe-3 { grid-template-columns: 2fr 1fr 1fr; } .feldgruppe-plz { grid-template-columns: 1fr 3fr; } }
.auswahl { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; }
.auswahl input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--akzent); flex: none; }

.hinweis { border-radius: 8px; padding: 12px 16px; margin-bottom: 16px; border: 1px solid; }
.hinweis-ok { background: var(--gruen-hell); border-color: #b8e2c6; color: #14532d; }
.hinweis-fehler { background: var(--rot-hell); border-color: #f1c4c8; color: #7a1520; }
.hinweis-info { background: var(--akzent-hell); border-color: transparent; color: var(--text); }
.hinweis-info a:not(.knopf) { color: var(--text); }
.hinweis-warnung { background: var(--gelb-hell); border-color: #f3dc9b; color: #6b4600; }

.marker { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 4px; font-size: .78rem; font-weight: 500; background: var(--hintergrund); color: var(--text-leise); border: 1px solid var(--rahmen); }
.marker-akzent { background: var(--akzent-hell); color: var(--text); border-color: transparent; }
.marker-ok { background: var(--gruen-hell); color: var(--gruen); border-color: transparent; }
.marker-warnung { background: var(--gelb-hell); color: var(--gelb); border-color: transparent; }
.marker-fehler { background: var(--rot-hell); color: var(--rot); border-color: transparent; }

.liste { list-style: none; margin: 0; padding: 0; }
.liste > li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--rahmen); }
.liste > li:last-child { border-bottom: 0; }
.liste-titel { font-weight: 600; }
.tabelle { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tabelle th { text-align: left; font-size: .76rem; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; color: var(--text-leise); padding: 8px; border-bottom: 1px solid var(--rahmen-stark); }
.tabelle td { padding: 10px 8px; border-bottom: 1px solid var(--rahmen); vertical-align: top; }
.tabelle .zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabelle-huelle { overflow-x: auto; }

.kachel { display: block; text-decoration: none; color: var(--text); }
.kachel:hover { border-color: var(--rahmen-stark); background: #fff; }
.kachel .symbol { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--rahmen); color: var(--akzent-dunkel); display: grid; place-items: center; margin-bottom: 12px; }
.kachel .symbol svg { width: 22px; height: 22px; }
.kennzahl { font-family: var(--serif); font-size: 1.95rem; font-weight: 400; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums lining-nums; }

.schritte { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.schritt { flex: 1 1 120px; padding: 8px 10px; border-radius: 6px; background: var(--flaeche); border: 1px solid var(--rahmen); font-size: .82rem; color: var(--text-leise); text-decoration: none; }
.schritt.erledigt { border-color: var(--akzent-hell); color: var(--akzent-dunkel); }
.schritt.aktuell { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); color: #fff; font-weight: 600; }
.schritt.erledigt { color: var(--text); }

details.aufklapp { border: 1px solid var(--rahmen); border-radius: 8px; padding: 0 14px; background: var(--flaeche); }
details.aufklapp + details.aufklapp { margin-top: 10px; }
details.aufklapp summary { cursor: pointer; padding: 12px 0; font-weight: 500; list-style: none; }
details.aufklapp summary::-webkit-details-marker { display: none; }
details.aufklapp[open] summary { border-bottom: 1px solid var(--rahmen); margin-bottom: 12px; }

.leer { text-align: center; padding: 32px 16px; color: var(--text-leise); text-wrap: pretty; }
.liste li.leer { display: block; padding: 24px 16px; line-height: 1.55; }
.leer .knopf { margin: 10px auto 0; display: flex; width: fit-content; }
.leer a:not(.knopf) { white-space: nowrap; }
.trenner { border: 0; border-top: 1px solid var(--rahmen); margin: 20px 0; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; background: var(--hintergrund-tief); padding: 2px 6px; border-radius: 4px; }

/* Öffentliche Seiten (Anmeldung, Buchung) */
.oeffentlich { max-width: 720px; margin: 0 auto; padding: 24px 16px 48px; }
.oeffentlich-kopf { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.oeffentlich-fuss { margin-top: 32px; font-size: .8rem; color: var(--text-leise); text-align: center; }
.honig { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media print {
  .seitenleiste, .kopf-mobil, .unten-nav, .knopf { display: none !important; }
  .app-rahmen { padding: 0 !important; }
}

/* Symbole in Knöpfen, Aufklappern und Links haben Schriftgrösse */
.knopf svg, summary svg, a svg, .marker svg { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.2em; }
.kopf-mobil .knopf svg { width: 22px; height: 22px; }

/* Balken für Auswertungen (ohne Diagramm-Bibliothek) */
.saeulen { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; align-items: end; height: 180px; padding-top: 8px; }
.saeule { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.saeule-paar { display: flex; align-items: flex-end; gap: 2px; height: 100%; width: 100%; justify-content: center; }
.saeule-paar span { display: block; width: 42%; max-width: 18px; border-radius: 4px 4px 0 0; min-height: 2px; }
.saeule-ein { background: var(--akzent); }
.saeule-aus { background: var(--rahmen-stark); }
.saeule small { font-size: .72rem; color: var(--text-leise); }
.balkenliste { list-style: none; margin: 0; padding: 0; }
.balkenliste li { padding: 6px 0; }
.balkenliste .zeile-zwischen { font-size: .92rem; }
.balken { height: 8px; border-radius: 99px; background: var(--hintergrund); overflow: hidden; margin-top: 4px; }
.balken > span { display: block; height: 100%; background: var(--akzent); border-radius: 99px; }
.balken-aus > span { background: #a99e8c; }
.legende { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--text-leise); }
.legende::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--akzent); }
.legende-aus::before { background: var(--rahmen-stark); }
.betrag-plus { color: var(--gruen); font-weight: 600; white-space: nowrap; }
.betrag-minus { color: var(--rot); font-weight: 600; white-space: nowrap; }
dialog.dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.dialog::backdrop { background: rgba(15, 30, 28, .45); }
dialog.dialog form { padding: 20px; }
.raster > .karte + .karte, .raster > div > .karte:first-child { margin-top: 0; }
@media (max-width: 719px) {
  .raster-3:has(.kennzahl) { grid-template-columns: 1fr 1fr; gap: 10px; }
  .raster-3:has(.kennzahl) .karte { padding: 14px; }
  .kennzahl { font-size: 1.25rem; }
}
/* Grid-Spalten dürfen schrumpfen (sonst drückt eine lange Zeile die Seite breiter als das Handy) */
.raster > *, .feldgruppe > *, .zeile > *, .zeile-zwischen > * { min-width: 0; }
.code, .liste-titel, .leise { overflow-wrap: anywhere; }
input[type=radio], input[type=checkbox] { accent-color: var(--akzent); }

/* ── Info-Symbole für Fachbegriffe ({{ hilfe(...) }}) ───────────────────────── */
.info { position: relative; display: inline-flex; vertical-align: middle; }
.info-knopf { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0;
  margin-left: 2px; border: 0; border-radius: 50%; background: none; color: var(--text-leise); cursor: pointer; }
.info-knopf svg { width: 17px; height: 17px; }
.info-knopf:hover, .info-knopf[aria-expanded="true"] { color: var(--akzent-dunkel); background: var(--akzent-hell); }
.info-text { position: absolute; z-index: 30; top: calc(100% + 6px); left: -8px; width: min(320px, 80vw);
  padding: 10px 12px; border: 1px solid var(--rahmen); border-radius: 10px; background: var(--flaeche);
  color: var(--text); font-size: .85rem; font-weight: 400; line-height: 1.45; text-align: left;
  box-shadow: 0 8px 24px rgba(20, 40, 35, .12); white-space: normal; }

/* ── Erste Schritte (Übersicht) ────────────────────────────────────────────── */
.erste-schritte { margin-bottom: 16px; }
.fortschritt { height: 6px; border-radius: 999px; background: var(--hintergrund); overflow: hidden; margin: 8px 0 4px; }
.fortschritt span { display: block; height: 100%; background: var(--akzent); border-radius: inherit; }
.schritte-liste { list-style: none; margin: 8px 0 0; padding: 0; }
.schritte-liste li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rahmen); }
.schritte-liste li:first-child { border-top: 0; }
.schritte-liste .schritt-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.schritte-liste .code { overflow-wrap: anywhere; }
.schritte-liste li.erledigt .liste-titel { color: var(--text-leise); text-decoration: line-through; }
.haken { width: 26px; height: 26px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  padding: 0; border: 1.5px solid var(--rahmen); border-radius: 50%; background: var(--flaeche); color: #fff; cursor: pointer; }
.haken svg { width: 16px; height: 16px; }
.haken[aria-pressed="true"] { background: var(--akzent); border-color: var(--akzent); }
.haken:disabled { cursor: default; }
.beispiel-angebot { margin-top: 10px; padding-top: 12px; border-top: 1px dashed var(--rahmen); gap: 12px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .schritte-liste li { flex-wrap: wrap; }
  .schritte-liste .schritt-text { flex-basis: calc(100% - 40px); }
  .schritte-liste li > .knopf { margin-left: 38px; }
}

/* Import: Zuordnung der Spalten */
.zuordnung { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 16px; }
/* Schmale Bildschirme: Formularzeilen untereinander statt gequetscht */
@media (max-width: 600px) {
  form.zeile > select, form.zeile > input:not([type=checkbox]):not([type=radio]) { flex: 1 1 100%; width: 100% !important; }
}
/* Sprunglink sichtbar, sobald er den Tastaturfokus hat */
.sr-only:focus { position: fixed; left: 12px; top: 12px; width: auto; height: auto; clip: auto; z-index: 100;
  padding: 10px 14px; background: var(--flaeche); color: var(--text); border: 1px solid var(--rahmen-stark); border-radius: 6px; }

/* Angaben als Liste Begriff – Wert (z. B. Verwaltung) */
.angaben { display: grid; grid-template-columns: minmax(0, 15em) 1fr; gap: 4px 14px; margin: 0; }
.angaben dt { color: var(--text-leise); }
.angaben dd { margin: 0; }
@media (max-width: 560px) { .angaben { grid-template-columns: 1fr; } .angaben dd { margin-bottom: 6px; } }
