/* Bonus — Grundgerüst. Mobile-first, große Touch-Ziele (min. 48 px), keine Inline-Styles (CSP). */
:root {
  --ink: #1d2b3a;
  --akzent: #2f855a;
  --akzent-hell: #e6f4ec;
  --warn: #b7791f;
  --warn-hell: #fff7e6;
  --fehler: #b42318;
  --fehler-hell: #fdecea;
  --grau: #5f6b76;
  --linie: #d9dee3;
  --hintergrund: #f5f6f4;
  --karte: #ffffff;
  --safe-oben: env(safe-area-inset-top, 0px);
  --safe-unten: env(safe-area-inset-bottom, 0px);
  --safe-links: env(safe-area-inset-left, 0px);
  --safe-rechts: env(safe-area-inset-right, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  color: var(--ink);
  background: var(--hintergrund);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--hintergrund); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 1.6rem; letter-spacing: -0.5px; margin-bottom: 8px; }
h2 { font-size: 1.2rem; margin-bottom: 12px; }
h3 { font-size: 1rem; margin-bottom: 8px; }
p { line-height: 1.5; }
.klein { font-size: 0.875rem; }
.grau { color: var(--grau); }
.laden { padding: 40px 16px; text-align: center; color: var(--grau); }

/* Kopf und Navigation */
header.kopf {
  background: var(--ink);
  color: #fff;
  padding: calc(10px + var(--safe-oben)) calc(16px + var(--safe-rechts)) 0 calc(16px + var(--safe-links));
}
.kopf-zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.marke { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.5px; }
.marke small { font-weight: 400; font-size: 0.8rem; opacity: 0.75; margin-left: 8px; }
.kopf-rechts { display: flex; align-items: center; gap: 4px; }
.kopf-rechts button { background: transparent; border: 1px solid transparent; color: #d7dee6; min-height: 44px; padding: 8px 12px; border-radius: 8px; }
.kopf-rechts button:hover { background: #ffffff1a; color: #fff; }
/* Die Reiter brechen um statt zu scrollen: auf dem iPhone bleiben alle fünf Eltern-Reiter sichtbar (Regel 14). */
nav.reiter { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
nav.reiter button {
  flex: 1 0 auto;
  min-height: 48px;
  padding: 10px 10px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: #c7d0d9;
  font-weight: 600;
  white-space: nowrap;
}
nav.reiter button.aktiv { color: #fff; border-bottom-color: #7fd1a3; }
nav.reiter .zaehler { display: inline-block; min-width: 22px; padding: 2px 6px; margin-left: 6px; border-radius: 11px; background: #7fd1a3; color: var(--ink); font-size: 0.8rem; text-align: center; }

main.inhalt { max-width: 760px; margin: 0 auto; padding: 20px calc(16px + var(--safe-rechts)) calc(40px + var(--safe-unten)) calc(16px + var(--safe-links)); }
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.karte h2 { margin-bottom: 10px; }
.hinweis { padding: 12px 14px; border-radius: 10px; background: var(--akzent-hell); border: 1px solid #b9dfc9; margin-bottom: 16px; line-height: 1.5; }
.hinweis.warn { background: var(--warn-hell); border-color: #f2d59b; }
.hinweis.fehler { background: var(--fehler-hell); border-color: #f0b4ad; }
.fehler-text { color: var(--fehler); line-height: 1.5; min-height: 1.2em; margin: 0 0 10px; }

/* Formulare */
.feld { margin-bottom: 16px; }
.feld label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
.feld input, .feld select, .feld textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #b8c2cc;
  border-radius: 10px;
  background: #fff;
}
.feld input:focus, .feld select:focus, .feld textarea:focus { outline: 3px solid #7fd1a3; border-color: transparent; }
.feld textarea { min-height: 96px; line-height: 1.5; resize: vertical; }
.feld.schalter label { display: flex; align-items: center; gap: 12px; min-height: 48px; }
.feld.schalter input { width: 26px; height: 26px; min-height: 0; }
.feld .erklaerung { display: block; font-weight: 400; color: var(--grau); font-size: 0.85rem; margin-top: 4px; }
button.knopf, .knopf {
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--linie);
  background: #fff;
  font-weight: 600;
}
button.knopf:hover { background: #eef1f3; }
button.knopf:disabled { opacity: 0.55; cursor: wait; }
button.knopf.primaer { background: var(--akzent); border-color: var(--akzent); color: #fff; }
button.knopf.primaer:hover { background: #276749; }
button.knopf.leise { background: transparent; border-color: transparent; }
button.knopf.breit { width: 100%; }
.knopfleiste { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }

/* Anmeldung */
.anmeldung { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px calc(16px + var(--safe-rechts)) calc(24px + var(--safe-unten)) calc(16px + var(--safe-links)); }
.anmeldung form, .anmeldung .karte { max-width: 420px; width: 100%; margin: 0 auto; }
.anmeldung .marke { color: var(--ink); font-size: 2rem; text-align: center; margin-bottom: 20px; }
.anmeldung .marke span { color: var(--akzent); }
.code-eingabe { font-size: 1.6rem; letter-spacing: 0.3em; text-align: center; }

/* Zwei-Faktor-Einrichtung */
.qr-rahmen { display: flex; justify-content: center; margin: 12px 0; }
.qr-rahmen svg { width: min(100%, 260px); height: auto; }
.schluessel { font-family: ui-monospace, Menlo, Consolas, monospace; word-break: break-all; background: #f0f2f4; padding: 10px; border-radius: 8px; }
.codes { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.codes li { background: #f0f2f4; padding: 10px; border-radius: 8px; text-align: center; }

/* Listen und Tabellen */
.liste { list-style: none; padding: 0; margin: 0; }
.liste li { padding: 12px 0; border-top: 1px solid var(--linie); line-height: 1.5; }
.liste li:first-child { border-top: none; }
.liste li.ungelesen { font-weight: 600; }
.liste .zeit { display: block; color: var(--grau); font-size: 0.85rem; font-weight: 400; }
.tabelle-scroll { overflow-x: auto; }
table.tabelle { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.tabelle th, .tabelle td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--linie); vertical-align: top; }
.tabelle thead th { border-top: none; border-bottom: 2px solid var(--ink); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--grau); white-space: nowrap; }
.pille { display: inline-block; padding: 3px 8px; border-radius: 6px; background: #edf0f2; color: #4a5560; font-size: 0.8rem; font-weight: 600; }
.pille.gut { background: var(--akzent-hell); color: #276749; }
.pille.warn { background: var(--warn-hell); color: #8a5a10; }
.pille.fehler { background: var(--fehler-hell); color: var(--fehler); }

/* Einstellungen */
.einstellungen-gruppe .feld { display: grid; grid-template-columns: 1fr; gap: 4px; }
.einstellungen-gruppe .feld input, .einstellungen-gruppe .feld select { max-width: 320px; }

/* Konten */
.konto { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.konto strong { font-size: 1.05rem; }
.konto-aktionen { display: flex; flex-wrap: wrap; gap: 8px; }
.unterformular { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--linie); }

/* Toast */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-unten));
  transform: translateX(-50%);
  max-width: min(92vw, 560px);
  padding: 14px 20px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 6px 24px #0004;
  line-height: 1.5;
  display: none;
  z-index: 20;
}
#toast.sichtbar { display: block; }

@media (min-width: 720px) {
  header.kopf { padding-left: calc(24px + var(--safe-links)); padding-right: calc(24px + var(--safe-rechts)); }
  nav.reiter button { flex: 0 0 auto; padding: 10px 14px; }
  .einstellungen-gruppe .feld { grid-template-columns: 1fr 320px; align-items: center; }
  .einstellungen-gruppe .feld label { margin-bottom: 0; }
}
