/* =====================================================================
   Belegerfassung – Pfadi St. Karl Rickenbach
   Mobile first. Eine Datei, kein Build-Schritt, kein Framework.
   Das ist Absicht: in fünf Jahren soll man hier eine Farbe ändern
   können, ohne npm zu verstehen.

   Keine Inline-Styles im HTML – die Content-Security-Policy verbietet
   sie. Deshalb gibt es weiter unten fertige Balken-Klassen.
   ===================================================================== */

:root {
  --blau: #00366B;
  --blau-hell: #0b5aa8;
  --blau-blass: #e8f0f9;

  --gruen: #2e7d32;
  --gruen-blass: #e6f4e7;
  --gelb: #b26a00;
  --gelb-blass: #fff4e0;
  --rot: #b3261e;
  --rot-blass: #fdecea;

  --text: #1a1d21;
  --text-leise: #5a626b;
  --linie: #d9dee4;
  --grund: #f4f6f8;
  --karte: #ffffff;

  --radius: 10px;
  --abstand: 1rem;
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --blau: #4a9eff;
    --blau-hell: #6bb3ff;
    --blau-blass: #12233a;
    --gruen: #6fcf75;
    --gruen-blass: #14291a;
    --gelb: #e0a33a;
    --gelb-blass: #2e2412;
    --rot: #ff7a70;
    --rot-blass: #33161a;
    --text: #e9edf2;
    --text-leise: #a3adb8;
    --linie: #333b45;
    --grund: #14181d;
    --karte: #1c2128;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--schrift);
  /* 17px: auf dem Handy gut lesbar, und iOS zoomt bei Eingabefeldern
     unter 16px automatisch hinein – das nervt beim Ausfüllen. */
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  background: var(--grund);
}

h1 { font-size: 1.6rem; margin: 0 0 .25rem; line-height: 1.2; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; color: var(--text-leise); text-transform: uppercase; letter-spacing: .04em; }
h2:first-child, h3:first-child { margin-top: 0; }

a { color: var(--blau-hell); }
a:hover { color: var(--blau); }

code, .mono { font-family: var(--mono); font-size: .9em; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.sprungmarke {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--blau); color: #fff; padding: .75rem 1rem;
}
.sprungmarke:focus { left: 0; }

/* ── Kopf ─────────────────────────────────────────────────────── */

.kopf {
  background: var(--blau);
  color: #fff;
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
@media (prefers-color-scheme: dark) {
  .kopf { background: #0d1720; border-bottom: 1px solid var(--linie); }
}
.kopf-innen {
  max-width: 1500px; margin: 0 auto; padding: .6rem var(--abstand);
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
}
.marke { display: flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; }
.marke-lilie { font-size: 1.5rem; line-height: 1; }
.marke-text { display: flex; flex-direction: column; line-height: 1.15; }
.marke-text small { opacity: .8; font-size: .72rem; }

.hauptnavi { display: flex; flex-wrap: wrap; gap: .15rem; flex: 1 1 100%; order: 3; }
.hauptnavi a {
  color: #fff; text-decoration: none; padding: .5rem .7rem;
  border-radius: var(--radius); font-size: .92rem; opacity: .85;
  min-height: 40px; display: flex; align-items: center;
}
.hauptnavi a:hover { background: rgba(255,255,255,.12); opacity: 1; }
.hauptnavi a.aktiv { background: rgba(255,255,255,.2); opacity: 1; font-weight: 600; }

.kopf-person { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.person-link { color: #fff; text-decoration: none; font-size: .9rem; display: flex; align-items: center; gap: .4rem; }
.rollen-chip {
  font-size: .68rem; padding: .1rem .4rem; border-radius: 999px;
  background: rgba(255,255,255,.2); text-transform: uppercase; letter-spacing: .03em;
}
.rollen-chip.rollen-admin { background: #ffd24a; color: #3a2c00; }
.rollen-chip.rollen-kassier { background: #a8e6a3; color: #10330d; }

@media (min-width: 900px) {
  .hauptnavi { flex: 1; order: 0; }
}

/* ── Grundlayout ──────────────────────────────────────────────── */

.inhalt { max-width: 1500px; margin: 0 auto; padding: var(--abstand); }
.schmal { max-width: 720px; margin: 0 auto; }
.langtext { max-width: 680px; }
.langtext li { margin-bottom: .4rem; }

.seitenkopf {
  display: flex; flex-wrap: wrap; gap: var(--abstand);
  align-items: flex-end; justify-content: space-between; margin-bottom: var(--abstand);
}
.unterzeile { color: var(--text-leise); margin: 0; font-size: .95rem; }

.karte {
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: var(--abstand);
  margin-bottom: var(--abstand);
}
.karte-kompakt { padding: .75rem var(--abstand); }
.karte-titel { font-weight: 600; margin: 0 0 .25rem; }
.karte-login { margin-top: 2rem; }
.karte-warnung { border-color: var(--gelb); background: var(--gelb-blass); }
.karte-kassier { border-color: var(--blau); border-width: 2px; }
.karte-erfolg { border-color: var(--gruen); background: var(--gruen-blass); text-align: center; }

.klein { font-size: .85rem; color: var(--text-leise); }
.optional { font-weight: 400; color: var(--text-leise); font-size: .85em; }
.pflicht { color: var(--rot); margin-left: .2rem; }

/* ── Meldungen ────────────────────────────────────────────────── */

.meldung {
  padding: .75rem 1rem; border-radius: var(--radius);
  margin-bottom: var(--abstand); border-left: 4px solid;
}
.meldung-ok { background: var(--gruen-blass); border-color: var(--gruen); }
.meldung-warnung { background: var(--gelb-blass); border-color: var(--gelb); }
.meldung-fehler { background: var(--rot-blass); border-color: var(--rot); }
.meldung-info { background: var(--blau-blass); border-color: var(--blau); }
.meldung ul { margin: .5rem 0 0; padding-left: 1.2rem; }

.hinweis-box {
  background: var(--blau-blass); border-radius: var(--radius);
  padding: .75rem 1rem; margin-top: var(--abstand); font-size: .9rem;
}

/* ── Kacheln ──────────────────────────────────────────────────── */

.kachel-reihe {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem; margin-bottom: var(--abstand);
}
.kachel {
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: .9rem 1rem;
  display: flex; flex-direction: column; gap: .15rem;
}
.kachel-zahl { font-size: 1.45rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kachel-text { font-size: .82rem; color: var(--text-leise); }
.kachel-offen { border-color: var(--gelb); background: var(--gelb-blass); }
.kachel-offen .kachel-zahl { color: var(--gelb); }
.kachel-erledigt { border-color: var(--gruen); background: var(--gruen-blass); }
.kachel-erledigt .kachel-zahl { color: var(--gruen); }

/* ── Formulare ────────────────────────────────────────────────── */

.formular { margin-top: .5rem; }
.feld { margin-bottom: 1.1rem; }
.feld > label, .feld > legend, fieldset.feld > legend {
  display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem;
}
fieldset.feld { border: 0; padding: 0; margin: 0 0 1.1rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="search"], input[type="file"], select, textarea {
  width: 100%; padding: .7rem .75rem; font: inherit; color: var(--text);
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: var(--radius); min-height: 48px; /* Daumenfreundlich */
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid var(--blau-hell); outline-offset: 1px;
}
input:disabled { background: var(--grund); color: var(--text-leise); }
input:invalid:not(:placeholder-shown) { border-color: var(--rot); }

.klein-eingabe { min-height: 40px; padding: .35rem .5rem; }
.betrag-eingabe, .code-eingabe { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.code-eingabe { letter-spacing: .3em; text-align: center; }
.iban-eingabe { font-family: var(--mono); letter-spacing: .02em; }
.datei-eingabe { padding: .75rem; background: var(--blau-blass); border-style: dashed; border-width: 2px; }

.feld-hilfe { font-size: .84rem; color: var(--text-leise); margin: .3rem 0 0; }
.feld-fehler {
  font-size: .88rem; color: var(--rot); margin: .3rem 0 0; font-weight: 600;
}
.feld-reihe { display: flex; flex-wrap: wrap; gap: .75rem; }
.feld-reihe > .feld { flex: 1 1 220px; margin-bottom: .75rem; }
.feld-reihe > .feld-schmal { flex: 0 1 170px; }
.feld-knopf { display: flex; align-items: flex-end; gap: .5rem; flex: 0 0 auto; }
.zeichen-zaehler { font-variant-numeric: tabular-nums; }

.haken-zeile { display: flex; gap: .5rem; align-items: flex-start; font-weight: 400; }
.haken-zeile input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; flex: 0 0 auto; margin-top: .15rem; }

/* Auswahlliste (Zahlungsmittel) – grosse Trefferflächen fürs Handy */
.auswahl-liste { display: flex; flex-direction: column; gap: .5rem; }
.auswahl-eintrag {
  display: flex; gap: .7rem; align-items: flex-start;
  border: 1px solid var(--linie); border-radius: var(--radius);
  padding: .8rem; cursor: pointer; background: var(--karte);
}
.auswahl-eintrag:hover { border-color: var(--blau-hell); }
.auswahl-eintrag input[type="radio"] { width: 22px; height: 22px; min-height: 0; margin-top: .15rem; flex: 0 0 auto; }
.auswahl-eintrag:has(input:checked) { border-color: var(--blau); border-width: 2px; background: var(--blau-blass); padding: calc(.8rem - 1px); }
.auswahl-inhalt { display: flex; flex-direction: column; gap: .1rem; }
.auswahl-titel { font-weight: 600; }
.auswahl-hilfe { font-size: .85rem; color: var(--text-leise); }

.datei-vorschau { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.datei-vorschau img {
  width: 88px; height: 88px; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--linie);
}
.datei-vorschau .vorschau-name {
  font-size: .78rem; padding: .4rem .6rem; background: var(--blau-blass);
  border-radius: var(--radius); align-self: center;
}

/* ── Knöpfe ───────────────────────────────────────────────────── */

.knopf, button.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.1rem; min-height: 48px;
  font: inherit; font-weight: 600; text-decoration: none;
  color: var(--text); background: var(--karte);
  border: 1px solid var(--linie); border-radius: var(--radius);
  cursor: pointer;
}
.knopf:hover { border-color: var(--blau-hell); color: var(--text); }
.knopf-primaer { background: var(--blau); border-color: var(--blau); color: #fff; }
.knopf-primaer:hover { background: var(--blau-hell); border-color: var(--blau-hell); color: #fff; }
.knopf-gross { width: 100%; font-size: 1.05rem; padding: .85rem 1.2rem; }
.knopf-schlank { background: transparent; }
.knopf-gefahr { color: var(--rot); border-color: var(--rot); }
.knopf-gefahr:hover { background: var(--rot); color: #fff; }
.knopf-mini { min-height: 34px; padding: .25rem .55rem; font-size: .82rem; font-weight: 500; }
.knopf-schlicht {
  background: none; border: 0; color: inherit; font: inherit; font-size: .85rem;
  text-decoration: underline; cursor: pointer; padding: .35rem 0; opacity: .9;
}
.knopf-leiste { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
.knopf-leiste-oben { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--linie); }
.inline-form { display: inline-flex; gap: .35rem; align-items: center; margin: 0; }
.hilfe-zeile { margin-top: 1rem; font-size: .9rem; }

@media (min-width: 600px) {
  .knopf-gross { width: auto; }
}

/* ── Belegliste (mobil) ───────────────────────────────────────── */

.beleg-liste { list-style: none; margin: 0; padding: 0; }
.beleg-eintrag { border-bottom: 1px solid var(--linie); }
.beleg-eintrag:last-child { border-bottom: 0; }
.beleg-link {
  display: flex; flex-direction: column; gap: .25rem;
  padding: .8rem .25rem; text-decoration: none; color: var(--text);
  border-left: 4px solid transparent; padding-left: .75rem;
}
.beleg-link:hover { background: var(--blau-blass); color: var(--text); }
.ist-offen .beleg-link { border-left-color: var(--gelb); }
.ist-bezahlt .beleg-link { border-left-color: var(--gruen); }
.beleg-kopf { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.beleg-nummer { font-family: var(--mono); font-size: .82rem; color: var(--text-leise); }
.beleg-betrag { font-weight: 700; font-variant-numeric: tabular-nums; }
.beleg-beschreibung { display: block; font-weight: 600; }
.beleg-meta { display: block; font-size: .82rem; color: var(--text-leise); }
.beleg-status { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .2rem; }

.chip {
  display: inline-block; font-size: .74rem; font-weight: 600;
  padding: .15rem .5rem; border-radius: 999px; white-space: nowrap;
}
.chip-gelb { background: var(--gelb-blass); color: var(--gelb); }
.chip-gruen { background: var(--gruen-blass); color: var(--gruen); }
.chip-rot { background: var(--rot-blass); color: var(--rot); }
.chip-blau { background: var(--blau-blass); color: var(--blau-hell); }
.chip-grau { background: var(--grund); color: var(--text-leise); }

.status-zeile { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.betrag-gross { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.belegnummer-gross { font-family: var(--mono); font-size: 1.6rem; font-weight: 700; margin: .25rem 0; }
.erfolg-symbol { font-size: 2.5rem; margin: 0; color: var(--gruen); }
.erfolg-hinweis { font-size: 1.05rem; }

.daten-liste { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: .35rem .9rem; margin: 0; }
.daten-liste dt { font-weight: 600; color: var(--text-leise); font-size: .88rem; }
.daten-liste dd { margin: 0; }
.notiz-kassier { background: var(--blau-blass); padding: .35rem .6rem; border-radius: var(--radius); }

.leer-zustand { text-align: center; padding: 2rem 1rem; }
.leer-symbol { font-size: 3rem; margin: 0; }
.leer-zelle { text-align: center; color: var(--text-leise); padding: 2rem; }

.datei-galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
.datei-kachel { margin: 0; }
.datei-kachel img {
  width: 100%; aspect-ratio: 3/4; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--linie); background: var(--grund);
}
.datei-kachel figcaption { font-size: .8rem; color: var(--text-leise); margin-top: .3rem; }
.pdf-kachel {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  aspect-ratio: 3/4; border: 1px dashed var(--linie); border-radius: var(--radius);
  text-decoration: none; text-align: center; padding: 1rem;
}
.pdf-symbol { font-size: 2.5rem; }

/* ── Tabellen ─────────────────────────────────────────────────── */

.tabelle-huelle {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid var(--linie); border-radius: var(--radius); background: var(--karte);
}
.belegtabelle { width: 100%; border-collapse: collapse; font-size: .88rem; }
.belegtabelle th, .belegtabelle td {
  padding: .5rem .6rem; text-align: left; border-bottom: 1px solid var(--linie);
  vertical-align: top;
}
.belegtabelle thead th {
  position: sticky; top: 0; background: var(--karte); z-index: 1;
  font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-leise);
  white-space: nowrap;
}
.belegtabelle thead th a { color: inherit; text-decoration: none; }
.belegtabelle thead th a:hover { text-decoration: underline; }
.belegtabelle tfoot td { background: var(--grund); font-weight: 600; }
.belegtabelle tbody tr:hover { background: var(--blau-blass); }
.rechts { text-align: right; }
.betrag-zelle { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nummer-link { font-family: var(--mono); font-size: .82rem; white-space: nowrap; }
.beschreibung-zelle { max-width: 260px; }
.detail-zelle { max-width: 380px; word-break: break-word; font-family: var(--mono); font-size: .76rem; }
.aktionen-zelle { display: flex; flex-wrap: wrap; gap: .25rem; }
.aktion-code { font-size: .78rem; white-space: nowrap; }
.detailzeile td { border-bottom: 2px solid var(--linie); padding-top: 0; }
.beleg-unterliste { margin: .35rem 0 0; padding-left: 1.1rem; }

.zeile-gelb { background: var(--gelb-blass); }
.zeile-rot { background: var(--rot-blass); }
.zeile-gruen { background: var(--gruen-blass); }
.zeile-blass { opacity: .55; }

.legende { padding: .05rem .4rem; border-radius: 4px; }
.legende-gelb { background: var(--gelb-blass); }
.legende-rot { background: var(--rot-blass); }
.legende-gruen { background: var(--gruen-blass); }

.haken-knopf {
  font: inherit; font-size: .82rem; padding: .25rem .5rem; min-height: 34px;
  border: 1px solid var(--linie); border-radius: var(--radius);
  background: var(--karte); color: var(--text); cursor: pointer; white-space: nowrap;
}
.haken-knopf:hover { border-color: var(--blau); }
.haken-gesetzt { background: var(--gruen-blass); border-color: var(--gruen); color: var(--gruen); font-weight: 600; }

.filter-leiste {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end;
  background: var(--karte); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: .75rem; margin-bottom: var(--abstand);
}
.filter-leiste .feld { margin-bottom: 0; flex: 1 1 150px; }
.filter-leiste .feld-knopf { flex: 0 0 auto; }

.blaettern { display: flex; gap: .75rem; align-items: center; justify-content: center; margin: var(--abstand) 0; }
.neu-block { margin-top: var(--abstand); }
.neu-block summary { cursor: pointer; padding: .5rem 0; }

/* ── Budgetbalken ─────────────────────────────────────────────
   Feste Klassen statt style="width:…". Die CSP verbietet Inline-
   Styles, und das ist gut so: keine Ausnahme, die man später
   versehentlich für etwas Gefährlicheres nutzt. */
.balken-huelle {
  background: var(--grund); border-radius: 999px; height: 12px;
  overflow: hidden; min-width: 90px; border: 1px solid var(--linie);
}
.balken { height: 100%; background: var(--gruen); border-radius: 999px; }
.balken-warnung { background: var(--gelb); }
.balken-ueber { background: var(--rot); }
.balken-0   { width: 0; }
.balken-5   { width: 5%; }
.balken-10  { width: 10%; }
.balken-15  { width: 15%; }
.balken-20  { width: 20%; }
.balken-25  { width: 25%; }
.balken-30  { width: 30%; }
.balken-35  { width: 35%; }
.balken-40  { width: 40%; }
.balken-45  { width: 45%; }
.balken-50  { width: 50%; }
.balken-55  { width: 55%; }
.balken-60  { width: 60%; }
.balken-65  { width: 65%; }
.balken-70  { width: 70%; }
.balken-75  { width: 75%; }
.balken-80  { width: 80%; }
.balken-85  { width: 85%; }
.balken-90  { width: 90%; }
.balken-95  { width: 95%; }
.balken-100 { width: 100%; }

/* ── 2FA ──────────────────────────────────────────────────────── */

.qr-bild { display: block; margin: 1rem auto; background: #fff; padding: .5rem; border-radius: var(--radius); }
.secret-anzeige { text-align: center; word-break: break-all; background: var(--grund); padding: .6rem; border-radius: var(--radius); }
.recovery-codes {
  list-style: none; margin: 1rem 0; padding: 1rem; background: var(--karte);
  border: 1px dashed var(--linie); border-radius: var(--radius);
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .4rem;
  font-family: var(--mono); font-size: 1rem; text-align: center;
}

.verlauf-liste { list-style: none; margin: .75rem 0 0; padding: 0; font-size: .85rem; }
.verlauf-liste li { display: flex; flex-wrap: wrap; gap: .6rem; padding: .3rem 0; border-bottom: 1px solid var(--linie); }
.verlauf-zeit { color: var(--text-leise); font-variant-numeric: tabular-nums; }
.verlauf-aktion { font-family: var(--mono); font-size: .8rem; }

.fehler-status { font-size: 3rem; font-weight: 700; color: var(--text-leise); margin: 0; line-height: 1; }
.fehler-text { font-size: 1.05rem; }
.entwickler-details pre { overflow-x: auto; font-size: .78rem; background: var(--grund); padding: .75rem; border-radius: var(--radius); }
.anleitung li { margin-bottom: .35rem; }

/* ── Fuss ─────────────────────────────────────────────────────── */

.fuss { border-top: 1px solid var(--linie); margin-top: 3rem; padding: 1.5rem var(--abstand); background: var(--karte); }
.fuss-innen {
  max-width: 1500px; margin: 0 auto; display: flex; flex-wrap: wrap;
  gap: 1rem; align-items: center; justify-content: space-between;
  font-size: .85rem; color: var(--text-leise);
}
.fuss nav { display: flex; gap: 1rem; }
.fuss-klein { flex: 1 1 100%; font-size: .8rem; }

@media print {
  .kopf, .fuss, .knopf, .knopf-leiste, .filter-leiste, .sprungmarke { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .karte, .tabelle-huelle { border: 0; }
  .tabelle-huelle { overflow: visible; }
}
