:root {
  --bg: #f8f5ef;
  --karte: #ffffff;
  --text: #1f2a22;
  --leise: #66705f;
  --linie: #e6e0d4;
  --gruen: #2f6b3d;
  --gruen-hell: #e3efe4;
  --tomate: #d9502b;
  --gelb: #e9a92a;
  --schatten: 0 1px 2px rgba(40, 40, 20, .06), 0 4px 14px rgba(40, 40, 20, .06);
  --rund: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131813; --karte: #1c231d; --text: #e9eee6; --leise: #9aa695; --linie: #2c352d;
    --gruen: #6fbf7f; --gruen-hell: #22352a; --tomate: #ff7a55; --gelb: #f2c14e;
    --schatten: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--gruen); }
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }

.kopf {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--linie);
}
.marke { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.marke img { width: 30px; height: 30px; border-radius: 8px; }
.kopf-knopf { width: 36px; height: 36px; display: grid; place-items: center; color: var(--leise); }
.kopf-knopf svg { width: 22px; height: 22px; }

main { max-width: 640px; margin: 0 auto; padding: 14px 16px 24px; }
h1 { font-size: 1.5rem; margin: 6px 0 12px; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; margin: 22px 0 10px; }
h3 { font-size: 1rem; margin: 14px 0 6px; }
.leise { color: var(--leise); }
.klein { font-size: .86rem; }

.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: grid; grid-template-columns: repeat(5, 1fr);
  align-items: end; padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); background: var(--karte);
  border-top: 1px solid var(--linie);
}
.leiste a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .72rem; color: var(--leise); text-decoration: none; padding: 4px 0; }
.leiste a svg { width: 24px; height: 24px; }
.leiste a.an { color: var(--gruen); font-weight: 600; }
.leiste a.kamera { justify-self: center; width: 62px; height: 62px; margin-top: -26px; border-radius: 50%; background: var(--gruen); color: #fff;
  justify-content: center; box-shadow: 0 6px 18px rgba(47, 107, 61, .35); }
.leiste a.kamera svg { width: 30px; height: 30px; }
.ausgeloggt .leiste, .ausgeloggt #kopf-einst { display: none; }

.karte { background: var(--karte); border-radius: var(--rund); box-shadow: var(--schatten); padding: 14px; margin-bottom: 12px; }
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 12px 18px; background: var(--gruen); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 46px;
}
.knopf svg { width: 20px; height: 20px; }
.knopf.zweit { background: var(--gruen-hell); color: var(--gruen); }
.knopf.rand { background: transparent; border: 1px solid var(--linie); color: var(--text); }
.knopf.warn { background: transparent; color: var(--tomate); border: 1px solid color-mix(in srgb, var(--tomate) 40%, transparent); }
.knopf.breit { width: 100%; }
.knopf[disabled] { opacity: .5; }
.reihe { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.reihe.zwischen { justify-content: space-between; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { text-decoration: none; color: inherit; border: 1px solid var(--linie); background: var(--karte); border-radius: 999px; padding: 8px 14px; cursor: pointer; font-size: .92rem; }
.chip.an { background: var(--gruen); border-color: var(--gruen); color: #fff; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }

label.feld { display: block; margin: 12px 0; }
label.feld > span { display: block; font-size: .86rem; color: var(--leise); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=datetime-local], textarea, select {
  width: 100%; border: 1px solid var(--linie); background: var(--karte); border-radius: 12px; padding: 12px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--gruen); }
textarea { min-height: 84px; resize: vertical; }
.mitmikro { position: relative; }
.mitmikro textarea { padding-right: 52px; }
.mikro { position: absolute; right: 8px; top: 8px; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--gruen-hell); color: var(--gruen); display: grid; place-items: center; }
.mikro svg { width: 20px; height: 20px; }
.mikro.an { background: var(--tomate); color: #fff; animation: puls 1.2s infinite; }
@keyframes puls { 50% { transform: scale(1.08); } }

.datum { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.datum a { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--text); text-decoration: none; font-size: 1.4rem; }
.datum h1 { margin: 0; text-align: center; }

.bilanz { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.ring { position: relative; width: 64px; height: 64px; margin: 0 auto 4px; }
.ring svg { width: 64px; height: 64px; transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: .82rem; }
.bilanz small { display: block; font-size: .72rem; color: var(--leise); line-height: 1.2; }

.essen { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.essen + .essen { border-top: 1px solid var(--linie); padding-top: 12px; margin-top: 12px; }
.daumen { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; flex: none; background: var(--gruen-hell); display: grid; place-items: center; color: var(--gruen); }
.daumen svg { width: 28px; height: 28px; }
.essen .info { flex: 1; min-width: 0; }
.essen .titel { font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.essen .zeile { font-size: .82rem; color: var(--leise); }
.typ-kopf { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); margin: 18px 0 6px; font-weight: 600; }

.sterne { display: inline-flex; gap: 2px; color: var(--gelb); }
.sterne svg { width: 15px; height: 15px; }
.sterne-wahl { display: flex; gap: 6px; }
.sterne-wahl button { border: 0; background: none; padding: 2px; color: var(--linie); cursor: pointer; }
.sterne-wahl button.an { color: var(--gelb); }
.sterne-wahl svg { width: 34px; height: 34px; }

.badge { display: inline-block; font-size: .74rem; padding: 2px 8px; border-radius: 999px; background: var(--gruen-hell); color: var(--gruen); font-weight: 600; }
.badge.warten { background: color-mix(in srgb, var(--gelb) 18%, transparent); color: #9a6a00; }
.badge.fehler { background: color-mix(in srgb, var(--tomate) 15%, transparent); color: var(--tomate); }
.note { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-weight: 800; color: #fff; }

.foto-gross { width: 100%; max-height: 62vh; object-fit: cover; border-radius: var(--rund); margin-bottom: 12px; background: var(--gruen-hell); }
.balken { margin: 8px 0; }
.balken .kopfz { display: flex; justify-content: space-between; font-size: .88rem; }
.balken .spur { height: 8px; background: var(--linie); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.balken .fuell { height: 100%; background: var(--gruen); border-radius: 99px; }
.balken .fuell.drueber { background: var(--tomate); }
ul.liste { padding-left: 1.1em; margin: 6px 0; }
ul.liste li { margin: 3px 0; }
ol.schritte { padding-left: 1.3em; }
ol.schritte li { margin: 6px 0; }
.vermutet { color: var(--leise); font-style: italic; }
.notiz { border-left: 3px solid var(--gruen); padding: 4px 10px; margin: 8px 0; }
.notiz small { color: var(--leise); display: block; font-size: .76rem; }

.lade { display: flex; align-items: center; gap: 12px; }
.kreisel { width: 22px; height: 22px; border: 3px solid var(--gruen-hell); border-top-color: var(--gruen); border-radius: 50%; animation: dreh 1s linear infinite; flex: none; }
@keyframes dreh { to { transform: rotate(360deg); } }

.kamera-feld { display: grid; place-items: center; gap: 10px; text-align: center; border: 2px dashed var(--linie); border-radius: var(--rund); padding: 30px 16px; cursor: pointer; background: var(--karte); }
.kamera-feld svg { width: 52px; height: 52px; color: var(--gruen); }
.kamera-feld img { border-radius: 12px; max-height: 50vh; object-fit: cover; }
input[type=file] { display: none; }

.wochen-balken { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 130px; margin: 10px 0 4px; }
.wochen-balken.lang { grid-template-columns: repeat(28, 1fr); gap: 2px; }
.wochen-balken div { background: var(--gruen); border-radius: 6px 6px 2px 2px; min-height: 2px; position: relative; }
.wochen-balken div.leer { background: var(--linie); }
.wochen-balken div.drueber { background: var(--tomate); }
.wochen-tage { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; font-size: .72rem; color: var(--leise); }
.hinweis { padding: 10px 12px; border-radius: 12px; background: var(--gruen-hell); margin: 8px 0; font-size: .94rem; }

.rang { display: grid; grid-template-columns: 30px 56px 1fr auto; gap: 10px; align-items: center; text-decoration: none; color: inherit; padding: 8px 0; }
.rang + .rang { border-top: 1px solid var(--linie); }
.rang .nr { font-weight: 800; font-size: 1.1rem; color: var(--leise); text-align: center; }
.rang .daumen { width: 56px; height: 56px; }

#toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 12px; opacity: 0; transition: .25s; pointer-events: none; z-index: 20; max-width: 90vw; font-size: .92rem; }
#toast.zeigen { opacity: 1; transform: translateX(-50%) translateY(0); }
.leer-zustand { text-align: center; padding: 30px 10px; color: var(--leise); }
.leer-zustand svg { width: 48px; height: 48px; color: var(--gruen); margin-bottom: 8px; }
details summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.trenn { height: 1px; background: var(--linie); margin: 14px 0; }
