/* Privatverwaltung – ruhige, mobile zuerst gestaltete Oberfläche. Keine externen Quellen. */
:root {
  color-scheme: light dark;
  --grund: #f3f5f8;
  --flaeche: #ffffff;
  --text: #1a222d;
  --text-leise: #4d5968;
  --linie: #cfd6df;
  --akzent: #1b5599;
  --akzent-text: #ffffff;
  --akzent-flaeche: #e6effa;
  --warn: #8a2b12;
  --warn-flaeche: #fdece6;
  --hinweis: #6b4a00;
  --hinweis-flaeche: #fbf1d9;
  --ok: #1c6238;
  --ok-flaeche: #e4f3ea;
  --leiste: 64px;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #11151b;
    --flaeche: #1a2029;
    --text: #e7ebf1;
    --text-leise: #a9b3c1;
    --linie: #364050;
    --akzent: #8fb8f2;
    --akzent-text: #0c1522;
    --akzent-flaeche: #1d2c41;
    --warn: #ffab94;
    --warn-flaeche: #3a211b;
    --hinweis: #f1cc74;
    --hinweis-flaeche: #332a14;
    --ok: #86d6a3;
    --ok-flaeche: #17301f;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: anywhere;
}
[hidden] { display: none !important; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 4px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0 0 10px; }
a { color: var(--akzent); }
ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
code, pre { font-family: ui-monospace, Consolas, "Cascadia Mono", monospace; font-size: .85rem; }

:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; border-radius: 4px; }
main:focus { outline: none; }

.sprunglink { position: absolute; left: -999px; top: 0; background: var(--flaeche); padding: 12px 16px; z-index: 10; }
.sprunglink:focus { left: 8px; top: 8px; }

/* ------------------------------------------------------------ Grundaufbau */
.kopf {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top));
  background: var(--flaeche); border-bottom: 1px solid var(--linie);
}
.kopf-name { font-weight: 700; font-size: 1.05rem; }
.kopf-hinweis { color: var(--text-leise); font-size: .8rem; white-space: nowrap; }
.kopf-verwaltung {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; padding: 6px 10px; margin: -8px -6px -8px 0;
  color: var(--text-leise); text-decoration: none; border-radius: 8px; font-size: .9rem;
}
.kopf-verwaltung[aria-current] { color: var(--akzent); font-weight: 700; background: var(--akzent-flaeche); }
.kopf-verwaltung-text { display: none; }

.buehne { padding: 16px 16px calc(var(--leiste) + 28px + env(safe-area-inset-bottom)); max-width: 880px; margin: 0 auto; }
.unterzeile { color: var(--text-leise); font-size: .9rem; margin-bottom: 14px; }
.abschnitt { margin-top: 24px; }
.anzahl { color: var(--text-leise); font-weight: 400; }
.laedt, .leer { color: var(--text-leise); padding: 12px 0; }

/* ------------------------------------------------------------ Navigation (unten auf dem Handy) */
.navigation {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  background: var(--flaeche); border-top: 1px solid var(--linie);
  padding-bottom: env(safe-area-inset-bottom);
}
.navigation ul { display: flex; }
.navigation li { flex: 1 1 0; min-width: 0; }
.navigation a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--leiste); padding: 6px 2px;
  color: var(--text-leise); text-decoration: none; font-size: .72rem; line-height: 1.2; text-align: center;
  border-top: 3px solid transparent;
}
.navigation a[aria-current] { color: var(--akzent); font-weight: 700; border-top-color: var(--akzent); }
.navigation a span { max-width: 100%; overflow-wrap: anywhere; hyphens: auto; }
.symbol { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ------------------------------------------------------------ Karten und Listen */
.liste { display: grid; gap: 10px; }
.karte {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 14px; min-width: 0;
}
.karte-link { color: inherit; text-decoration: none; min-height: 44px; }
.karte-link:hover { border-color: var(--akzent); }
.karte-zeile { flex-direction: row; align-items: center; gap: 12px; }
.karte-spalte { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 auto; }
.karte-aktion .knopf-verweis { align-self: flex-start; margin-top: 6px; }
.karte-dokument { flex-direction: row; align-items: flex-start; gap: 12px; }
.miniatur { flex: none; width: 72px; height: 96px; border: 1px solid var(--linie); border-radius: 6px; background: var(--grund); object-fit: cover; pointer-events: none; }
.karte-titel { font-weight: 650; line-height: 1.35; }
.karte-zusatz { color: var(--text-leise); font-size: .88rem; }
.karte-auszug { color: var(--text-leise); font-size: .85rem; font-style: italic; overflow-wrap: anywhere; }
.liste .eingerueckt { margin-left: 18px; }
.karte-text { font-size: .93rem; }
.karte-kopfzeile { color: var(--text-leise); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.beschriftung { color: var(--text-leise); }
.punkte { list-style: disc; padding-left: 20px; display: grid; gap: 4px; }
.textblock p { margin: 0 0 6px; }
.bericht { white-space: pre-wrap; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); padding: 12px; }
.pruefsumme { overflow-wrap: anywhere; }

.kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kachel {
  display: flex; flex-direction: column; gap: 2px; min-height: 96px;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 12px 14px; color: inherit; text-decoration: none;
}
.kachel:hover { border-color: var(--akzent); }
.kachel-zahl { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.kachel-titel { font-size: .92rem; }
.kachel-zusatz { font-size: .8rem; color: var(--text-leise); }
.kachel-betont { border-color: var(--warn); border-width: 2px; }
.kachel-betont .kachel-zahl, .kachel-betont .kachel-zusatz { color: var(--warn); }
.lauf { margin-top: 10px; }

/* ------------------------------------------------------------ Kennzeichnungen (Bedeutung steht immer im Text) */
.marken { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.marke {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--linie); border-radius: 999px; padding: 2px 10px;
  font-size: .8rem; line-height: 1.5; color: var(--text); background: transparent;
}
.marke-zeichen { font-weight: 700; }
.marke-akzent { background: var(--akzent-flaeche); border-color: var(--akzent); color: var(--akzent); font-weight: 600; }
.marke-info { background: var(--hinweis-flaeche); border-color: var(--hinweis); color: var(--hinweis); font-weight: 600; }
.marke-warnung, .marke-hart { background: var(--warn-flaeche); border-color: var(--warn); color: var(--warn); font-weight: 600; }
.marke-weich { border-style: dashed; color: var(--text-leise); }
.marke-ok, .marke-ds-bestaetigt { background: var(--ok-flaeche); border-color: var(--ok); color: var(--ok); font-weight: 600; }
.marke-ds-ungeprueft { background: var(--hinweis-flaeche); border-color: var(--hinweis); color: var(--hinweis); border-style: dashed; }

/* ------------------------------------------------------------ Chips (Bereichsauswahl) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  font: inherit; font-weight: 600; font-size: .92rem; text-decoration: none;
  color: var(--text); background: var(--flaeche); border: 1px solid var(--linie);
}
.chip-aktiv { color: var(--akzent-text); background: var(--akzent); border-color: var(--akzent); }

/* ------------------------------------------------------------ Formulare und Knöpfe */
.filter { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 14px; }
.filter-weitere { display: contents; }
.feld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.feld-breit { grid-column: 1 / -1; }
label { font-size: .85rem; color: var(--text-leise); }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--flaeche);
  border: 1px solid var(--text-leise); border-radius: 8px; padding: 9px 10px; min-height: 44px; width: 100%; min-width: 0;
}
textarea { resize: vertical; }
.knopf {
  font: inherit; font-weight: 600; min-height: 46px; padding: 10px 16px; border-radius: 8px; cursor: pointer;
  background: var(--flaeche); color: var(--text); border: 1px solid var(--text-leise);
}
.knopf-haupt { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.knopf-verweis { display: inline-flex; align-items: center; text-decoration: none; }
.knopf:disabled { opacity: .6; cursor: default; }
.aktionen { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; align-items: center; }
.aktionen:empty { display: none; }
.aktionen .knopf { flex: 1 1 120px; }
.seitenzahl { flex: 1 1 100%; text-align: center; color: var(--text-leise); font-size: .9rem; }
.bestaetigung { display: flex; flex-direction: column; gap: 8px; width: 100%; border-top: 1px solid var(--linie); padding-top: 10px; }
.bestaetigung-frage { margin: 0; }
.fehlertext { color: var(--warn); font-weight: 600; margin: 0; }
.kennwort { display: flex; flex-direction: column; gap: 6px; }
.kennwort .aktionen { margin-top: 8px; }

.hinweis { border: 1px solid var(--linie); border-left-width: 5px; border-radius: 8px; padding: 10px 12px; margin: 0; background: var(--flaeche); }
.hinweis-info { border-color: var(--hinweis); background: var(--hinweis-flaeche); }
.hinweis-fehler { border-color: var(--warn); background: var(--warn-flaeche); }
.hinweis-fehler p { margin-bottom: 10px; }
.offline-hinweis {
  border: 1px solid var(--hinweis); border-left-width: 5px; border-radius: 8px; background: var(--hinweis-flaeche);
  color: var(--text); padding: 10px 12px; margin-bottom: 14px; font-weight: 600;
}

/* ------------------------------------------------------------ Einzelteile */
.angaben { display: grid; gap: 8px; }
.angabe dt { font-size: .8rem; color: var(--text-leise); }
.angabe dd { font-size: .95rem; }
.verweis { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
/* Verweise im Fließtext (Karten-Titel, Angaben, Dubletten) bekommen dieselbe Tippfläche wie Knöpfe. */
.karte-titel a, .angabe dd a, .dubletten a, .karte-zusatz a, .hinweis a, .klein a { display: inline-flex; align-items: center; min-height: 44px; }
.zurueck { text-decoration: none; }
.hervorgehoben { border-left: 5px solid var(--akzent); background: var(--akzent-flaeche); padding: 10px 12px; border-radius: 8px; font-weight: 600; }
.verlauf { border-left: 2px solid var(--linie); margin-left: 6px; display: grid; gap: 14px; }
.verlauf li { position: relative; padding-left: 16px; display: flex; flex-direction: column; }
.verlauf li::before { content: ""; position: absolute; left: -6px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--text-leise); }
.verlauf-zeit { font-size: .8rem; color: var(--text-leise); }
.dubletten { font-size: .9rem; }

.tabelle-beides .tabelle-rahmen { display: none; }
.tabelle-rahmen { overflow-x: auto; max-width: 100%; border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche); margin: 8px 0; }
.tabelle { border-collapse: collapse; width: 100%; font-size: .88rem; }
.tabelle th, .tabelle td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--linie); min-width: 120px; }
.tabelle th { color: var(--text-leise); font-weight: 600; background: var(--grund); }
.tabelle tr:last-child td { border-bottom: 0; }

.vorschau { display: flex; flex-direction: column; gap: 8px; margin: 6px 0; }
.vorschau iframe { width: 100%; height: 60vh; min-height: 320px; border: 1px solid var(--linie); border-radius: 8px; background: var(--flaeche); }
.vorschau img { max-width: 100%; height: auto; border: 1px solid var(--linie); border-radius: 8px; }
.vorschau-gross iframe { height: 85vh; }
.vorschau-gross img { max-width: none; width: 200%; }
.vorschau-gross { overflow: auto; touch-action: pan-x pan-y pinch-zoom; }
.vorschau img { touch-action: pinch-zoom; }

/* ------------------------------------------------------------ Klärung: ein Fall pro Karte, große Knöpfe */
.liste-klaerung { gap: 18px; }
.liste-klaerung > .gruppe-kopf { margin-top: 10px; }
.liste-klaerung > .gruppe-kopf h2 { color: var(--text-leise); font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; margin: 0; }
.klaerung { gap: 10px; padding: 16px; border-width: 2px; }
.klaerung-kopf { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; }
.klaerung-titel { font-size: 1.2rem; margin: 0; }
.vorschau-fall iframe { height: 55vh; min-height: 360px; }
.vorschau-bilder { display: grid; gap: 8px; }
.vorschau-seiten .vorschau-bilder { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.vorschau-seite { margin: 0; display: flex; flex-direction: column; gap: 4px; }
.vorschau-seite img { width: 100%; height: auto; }
.vorschau-seite figcaption { font-size: .8rem; color: var(--text-leise); text-align: center; }
.angaben-zeile { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.begruendung { background: var(--hinweis-flaeche); border-left: 5px solid var(--hinweis); border-radius: 8px; padding: 10px 12px; margin: 0; font-size: 1rem; }
.entscheidung { display: grid; gap: 10px; }
.knopf-gross {
  display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 16px; font-size: 1.05rem; text-align: left; width: 100%;
}
.knopf-gross kbd {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 6px;
  font: 700 .9rem/1 ui-monospace, Consolas, monospace; background: rgba(127, 127, 127, .18); border: 1px solid currentColor;
}
.knopf-auswahl { cursor: default; }
.knopf-auswahl select { flex: 1 1 auto; min-height: 44px; border: 0; padding: 4px 6px; background: transparent; font-weight: 600; }

/* ------------------------------------------------------------ Kalender: Tage */
.tag h2 { padding-bottom: 6px; border-bottom: 1px solid var(--linie); }
.tag-heute h2 { color: var(--akzent); border-bottom: 3px solid var(--akzent); }
.tag-heute .karte { border-color: var(--akzent); }
.tag-vergangen h2 { color: var(--warn); }
.karte-leise { border-style: dashed; }
.liste-verwaltung .symbol { width: 28px; height: 28px; color: var(--akzent); }

.anmeldung { max-width: 420px; margin: 0 auto; padding: 48px 20px; }
.anmeldung form { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.klein { font-size: .85rem; color: var(--text-leise); }
.noscript { padding: 20px; }

/* ------------------------------------------------------------ ab 900 px: Seitenleiste */
@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 264px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
  .kopf { grid-column: 1; grid-row: 1; flex-direction: column; gap: 2px; border-bottom: 0; border-right: 1px solid var(--linie); padding: 22px 20px 12px; position: static; }
  .navigation { position: static; grid-column: 1; grid-row: 2; border-top: 0; border-right: 1px solid var(--linie); padding: 0 10px 20px; }
  .navigation ul { flex-direction: column; gap: 2px; position: sticky; top: 12px; }
  .kopf-verwaltung { margin: 10px 0 0; justify-content: flex-start; padding: 8px 12px; }
  .kopf-verwaltung-text { display: inline; }
  .navigation a {
    flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 6px 12px;
    font-size: .92rem; text-align: left; border-top: 0; border-left: 4px solid transparent; border-radius: 6px;
  }
  .navigation a[aria-current="page"] { border-left-color: var(--akzent); background: var(--akzent-flaeche); }
  .navigation a:hover { background: var(--akzent-flaeche); }
  .buehne { grid-column: 2; grid-row: 1 / span 2; width: 100%; padding: 28px 32px 48px; margin: 0; max-width: 1000px; }
  .tabelle-beides .tabelle-rahmen { display: block; }
  .tabelle-karten { display: none; }
  .kacheln { grid-template-columns: repeat(3, 1fr); }
  .filter { grid-template-columns: 2fr 1fr 1fr 1fr 1fr; }
  .entscheidung { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .miniatur { width: 96px; height: 128px; }
  .liste-dokumente { grid-template-columns: 1fr 1fr; }
  .feld-breit { grid-column: auto; }
  .aktionen .knopf { flex: 0 1 auto; }
  .seitenzahl { flex: 0 1 auto; }
}

@media (prefers-reduced-motion: no-preference) {
  .karte-link, .kachel { transition: border-color .15s; }
}

/* ------------------------------------------------------------ Cloud */
.quelle-hinweis { color: var(--text-leise); font-size: .85rem; margin-bottom: 12px; }
.hinweis-ok { border-color: var(--ok); background: var(--ok-flaeche); }
.schritte { display: grid; gap: 8px; margin: 12px 0; }
.schritte li { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.schritt-fertig { color: var(--text-leise); }
.wiederherstellung { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.wiederherstellung .code { margin: 0; }
.wiederherstellung code { display: block; font-size: 1.25rem; letter-spacing: .08em; padding: 12px; border: 1px dashed var(--text-leise); border-radius: 8px; text-align: center; user-select: all; }
.haken { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 1rem; color: var(--text); }
.haken input { width: 44px; height: 44px; flex: none; }
.anmeldung .chips { margin-bottom: 12px; }

/* ------------------------------------------------------------ Übersicht: Erinnerungen, Klärungsbündel */
.erinnerungen { border: 2px solid var(--warn); border-radius: var(--radius); background: var(--warn-flaeche); padding: 12px 14px; }
.erinnerungen h2 { color: var(--warn); margin-top: 0; }
.unterueberschrift { font-size: 1rem; margin: 18px 0 4px; }
.buendel .karte-titel { font-size: 1rem; margin: 0; }
.buendel-zeilen { margin: 4px 0; }
.zeilenliste { margin: 0; padding-left: 1.6em; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; overflow-wrap: anywhere; }
.zeilenliste li { padding: 1px 0; }

/* ------------------------------------------------------------ Übersicht: Automatik-Ampel, Cowork, Zahlen */
.unsichtbar { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.automatik-zeile {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: 44px; padding: 8px 12px; margin-top: 12px;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); color: var(--text); text-decoration: none; font-size: .85rem;
}
.automatik-link:hover { border-color: var(--akzent); }
.automatik-titel { font-weight: 700; color: var(--text-leise); }
.automatik-liste { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0; padding: 0; list-style: none; }
.automatik { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.automatik-punkt { width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--text-leise); }
.automatik-ok .automatik-punkt { background: var(--ok); }
.automatik-stoerung .automatik-punkt { background: var(--warn); }
.automatik-stoerung { color: var(--warn); font-weight: 700; }
.automatik-unbekannt .automatik-punkt { background: transparent; border: 2px solid var(--text-leise); }
.automatik-meldung { flex: 1 1 100%; color: var(--warn); font-weight: 600; }
.zahlenreihe { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.zahl-chip { border: 1px solid var(--linie); border-radius: 999px; padding: 2px 10px; font-size: .88rem; background: var(--grund); }
.karte-pruefung { margin-top: 10px; }
.karte-buendel-sammel .buendel-liste { margin-top: 6px; }
.automatik-tabelle { display: grid; gap: 8px; }
.automatik-tabelle .automatik { white-space: normal; }
