:root {
  --bg: #f6f5f1;
  --karte: #ffffff;
  --text: #1c1f23;
  --gedaempft: #6b7078;
  --linie: #e4e2dc;
  --fl: #efede7;
  --akzent: #0f766e;
  --akzent-dunkel: #0b5f58;
  --akzent-hell: #e3f1ef;
  --auf-akzent: #ffffff;
  --plus: #0f7a4a;
  --minus: #c2410c;
  --gefahr: #b91c1c;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121416;
    --karte: #1b1e21;
    --text: #e9eaec;
    --gedaempft: #9aa0a8;
    --linie: #2b3035;
    --fl: #24282c;
    --akzent: #2bb3a6;
    --akzent-dunkel: #239a8f;
    --akzent-hell: #183531;
    --auf-akzent: #0b1513;
    --plus: #4cc38a;
    --minus: #f59e5b;
    --gefahr: #f0705f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121416; --karte: #1b1e21; --text: #e9eaec; --gedaempft: #9aa0a8; --linie: #2b3035; --fl: #24282c;
  --akzent: #2bb3a6; --akzent-dunkel: #239a8f; --akzent-hell: #183531; --auf-akzent: #0b1513;
  --plus: #4cc38a; --minus: #f59e5b; --gefahr: #f0705f; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--akzent); }
h1, h2, h3 { line-height: 1.2; }
[hidden] { display: none !important; }

/* Kopfzeile */
.kopf {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  min-height: 56px;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--linie);
}
.marke { font-weight: 800; font-size: 22px; letter-spacing: -.02em; color: var(--akzent); text-decoration: none; margin-right: auto; }
.kopf-zurueck { display: grid; place-items: center; width: 44px; height: 44px; margin-left: -10px; color: var(--text); border-radius: 50%; }
.kopf-zurueck:active { background: var(--fl); }
.kopf-titel { flex: 1; margin: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf-aktion { margin: 0; }
button.link { background: none; border: 0; padding: 12px 0 12px 8px; font: inherit; font-size: 14px; color: var(--gedaempft); cursor: pointer; }

.inhalt {
  flex: 1;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-right)) 32px max(16px, env(safe-area-inset-left));
}
.fuss {
  display: flex; justify-content: center; gap: 20px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  font-size: 13px;
}
.fuss a { color: var(--gedaempft); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
#recht a[href^="tel:"], #recht a[href^="mailto:"] { display: inline-block; min-height: 44px; line-height: 44px; }

/* Bausteine */
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 18px; margin: 16px 0; }
.karte.mittig { text-align: center; }
.karte h2 { margin: 8px 0; font-size: 20px; }
.seiten-titel { font-size: 28px; margin: 8px 0 16px; letter-spacing: -.02em; }
.abschnitt-titel { font-size: 17px; margin: 28px 0 10px; }
form > input[type=hidden]:first-child + .abschnitt-titel { margin-top: 4px; }
.abschnitt-kopf { display: flex; justify-content: space-between; align-items: baseline; margin: 28px 0 6px; }
.abschnitt-kopf h2 { font-size: 17px; margin: 0; }
.klein { font-size: 14px; }
.gedaempft { color: var(--gedaempft); }
.leer { text-align: center; color: var(--gedaempft); padding: 24px 8px; }
.zeile { display: flex; gap: 10px; align-items: stretch; }
.zeile .feld { flex: 1; min-width: 0; }
.wachsen { flex: 1; }

.meldung { background: var(--fl); border-radius: 10px; padding: 12px 14px; margin: 12px 0; font-size: 15px; }
.meldung.ok { background: var(--akzent-hell); color: var(--text); }
.meldung.fehler { background: color-mix(in srgb, var(--gefahr) 14%, var(--karte)); color: var(--text); }

/* Formulare */
.feld-label { display: block; font-weight: 600; font-size: 15px; margin: 18px 0 6px; }
.feld-label.gross { font-size: 22px; margin-top: 8px; letter-spacing: -.01em; }
.karte > .feld-label:first-child, .karte > input[type=hidden]:first-child + .feld-label { margin-top: 0; }
.feld {
  display: block; width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  font: inherit; font-size: 17px; /* ab 16px kein Zoom auf iOS */
  color: var(--text);
  background: var(--karte);
  border: 1.5px solid var(--linie);
  border-radius: 12px;
  -webkit-appearance: none; appearance: none;
}
select.feld { background-image: linear-gradient(45deg, transparent 50%, var(--gedaempft) 50%), linear-gradient(135deg, var(--gedaempft) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
textarea.feld { resize: vertical; }
.feld:focus { outline: none; border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-hell); }
.code-feld { text-transform: uppercase; letter-spacing: .25em; font-weight: 700; font-family: ui-monospace, Menlo, monospace; }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 20px;
  font: inherit; font-size: 16px; font-weight: 700;
  color: var(--text); background: var(--fl);
  border: 0; border-radius: 12px;
  text-decoration: none; cursor: pointer;
  touch-action: manipulation;
}
.knopf:active { transform: scale(.98); }
.knopf.haupt { background: var(--akzent); color: var(--auf-akzent); }
.knopf.haupt:active { background: var(--akzent-dunkel); }
.knopf.gefahr { background: none; color: var(--gefahr); }
.knopf.leise { background: none; color: var(--akzent); }
.knopf.breit { display: flex; width: 100%; margin-top: 16px; }

/* Startseite */
.start-held { padding: 28px 0 4px; }
.start-held h1 { font-size: 34px; letter-spacing: -.03em; margin: 0 0 10px; }
.start-held p { font-size: 18px; color: var(--gedaempft); margin: 0; }
.start-punkte { list-style: none; padding: 0; margin: 24px 0; }
.start-punkte li { padding: 12px 0 12px 32px; border-top: 1px solid var(--linie); position: relative; }
.start-punkte li::before { content: ""; position: absolute; left: 4px; top: 19px; width: 12px; height: 12px; border-radius: 50%; background: var(--akzent); }
.symbol-gross { width: 56px; height: 56px; color: var(--akzent); }

/* Listen */
.liste { list-style: none; padding: 0; margin: 0 0 16px; background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); overflow: hidden; }
.liste:empty { display: none; }
.liste > li + li { border-top: 1px solid var(--linie); }
.liste-eintrag { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; color: var(--text); text-decoration: none; }
a.liste-eintrag:active { background: var(--fl); }
.liste-haupt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.liste-haupt strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liste-datum { padding: 8px 16px 6px; font-size: 13px; font-weight: 700; color: var(--gedaempft); background: var(--bg); text-transform: uppercase; letter-spacing: .04em; }
.betrag { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.betrag.plus { color: var(--plus); }
.betrag.minus { color: var(--minus); }

/* Gruppenseite */
.gross-knoepfe { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 8px; }
.kachel {
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  min-height: 120px; padding: 16px;
  font-size: 18px; font-weight: 700; line-height: 1.2;
  color: var(--text); background: var(--karte); border: 1px solid var(--linie);
  border-radius: 18px; text-decoration: none;
}
.kachel svg { width: 34px; height: 34px; padding: 6px; border-radius: 50%; background: var(--akzent-hell); color: var(--akzent); }
.kachel.haupt { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
.kachel.haupt svg { background: rgba(255, 255, 255, .2); color: var(--auf-akzent); }
.kachel:active { transform: scale(.98); }
.hinweis-karte { border-color: var(--akzent); }
.unter-links { display: flex; justify-content: center; gap: 24px; margin: 24px 0 0; }
.unter-links a { padding: 10px 4px; text-decoration: none; font-weight: 600; }

/* Ausgabe */
.betrag-feld { position: relative; }
.betrag-feld .feld { font-size: 34px; font-weight: 700; min-height: 72px; padding-right: 48px; font-variant-numeric: tabular-nums; }
.betrag-feld span { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 26px; color: var(--gedaempft); }
.auswahl { display: flex; flex-wrap: wrap; gap: 8px; }
.auswahl label { position: relative; }
.auswahl input { position: absolute; opacity: 0; inset: 0; }
.auswahl span { display: inline-flex; align-items: center; min-height: 46px; padding: 10px 16px; border: 1.5px solid var(--linie); border-radius: 999px; background: var(--karte); font-weight: 600; cursor: pointer; }
.auswahl input:checked + span { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); }
.auswahl input:focus-visible + span { box-shadow: 0 0 0 3px var(--akzent-hell); }

/* Auswertung */
.summe-karte { display: flex; flex-direction: column; align-items: center; padding: 20px; background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); }
.summe-karte strong { font-size: 34px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.zahlungen { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.zahlungen li { display: flex; align-items: center; gap: 12px; padding: 16px; background: var(--akzent-hell); border-radius: var(--radius); }
.zahlung-wer { flex: 1; min-width: 0; }
.zahlungen .betrag { font-size: 19px; }
.liste-eintrag.statisch { min-height: 60px; }

/* Wizard */
.schritte { display: flex; gap: 8px; list-style: none; padding: 0; margin: 4px 0 20px; counter-reset: s; }
.schritte li { flex: 1; padding-top: 8px; border-top: 4px solid var(--linie); font-size: 13px; font-weight: 600; color: var(--gedaempft); counter-increment: s; }
.schritte li::before { content: counter(s) ". "; }
.schritte li.aktiv { border-color: var(--akzent); color: var(--text); }
.team-felder { display: grid; gap: 10px; margin: 16px 0 8px; }
.team-feld { display: flex; gap: 10px; align-items: center; }
.team-feld .feld { flex: 1; min-width: 0; }
.mein-team { display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--gedaempft); min-height: 44px; white-space: nowrap; }
.mein-team input { width: 20px; height: 20px; accent-color: var(--akzent); }

/* Stepper */
.stepper { display: inline-flex; align-items: center; background: var(--fl); border-radius: 999px; padding: 4px; }
.stepper-knopf { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--karte); color: var(--text); font-size: 24px; line-height: 1; cursor: pointer; touch-action: manipulation; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.stepper-knopf:active { background: var(--akzent-hell); }
.stepper-wert { width: 44px; border: 0; background: none; color: var(--text); text-align: center; font: inherit; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stepper.gross { display: flex; justify-content: space-between; margin: 12px 0; }
.stepper.gross .stepper-knopf { width: 56px; height: 56px; }
.stepper.gross .stepper-wert { font-size: 30px; width: auto; }

/* Einstellungen */
.team-karte { padding: 16px; }
.team-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.team-kopf h3 { margin: 0; font-size: 18px; min-width: 0; overflow-wrap: anywhere; }
.faktor-gross { font-size: 44px; font-weight: 800; line-height: 1; color: var(--akzent); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.segmente { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--fl); border-radius: 12px; padding: 4px; gap: 4px; }
.segmente label { position: relative; }
.segmente input { position: absolute; opacity: 0; inset: 0; }
.segmente span { display: flex; align-items: center; justify-content: center; min-height: 42px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--gedaempft); cursor: pointer; }
.segmente input:checked + span { background: var(--karte); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.segmente input:focus-visible + span { outline: 2px solid var(--akzent); }
.modus-inhalt { padding-top: 12px; }
.modus-inhalt .feld-label { margin-top: 4px; }
.personen-zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.personen-zeile + .personen-zeile { border-top: 1px solid var(--linie); }
.leiste-unten { position: sticky; bottom: 0; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); }
.leiste-unten .knopf.breit { margin-top: 8px; }

/* Einladen */
.code-anzeige { font: 800 40px/1.2 ui-monospace, Menlo, monospace; letter-spacing: .18em; color: var(--akzent); margin: 6px 0 4px; user-select: all; }

@media (min-width: 640px) {
  .kachel { min-height: 140px; font-size: 20px; }
  .start-held h1 { font-size: 44px; }
}
