/* ─────────────────────────────────────────────────────────────
   app.css – Aussehen der App
   Hell = „Stille“ (Papier, Salbeigrün), Dunkel = „Abend“ (Anthrazit, Gold)
   ───────────────────────────────────────────────────────────── */

/* Farben */
:root,
[data-theme="hell"] {
  --bg: #F7F3EC;
  --karte: #FFFFFF;
  --weich: #EFE9DF;
  --leiste: #FBF8F3;
  --text: #2B2723;
  --gedaempft: #6B6358;
  --linie: #E3DACB;
  --akzent: #56704A;
  --auf-akzent: #FFFFFF;
  --akzent-bg: #E4EBDD;
  --akzent-text: #3F5636;
  --gefahr: #A33A2B;
  color-scheme: light;
}
[data-theme="dunkel"] {
  --bg: #151821;
  --karte: #1F2330;
  --weich: #262B3A;
  --leiste: #191C26;
  --text: #ECE7DE;
  --gedaempft: #A29D94;
  --linie: #2E3445;
  --akzent: #D4A857;
  --auf-akzent: #1A1A1A;
  --akzent-bg: #332C1F;
  --akzent-text: #E2BE78;
  --gefahr: #F08A7A;
  color-scheme: dark;
}

/* Schriften. „-apple-system-body“ übernimmt die Textgröße aus den
   iPhone-Einstellungen. Alle anderen Größen sind in rem angegeben
   und wachsen dadurch mit. */
:root {
  --serif: ui-serif, "New York", Georgia, serif;
  --sans: -apple-system, system-ui, "SF Pro Text", "Helvetica Neue", sans-serif;
  --tabhoehe: 64px;
  --rand: 20px;
}
html { font: -apple-system-body; font-family: var(--sans); -webkit-text-size-adjust: 100%; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--akzent); outline-offset: 2px; }

/* Grundlayout */
.seite {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) var(--rand) 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.mit-tabs main { padding-bottom: calc(var(--tabhoehe) + env(safe-area-inset-bottom) + 72px); }

.kopf { display: flex; flex-direction: column; gap: 2px; }
.kopf-zeile { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.titel { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 1.75rem; line-height: 1.2; }
.serif { font-family: var(--serif); }
.mittel { font-size: 1.2rem; font-weight: 500; }
.klein { font-size: 0.8rem; }
.gedaempft { color: var(--gedaempft); }
.mitte { text-align: center; }
.wachsen { flex: 1; min-width: 0; }
.abschnitt { margin: 8px 0 2px; font-size: 0.8rem; font-weight: 400; color: var(--gedaempft); }
.icon { flex: none; display: block; }

/* Karten und Zeilen */
.karte { background: var(--karte); border: 1px solid var(--linie); border-radius: 18px; padding: 16px; }
.karte-zeile { display: flex; align-items: center; gap: 12px; }
.karte-text { margin-top: 3px; }
.rund-icon { width: 38px; height: 38px; border-radius: 50%; background: var(--akzent-bg); color: var(--akzent-text); display: flex; align-items: center; justify-content: center; flex: none; }
.zeile { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--linie); align-items: flex-start; }
.zeile-text { flex: 1; min-width: 0; }
.zwei-zeilen { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.datumsblock { width: 2.4rem; flex: none; display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.zahl { font-size: 1.35rem; font-weight: 500; }
.info-zeile { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--linie); }
.info-zeile:last-child { border-bottom: 0; }
.info-zeile span:last-child { color: var(--gedaempft); text-align: right; }
.leer { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 24px 0; }
.leer h2 { margin: 0; font-weight: 500; font-size: 1.3rem; }
.leer p { margin: 0; }
.gruppe { display: flex; flex-direction: column; gap: 10px; }

/* Knöpfe */
.knopf { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--linie); background: transparent; font-size: 1rem; }
.knopf-haupt { background: var(--akzent); color: var(--auf-akzent); border: 0; font-weight: 500; }
.knopf-gestrichelt { width: 100%; border-style: dashed; margin-top: 12px; }
.iconknopf { width: 44px; height: 44px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; border-radius: 12px; margin-right: -10px; }
.plusknopf {
  position: fixed; right: max(var(--rand), env(safe-area-inset-right));
  bottom: calc(var(--tabhoehe) + env(safe-area-inset-bottom) + 16px);
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--akzent); color: var(--auf-akzent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  z-index: 5;
}

/* Umschalter (Verlauf | Kalender usw.) */
.umschalter { display: flex; background: var(--weich); border-radius: 12px; padding: 3px; }
.umschalter button { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--gedaempft); font-size: 0.9rem; }
.umschalter button.an { background: var(--karte); color: var(--text); font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

/* Tab-Leiste unten */
.tableiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 6px 6px calc(env(safe-area-inset-bottom) + 6px);
  background: var(--leiste); border-top: 1px solid var(--linie);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 48px; justify-content: center; font-size: 0.65rem; color: var(--gedaempft); }
.tab.aktiv { color: var(--akzent-text); }

/* Kalender */
.kalender-kopf { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 8px; }
.kalender-kopf .iconknopf { margin: 0; }
.kalender-raster { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.kalender-raster.wochentage { text-align: center; font-size: 0.7rem; color: var(--gedaempft); margin-bottom: 2px; }
.kalendertag { position: relative; height: 44px; border: 0; border-radius: 10px; background: transparent; font-size: 0.9rem; padding: 0 0 8px; }
.kalendertag.heute { background: var(--akzent-bg); color: var(--akzent-text); font-weight: 500; }
.kalendertag.gewaehlt { box-shadow: inset 0 0 0 2px var(--text); }
.kalendertag .punkt { position: absolute; bottom: 7px; left: 50%; margin-left: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--akzent); }

/* Schreibansicht */
.schreiben { gap: 14px; }
.schreib-leiste { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.zurueck-knopf { display: flex; align-items: center; gap: 2px; min-height: 44px; border: 0; background: transparent; padding: 0 8px 0 0; margin-left: -8px; color: var(--akzent-text); font-size: 1rem; }
.speicherstatus { display: flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--gedaempft); margin-left: auto; }
.speicherstatus.fehler { color: var(--gefahr); }
.menue-anker { position: relative; }
.menue { position: absolute; right: 0; top: 46px; z-index: 20; min-width: 200px; background: var(--karte); border: 1px solid var(--linie); border-radius: 14px; padding: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15); }
.menue button { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; border-radius: 10px; padding: 0 10px; text-align: left; }
.menue .gefahr { color: var(--gefahr); }
.datum-feld { display: flex; flex-direction: column; gap: 2px; }
.datum-titel { position: relative; display: inline-block; align-self: flex-start; }
.datum-titel input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; }
.schreibfeld, .antwortfeld {
  width: 100%; border: 0; background: transparent; resize: none; outline: none; padding: 0;
  font-family: var(--serif); line-height: 1.6; overflow: hidden;
}
.schreibfeld { font-size: 1.05rem; min-height: 9rem; }
.antwortfeld { font-size: 1rem; min-height: 3rem; padding: 0 0 12px 22px; }
.schreibfeld::placeholder, .antwortfeld::placeholder { color: var(--gedaempft); }
.fragen { border-top: 1px solid var(--linie); padding-top: 10px; }
.fragen-kopf { display: flex; justify-content: space-between; margin-bottom: 2px; }
.frage { border-bottom: 1px solid var(--linie); }
.frage-knopf { width: 100%; min-height: 48px; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; text-align: left; padding: 0; font-size: 0.95rem; }
.markierung { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--linie); flex: none; }
.markierung.voll { background: var(--akzent); border-color: var(--akzent); }
.pfeil { color: var(--gedaempft); transition: transform 0.15s; }
.pfeil.gedreht { transform: rotate(180deg); }

/* Eingabefelder */
.feld { display: flex; flex-direction: column; gap: 4px; }
.feld input { min-height: 44px; border: 1px solid var(--linie); border-radius: 12px; background: var(--karte); padding: 0 12px; font-size: 1rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
