/*
  Haushaltsbuch. Ruhig, eine Spalte auf dem Handy, Leiste unten am Daumen.
  Farbe traegt Bedeutung: Einnahmen gruen, alles andere neutral. Ausgaben
  sind nicht rot -- Ausgeben ist kein Fehler, und eine rote Seite jeden
  Monat sagt nichts, was die Zahl nicht schon sagt.
  Die Schrift liegt lokal, wie im Trainingscoach.
*/

@font-face {
  font-family: "Manrope";
  src: url("/static/manrope-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --bg: oklch(0.975 0.004 250);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.955 0.006 250);
  --line: oklch(0.90 0.008 250);
  --ink: oklch(0.24 0.015 250);
  --muted: oklch(0.50 0.012 250);
  --faint: oklch(0.62 0.01 250);
  --accent: oklch(0.52 0.13 255);
  --accent-bg: oklch(0.94 0.035 255);
  --plus: oklch(0.50 0.12 155);
  --hinweis: oklch(0.58 0.12 75);
  --hinweis-bg: oklch(0.95 0.05 85);
  --bar: oklch(0.70 0.08 255);
  --bar-vergleich: oklch(0.45 0.02 250);
  --r: 16px;
  --pad: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.17 0.012 255);
    --surface: oklch(0.215 0.014 255);
    --surface-2: oklch(0.25 0.016 255);
    --line: oklch(0.30 0.016 255);
    --ink: oklch(0.95 0.005 255);
    --muted: oklch(0.72 0.01 255);
    --faint: oklch(0.60 0.01 255);
    --accent: oklch(0.76 0.11 255);
    --accent-bg: oklch(0.30 0.05 255);
    --plus: oklch(0.80 0.13 155);
    --hinweis: oklch(0.82 0.12 85);
    --hinweis-bg: oklch(0.30 0.05 85);
    --bar: oklch(0.62 0.09 255);
    --bar-vergleich: oklch(0.85 0.01 255);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 "Manrope", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 1.35rem; font-weight: 800; }
h2 { font-size: 1.02rem; font-weight: 750; }
h3 { font-size: .95rem; font-weight: 700; }
p { margin: 0; }
.zahl { font-variant-numeric: tabular-nums; white-space: nowrap; }
.plus { color: var(--plus); }
.muted { color: var(--muted); }
.klein { font-size: .82rem; }
.eyebrow { font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); }

/* ------------------------------------------------------------ Geruest */

.seite {
  max-width: 760px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 18px) var(--pad)
           calc(env(safe-area-inset-bottom) + 96px);
  display: grid; gap: 14px;
}
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kopf .wer { font-size: .78rem; color: var(--muted); }

.leiste {
  position: fixed; left: 50%; transform: translateX(-50%);
  width: min(760px, calc(100% - 2 * var(--pad)));
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  display: flex; gap: 4px; padding: 5px;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 20px; z-index: 20;
}
.leiste a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px; border-radius: 15px; position: relative;
  font-size: .68rem; font-weight: 700; color: var(--faint); text-decoration: none;
}
.leiste a.aktiv { background: var(--surface-2); color: var(--ink); }
.leiste svg { width: 20px; height: 20px; stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.leiste .zaehler {
  position: absolute; top: 3px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--surface); font-size: .66rem;
  line-height: 18px; text-align: center;
}

/* ------------------------------------------------------------ Bausteine */

.karte {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; display: grid; gap: 10px; min-width: 0;
}
.karte.ruhig { background: var(--surface-2); }
.hinweis { background: var(--hinweis-bg); color: var(--ink); border-radius: 12px;
  padding: 10px 14px; font-size: .9rem; }
.hinweis b { color: var(--hinweis); }

.monatsnav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.monatsnav .pfeil { font-size: 1.3rem; padding: 4px 12px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.monatsnav .pfeil.leer { visibility: hidden; }
.monatsnav .mitte { text-align: center; }

/* Die Bilanz oben: vier Zahlen, die zusammen die Veraenderung ergeben. */
.bilanz { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.bilanz .summe { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 4px;
  font-weight: 750; }

.zeilen { display: grid; gap: 0; }
.zeile {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px;
  padding: 9px 0; border-top: 1px solid var(--line); color: inherit;
}
.zeile:first-child { border-top: 0; }
a.zeile:hover { text-decoration: none; background: var(--surface-2); }
.zeile .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Darf umbrechen: abgeschnitten fehlte gerade das Datum am Ende. */
.zeile .neben { grid-column: 1 / -1; font-size: .78rem; color: var(--muted);
  overflow-wrap: anywhere; }

/* Balken: Anteil an der groessten Kategorie, Strich = sonst ueblich. */
.balken { grid-column: 1 / -1; position: relative; height: 6px; border-radius: 3px;
  background: var(--surface-2); }
.balken i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px;
  background: var(--bar); }
.balken b { position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--bar-vergleich); border-radius: 1px; }

.chip { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip.akzent { background: var(--accent-bg); color: var(--accent); }
.chip.hinweis { background: var(--hinweis-bg); color: var(--hinweis); padding: 2px 8px; }

/* ------------------------------------------------------------ Formulare */

button, .knopf {
  font: inherit; font-size: .88rem; font-weight: 700; cursor: pointer;
  padding: 9px 14px; border-radius: 12px; border: 1px solid transparent;
  background: var(--accent); color: var(--surface); display: inline-block;
}
button.leise, .knopf.leise { background: var(--surface-2); color: var(--ink);
  border-color: var(--line); }
button.klein { padding: 6px 10px; font-size: .8rem; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px;
  width: 100%; min-width: 0;
}
label { display: grid; gap: 4px; font-size: .85rem; color: var(--muted); }
label.haken { display: flex; align-items: center; gap: 8px; color: var(--ink); }
label.haken input { width: auto; }
.reihe { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.reihe > * { flex: 0 0 auto; }
.reihe > .wachsen { flex: 1 1 160px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line); padding: 6px 10px; font-size: .8rem; }
.chips button:hover { background: var(--accent-bg); }
/* Was bei diesem Haendler frueher gewaehlt wurde -- vorne und hervorgehoben. */
.chips button.bisher { background: var(--accent-bg); color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 35%, transparent); }
.chips button.bisher small { font-weight: 600; opacity: .75; margin-left: 2px; }

/* Kasten "Bitte zuordnen": eine Karte je Buchung */
.offen .kopfzeile { display: flex; justify-content: space-between; gap: 12px;
  align-items: baseline; }
.offen .wer { font-weight: 750; min-width: 0; overflow-wrap: anywhere; }
.offen .zweck { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
td, th { text-align: left; padding: 7px 6px; border-top: 1px solid var(--line);
  vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); border-top: 0; }
td.r, th.r { text-align: right; }
.tabelle { overflow-x: auto; }

dl.fakten { display: grid; grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 14px; margin: 0; font-size: .9rem; }
dl.fakten dt { color: var(--muted); }
dl.fakten dd { margin: 0; overflow-wrap: anywhere; }

/* Anmeldung */
.anmeldung { max-width: 420px; margin: 0 auto; padding: 48px var(--pad);
  display: grid; gap: 16px; }
.marke { display: flex; align-items: center; gap: 10px; font-weight: 800;
  font-size: 1.2rem; }
.marke svg { width: 28px; height: 28px; }

@media (min-width: 700px) {
  .zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
}
