:root {
  --grund: #f4f1ea;
  --flaeche: #ffffff;
  --text: #1d1c1a;
  --leise: #6d6a63;
  --linie: #e2ddd2;
  --akzent: #2f5d50;
  --akzent-text: #ffffff;
  --warten: #a86a12;
  --gefahr: #a23a2c;
  --schatten: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 16px rgba(0, 0, 0, .05);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #16171a;
    --flaeche: #202227;
    --text: #ecebe7;
    --leise: #9a978f;
    --linie: #31343a;
    --akzent: #6fb39e;
    --akzent-text: #0f1513;
    --warten: #e0a752;
    --gefahr: #e07b6c;
    --schatten: none;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.ansicht {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 32px);
}

[hidden] { display: none !important; }

h1 { font-size: 1.35rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: .95rem; color: var(--leise); font-weight: 600; margin: 28px 0 10px; }

.kopf {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
#haupt .kopf { grid-template-columns: 1fr auto; }

/* ── Knoepfe ── */
.knopf {
  font: inherit;
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  min-height: 46px;
  cursor: pointer;
  background: var(--flaeche);
  color: var(--text);
  box-shadow: var(--schatten);
}
.knopf:disabled { opacity: .55; cursor: default; }
.knopf.haupt { background: var(--akzent); color: var(--akzent-text); font-weight: 600; }
.knopf.leise { background: transparent; box-shadow: none; color: var(--akzent); padding: 8px 10px; }
.knopf.rund { font-size: 1.3rem; width: 46px; padding: 0; }
.knopf.gefahr { color: var(--gefahr); }
.knopf.klein { min-height: 36px; padding: 6px 12px; font-size: .9rem; border-radius: 10px; }

/* ── Eingabe ── */
textarea, input {
  width: 100%;
  font: inherit;
  font-size: 18px; /* ab 16 px zoomt iOS nicht hinein */
  color: var(--text);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--schatten);
}
textarea { resize: vertical; min-height: 140px; }
textarea:focus, input:focus { outline: 2px solid var(--akzent); outline-offset: 1px; }

#notiz-form { display: grid; gap: 10px; }

.hinweis { min-height: 1.4em; margin: 8px 2px 0; color: var(--akzent); font-weight: 600; }
.hinweis.warten { color: var(--warten); }
.hinweis.fehler, .meldung { color: var(--gefahr); }

/* ── Liste ── */
.liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.notiz {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: 14px;
  padding: 12px 12px 10px 14px;
  box-shadow: var(--schatten);
}
.notiz.wartet { border-style: dashed; border-color: var(--warten); }
.notiz-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 8px; }
.notiz-fuss { display: flex; align-items: center; gap: 6px; color: var(--leise); font-size: .85rem; }
.notiz-fuss .zeit { flex: 1; }
.notiz .status-warten { color: var(--warten); font-weight: 600; }
.notiz textarea { min-height: 90px; margin-bottom: 8px; box-shadow: none; }

.anzahl { color: var(--leise); font-weight: 400; }
.leer { color: var(--leise); text-align: center; margin: 24px 0; }

/* ── Anmeldung ── */
#anmeldung { min-height: 100vh; display: grid; place-items: center; }
.anmelde-karte { width: 100%; max-width: 360px; text-align: center; }
.anmelde-karte form { display: grid; gap: 10px; text-align: left; margin-top: 20px; }
.anmelde-karte label { color: var(--leise); font-size: .9rem; }
.marke {
  width: 64px; height: 64px; margin: 0 auto 14px;
  border-radius: 18px; display: grid; place-items: center;
  background: var(--akzent); color: var(--akzent-text);
  font-size: 34px; font-weight: 700;
}
.meldung { min-height: 1.4em; margin: 4px 0 0; }

/* ── Einstellungen ── */
.erklaerung { color: var(--leise); font-size: .92rem; margin: 0 0 12px; }
.schluessel-zeile {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--flaeche); border: 1px solid var(--linie);
  border-radius: 14px; padding: 12px 14px; box-shadow: var(--schatten);
}
.schluessel-zeile .name { flex: 1; min-width: 140px; }
.schluessel-zeile .name small { display: block; color: var(--leise); }
.neuer-schluessel {
  margin-top: 12px; padding: 14px; border-radius: 14px;
  border: 2px solid var(--akzent); display: grid; gap: 10px;
}
.neuer-schluessel p { margin: 0; }
.neuer-schluessel input { font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
