/* Pippo – App-Oberfläche (mobile-first, hell/dunkel) */
:root {
  --text: #1d1d1f;
  --text-leise: #5f6368;
  --grund: #f5f5f7;
  --flaeche: #ffffff;
  --rand: #d2d2d7;
  --akzent: #2e7d32;
  --akzent-text: #ffffff;
  --akzent-hell: #e8f5e9;
  --fehler: #b3261e;
  --fehler-hell: #fdecea;
  --warnung: #8a5300;
  --warnung-hell: #fff4e0;
  --radius: 10px;
  --abstand: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --text: #f5f5f7;
    --text-leise: #a1a1a6;
    --grund: #111113;
    --flaeche: #1c1c1e;
    --rand: #3a3a3c;
    --akzent: #66bb6a;
    --akzent-text: #0b2a0d;
    --akzent-hell: #1e3320;
    --fehler: #f2b8b5;
    --fehler-hell: #3b1d1b;
    --warnung: #ffcc80;
    --warnung-hell: #3a2a12;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* sonst hebt z. B. button{display:inline-flex} hidden auf */
html, body { margin: 0; }
/* Fokussierte/angesprungene Elemente nicht unter der festen Navigation verstecken */
html { scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { html { scroll-padding-bottom: 0; } }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--grund);
  -webkit-text-size-adjust: 100%;
}
.huelle { min-height: 100vh; }
.inhalt {
  max-width: 820px;
  margin: 0 auto;
  padding: var(--abstand) var(--abstand) calc(96px + env(safe-area-inset-bottom));
  outline: none;
}
/* Links einheitlich, auch im Zustand „besucht“ (sonst Browser-Lila, dunkel kaum lesbar) */
a, a:visited { color: var(--akzent); }
a:hover { text-decoration: underline; }
.liste a.titel, .liste a.titel:visited { color: var(--text); text-decoration: none; }
.liste a.titel:hover { color: var(--akzent); text-decoration: underline; }
a.knopf, a.knopf:visited { color: var(--text); text-decoration: none; }
.navigation a:visited { color: var(--text-leise); }
.navigation a[aria-current="page"]:visited { color: var(--akzent); }
h1 { font-size: 1.5rem; margin: 8px 0 16px; }
h2 { font-size: 1.15rem; margin: 24px 0 8px; }
p { margin: 8px 0; }
.hinweis { color: var(--text-leise); }

/* Navigation: unten auf dem Handy, links am PC */
.navigation {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: var(--flaeche); border-top: 1px solid var(--rand);
  padding-bottom: env(safe-area-inset-bottom);
}
.navigation a {
  flex: 1; min-height: 56px; display: flex; align-items: center; justify-content: center;
  color: var(--text-leise); text-decoration: none; font-size: .8rem; font-weight: 600; text-align: center;
}
.navigation a[aria-current="page"] { color: var(--akzent); box-shadow: inset 0 3px 0 var(--akzent); }
@media (min-width: 900px) {
  .navigation {
    top: 0; right: auto; width: 200px; flex-direction: column;
    border-top: 0; border-right: 1px solid var(--rand); padding: 16px 0;
  }
  .navigation a { flex: 0; justify-content: flex-start; padding: 0 20px; font-size: 1rem; }
  .navigation a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--akzent); }
  .inhalt { margin-left: 200px; margin-right: auto; padding-left: 32px; padding-bottom: 48px; }
}

/* Karten, Listen */
.karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: var(--abstand); margin: 0 0 var(--abstand);
}
.liste { list-style: none; margin: 0; padding: 0; }
.liste li {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--rand);
}
.liste li:last-child { border-bottom: 0; }
.liste .titel { font-weight: 600; }
.liste .unter { color: var(--text-leise); font-size: .9rem; }
.marke {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  background: var(--akzent-hell); color: var(--akzent); margin-left: 6px; vertical-align: middle;
}
.marke.inaktiv { background: var(--rand); color: var(--text-leise); }
.marke.warnung { background: var(--warnung-hell); color: var(--warnung); }

/* Formulare */
.feld { margin: 0 0 14px; }
.feld label { display: block; font-weight: 600; margin-bottom: 4px; }
.feld .erklaerung { color: var(--text-leise); font-size: .85rem; margin-top: 4px; }
input, select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--grund); border: 1px solid var(--rand); border-radius: 8px;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--akzent); outline-offset: 2px;
}
.feld.fehlerhaft input, .feld.fehlerhaft select { border-color: var(--fehler); }
.feld .feldfehler { color: var(--fehler); font-size: .85rem; margin-top: 4px; }
.reihe { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reihe-3 { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.schalter { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.schalter input { width: 22px; min-height: 22px; }

/* Knöpfe */
button, .knopf {
  min-height: 44px; padding: 10px 16px; font: inherit; font-weight: 600; border-radius: 8px;
  border: 1px solid var(--rand); background: var(--flaeche); color: var(--text); cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
button.primaer { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
button.gefahr { color: var(--fehler); }
button:disabled { opacity: .6; cursor: default; }
.knopfleiste { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.zurueck { display: inline-block; margin: 4px 0 8px; color: var(--akzent); text-decoration: none; font-weight: 600; }

/* Meldungen */
.meldung { border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; }
.meldung.fehler { background: var(--fehler-hell); color: var(--fehler); }
.meldung.erfolg { background: var(--akzent-hell); color: var(--akzent); }
.meldung.warnung { background: var(--warnung-hell); color: var(--warnung); }
.token { font-family: ui-monospace, Menlo, monospace; word-break: break-all; padding: 10px; background: var(--grund); border-radius: 8px; }

/* Tabellen (Preise) */
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th, .tabelle td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--rand); vertical-align: middle; }
.tabelle td.zahl { text-align: right; white-space: nowrap; }
.tabelle-rahmen { overflow-x: auto; margin: 0 -4px; }
button.klein { min-height: 36px; padding: 6px 10px; font-size: .85rem; }

/* Dialog + Login-Overlay */
dialog {
  border: 1px solid var(--rand); border-radius: var(--radius); padding: 20px;
  background: var(--flaeche); color: var(--text); width: min(440px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.logo-vorschau { max-width: 240px; max-height: 100px; display: block; margin: 8px 0; background: #fff; border-radius: 6px; }
.update {
  position: fixed; left: 16px; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 20;
  background: var(--text); color: var(--grund); border-radius: var(--radius); padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.update[hidden] { display: none; }
@media (max-width: 420px) { .reihe { grid-template-columns: 1fr; } }

/* Erfassung */
fieldset.mehrfach { border: 1px solid var(--rand); border-radius: 8px; padding: 8px 12px; }
fieldset.mehrfach legend { font-weight: 600; padding: 0 4px; }
.schnellwahl { margin-top: 6px; }
.vorschau { background: var(--grund); border-radius: 8px; padding: 10px 12px; min-height: 44px; }
.vorschau-zeile { padding: 4px 0; }
.warnung-text { color: var(--warnung); font-size: .9rem; }
.fehlertext { color: var(--fehler); }
input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; }
.reihe.zeiten { grid-template-columns: 1fr 1fr; }   /* Von/Bis auch schmal nebeneinander */

/* Häkchen/Optionen innerhalb eines Felds: wie .schalter ausgerichtet, nicht fett wie die Beschriftung */
.feld label.schalter { display: flex; font-weight: 400; margin-bottom: 0; }
.feld input + label.schalter { margin-top: 4px; }

/* Uhrzeit per Kacheln (zeitwahl.js) */
button.zeitknopf {
  width: 100%; justify-content: flex-start; font-weight: 400; background: var(--grund);
  font-variant-numeric: tabular-nums; padding: 10px 12px;
}
button.zeitknopf.leer { color: var(--text-leise); }
.feld.fehlerhaft .zeitknopf { border-color: var(--fehler); }
dialog.zeitwahl { padding: 14px; }
.zeitwahl-kopf { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.1rem; }
.zeitwahl-anzeige { font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 600; }
.zeitwahl-schritt { margin: 2px 0 10px; }
.kacheln { display: grid; gap: 6px; }
.kacheln.stunden { grid-template-columns: repeat(6, 1fr); }
.kacheln.minuten { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 359px) { .kacheln.stunden { grid-template-columns: repeat(4, 1fr); } }
button.kachel { min-height: 48px; min-width: 44px; padding: 0; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
button.kachel.aktuell { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
button.kachel.breit { width: 100%; margin-top: 6px; }

/* Liste (Schritt 5) */
.filter-kopf { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.filter-kopf .knopfleiste { margin-top: 0; }
.filter-zusammenfassung { margin: 0; font-weight: 600; flex: 1 1 240px; }
.filter-felder { margin-top: 14px; }
.umschalter { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.umschalter button[aria-pressed="true"] { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }
.summe-gesamt .summe { font-size: 1.05rem; }
.auswahl-leiste { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 4px 0 8px; }
.tag-kopf { font-size: 1rem; margin: 16px 0 0; padding-bottom: 4px; border-bottom: 2px solid var(--rand); }
.liste li.eintrag { justify-content: flex-start; align-items: flex-start; gap: 4px; padding-left: 8px; border-left: 4px solid transparent; }
.liste li.eintrag:last-child { border-bottom: 0; }
.liste li.eintrag.ungeprueft { border-left-color: var(--warnung); }
.liste li.eintrag.unklar { border-left-color: var(--fehler); background: var(--fehler-hell); }
.eintrag-text { flex: 1; min-width: 0; }
label.auswahl-feld { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; margin: -10px 0 -10px -8px; cursor: pointer; }
label.auswahl-feld input { width: 22px; min-height: 22px; }
.marke.unklar { background: var(--fehler-hell); color: var(--fehler); }
.liste li.eintrag.unklar .marke.unklar { background: var(--flaeche); }
.karte > h2:first-child { margin-top: 0; }   /* kein Leerraum über der ersten Überschrift einer Karte */
.tabelle th.zahl { text-align: right; }
h3 { font-size: 1rem; margin: 16px 0 4px; }

/* PDF / Abrechnen (Schritt 6b) */
.pdf-leiste { align-items: center; margin-top: 10px; }
.pdf-leiste .hinweis { font-size: .85rem; }
dialog.pdf-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; }
dialog.pdf-dialog h2 { margin-top: 0; }
.uebersicht .summe { margin: 4px 0; }
.sperrgrund { margin: 4px 0; }
.ergebnis { margin-top: 12px; }
.pdf-aktionen .knopfleiste { margin-top: 4px; }
.meldung.storno { font-weight: 600; border-left: 4px solid var(--warnung); }
.liste li.abrechnung.storniert .titel { text-decoration: line-through; color: var(--text-leise); }

/* Gesperrte Hauptknöpfe deutlich grau (nicht nur blasser), destruktive Bestätigung rot */
button.primaer:disabled { background: var(--rand); border-color: var(--rand); color: var(--text-leise); opacity: 1; }
button.gefahr-voll { background: var(--fehler); border-color: var(--fehler); color: var(--grund); }
