/* sindquitt – ruhig, hell, großzügig. Farben nur über Tokens. */

:root {
  --bg: #f4f5f2;
  --flaeche: #ffffff;
  --flaeche-2: #eef0ec;
  --linie: #e1e4de;
  --text: #1b211e;
  --leise: #66706b;
  --akzent: #0d7a5f;
  --akzent-hell: #e1f2ec;
  --akzent-text: #ffffff;
  --plus: #0d7a5f;
  --minus: #b8461b;
  --minus-hell: #fbeae2;
  --warn: #8a5a00;
  --warn-hell: #fff4d6;
  --schatten: 0 1px 2px rgba(20, 30, 25, .06), 0 4px 16px rgba(20, 30, 25, .06);
  --schatten-hoch: 0 8px 32px rgba(20, 30, 25, .18);
  --radius: 18px;
  --radius-klein: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513;
    --flaeche: #1a201d;
    --flaeche-2: #232a26;
    --linie: #2d3530;
    --text: #e9eeeb;
    --leise: #95a19b;
    --akzent: #3fbf95;
    --akzent-hell: #18352b;
    --akzent-text: #06140f;
    --plus: #4fcf9f;
    --minus: #f08a5d;
    --minus-hell: #3a2219;
    --warn: #f2c14e;
    --warn-hell: #3a301a;
    --schatten: 0 1px 2px rgba(0, 0, 0, .3);
    --schatten-hoch: 0 8px 32px rgba(0, 0, 0, .5);
    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.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.zahl { font-variant-numeric: tabular-nums; }

.app { max-width: 560px; margin: 0 auto; padding: 0 16px calc(120px + env(safe-area-inset-bottom)); }

/* ── Kopf ─────────────────────────────────────────────────────────────── */
.kopf {
  display: flex; align-items: center; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 0 10px;
}
.kopf-titel { flex: 1; min-width: 0; }
.kopf h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kopf .unter { color: var(--leise); font-size: 13px; }
.rund {
  width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: var(--flaeche); box-shadow: var(--schatten);
  display: grid; place-items: center; flex: none;
}
.rund svg { width: 20px; height: 20px; }

/* ── Übersicht ────────────────────────────────────────────────────────── */
.uebersicht {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--linie); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--schatten); margin: 6px 0 16px;
}
.uebersicht > div { background: var(--flaeche); padding: 12px 12px 14px; }
.uebersicht .k { font-size: 12px; color: var(--leise); }
.uebersicht .w { font-size: 17px; font-weight: 650; margin-top: 2px; white-space: nowrap; }
.plus { color: var(--plus); }
.minus { color: var(--minus); }

/* ── Umschalter ───────────────────────────────────────────────────────── */
.segmente {
  display: flex; background: var(--flaeche-2); border-radius: 999px; padding: 4px; gap: 4px;
}
.segmente button {
  flex: 1; border: 0; background: transparent; border-radius: 999px; padding: 8px 10px;
  font-size: 15px; font-weight: 550; color: var(--leise);
}
.segmente button[aria-pressed="true"] { background: var(--flaeche); color: var(--text); box-shadow: var(--schatten); }
.segmente.klein button { font-size: 14px; padding: 6px 8px; }

/* ── Hinweise ─────────────────────────────────────────────────────────── */
.hinweis {
  border-radius: var(--radius-klein); padding: 12px 14px; margin: 12px 0;
  background: var(--akzent-hell); font-size: 14px;
}
.hinweis.warn { background: var(--warn-hell); color: var(--warn); }
.hinweis.fehler { background: var(--minus-hell); color: var(--minus); }
.hinweis ul { margin: 6px 0 8px; padding-left: 18px; }
.hinweis li { margin: 2px 0; }
.hinweis .zeile { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.link { border: 0; background: none; padding: 4px 0; color: var(--akzent); font-weight: 600; }

/* ── Liste ────────────────────────────────────────────────────────────── */
.tag { font-size: 13px; font-weight: 600; color: var(--leise); margin: 18px 4px 6px; text-transform: none; }
.karte { background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); overflow: hidden; }
.eintrag {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px; border: 0; background: transparent; text-align: left;
}
.eintrag + .eintrag { border-top: 1px solid var(--linie); }
.eintrag:active { background: var(--flaeche-2); }
.symbol {
  width: 40px; height: 40px; border-radius: 12px; background: var(--flaeche-2);
  display: grid; place-items: center; font-size: 20px; flex: none;
}
.eintrag .mitte { flex: 1; min-width: 0; }
.eintrag .t, .eintrag .u, .eintrag .betrag, .eintrag .basis { display: block; }
.eintrag .t { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eintrag .u { font-size: 13px; color: var(--leise); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eintrag .rechts { text-align: right; flex: none; }
.eintrag .betrag { font-weight: 600; white-space: nowrap; }
.eintrag .basis { font-size: 12px; color: var(--leise); white-space: nowrap; }
.punkt { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--akzent); margin-right: 6px; vertical-align: 2px; }
.klammer { font-size: 13px; }
.leer { text-align: center; color: var(--leise); padding: 48px 16px; }

/* ── Salden ───────────────────────────────────────────────────────────── */
.saldo { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.saldo + .saldo { border-top: 1px solid var(--linie); }
.saldo .name { flex: 1; min-width: 0; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saldo .balken { flex: 1.2; height: 8px; background: var(--flaeche-2); border-radius: 4px; position: relative; overflow: hidden; }
.saldo .balken i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.saldo .balken i.p { left: 50%; background: var(--plus); }
.saldo .balken i.m { right: 50%; background: var(--minus); }
.saldo .wert { width: 108px; text-align: right; font-weight: 600; white-space: nowrap; }
.saldo .wert small { display: block; font-weight: 400; font-size: 12px; color: var(--leise); }
.zahlung { display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.zahlung + .zahlung { border-top: 1px solid var(--linie); }
.zahlung .wer { flex: 1; min-width: 0; }
.zahlung .knopf { flex: none; max-width: 46%; }
.zahlung .wer b { font-weight: 600; }
h2 { font-size: 17px; margin: 24px 4px 8px; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff;
}

/* ── Knöpfe ───────────────────────────────────────────────────────────── */
.knopf {
  border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 600;
  background: var(--flaeche-2); color: var(--text);
}
.knopf.primaer { background: var(--akzent); color: var(--akzent-text); }
.knopf.gefahr { background: transparent; color: var(--minus); }
.knopf.klein { padding: 7px 14px; font-size: 14px; }
.knopf:disabled { opacity: .5; }

.fab-leiste {
  position: fixed; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex; justify-content: center; gap: 12px; pointer-events: none; z-index: 5;
}
.fab {
  pointer-events: auto; border: 0; border-radius: 999px; height: 56px; padding: 0 22px;
  display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 16px;
  box-shadow: var(--schatten-hoch);
}
.fab.haupt { background: var(--akzent); color: var(--akzent-text); }
.fab.neben { background: var(--flaeche); color: var(--text); }
.fab svg { width: 22px; height: 22px; }

/* ── Blätter (Dialoge von unten) ──────────────────────────────────────── */
.schleier {
  position: fixed; inset: 0; background: rgba(10, 15, 12, .4); z-index: 20;
  display: flex; align-items: flex-end; justify-content: center;
  animation: einblenden .15s ease-out;
}
.blatt {
  background: var(--bg); width: 100%; max-width: 560px; max-height: 94dvh;
  border-radius: 22px 22px 0 0; display: flex; flex-direction: column;
  animation: hoch .22s cubic-bezier(.2, .8, .3, 1);
  box-shadow: var(--schatten-hoch);
}
@media (min-width: 600px) {
  .schleier { align-items: center; }
  .blatt { border-radius: 22px; max-height: 88dvh; }
}
.blatt-kopf { display: flex; align-items: center; gap: 8px; padding: 14px 16px 8px; }
.blatt-kopf h3 { flex: 1; margin: 0; font-size: 18px; }
.blatt-inhalt { overflow-y: auto; padding: 4px 16px 16px; -webkit-overflow-scrolling: touch; }
.blatt-fuss {
  display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--linie); background: var(--bg);
}
.blatt-fuss .knopf { flex: 1; }
@keyframes hoch { from { transform: translateY(40px); opacity: .4; } }
@keyframes einblenden { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .schleier, .blatt { animation: none; } }

/* ── Formular ─────────────────────────────────────────────────────────── */
.feld { margin: 14px 0; }
.feld > label, .feld > .label { display: block; font-size: 13px; font-weight: 600; color: var(--leise); margin: 0 4px 6px; }
.eingabe {
  width: 100%; border: 1.5px solid var(--linie); background: var(--flaeche);
  border-radius: var(--radius-klein); padding: 11px 13px; outline: none;
}
.eingabe:focus { border-color: var(--akzent); }
.eingabe.falsch { border-color: var(--minus); }
.gross-betrag { display: flex; gap: 8px; align-items: stretch; }
.gross-betrag .eingabe { font-size: 30px; font-weight: 650; padding: 8px 14px; text-align: right; }
.gross-betrag select.eingabe { width: auto; font-size: 18px; font-weight: 600; text-align: left; flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--linie); background: var(--flaeche); border-radius: 999px;
  padding: 7px 13px 7px 7px; display: inline-flex; align-items: center; gap: 8px; font-weight: 550;
}
.chip.ohne-avatar { padding-left: 13px; }
.chip .avatar { width: 24px; height: 24px; font-size: 11px; }
.chip[aria-pressed="true"] { border-color: var(--akzent); background: var(--akzent-hell); }
.chip.klein { padding: 4px 10px 4px 4px; font-size: 14px; }
.chip.klein .avatar { width: 20px; height: 20px; font-size: 10px; }

.teile { background: var(--flaeche); border-radius: var(--radius-klein); box-shadow: var(--schatten); margin-top: 10px; }
.teil { display: flex; align-items: center; gap: 10px; padding: 9px 12px; }
.teil + .teil { border-top: 1px solid var(--linie); }
.teil .name { flex: 1; min-width: 0; }
.teil .eingabe { width: 110px; text-align: right; padding: 7px 10px; }
.teil .anteil { width: 96px; text-align: right; color: var(--leise); white-space: nowrap; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--linie); background: var(--flaeche); font-weight: 700; }
.stepper span { min-width: 22px; text-align: center; font-weight: 600; }
.summenzeile { display: flex; justify-content: space-between; padding: 8px 4px 0; font-size: 14px; }

.kursbox { background: var(--flaeche); border-radius: var(--radius-klein); padding: 10px 12px; box-shadow: var(--schatten); font-size: 14px; }
.kursbox .zeile { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kursbox .eingabe { padding: 8px 10px; }

.posten { background: var(--flaeche); border-radius: var(--radius-klein); box-shadow: var(--schatten); padding: 10px 12px; margin-bottom: 10px; }
.posten.offen { box-shadow: 0 0 0 2px var(--warn) inset, var(--schatten); }
.posten .kopfzeile { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.posten .kopfzeile .eingabe { padding: 6px 9px; }
.posten .kopfzeile .text { flex: 1; }
.posten .kopfzeile .betrag { width: 104px; text-align: right; }
.posten .weg { border: 0; background: none; color: var(--leise); font-size: 20px; padding: 0 4px; }
.posten .chips { gap: 6px; }

.beleg-vorschau { max-width: 100%; border-radius: var(--radius-klein); display: block; margin: 8px auto; }

.ladebalken { height: 4px; border-radius: 2px; background: var(--flaeche-2); overflow: hidden; margin: 18px 0; }
.ladebalken i { display: block; height: 100%; width: 40%; background: var(--akzent); border-radius: 2px; animation: laden 1.1s ease-in-out infinite; }
@keyframes laden { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* ── Verlauf ──────────────────────────────────────────────────────────── */
.verlauf-eintrag { padding: 10px 12px; }
.verlauf-eintrag + .verlauf-eintrag { border-top: 1px solid var(--linie); }
.verlauf-eintrag .wann { font-size: 12px; color: var(--leise); }
.verlauf-eintrag .diff { font-size: 13px; color: var(--leise); margin-top: 2px; }
.verlauf-eintrag .diff s { color: var(--minus); }

/* ── Meldung unten ────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 40;
  background: var(--text); color: var(--bg); border-radius: 999px; padding: 10px 16px;
  display: flex; gap: 14px; align-items: center; font-size: 14px; box-shadow: var(--schatten-hoch);
  max-width: calc(100% - 32px);
}
.toast button { border: 0; background: none; color: var(--akzent-hell); font-weight: 700; padding: 0; }

/* ── Startseite ohne Link ─────────────────────────────────────────────── */
.willkommen { text-align: center; padding: 18vh 24px 0; }
.willkommen .logo { width: 72px; height: 72px; margin: 0 auto 18px; }
.willkommen h1 { font-size: 24px; margin: 0 0 8px; }
.willkommen p { color: var(--leise); max-width: 340px; margin: 0 auto; }
