/* Haushaltsbuch: ruhig, warm, gross lesbar. Papier statt Neonweiss, Serifen fuer Zahlen und Ueberschriften. */
:root {
  --papier: #f4eee2;
  --karte: #fffbf3;
  --tinte: #1e2a24;
  --grau: #5f6a63;
  --linie: #e0d5bf;
  --gruen: #2f5d46;
  --gruen-dunkel: #234635;
  --gruen-hell: #e3ece2;
  --terra: #b14a26;
  --terra-hell: #f6e1d6;
  --senf: #b8862a;
  --senf-hell: #f5ead0;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 76px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--papier); color: var(--tinte);
  font: 19px/1.45 var(--sans);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}
#app { max-width: 560px; margin: 0 auto; padding: 18px 16px 8px; }
.laden { padding: 40vh 0; text-align: center; color: var(--grau); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 30px; line-height: 1.15; }
h2 { font-size: 23px; }
h3 { font-size: 19px; }
.marke {
  font: 600 13px/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--grau);
}
.zahl { font-family: var(--serif); font-variant-numeric: tabular-nums lining-nums; }
.leise { color: var(--grau); }
.klein { font-size: 16px; }
.plus { color: var(--gruen); }
.minus { color: var(--tinte); }
.rot { color: var(--terra); }

/* Kopf der Startseite: grosse Zahl auf Ampel-Flaeche */
.lage {
  position: relative; margin: 6px -16px 18px; padding: 22px 20px 20px;
  background: var(--gruen); color: #fbf7ee; overflow: hidden;
}
.lage::after { /* feine diagonale Kante unten rechts */
  content: ""; position: absolute; right: -40px; bottom: -40px; width: 140px; height: 140px;
  background: rgba(255,255,255,0.06); transform: rotate(45deg);
}
.lage.gelb { background: #7a5a17; }
.lage.rot { background: var(--terra); }
.lage .marke { color: rgba(251,247,238,0.8); }
.lage .gross { font: 600 60px/1.05 var(--serif); margin: 8px 0 6px; font-variant-numeric: tabular-nums; }
.lage .satz { font-size: 19px; }
.lage .satz b { font-weight: 700; }
.lage-zahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(251,247,238,0.25); }
.lage-zahlen div { font-size: 14px; color: rgba(251,247,238,0.85); }
.lage-zahlen b { display: block; font: 600 19px/1.2 var(--serif); color: #fbf7ee; }

.karte {
  background: var(--karte); border: 1px solid var(--linie); border-radius: 6px;
  padding: 16px; margin: 0 0 16px;
}
.karte > h2, .karte > .kopf { margin-bottom: 10px; }
.kopf { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }

/* Listen */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--linie);
}
.liste li:first-child { border-top: 0; }
.liste li.klickbar { cursor: pointer; }
.datum-chip {
  min-width: 58px; text-align: center; padding: 5px 6px; border-radius: 4px;
  background: var(--gruen-hell); color: var(--gruen-dunkel); font: 600 15px/1.15 var(--sans);
}
.datum-chip small { display: block; font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.datum-chip.aus { background: var(--terra-hell); color: #7c321a; }
.betrag { font: 600 20px/1.2 var(--serif); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.etikett { display: inline-block; font-size: 13px; padding: 1px 7px; border-radius: 3px; background: var(--senf-hell); color: #6d4f12; margin-left: 6px; vertical-align: 2px; }
.symbol { font-size: 26px; width: 40px; text-align: center; }

/* Balken */
.balken { height: 12px; background: var(--gruen-hell); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.balken i { display: block; height: 100%; background: var(--gruen); }
.balken.ueber i { background: var(--terra); }

/* Knoepfe: kantig, klare Hierarchie */
button, .knopf {
  font: inherit; color: inherit; cursor: pointer; border: 0; background: none;
  -webkit-tap-highlight-color: transparent;
}
.knopf {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 60px; padding: 14px 18px; border-radius: 6px; font-weight: 650; font-size: 20px;
  background: var(--gruen); color: #fbf7ee; text-decoration: none;
}
.knopf:active { background: var(--gruen-dunkel); }
.knopf.zweit { background: transparent; color: var(--gruen); border: 2px solid var(--gruen); }
.knopf.warn { background: transparent; color: var(--terra); border: 2px solid var(--terra); }
.knopf[disabled] { opacity: 0.5; }
.knopf .dreieck { width: 0; height: 0; border-left: 10px solid currentColor; border-top: 7px solid transparent; border-bottom: 7px solid transparent; }
.textlink { color: var(--gruen); text-decoration: underline; text-underline-offset: 3px; padding: 10px 0; font-weight: 600; }
.reihe { display: flex; gap: 10px; }
.reihe > * { flex: 1; }
.stapel > * + * { margin-top: 10px; }

/* Formulare */
label.feld { display: block; margin: 0 0 14px; }
label.feld > span { display: block; font-weight: 600; margin-bottom: 6px; }
input, select {
  font: inherit; color: var(--tinte); width: 100%; min-height: 54px; padding: 10px 12px;
  background: #fff; border: 2px solid var(--linie); border-radius: 6px;
}
input:focus, select:focus { outline: none; border-color: var(--gruen); }
.betrag-eingabe { position: relative; }
.betrag-eingabe input { font: 600 44px/1 var(--serif); text-align: right; padding-right: 54px; min-height: 84px; }
.betrag-eingabe::after { content: "€"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font: 600 34px var(--serif); color: var(--grau); }

/* Kategorie-Kacheln */
.kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.kachel {
  display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 10px 12px; text-align: left;
  background: var(--karte); border: 2px solid var(--linie); border-radius: 6px; font-size: 17px; font-weight: 600;
}
.kachel .symbol { font-size: 26px; width: 32px; }
.kachel.an { border-color: var(--gruen); background: var(--gruen-hell); box-shadow: inset 4px 0 0 var(--gruen); }

.tage { display: flex; gap: 8px; margin-bottom: 14px; }
.tage button { flex: 1; min-height: 50px; border: 2px solid var(--linie); border-radius: 6px; background: var(--karte); font-weight: 600; }
.tage button.an { border-color: var(--gruen); background: var(--gruen-hell); }

/* PIN-Tastatur */
.pin-punkte { display: flex; justify-content: center; gap: 14px; margin: 18px 0 22px; min-height: 22px; }
.pin-punkte i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--gruen); }
.pin-punkte i.voll { background: var(--gruen); }
.tastatur { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 340px; margin: 0 auto; }
.tastatur button { min-height: 70px; font: 600 30px var(--serif); background: var(--karte); border: 2px solid var(--linie); border-radius: 6px; }
.tastatur button:active { background: var(--gruen-hell); }
.tastatur .leer { visibility: hidden; }

.wer-wahl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.wer-wahl button { min-height: 90px; border: 2px solid var(--linie); border-radius: 6px; background: var(--karte); font: 600 22px var(--serif); }
.wer-wahl button.an { border-color: var(--gruen); background: var(--gruen-hell); }

/* Einrichtungs-Assistent */
.schritte { display: flex; gap: 6px; margin: 4px 0 18px; }
.schritte i { flex: 1; height: 5px; background: var(--linie); border-radius: 2px; }
.schritte i.an { background: var(--gruen); }
.posten-zeile { padding: 12px 0; border-top: 1px solid var(--linie); }
.posten-zeile:first-child { border-top: 0; }
.posten-zeile .name { font-weight: 650; margin-bottom: 6px; }
.posten-zeile .felder { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 8px; }
.posten-zeile .felder2 { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }
.posten-zeile .felder2 span:empty { display: none; }
.posten-zeile input.betrag-feld { font: 600 22px var(--serif); text-align: right; }
.posten-zeile input.name-feld { margin-bottom: 8px; }

/* Vorschau-Diagramm */
.vorschau { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; align-items: end; height: 150px; padding-top: 6px; position: relative; }
.vorschau .nulllinie { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--grau); }
.vorschau div { position: relative; height: 100%; }
.vorschau div b { position: absolute; left: 0; right: 0; background: var(--gruen); border-radius: 2px 2px 0 0; }
.vorschau div b.neg { background: var(--terra); border-radius: 0 0 2px 2px; }
.vorschau-monate { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; font-size: 12px; text-align: center; color: var(--grau); margin-top: 6px; }

/* Jahrestabelle */
.tabelle-huelle { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { border-collapse: collapse; font-size: 16px; font-variant-numeric: tabular-nums; width: 100%; }
th, td { padding: 9px 8px; text-align: right; border-bottom: 1px solid var(--linie); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { font: 600 13px var(--sans); text-transform: uppercase; letter-spacing: 0.08em; color: var(--grau); }
tr.summe td { font-weight: 700; border-top: 2px solid var(--tinte); }

/* Unten fest: Navigation */
#nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--karte); border-top: 1px solid var(--linie);
  padding-bottom: env(safe-area-inset-bottom);
}
#nav[hidden] { display: none; }
#nav button { min-height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 14px; font-weight: 600; color: var(--grau); }
#nav .ni { font-size: 26px; line-height: 1; }
#nav button.an { color: var(--gruen); box-shadow: inset 0 3px 0 var(--gruen); }
#nav .nav-plus .ni { background: var(--gruen); color: #fbf7ee; width: 40px; height: 32px; border-radius: 6px; display: grid; place-items: center; font-size: 24px; }

/* Rueckmeldung */
#hinweis {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px); z-index: 20;
  max-width: 528px; margin: 0 auto; padding: 16px 18px; border-radius: 6px;
  background: var(--tinte); color: #fbf7ee; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}
#hinweis.fehler { background: var(--terra); }

/* Blatt (Bearbeiten) */
.blatt-grund { position: fixed; inset: 0; background: rgba(30,42,36,0.45); z-index: 30; display: flex; align-items: flex-end; }
.blatt {
  width: 100%; max-width: 560px; margin: 0 auto; max-height: 92vh; overflow-y: auto;
  background: var(--papier); border-radius: 10px 10px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}
.blatt h2 { margin-bottom: 14px; }
.beleg-bild { width: 100%; max-height: 50vh; object-fit: contain; background: #fff; border: 1px solid var(--linie); border-radius: 6px; }
.beleg-mini { width: 100%; max-height: 160px; object-fit: cover; object-position: top; border-radius: 6px; border: 1px solid var(--linie); margin-bottom: 12px; }
.infokasten { background: var(--senf-hell); border-left: 4px solid var(--senf); padding: 12px 14px; border-radius: 4px; margin-bottom: 14px; font-size: 17px; }
.infokasten.gut { background: var(--gruen-hell); border-color: var(--gruen); }
.leerzustand { text-align: center; padding: 16px 6px; color: var(--grau); }
.abstand { height: 10px; }
@media (min-width: 600px) { .lage { margin-left: 0; margin-right: 0; border-radius: 6px; } }

/* Beispiel-Modus: Band oben, Rundgang-Karte unten, Hervorhebung */
#demo-band {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: var(--senf-hell); border-bottom: 2px solid var(--senf); font-size: 16px; font-weight: 600;
}
#demo-band span { flex: 1; }
#demo-band button { color: var(--gruen); text-decoration: underline; text-underline-offset: 3px; font-weight: 700; padding: 6px 4px; }
body.mit-tour { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 330px); }
body.mit-tour #hinweis { bottom: auto; top: 58px; }
#tour {
  position: fixed; left: 10px; right: 10px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); z-index: 18;
  max-width: 540px; margin: 0 auto; padding: 14px 18px 16px; border-radius: 10px;
  background: var(--tinte); color: #fbf7ee; box-shadow: 0 10px 30px rgba(0,0,0,0.28); font-size: 17px; line-height: 1.4;
}
#tour h2 { font-size: 22px; margin: 2px 0 6px; color: #fbf7ee; }
#tour p { margin: 0 0 12px; }
#tour .kopf { display: flex; justify-content: space-between; align-items: center; }
#tour .tour-zaehler { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--senf-hell); font-weight: 700; }
#tour .kopf button { color: #fbf7ee; font-size: 22px; padding: 4px 8px; }
#tour .knopf.zweit { color: #fbf7ee; border-color: #fbf7ee; }
#tour .knopf.hell { background: var(--senf-hell); color: var(--tinte); margin-bottom: 10px; }
#tour .textlink { color: var(--senf-hell); }
#tour .reihe { display: flex; gap: 10px; }
#tour .reihe .knopf { flex: 1; }
.tour-ziel { outline: 4px solid var(--senf); outline-offset: 4px; border-radius: 6px; scroll-margin-top: 70px; animation: tour-puls 1.8s ease-in-out infinite; }
@keyframes tour-puls { 50% { outline-color: rgba(184,134,42,0.35); } }
