/* Taschengeld - Oberflaeche.
   Grundsaetze: grosse Flächen zum Antippen, wenig Text, klare Farben.
   Auf dem Handy eine Spalte, ab Tablet zwei Spalten (Katalog links, Liste rechts). */

:root {
  --blau: #2f6df6;
  --blau-hell: #e8efff;
  --gruen: #17a34a;
  --gruen-hell: #e6f7ec;
  --rot: #e0453a;
  --rot-hell: #fdeceb;
  --orange: #f59e0b;
  --orange-hell: #fef4e3;
  --grau-1: #f5f6f8;
  --grau-2: #e7e9ee;
  --grau-3: #9aa1ad;
  --text: #1c2430;
  --nacht: #1c2430;
  --braun: #a86400;
  --text-leise: #5b6472;
  --karte: #ffffff;
  --rand: #e3e6ec;
  --schatten: 0 1px 2px rgba(20, 26, 38, .06), 0 6px 18px rgba(20, 26, 38, .06);
  --radius: 16px;
  --radius-klein: 12px;
  --tap: 48px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* WICHTIG: Das HTML-Attribut "hidden" muss IMMER gewinnen.
   Ohne diese Regel ueberstimmt ein "display: flex" aus dem Stylesheet das
   hidden-Attribut (die Browser-Regel [hidden] { display: none } ist schwaecher
   als jede Autoren-Regel). Folge am 06.10.2026: die halbtransparente
   Dialog-Huelle lag von Anfang an ueber der ganzen Seite - nichts liess sich
   mehr antippen oder eintippen, die Seite wirkte nur "grau". */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--grau-1);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

.huelle {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

/* ------------------------------------------------------------------ Kopf */
.kopf {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background: var(--karte);
  border-bottom: 1px solid var(--rand);
}
.kopf-marke { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; text-align: left; }
.marke-symbol { font-size: 26px; line-height: 1; }
.marke-text { display: flex; flex-direction: column; min-width: 0; }
.marke-text b { font-size: 18px; }
.marke-text small { color: var(--text-leise); font-size: 12px; }
.kopf-knopf {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--grau-1); color: var(--text-leise); font-size: 20px;
}
.kopf-knopf:active { background: var(--grau-2); }

/* ------------------------------------------------------------------ Inhalt */
.ansicht { flex: 1; padding: 14px 14px 120px; }
.lade, .leer { color: var(--text-leise); text-align: center; padding: 40px 10px; }

.abschnitt { margin-bottom: 20px; }
.abschnitt-titel {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin: 4px 4px 10px;
}
.abschnitt-titel h2 { font-size: 15px; margin: 0; letter-spacing: .2px; }
.abschnitt-titel small { color: var(--text-leise); font-size: 12px; }

/* ------------------------------------------------------------------ Karten */
.karte {
  background: var(--karte); border: 1px solid var(--rand);
  border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 14px; margin-bottom: 12px;
}
.kinder-liste { display: grid; grid-template-columns: 1fr; gap: 12px; }

.kind-karte {
  position: relative; overflow: hidden; padding: 0;
}
.kind-karte::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 6px;
  background: var(--kind-farbe, var(--blau));
}
.kind-inhalt { padding: 14px 14px 14px 20px; }
.kind-oben { display: flex; align-items: center; gap: 10px; }
.kind-name { font-size: 19px; font-weight: 650; display: flex; align-items: center; gap: 8px; min-width: 0; }
.kind-name .emoji { font-size: 22px; }
.kind-stand { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; }
.kind-stand b { font-size: 21px; }
.kind-stand small { display: block; color: var(--text-leise); font-size: 11px; }
.stand-plus b { color: var(--gruen); }
.stand-minus b { color: var(--rot); }

.kind-zahlen { display: flex; gap: 16px; margin-top: 8px; color: var(--text-leise); font-size: 12.5px; flex-wrap: wrap; }
.kind-zahlen b { color: var(--text); font-variant-numeric: tabular-nums; }

.kind-knoepfe { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ Knoepfe */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 16px; border-radius: var(--radius-klein);
  background: var(--grau-1); color: var(--text); font-weight: 600; font-size: 15px;
  border: 1px solid transparent;
}
.knopf:active { transform: translateY(1px); }
.knopf-blau { background: var(--blau); color: #fff; }
.knopf-blau-hell { background: var(--blau-hell); color: var(--blau); }
.knopf-gruen { background: var(--gruen); color: #fff; }
.knopf-gruen-hell { background: var(--gruen-hell); color: var(--gruen); }
.knopf-rot { background: var(--rot); color: #fff; }
.knopf-rot-hell { background: var(--rot-hell); color: var(--rot); }
.knopf-orange-hell { background: var(--orange-hell); color: var(--braun); }
.knopf-gross { min-height: 56px; font-size: 16px; padding: 0 20px; }
.knopf-klein { min-height: 38px; font-size: 13.5px; padding: 0 12px; }
.knopf[disabled] { opacity: .5; pointer-events: none; }
.knopf-breit { width: 100%; }

/* ------------------------------------------------------------------ Katalog-Kacheln */
/* Drei je Reihe (Wunsch des Auftraggebers 06.10.2026): "keine Liste, sondern
   Knoepfe - am liebsten drei in einer Reihe, und moeglichst ohne Scrollen." */
.kacheln { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kachel {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 78px; padding: 8px 4px; text-align: center;
  background: var(--karte); border: 1px solid var(--rand);
  border-radius: var(--radius-klein); box-shadow: var(--schatten);
}
.kachel:active { background: var(--blau-hell); border-color: var(--blau); }
.kachel .symbol { font-size: 26px; line-height: 1.1; }
.kachel .bez { font-size: 13px; font-weight: 650; line-height: 1.15; word-break: break-word; }
.kachel .preis { font-size: 13px; color: var(--blau); font-variant-numeric: tabular-nums; font-weight: 650; }
.kachel-frei { border-style: dashed; border-color: var(--blau); background: var(--blau-hell); }
.kachel-gruen { border-color: var(--gruen); background: var(--gruen-hell); }
.kachel-rot { border-color: var(--rot); background: var(--rot-hell); }
.kachel-neu { border-style: dashed; color: var(--text-leise); }

/* Kleinere Kacheln: vier nebeneinander, wenig Text - spart Platz.
   Wunsch des Auftraggebers (06.10.2026): "唔需要太大…一行四個，
   唔好寫咁多嘢晒位". */
.kacheln-4 { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.kachel-klein { min-height: 58px; padding: 6px 3px; gap: 1px; box-shadow: none; }
.kachel-klein .symbol { font-size: 20px; }
.kachel-klein .bez { font-size: 11px; font-weight: 600; line-height: 1.1; }

/* Kopfzeile der Kind-Ansicht: nur der Name, rechts zwei kleine Knoepfe.
   Wunsch: "Alle Kinder weg, den Namen nach oben" - kein zusaetzlicher Text. */
.kind-kopf {
  display: flex; align-items: center; gap: 8px; margin: 0 0 10px;
}
.kind-name {
  flex: 1; min-width: 0; margin: 0; font-size: 22px; font-weight: 750;
  letter-spacing: .2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.karte-kompakt { padding: 8px; }

/* ------------------------------------------------------------------ Buchungsliste */
.zeile {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--grau-2);
}
.zeile:last-child { border-bottom: none; }
.zeile-symbol {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grau-1); font-size: 19px;
}
.zeile-mitte { flex: 1; min-width: 0; }
.zeile-titel { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zeile-neben { color: var(--text-leise); font-size: 12.5px; display: flex; gap: 8px; flex-wrap: wrap; }
.zeile-betrag { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 16px; white-space: nowrap; }
.betrag-minus { color: var(--rot); }
.betrag-plus { color: var(--gruen); }
.zeile-geloescht { opacity: .55; }
.zeile-geloescht .zeile-titel { text-decoration: line-through; }

.zeit-gruppe { margin: 16px 2px 6px; color: var(--text-leise); font-size: 12.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .4px; }

/* ------------------------------------------------------------------ Formular */
.feld { margin-bottom: 12px; }
.feld > label { display: block; font-size: 13px; color: var(--text-leise); margin-bottom: 5px; }
.eingabe {
  width: 100%; min-height: var(--tap); padding: 10px 12px;
  background: var(--grau-1); border: 1px solid var(--rand);
  border-radius: var(--radius-klein); outline: none;
}
.eingabe:focus { border-color: var(--blau); background: #fff; }
.reihe { display: flex; gap: 10px; }
.reihe > * { flex: 1; min-width: 0; }
.schalter-reihe { display: flex; gap: 8px; flex-wrap: wrap; }
.wahl {
  min-height: 42px; padding: 0 14px; border-radius: 999px;
  background: var(--grau-1); border: 1px solid var(--rand); font-size: 14px;
}
.wahl-aktiv { background: var(--blau); border-color: var(--blau); color: #fff; font-weight: 650; }

/* ------------------------------------------------------------------ Ziffernblock */
.ziffern { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.ziffer {
  min-height: 56px; border-radius: var(--radius-klein);
  background: var(--grau-1); font-size: 22px; font-weight: 600;
}
.ziffer:active { background: var(--blau-hell); }
.ziffer-ok { background: var(--gruen); color: #fff; font-size: 16px; }
.ziffer-rot { background: var(--rot-hell); color: var(--rot); font-size: 15px; }

.betrag-anzeige {
  display: flex; align-items: baseline; justify-content: flex-end; gap: 6px;
  padding: 12px 14px; margin-bottom: 10px; background: var(--grau-1);
  border-radius: var(--radius-klein); font-variant-numeric: tabular-nums;
}
.betrag-anzeige b { font-size: 34px; font-weight: 700; }
.betrag-anzeige span { font-size: 20px; color: var(--text-leise); }
.betrag-anzeige-plus { background: var(--gruen-hell); }
.betrag-anzeige-plus b { color: var(--gruen); }
.betrag-hinweis { text-align: right; font-size: 12.5px; color: var(--text-leise); margin: -6px 0 8px; }

/* ------------------------------------------------------------------ Foto */
.foto-zeile {
  display: flex; align-items: center; gap: 12px;
  padding: 8px; background: var(--grau-1); border-radius: var(--radius-klein);
}
.foto-vorschau {
  width: 64px; height: 64px; flex: none; object-fit: cover;
  border-radius: 10px; background: var(--grau-2);
}
.foto-text { flex: 1; min-width: 0; }
.foto-text b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foto-text small { color: var(--text-leise); font-size: 12px; }

/* Kleines Foto in der Buchungsliste */
.zeile-foto {
  width: 40px; height: 40px; flex: none; object-fit: cover;
  border-radius: 10px; background: var(--grau-2);
}

/* Grosses Bild im Dialog */
.bild-gross {
  width: 100%; max-height: 65vh; object-fit: contain;
  border-radius: var(--radius-klein); background: var(--grau-1);
}

/* ------------------------------------------------------------------ Buchungs-Blatt (Kasse) */
/* Bewusst einfach: eine Textzeile, ein paar Betrag-Knoepfe, Ziffernblock.
   Kein Textfeld fuer Betrag oder Datum - damit geht nie ungefragt die
   Bildschirmtastatur auf und verdeckt die Haelfte. */
.blatt-kopf { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.blatt-kopf h3 { margin: 0; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Der grosse Betrag: die wichtigste Anzeige im Dialog. */
.betrag-gross {
  display: flex; align-items: baseline; justify-content: flex-end; gap: 6px;
  padding: 10px 16px; margin-bottom: 10px;
  background: var(--grau-1); border-radius: var(--radius-klein);
  font-variant-numeric: tabular-nums;
}
.betrag-gross b { font-size: 40px; font-weight: 800; letter-spacing: -.5px; }
.betrag-gross span { font-size: 22px; color: var(--text-leise); }
.betrag-gross-plus { background: var(--gruen-hell); }
.betrag-gross-plus b { color: var(--gruen); }

/* Grosse Ziffern: mit dem Finger sicher zu treffen, ohne Hinsehen. */
.blatt .ziffern { gap: 8px; }
.blatt .ziffer { min-height: 58px; font-size: 24px; font-weight: 700; }
.blatt .ziffer-rot { font-size: 18px; }

/* Die vier Schnellknoepfe unter der Textzeile: je zwei in einer Reihe,
   damit die Beschriftung gross und lesbar bleibt. */
.schnellknopf { flex: 1 1 calc(50% - 4px); min-width: 0; justify-content: flex-start; font-weight: 650; }

/* Einrichten der vier Schnellknoepfe */
.schnell-zeile { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.schnell-zeile .eingabe { flex: 1; min-width: 0; }
.schnell-zeile .knopf { flex: none; min-width: 86px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ Eigene Tastatur */
/* Grosse Tasten, 7 je Reihe: Zahlen und Buchstaben, gross und klein.
   Wird statt der Geraetetastatur benutzt. */
.tat { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.tat-reihe { display: flex; gap: 6px; justify-content: center; }
.tat-taste {
  flex: 1 1 0; min-width: 0; min-height: 50px;
  background: var(--grau-1); border: 1px solid var(--rand);
  border-radius: 10px; font-size: 20px; font-weight: 650;
  display: flex; align-items: center; justify-content: center;
}
.tat-taste:active { background: var(--blau-hell); border-color: var(--blau); }
.tat-klein { font-size: 17px; min-height: 44px; }
.tat-breit { font-size: 14px; font-weight: 600; min-height: 46px; }
.tat-aktiv { background: var(--blau); border-color: var(--blau); color: #fff; }
.tat-gruen { background: var(--gruen); border-color: var(--gruen); color: #fff; font-size: 15px; }
.tat-rot { background: var(--rot-hell); border-color: var(--rot-hell); color: var(--rot); font-size: 14px; }

/* Die Textzeile selbst: kein echtes Eingabefeld, damit die Geraetetastatur
   nie aufgeht. Der Text wird von der eigenen Tastatur gefuellt. */
.textzeile {
  display: flex; align-items: center; gap: 8px;
  min-height: var(--tap); padding: 10px 12px;
  background: var(--grau-1); border: 1px solid var(--rand);
  border-radius: var(--radius-klein);
}

/* ------------------------------------------------------------------ Nur-Betrag-Blatt */
/* Die kuerzeste Ansicht: eine grosse Zahl, ein grosser Ziffernblock, Abziehen. */
.betrag-blatt-kopf {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.betrag-blatt-kopf b { flex: 1; font-size: 20px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.betrag-blatt-symbol { font-size: 26px; line-height: 1; }
.betrag-blatt .betrag-gross b { font-size: 46px; }
.betrag-blatt .ziffer { min-height: 64px; font-size: 26px; }
.textzeile-aktiv { border-color: var(--blau); background: #fff; }
.textzeile-text { flex: 1; min-width: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.textzeile-leer { color: var(--text-leise); }
.textzeile-cursor { display: inline-block; width: 2px; height: 18px; background: var(--blau); animation: blinken 1s steps(1) infinite; }
@keyframes blinken { 50% { opacity: 0; } }

/* ------------------------------------------------------------------ Dialog */
.dialog-huelle {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(16, 21, 30, .45);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
.dialog {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--karte); border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(env(safe-area-inset-bottom) + 16px);
  box-shadow: 0 -8px 40px rgba(16, 21, 30, .25);
  animation: hoch .18s ease-out;
}
@keyframes hoch { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.dialog-kopf { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.dialog-kopf h3 { margin: 0; font-size: 18px; flex: 1; }
.dialog-x { width: 40px; height: 40px; border-radius: 50%; background: var(--grau-1); font-size: 18px; color: var(--text-leise); }
.dialog-fuss { display: flex; gap: 10px; margin-top: 16px; }
.dialog-fuss .knopf { flex: 1; }
.dialog-text { color: var(--text-leise); font-size: 14.5px; }

/* ------------------------------------------------------------------ Fussnavigation */
.fuss {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; max-width: 1180px; margin: 0 auto;
  background: var(--karte); border-top: 1px solid var(--rand);
  padding-bottom: env(safe-area-inset-bottom);
}
.fuss button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px 10px; font-size: 11.5px; color: var(--text-leise);
}
.fuss button span { font-size: 20px; line-height: 1.1; }
.fuss button.aktiv { color: var(--blau); font-weight: 700; }

/* ------------------------------------------------------------------ Hinweis / Toast */
.hinweis {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(16, 21, 30, .5);
}
.hinweis-karte { background: #fff; border-radius: var(--radius); padding: 18px; max-width: 420px; width: 100%; }
.hinweis-karte h3 { margin: 0 0 8px; font-size: 17px; }
.hinweis-karte p { margin: 0 0 14px; color: var(--text-leise); font-size: 14.5px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 74px); z-index: 80;
  background: var(--nacht); color: #fff; padding: 11px 16px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(16, 21, 30, .3); max-width: 90vw;
}
.toast-gut { background: var(--gruen); }
.toast-schlecht { background: var(--rot); }

/* ------------------------------------------------------------------ Statistik-Tabelle */
.tabelle { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tabelle th, .tabelle td { padding: 9px 6px; text-align: right; border-bottom: 1px solid var(--grau-2); font-size: 14px; }
.tabelle th:first-child, .tabelle td:first-child { text-align: left; }
.tabelle thead th { color: var(--text-leise); font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .3px; }
.tabelle tr.jahres-summe td { font-weight: 700; background: var(--grau-1); }
.tabelle tr.ansprechbar:active { background: var(--blau-hell); }

/* ------------------------------------------------------------------ Anmeldung */
.anmeldung { max-width: 420px; margin: 8vh auto 0; }
.anmeldung-pin {
  text-align: center; letter-spacing: 10px; font-size: 26px;
  font-variant-numeric: tabular-nums; padding-left: 16px;
}

/* ------------------------------------------------------------------ Breite Bildschirme */
@media (min-width: 860px) {
  .ansicht { padding: 20px 20px 100px; }
  .kinder-liste { grid-template-columns: 1fr 1fr; }
  .kind-detail { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.1fr); gap: 20px; align-items: start; }
  .dialog-huelle { align-items: center; padding: 20px; }
  .dialog { border-radius: 20px; max-height: 86vh; }
}
