/* Waschkasse – ein Stylesheet, mobile-first, Hell- und Dunkelmodus.
   Keine externen Fonts oder CDNs. */

:root {
  --hintergrund: #f4f6f8;
  --flaeche: #ffffff;
  --text: #1c2430;
  --text-leise: #5b6675;
  --rand: #d8dee6;
  --akzent: #1f6feb;
  --akzent-text: #ffffff;
  --akzent-hell: #e3edff;
  --gefahr: #c62828;
  --gefahr-hell: #fdecec;
  --erfolg: #1b7f3b;
  --erfolg-hell: #e6f5ea;
  --warnung: #9a5b00;
  --warnung-hell: #fff4e0;
  --negativ: #c62828;
  --schatten: 0 1px 3px rgba(20, 30, 50, 0.08);
  --radius: 10px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hintergrund: #11161d;
    --flaeche: #1a212b;
    --text: #e6ebf1;
    --text-leise: #9aa6b4;
    --rand: #2e3946;
    --akzent: #5b9bff;
    --akzent-text: #0b1220;
    --akzent-hell: #1c2c47;
    --gefahr: #ff6b6b;
    --gefahr-hell: #3a1d20;
    --erfolg: #5fd58a;
    --erfolg-hell: #17301f;
    --warnung: #ffb84d;
    --warnung-hell: #3a2c14;
    --negativ: #ff7b7b;
    --schatten: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--hintergrund);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 1.5rem 0 0.75rem; }
a { color: var(--akzent); }
small { color: var(--text-leise); }

.sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- Kopf und Navigation --------------------------------------------------- */

.kopf { background: var(--flaeche); border-bottom: 1px solid var(--rand); }

.kopf-innen {
  max-width: 1100px; margin: 0 auto; padding: 0.5rem 1rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 56px;
}

.marke { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.marke-zusatz { font-weight: 400; color: var(--text-leise); font-size: 0.9rem; }

.menu-knopf {
  display: none;
  min-height: 44px; min-width: 44px; padding: 0 1rem;
  border: 1px solid var(--rand); border-radius: var(--radius);
  background: var(--flaeche); color: var(--text); font: inherit; cursor: pointer;
}

.hauptnav ul {
  list-style: none; margin: 0 auto; padding: 0 1rem 0.5rem; max-width: 1100px;
  display: flex; flex-wrap: wrap; gap: 0.25rem;
}

.hauptnav a, .nav-abmelden {
  display: flex; align-items: center; min-height: 44px; padding: 0 0.75rem;
  border-radius: var(--radius); color: var(--text); text-decoration: none;
  background: none; border: 0; font: inherit; cursor: pointer;
}

.hauptnav a:hover, .nav-abmelden:hover { background: var(--akzent-hell); }
.hauptnav a[aria-current="page"] { background: var(--akzent-hell); color: var(--akzent); font-weight: 600; }
.nav-form { margin: 0; }

/* Auf dem Handy: Menü eingeklappt hinter dem Knopf (nur wenn JS läuft) */
@media (max-width: 799px) {
  .js .menu-knopf { display: inline-flex; align-items: center; }
  .js .hauptnav { display: none; }
  .js .hauptnav.offen { display: block; }
  .hauptnav ul { flex-direction: column; }
  .hauptnav a, .nav-abmelden { width: 100%; }
}

/* --- Inhalt ------------------------------------------------------------------ */

.inhalt { max-width: 1100px; margin: 0 auto; padding: 1rem; }

.karte {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 1rem; margin: 0 0 1rem; box-shadow: var(--schatten);
}
.karte.schmal { max-width: 32rem; margin-left: auto; margin-right: auto; }
.karte > :first-child { margin-top: 0; }

.meldung {
  padding: 0.75rem 1rem; border-radius: var(--radius); margin: 0 0 1rem;
  border: 1px solid transparent;
}
.meldung ul { margin: 0; padding-left: 1.2rem; }
.meldung.erfolg { background: var(--erfolg-hell); color: var(--erfolg); border-color: var(--erfolg); }
.meldung.fehler { background: var(--gefahr-hell); color: var(--gefahr); border-color: var(--gefahr); }

.hinweis, .leer { color: var(--text-leise); }
.status { margin: 0.75rem 0 0; }
.status:empty { display: none; }  /* keine Leerfläche, solange keine Meldung da ist */
.formular input + button, .formular input + .knopf { margin-top: 0.75rem; }
.status.fehler { color: var(--gefahr); font-weight: 600; }
.fehlercode { color: var(--text-leise); margin: 0; }
.begruessung { color: var(--text-leise); margin: 0.25rem 0 0.75rem; }

.etikett {
  display: inline-block; font-size: 0.8rem; padding: 0 0.5rem; border-radius: 999px;
  background: var(--akzent-hell); color: var(--akzent); vertical-align: middle;
}

/* --- Knöpfe ------------------------------------------------------------------ */

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; padding: 0.5rem 1rem;
  border: 1px solid var(--rand); border-radius: var(--radius);
  background: var(--flaeche); color: var(--text);
  font: inherit; font-weight: 500; text-decoration: none; text-align: center; cursor: pointer;
}
.knopf:hover { border-color: var(--akzent); }
.knopf:disabled { opacity: 0.6; cursor: progress; }
.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf.gefahr { color: var(--gefahr); border-color: var(--gefahr); }
.knopf.gross { width: 100%; font-size: 1.1rem; min-height: 52px; }
.knopf.klein { min-height: 44px; padding: 0.25rem 0.75rem; font-size: 0.95rem; }
.knopf.paypal { background: #ffc439; border-color: #ffc439; color: #111; font-weight: 600; }
.knopf.whatsapp { background: #25d366; border-color: #25d366; color: #0b2e17; font-weight: 600; }

.knopfreihe { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; align-items: center; }
.knopfreihe form { margin: 0; }
:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }

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

.formular label { display: block; font-weight: 600; margin: 0.75rem 0 0.25rem; }
.formular label:first-of-type { margin-top: 0; }

input[type="text"], input[type="date"], select {
  display: block; width: 100%; max-width: 100%;
  min-height: 44px; padding: 0.5rem 0.75rem;
  font: inherit; font-size: 16px; /* >= 16px: iOS zoomt sonst hinein */
  color: var(--text); background: var(--flaeche);
  border: 1px solid var(--rand); border-radius: var(--radius);
}
input:focus, select:focus { border-color: var(--akzent); }
input[type="checkbox"] { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--akzent); }

.formular .auswahl, .auswahl {
  display: flex; align-items: center; gap: 0.6rem; min-height: 44px;
  font-weight: 400; margin: 0;
}

.eingabe-mit-knopf { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.eingabe-mit-knopf input { flex: 1 1 12rem; width: auto; }

.personen-auswahl { border: 1px solid var(--rand); border-radius: var(--radius); margin: 1rem 0 0; padding: 0.5rem 0.75rem; }
.personen-auswahl legend { font-weight: 600; padding: 0 0.25rem; }
.auswahl.alle { border-bottom: 1px solid var(--rand); margin-bottom: 0.25rem; }
.auswahl-zeile { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; padding: 0.25rem 0; }
.auswahl-zeile .auswahl { flex: 1 1 14rem; }
.auswahl-zeile input[type="text"] { flex: 0 1 10rem; width: 10rem; }

.filter { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
.filter > div { flex: 1 1 12rem; }
.filter label { display: block; font-weight: 600; margin-bottom: 0.25rem; }

.link-feld { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 16px; }
.qr { text-align: center; margin: 0.5rem 0 1rem; }
.qr img { display: inline-block; max-width: 100%; height: auto; background: #fff; border-radius: var(--radius); }
.qr .hinweis { margin: 0.25rem 0 0; }

.schalter {
  min-height: 44px; min-width: 6rem; padding: 0 0.75rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rand); background: var(--hintergrund); color: var(--text-leise); font: inherit;
}
.schalter.an { background: var(--erfolg-hell); border-color: var(--erfolg); color: var(--erfolg); font-weight: 600; }

/* --- Beträge und Status ------------------------------------------------------- */

.betrag { white-space: nowrap; font-variant-numeric: tabular-nums; }
.betrag.negativ { color: var(--negativ); }
.betrag.offen { color: var(--gefahr); font-weight: 700; }
.betrag.guthaben { color: var(--erfolg); font-weight: 600; }

.status.bezahlt { color: var(--erfolg); }
.status.teilweise { color: var(--warnung); font-weight: 600; }
.status.offen { color: var(--gefahr); font-weight: 600; }

/* Große Karte auf der User-Seite */
.stand-karte {
  border-radius: 16px; padding: 1.25rem 1rem; margin: 0 0 1.5rem; text-align: center;
  border: 2px solid var(--rand); background: var(--flaeche);
}
.stand-karte.offen { border-color: var(--gefahr); background: var(--gefahr-hell); }
.stand-karte.guthaben, .stand-karte.bezahlt { border-color: var(--erfolg); background: var(--erfolg-hell); }
.stand-text { font-size: 1.9rem; font-weight: 700; margin: 0 0 0.5rem; }
.stand-karte .knopf { margin-top: 0.5rem; }
.stand-karte .hinweis { margin: 0.75rem 0 0; font-size: 0.95rem; }

.abschnitt-kopf { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; }

/* Kennzahlen (Übersicht, Person) */
.kennzahlen { display: grid; grid-template-columns: 1fr; gap: 0.75rem; margin-bottom: 1rem; }
.kennzahl {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 0.75rem 1rem; display: flex; flex-direction: column; box-shadow: var(--schatten);
}
.kennzahl-titel { color: var(--text-leise); font-size: 0.95rem; }
.kennzahl-wert { font-size: 1.5rem; font-weight: 700; }

.schnellzugriff { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }

.bilanz { margin: 0; }
.bilanz > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--rand); }
.bilanz > div:last-child { border-bottom: 0; }
.bilanz dt { margin: 0; }
.bilanz dd { margin: 0; text-align: right; }
.bilanz .summe { font-weight: 700; }

.liste { list-style: none; margin: 0 0 1rem; padding: 0; }
.liste li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0.5rem 0; border-bottom: 1px solid var(--rand); }
.liste form { margin: 0; }

/* --- Tabellen: auf dem Handy als Karten pro Zeile ----------------------------- */

.tabelle { width: 100%; border-collapse: collapse; margin: 0 0 1rem; }
.tabelle th, .tabelle td { text-align: left; vertical-align: middle; }
.tabelle th { overflow-wrap: normal; white-space: nowrap; }
.tabelle .zahl { text-align: right; }
.aktionen { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.aktionen form { margin: 0; }
.tabelle form { margin: 0; }

@media (max-width: 799px) {
  .tabelle thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .tabelle, .tabelle tbody, .tabelle tfoot, .tabelle tr, .tabelle td { display: block; width: 100%; }
  .tabelle tr {
    background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius);
    padding: 0.5rem 0.75rem; margin-bottom: 0.75rem; box-shadow: var(--schatten);
  }
  .tabelle td {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: 0.3rem 0; text-align: right; min-height: 2rem;
  }
  .tabelle td::before { content: attr(data-label); color: var(--text-leise); text-align: left; font-weight: 500; flex: none; }
  .tabelle td.zahl { text-align: right; }
  .tabelle td:empty { display: none; }
  .tabelle td.aktionen { justify-content: flex-end; flex-wrap: wrap; }
  .tabelle td.aktionen::before { content: none; }
  .tabelle tr.status-offen, .tabelle tr.status-teilweise, .tabelle tr.zeile-offen { border-left: 4px solid var(--gefahr); }
  .tabelle tr.zeile-guthaben { border-left: 4px solid var(--erfolg); }
  .summenzeile { font-weight: 700; }
}

@media (min-width: 800px) {
  .tabelle { background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--radius); overflow: hidden; }
  .tabelle th, .tabelle td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--rand); }
  .tabelle thead th { background: var(--hintergrund); font-weight: 600; color: var(--text-leise); }
  .tabelle tbody tr:last-child td { border-bottom: 0; }
  .tabelle tr.status-offen, .tabelle tr.status-teilweise, .tabelle tr.zeile-offen { background: var(--gefahr-hell); }
  .tabelle tr.zeile-guthaben { background: var(--erfolg-hell); }
  /* Aktionszelle bleibt eine echte Tabellenzelle (sonst verrutscht die Zeilenlinie) */
  .tabelle td.aktionen { display: table-cell; }
  .tabelle td.aktionen > * { display: inline-flex; margin: 0.2rem 0.4rem 0.2rem 0; vertical-align: middle; }
  .summenzeile td { font-weight: 700; border-top: 2px solid var(--rand); }
  .kennzahlen { grid-template-columns: repeat(3, 1fr); }
  .schnellzugriff { grid-template-columns: repeat(3, 1fr); }
  .knopf.gross { width: auto; min-width: 18rem; }
  .karte.schmal .knopf.gross { width: 100%; }
  h1 { font-size: 1.75rem; }
}
