:root {
  --grund: #ffffff;
  --flaeche: #f7f6f4;
  --linie: #ebe8e4;
  --text: #1d1b19;
  --leise: #6f6a64;
  --akzent: #8a5a3b;
  --akzent-hell: #f5ede6;
  --gut: #2e7a4d;
  --gut-hell: #e9f4ed;
  --warn: #a35f00;
  --warn-hell: #fcf2e2;
  --rot: #b3261e;
  --rot-hell: #fcebe9;
  --radius: 14px;
  --unten: env(safe-area-inset-bottom, 0px);
  --oben: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--grund); color: var(--text); }
body {
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(70px + var(--unten));
}
a { color: var(--akzent); }
button, input, textarea, select { font: inherit; color: inherit; }
h2 { font-size: 17px; margin: 22px 0 8px; font-weight: 650; }
h3 { font-size: 15px; margin: 0 0 6px; font-weight: 650; }
p { margin: 6px 0; }

#kopf {
  position: sticky; top: 0; z-index: 5; background: rgba(255,255,255,.96);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + var(--oben)) 16px 8px; border-bottom: 1px solid var(--linie);
}
#titel { font-size: 21px; margin: 0; font-weight: 700; letter-spacing: -.2px; }
#neu-laden { border: 0; background: var(--flaeche); width: 36px; height: 36px; border-radius: 50%; font-size: 19px; line-height: 1; cursor: pointer; }
#neu-laden.dreht { animation: drehen 1s linear infinite; }
@keyframes drehen { to { transform: rotate(360deg); } }

#inhalt { padding: 6px 16px 24px; max-width: 720px; margin: 0 auto; }
.laden { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--leise); padding: 80px 0; }
.laden img { border-radius: 16px; border: 1px solid var(--linie); }

#leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: rgba(255,255,255,.97);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-top: 1px solid var(--linie); display: grid; grid-template-columns: repeat(6, 1fr);
  padding: 6px 4px calc(6px + var(--unten));
}
#leiste button {
  border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 1px;
  font-size: 11px; color: var(--leise); padding: 4px 0; cursor: pointer; position: relative;
}
#leiste button .sym { font-size: 21px; line-height: 1.15; filter: grayscale(.6); opacity: .8; }
#leiste button.an { color: var(--text); font-weight: 650; }
#leiste button.an .sym { filter: none; opacity: 1; }
#leiste .zahl {
  position: absolute; top: 0; left: 55%; background: var(--rot); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 9px; min-width: 17px; height: 17px; line-height: 17px; padding: 0 4px; text-align: center;
}

.karte { border: 1px solid var(--linie); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; background: var(--grund); }
.karte.leise { background: var(--flaeche); border-color: transparent; }
.karte.warn { background: var(--warn-hell); border-color: #f1dcb8; }
.karte.gut { background: var(--gut-hell); border-color: #cfe6d7; }
.karte .kopfzeile { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.karte .kopfzeile h3 { margin: 0; }
.datumzeile { color: var(--leise); margin: 10px 0 2px; font-size: 15px; }
.klein { font-size: 13px; color: var(--leise); }
.fett { font-weight: 650; }
.rot { color: var(--rot); }
.gruen { color: var(--gut); }
.orange { color: var(--warn); }
.mitte { text-align: center; }

.chip {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--flaeche); color: var(--leise); white-space: nowrap; vertical-align: 1px;
}
.chip.rot { background: var(--rot-hell); color: var(--rot); }
.chip.orange { background: var(--warn-hell); color: var(--warn); }
.chip.gruen { background: var(--gut-hell); color: var(--gut); }
.chip.akzent { background: var(--akzent-hell); color: var(--akzent); }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--linie); background: var(--grund); border-radius: 10px;
  padding: 8px 12px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; color: var(--text);
}
.knopf.voll { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.rot { color: var(--rot); }
.knopf.breit { width: 100%; padding: 11px 12px; font-size: 15px; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.zeile .knopfreihe { gap: 6px; }
.zeile .knopfreihe .knopf { padding: 4px 10px; font-size: 13px; border-radius: 8px; }

.segment { display: flex; background: var(--flaeche); border-radius: 10px; padding: 3px; margin: 10px 0 4px; }
.segment button { flex: 1; border: 0; background: none; padding: 7px 0; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--leise); cursor: pointer; }
.segment button.an { background: var(--grund); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.zeile { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--linie); }
.zeile:first-child { border-top: 0; }
.karte > .zeile:first-of-type { border-top: 0; }
.zeile .rest { flex: 1; min-width: 0; }
.zeile .rechts { text-align: right; white-space: nowrap; }
.zeile .sym { width: 22px; text-align: center; flex: none; }
.zeile.erledigt .text { color: var(--leise); text-decoration: line-through; }
.text { overflow-wrap: anywhere; }
.text.zu { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.haken {
  flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #cfc9c2; background: var(--grund);
  display: flex; align-items: center; justify-content: center; font-size: 15px; color: #fff; cursor: pointer; margin-top: 1px; padding: 0;
}
.haken.an { background: var(--gut); border-color: var(--gut); }

.bild { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--flaeche); flex: none; }

.kacheln { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.kachel { background: var(--flaeche); border-radius: 12px; padding: 12px; }
.kachel .titel { font-size: 13px; color: var(--leise); }
.kachel .wert { font-size: 22px; font-weight: 700; letter-spacing: -.3px; margin-top: 2px; }
.kachel .unter { font-size: 13px; color: var(--leise); }

.gross { font-size: 30px; font-weight: 750; letter-spacing: -.5px; }
.balken { width: 100%; height: 130px; display: block; }

.eingabe { display: flex; gap: 8px; margin: 10px 0 4px; }
.eingabe input[type=text], .eingabe input:not([type]) { flex: 1; min-width: 0; }
input[type=text], input[type=password], input[type=date], input[type=url], input:not([type]), textarea, select {
  border: 1px solid #ddd8d2; border-radius: 10px; padding: 9px 11px; background: var(--grund); width: 100%; font-size: 16px;
}
input[type=date] { min-height: 42px; }
textarea { min-height: 96px; resize: vertical; }
.feld { margin: 10px 0; }
.feld label { display: block; font-size: 13px; color: var(--leise); margin-bottom: 4px; }
.knopf.plus { flex: none; width: 44px; padding: 0; font-size: 22px; }
.auswahl { display: flex; gap: 8px; }
.auswahl button { flex: 1; }
.auswahl button.an { background: var(--akzent-hell); border-color: var(--akzent); color: var(--akzent); }

details.mehr { margin: 8px 0; }
details.mehr > summary { cursor: pointer; color: var(--leise); font-size: 14px; padding: 6px 0; list-style: none; }
details.mehr > summary::-webkit-details-marker { display: none; }
details.mehr > summary::before { content: "▸ "; }
details.mehr[open] > summary::before { content: "▾ "; }

.caption { white-space: pre-wrap; background: var(--flaeche); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 8px; }
.liste { margin: 6px 0 0; padding-left: 20px; }
.liste li { margin: 3px 0; }
.leer { color: var(--leise); font-size: 14px; padding: 6px 0; }

.tag-kopf { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 6px; }
.tag-kopf .wt { font-weight: 700; font-size: 16px; }
.tag-kopf.heute .wt { color: var(--akzent); }

details.karte > summary { list-style: none; cursor: pointer; }
details.karte > summary::-webkit-details-marker { display: none; }
details.gespraech[open] > summary .frage { display: none; }
.gespraech .frage { font-weight: 600; }
.gespraech .antwort { color: #3d3934; font-size: 14px; white-space: pre-wrap; margin: 4px 0 10px; }

.anmelden { max-width: 380px; margin: 40px auto; text-align: center; }
.anmelden img { border-radius: 20px; border: 1px solid var(--linie); }
.anmelden .feld { text-align: left; }
.fehler { color: var(--rot); font-size: 14px; min-height: 20px; margin: 6px 0; }

#blatt-wurzel .schleier {
  position: fixed; inset: 0; background: rgba(20, 16, 12, .35); z-index: 20; display: flex; align-items: flex-end; justify-content: center;
}
#blatt-wurzel .blatt {
  background: var(--grund); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + var(--unten));
  max-height: 88vh; overflow: auto; box-shadow: 0 -6px 30px rgba(0,0,0,.12);
}
.blatt h3 { font-size: 17px; margin-bottom: 4px; }

#toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--unten)); transform: translateX(-50%) translateY(20px); opacity: 0;
  background: #26221e; color: #fff; padding: 10px 14px; border-radius: 12px; font-size: 14px; z-index: 30;
  transition: opacity .2s, transform .2s; pointer-events: none; display: flex; gap: 12px; align-items: center; max-width: 92vw;
}
#toast.an { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
#toast button { background: none; border: 0; color: #f3c99f; font-weight: 700; padding: 0; cursor: pointer; }

@media (min-width: 700px) {
  .kacheln { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
