/* Kundenportal (A-1331, Release 423) - ruhig, hochwertig, mobil zuerst, barrierefrei.
   Kontraste geprueft (WCAG 2.2 AA, Text >= 4.5:1): --text auf --flaeche 15.4:1, --text-2 7.0:1,
   --akzent auf weiss 8.6:1, weiss auf --akzent 8.6:1, --gut 6.6:1, --warn 6.1:1, --fehler 6.5:1.
   Schrift: Systemschrift; auf dem iPhone folgt sie der eingestellten Textgroesse (Dynamic Type). */

:root {
  --bg: #f6f5f2;
  --flaeche: #ffffff;
  --flaeche-2: #fbfaf8;
  --text: #17202b;
  --text-2: #4b5563;
  --linie: #e4e1db;
  --linie-2: #d3cfc7;
  --akzent: #1f4e79;
  --akzent-dunkel: #173b5c;
  --akzent-hell: #e9f0f7;
  --akzent-text: #ffffff;
  --gut: #1d6b43;
  --gut-hell: #e6f3ec;
  --warn: #8a4b00;
  --warn-hell: #fdf3e3;
  --fehler: #b3261e;
  --fehler-hell: #fbeceb;
  --fokus: #0b62c4;
  --schatten: 0 1px 2px rgba(23, 32, 43, .06), 0 4px 16px rgba(23, 32, 43, .06);
  --radius: 16px;
  --radius-k: 10px;
  --skala: 1;
  --navi-hoehe: 64px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) {
    --bg: #0f141a; --flaeche: #18202a; --flaeche-2: #1d2631; --text: #eef2f6; --text-2: #b8c2cd; --linie: #2b3642; --linie-2: #3a4655;
    --akzent: #8fbbe6; --akzent-dunkel: #b3d2f0; --akzent-hell: #1c2d40; --akzent-text: #0c1724; --gut: #7fd3a4; --gut-hell: #173126;
    --warn: #f2c27a; --warn-hell: #33270f; --fehler: #ff9b93; --fehler-hell: #3a1a18; --fokus: #9cc8ff;
    --schatten: 0 1px 2px rgba(0,0,0,.4), 0 4px 18px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }
html { font-size: 106.25%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@supports (font: -apple-system-body) { html { font: -apple-system-body; } }
html { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; min-height: 100vh; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0; }
a { color: var(--akzent); text-underline-offset: 3px; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprung { position: absolute; left: 12px; top: -60px; background: var(--akzent); color: var(--akzent-text); padding: 12px 16px; border-radius: 10px; z-index: 50; }
.sprung:focus { top: 12px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- Rahmen ---------- */
.app { min-height: 100vh; }
.kopf { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--linie); padding: calc(env(safe-area-inset-top) + 8px) 16px 8px; min-height: 56px; display: flex; align-items: center; gap: 8px; }
.kopf .marke { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 1rem; min-width: 0; }
.kopf .marke img { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.kopf .marke span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kopf .zurueck { margin-left: -8px; }
.kopf .titel { font-weight: 650; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kopf .rechts { margin-left: auto; display: flex; gap: 4px; }
.inhalt { max-width: 760px; margin: 0 auto; padding: 20px 16px calc(var(--navi-hoehe) + env(safe-area-inset-bottom) + 28px); }
.inhalt:focus { outline: none; }
.navi { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--flaeche); border-top: 1px solid var(--linie);
  padding: 4px 6px calc(env(safe-area-inset-bottom) + 4px); display: none; }
.navi.an { display: flex; }
.navi a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; text-decoration: none; color: var(--text-2);
  font-size: .75rem; font-weight: 600; border-radius: 12px; position: relative; }
.navi a svg { width: 26px; height: 26px; }
.navi a[aria-current="page"] { color: var(--akzent); }
.navi a .zahl { position: absolute; top: 4px; left: calc(50% + 6px); background: var(--fehler); color: #fff; border-radius: 10px; min-width: 20px; height: 20px; font-size: .7rem; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
.navi a.melden svg { width: 30px; height: 30px; color: var(--akzent); }
@media (min-width: 900px) {
  .app.mit-navi { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: auto 1fr; }
  .app.mit-navi .kopf { grid-column: 1 / -1; }
  .navi.an { position: sticky; top: 72px; align-self: start; flex-direction: column; border: 0; background: transparent; padding: 24px 12px; gap: 4px; height: calc(100vh - 72px); }
  .navi.an a { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 14px; font-size: .95rem; min-height: 48px; }
  .navi.an a[aria-current="page"] { background: var(--akzent-hell); }
  .navi a .zahl { position: static; margin-left: auto; }
  .inhalt { padding: 32px 24px 48px; }
}

/* ---------- Bausteine ---------- */
.stapel > * + * { margin-top: 16px; }
.stapel-k > * + * { margin-top: 8px; }
.abschnitt { margin-top: 28px; }
.abschnitt > h2 { margin-bottom: 10px; }
.unter { color: var(--text-2); }
form > p.unter { margin-bottom: 18px; }
.klein { font-size: .875rem; }
.karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 16px; box-shadow: var(--schatten); }
.karte.flach { box-shadow: none; }
.karte.hinweis { background: var(--akzent-hell); border-color: transparent; box-shadow: none; }
.karte.warn { background: var(--warn-hell); border-color: transparent; color: var(--text); box-shadow: none; }
.karte.fehler { background: var(--fehler-hell); border-color: transparent; box-shadow: none; }
.karte.gut { background: var(--gut-hell); border-color: transparent; box-shadow: none; }
.liste { list-style: none; margin: 0; padding: 0; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); overflow: hidden; }
.liste > li + li { border-top: 1px solid var(--linie); }
.zeile { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; text-decoration: none; color: inherit; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
.zeile:hover { background: var(--flaeche-2); }
.zeile .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--akzent-hell); color: var(--akzent); display: grid; place-items: center; flex: none; }
.zeile .ico svg { width: 24px; height: 24px; }
.zeile .txt { flex: 1; min-width: 0; }
.zeile .txt strong { display: block; font-weight: 600; }
.zeile .txt span { display: block; color: var(--text-2); font-size: .9rem; overflow-wrap: anywhere; }
.zeile > svg { color: var(--text-2); flex: none; width: 20px; height: 20px; }
svg { flex: none; }
.zeile .wert { font-weight: 650; white-space: nowrap; }

.knopf { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid var(--linie-2);
  background: var(--flaeche); color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer; }
.knopf:hover { border-color: var(--text-2); }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf.primaer:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); }
.knopf.breit { width: 100%; }
.knopf.leise { border-color: transparent; background: transparent; color: var(--akzent); padding: 0 12px; }
.knopf.gefahr { color: var(--fehler); }
.knopf[disabled], .knopf[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.knopf svg { width: 22px; height: 22px; flex: none; }
.symbolknopf { width: 48px; height: 48px; border-radius: 12px; border: 0; background: transparent; color: var(--akzent); display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.symbolknopf svg { width: 26px; height: 26px; }
.knopfreihe { display: flex; gap: 10px; flex-wrap: wrap; }
.knopfreihe > .knopf { flex: 1 1 160px; }

.raster { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .raster.vier { grid-template-columns: repeat(4, minmax(0, 1fr)); } .raster.drei { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kachel { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; min-height: 112px; border-radius: var(--radius); background: var(--flaeche); border: 1px solid var(--linie);
  box-shadow: var(--schatten); text-decoration: none; color: var(--text); font-weight: 600; cursor: pointer; text-align: left; width: 100%; }
.kachel:hover { border-color: var(--linie-2); }
.kachel .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--akzent-hell); color: var(--akzent); display: grid; place-items: center; }
.kachel .ico svg { width: 26px; height: 26px; }
.kachel span.b { font-weight: 400; color: var(--text-2); font-size: .875rem; }
.kachel[aria-pressed="true"], .kachel.gewaehlt { border: 2px solid var(--akzent); background: var(--akzent-hell); }

.gruss { margin-bottom: 4px; }
.gruss h1 { font-size: 1.75rem; }
.aufgabe { border-left: 4px solid var(--akzent); }
.aufgabe .knopf { margin-top: 12px; }
.marke-zahl { display: inline-flex; min-width: 24px; height: 24px; padding: 0 7px; align-items: center; justify-content: center; border-radius: 12px; background: var(--akzent); color: var(--akzent-text); font-size: .8rem; font-weight: 700; margin-left: 6px; vertical-align: 2px; }
.pille { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 650; background: var(--akzent-hell); color: var(--akzent-dunkel); }
.pille.gut { background: var(--gut-hell); color: var(--gut); }
.pille.warn { background: var(--warn-hell); color: var(--warn); }

/* Stufen des Bearbeitungsstands */
.stufen { list-style: none; margin: 12px 0 0; padding: 0; display: flex; gap: 6px; }
.stufen li { flex: 1; min-width: 0; }
.stufen .balken { height: 6px; border-radius: 3px; background: var(--linie); }
.stufen li.erreicht .balken { background: var(--akzent); }
.stufen li.aktuell .balken { background: var(--akzent); }
.stufen .name { display: block; font-size: .75rem; color: var(--text-2); margin-top: 6px; line-height: 1.25; }
.stufen li.aktuell .name { color: var(--text); font-weight: 650; }
.stufen.gross .name { font-size: .85rem; }

/* Vertraege */
.vertrag-kopf { display: flex; gap: 14px; align-items: center; }
.vertrag-kopf .ico { width: 56px; height: 56px; border-radius: 16px; background: var(--akzent-hell); color: var(--akzent); display: grid; place-items: center; flex: none; }
.vertrag-kopf .ico svg { width: 30px; height: 30px; }
.kern { font-size: 1.05rem; }
.fakten { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; }
.fakten > div { padding: 14px 0; border-top: 1px solid var(--linie); }
.fakten > div:first-child { border-top: 0; padding-top: 0; }
.fakten dt { color: var(--text-2); font-size: .875rem; }
.fakten dd { margin: 2px 0 0; font-weight: 650; font-size: 1.05rem; }
.fakten dd small { display: block; font-weight: 400; color: var(--text-2); font-size: .875rem; margin-top: 2px; }

/* Formulare */
.feld { display: block; }
.feld + .feld, .feld + fieldset, fieldset + .feld, fieldset + fieldset { margin-top: 18px; }
.feld > label, .feld > .etikett, fieldset > legend { display: block; font-weight: 600; margin-bottom: 6px; padding: 0; }
.feld .hilfe { display: block; color: var(--text-2); font-size: .875rem; margin: -2px 0 6px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=number], input:not([type]), select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; border-radius: 12px; border: 1.5px solid var(--linie-2); background: var(--flaeche); font-size: 1.0625rem; }
textarea { min-height: 120px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--fokus); outline-offset: 1px; border-color: var(--fokus); }
[aria-invalid="true"] { border-color: var(--fehler) !important; }
.feldfehler { color: var(--fehler); font-size: .9rem; margin-top: 6px; font-weight: 600; }
.wahl { display: grid; gap: 10px; }
.wahl.zwei { grid-template-columns: 1fr 1fr; }
.option { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 14px; border: 1.5px solid var(--linie-2); border-radius: 12px; background: var(--flaeche); cursor: pointer; }
.option input { width: 22px; height: 22px; accent-color: var(--akzent); flex: none; margin: 0; }
.option:has(input:checked) { border-color: var(--akzent); background: var(--akzent-hell); }
.option:has(input:focus-visible) { outline: 3px solid var(--fokus); outline-offset: 2px; }
.option .ico { width: 40px; height: 40px; border-radius: 10px; background: var(--akzent-hell); color: var(--akzent); display: grid; place-items: center; flex: none; }
.option .ico svg { width: 24px; height: 24px; }
.option .t strong { display: block; font-weight: 600; }
.option .t span { display: block; color: var(--text-2); font-size: .875rem; }
.haken { display: flex; gap: 12px; align-items: flex-start; }
.haken input { width: 24px; height: 24px; margin-top: 2px; accent-color: var(--akzent); flex: none; }
.pw-zeile { position: relative; }
.pw-zeile input { padding-right: 64px; }
.pw-zeile button { position: absolute; right: 4px; top: 4px; height: 44px; min-width: 56px; border: 0; background: transparent; color: var(--akzent); font-weight: 600; cursor: pointer; border-radius: 10px; }

/* Assistent (Schadenmeldung) */
.schritte { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: .9rem; margin-bottom: 8px; }
.schritte .leiste { flex: 1; height: 6px; background: var(--linie); border-radius: 3px; overflow: hidden; }
.schritte .leiste i { display: block; height: 100%; background: var(--akzent); border-radius: 3px; }
.unten { position: sticky; bottom: calc(var(--navi-hoehe) + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 16px 0 8px; margin-top: 20px; }
@media (min-width: 900px) { .unten { bottom: 0; } }
.fehlt { list-style: none; padding: 0; margin: 8px 0 0; }
.fehlt li { padding: 6px 0; }
.fehlt li a { font-weight: 600; }

/* Anlagen */
.anlagen { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.anlage { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--flaeche-2); border: 1px solid var(--linie); display: grid; place-items: center; text-align: center; font-size: .8rem; color: var(--text-2); padding: 0; }
.anlage img { width: 100%; height: 100%; object-fit: cover; }
.anlage .weg { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border-radius: 18px; border: 0; background: rgba(23,32,43,.75); color: #fff; display: grid; place-items: center; cursor: pointer; }
.anlage .weg svg { width: 18px; height: 18px; }
.anlage .stand { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(0,0,0,.15); }
.anlage .stand i { display: block; height: 100%; background: var(--gut); }
.anlage .art { padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.anlage .art svg { width: 28px; height: 28px; color: var(--akzent); }
.aufnahme { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.aufnahme .zeit { font-variant-numeric: tabular-nums; font-weight: 650; }
.aufnahme audio { width: 100%; margin-top: 8px; }
.punkt-rot { width: 12px; height: 12px; border-radius: 6px; background: var(--fehler); display: inline-block; }

/* Nachrichten */
.verlauf { display: flex; flex-direction: column; gap: 10px; }
.blase { max-width: 86%; padding: 10px 14px; border-radius: 16px; background: var(--flaeche); border: 1px solid var(--linie); white-space: pre-wrap; overflow-wrap: anywhere; }
.blase.ich { align-self: flex-end; background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.blase .wer { display: block; font-size: .75rem; opacity: .85; margin-top: 4px; }
.zeitlinie { list-style: none; margin: 0; padding: 0; }
.zeitlinie li { position: relative; padding: 0 0 14px 22px; }
.zeitlinie li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 10px; height: 10px; border-radius: 5px; background: var(--akzent); }
.zeitlinie li::after { content: ""; position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: var(--linie); }
.zeitlinie li:last-child::after { display: none; }

/* Anmeldung */
.anmeldung { max-width: 440px; margin: 4vh auto 0; }
.anmeldung .logo { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 18px; }
.anmeldung h1 { margin-bottom: 6px; }

.meldung { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--navi-hoehe) + env(safe-area-inset-bottom) + 16px); background: var(--text); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; max-width: calc(100% - 32px); z-index: 60; font-weight: 600; box-shadow: var(--schatten); opacity: 0; pointer-events: none; transition: opacity .2s; }
.meldung.an { opacity: 1; }
.netz { position: fixed; top: calc(env(safe-area-inset-top) + 64px); left: 50%; transform: translateX(-50%); background: var(--warn-hell); color: var(--warn); padding: 8px 14px; border-radius: 10px; font-weight: 650; z-index: 40; font-size: .9rem; }
.laden { color: var(--text-2); padding: 40px 0; text-align: center; }
.leer { color: var(--text-2); padding: 18px 16px; }
details.mehr summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; font-weight: 600; color: var(--akzent); }
hr.trenn { border: 0; border-top: 1px solid var(--linie); margin: 20px 0; }

/* A-1331 P2a (Release 429): „hidden“ gilt immer - sonst zeigte .feld { display: block } das verborgene Codefeld der Anmeldung */
[hidden] { display: none !important; }
/* A-1331 P2a (Release 429): Termine (Tage, Uhrzeiten) */
.wahl.tage { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.wahl.zeiten { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.wahl.zeiten .option { min-height: 48px; justify-content: center; padding: 8px 10px; }
/* ---------- A-1331 P3 (Release 431): Personenwechsel, Familie, Assistent ---------- */
.kopf .ansicht { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: .875rem; color: var(--text-2); min-width: 0; }
.kopf .ansicht label { font-weight: 600; }
.ansicht-wahl { min-height: 44px; max-width: 46vw; padding: 0 10px; border: 1px solid var(--linie-2); border-radius: 10px; background: var(--flaeche); color: var(--text); font-weight: 600; }
@media (max-width: 480px) { .kopf:has(.ansicht) .marke span { display: none; } .ansicht-wahl { max-width: 60vw; }
  .zeile .wert { white-space: normal; max-width: 6.5em; text-align: right; font-size: .9rem; } }
.marke-person { color: var(--akzent); font-weight: 600; }
.liste > li.mit-zusatz { display: flex; flex-direction: column; }
.liste .zusatz { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px 10px 74px; font-size: .9rem; font-weight: 600; text-decoration: none; }
.liste .zusatz svg { width: 18px; height: 18px; }
.ki-karte > * + * { margin-top: 8px; }
.ki-karte.neu { border-color: var(--akzent); }
.ki-karte .frage { font-weight: 650; overflow-wrap: anywhere; }
.ki-karte .antwort > p { white-space: pre-line; overflow-wrap: anywhere; }
.ki-karte .antwort > p + p { margin-top: 8px; }
.ki-karte .quellen { background: var(--flaeche-2); border: 1px solid var(--linie); border-radius: var(--radius-k); padding: 10px 12px; }
.ki-karte .quellen ol { margin: 4px 0 0; padding-left: 1.4rem; font-size: .9rem; }
.ki-karte .wartet { display: flex; align-items: center; gap: 10px; color: var(--text-2); }
.ki-karte .punkt { width: 10px; height: 10px; border-radius: 50%; background: var(--akzent); flex: none; animation: kp-puls 1.4s ease-in-out infinite; }
@keyframes kp-puls { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
