/* CashTinu — mobile-first */
:root {
  --akzent: #166534;
  --akzent-hell: #dcfce7;
  --rot: #b91c1c;
  --rot-hell: #fee2e2;
  --gelb-hell: #fef9c3;
  --rand: #d4d4d8;
  --grau: #71717a;
  --hintergrund: #fafaf9;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--hintergrund);
  color: #18181b;
  font-size: 16px;
}
main { max-width: 640px; margin: 0 auto; padding: 0.75rem 0.75rem 4rem; }
h1 { font-size: 1.25rem; margin: 0; color: var(--akzent); }
h1 a { color: inherit; text-decoration: none; }
h2 { font-size: 1rem; margin: 0 0 0.6rem; }
code { background: #f4f4f5; padding: 0.1rem 0.3rem; border-radius: 4px; word-break: break-all; }

.kopf {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 0.5rem; padding: 0.5rem 0 0.75rem; flex-wrap: wrap;
}
.kunde { color: var(--grau); font-size: 0.9rem; }

/* Salden */
.saldi { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.saldo-karte {
  flex: 1 1 8rem; background: #fff; border: 1px solid var(--rand);
  border-radius: 10px; padding: 0.5rem 0.75rem;
  display: flex; flex-direction: column;
}
.saldo-name { font-size: 0.8rem; color: var(--grau); }
.saldo-wert { font-size: 1.15rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.saldo-karte.negativ .saldo-wert { color: var(--rot); }

/* Banner */
.banner { border-radius: 8px; padding: 0.6rem 0.75rem; margin-bottom: 0.75rem; font-size: 0.9rem; }
.banner.ok { background: var(--akzent-hell); }
.banner.warnung { background: var(--gelb-hell); }
.banner.fehler { background: var(--rot-hell); }
.banner ul { margin: 0; padding-left: 1.1rem; }

/* Maske */
.maske {
  background: #fff; border: 1px solid var(--rand); border-radius: 12px;
  padding: 0.9rem; margin-bottom: 1rem;
}
.maske.schmal { max-width: 22rem; margin: 2rem auto; }
.abbrechen { font-size: 0.8rem; font-weight: 400; margin-left: 0.5rem; }
.segmente { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; }
.segment { flex: 1; }
.segment input { position: absolute; opacity: 0; }
.segment span {
  display: block; text-align: center; padding: 0.55rem 0.25rem;
  border: 1px solid var(--rand); border-radius: 8px; cursor: pointer;
  font-size: 0.95rem; background: #fff;
}
.segment input:checked + span { border-color: var(--akzent); background: var(--akzent-hell); font-weight: 600; }
.segment input:focus-visible + span { outline: 2px solid var(--akzent); }

.feld { display: block; margin-bottom: 0.7rem; }
.feld > span { display: block; font-size: 0.8rem; color: var(--grau); margin-bottom: 0.2rem; }
.feld input, .feld select {
  width: 100%; padding: 0.6rem; font-size: 1.05rem;
  border: 1px solid var(--rand); border-radius: 8px; background: #fff;
}
.feld.klein { display: inline-block; }
.feld.klein input { width: auto; }
.feld input:focus, .feld select:focus { outline: 2px solid var(--akzent); border-color: var(--akzent); }

.beleg-zeile { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.beleg-knopf {
  border: 1px dashed var(--rand); border-radius: 8px; padding: 0.5rem 0.8rem;
  cursor: pointer; background: #fff; font-size: 0.95rem;
}
.beleg-info { font-size: 0.85rem; color: var(--akzent); }
.beleg-bestand { margin-bottom: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.beleg-chip {
  background: #f4f4f5; border-radius: 6px; padding: 0.25rem 0.5rem; font-size: 0.85rem;
}
.beleg-chip button { border: none; background: none; cursor: pointer; color: var(--rot); }

button.speichern {
  width: 100%; padding: 0.75rem; font-size: 1.1rem; font-weight: 600;
  color: #fff; background: var(--akzent); border: none; border-radius: 10px; cursor: pointer;
}
button.speichern.klein { width: auto; padding: 0.5rem 1rem; font-size: 0.95rem; }
button.leise {
  border: 1px solid var(--rand); background: #fff; border-radius: 6px;
  padding: 0.3rem 0.6rem; font-size: 0.85rem; cursor: pointer; color: var(--grau);
}
button.leise.gefahr { color: var(--rot); border-color: var(--rot); }

/* Buchungsliste */
.liste-kopf { display: flex; justify-content: space-between; align-items: center; }
.zeile {
  display: flex; justify-content: space-between; gap: 0.5rem;
  background: #fff; border: 1px solid var(--rand); border-radius: 10px;
  padding: 0.55rem 0.7rem; margin-bottom: 0.45rem;
  text-decoration: none; color: inherit;
}
.zeile.klickbar:hover { border-color: var(--akzent); }
.zeile-links { display: flex; flex-direction: column; min-width: 0; }
.zeile-datum { font-size: 0.75rem; color: var(--grau); }
.zeile-text { font-weight: 600; overflow-wrap: anywhere; }
.zeile-detail { font-size: 0.8rem; color: var(--grau); }
.zeile-detail a { text-decoration: none; }
.zeile-rechts { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; flex-shrink: 0; }
.zeile-betrag { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.zeile-betrag.einnahme { color: var(--akzent); }
.zeile-betrag.ausgabe { color: var(--rot); }
.zeile-aktionen { display: flex; gap: 0.4rem; align-items: center; }
.zeile-aktionen a { text-decoration: none; }
.zeile-aktionen form { display: inline; }
.zeile-aktionen button { border: none; background: none; cursor: pointer; font-size: 1rem; padding: 0; }
.zeile-status { font-size: 0.75rem; color: var(--akzent); white-space: nowrap; }

/* Admin */
.inline-form { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.inline { display: inline; }
.hinweis-klein { font-size: 0.8rem; color: var(--grau); }
.hinweis-seite { text-align: center; color: var(--grau); margin: 1.5rem 0; }
.tabelle { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 0.5rem; }
.tabelle th, .tabelle td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--rand); }
.tabelle tr.storniert { color: var(--grau); text-decoration: line-through; }
.tabelle tr.storniert td:last-child { text-decoration: none; }

@media (min-width: 480px) {
  main { padding: 1rem 1rem 4rem; }
  h1 { font-size: 1.4rem; }
}
