:root {
  --bg: #f4f6f5; --flaeche: #ffffff; --flaeche-2: #eef1f0; --linie: #e2e7e5;
  --text: #13201c; --text-2: #5c6b66; --akzent: #0f766e; --akzent-zart: #d7efeb;
  --rot: #dc4c3e; --rot-zart: #fbe4e1; --gelb: #e0a526; --gruen: #2f9e6e; --blau: #3b6fd8;
  --schatten: 0 1px 2px rgba(19, 32, 28, .05), 0 4px 16px rgba(19, 32, 28, .05);
  --rund: 20px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1312; --flaeche: #181e1c; --flaeche-2: #222a28; --linie: #2b3432;
    --text: #e8efec; --text-2: #96a6a0; --akzent: #3cc3b1; --akzent-zart: #173a35;
    --rot: #f0705f; --rot-zart: #3d2020; --schatten: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased;
  user-select: none; -webkit-user-select: none; overflow-x: clip; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
input, textarea { user-select: text; -webkit-user-select: text; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.seite { max-width: 640px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 16px 20px; display: flex; flex-direction: column; gap: 14px; }
.kopf { display: flex; align-items: baseline; justify-content: space-between; padding: 6px 2px 2px; }
.kopf h1 { font-size: 30px; font-weight: 800; }
.kopf small { color: var(--text-2); font-size: 15px; }
.karte { background: var(--flaeche); border-radius: var(--rund); box-shadow: var(--schatten); padding: 16px; }
.karte h2 { font-size: 18px; font-weight: 750; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.karte h2 small { font-size: 13px; font-weight: 600; color: var(--text-2); }
.leise { color: var(--text-2); font-size: 14px; }
.knopf { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 14px 16px; border-radius: 16px; font-weight: 700; background: var(--akzent); color: #fff; }
.knopf.zart { background: var(--flaeche-2); color: var(--text); }
.knopf.rot { background: var(--rot); color: #fff; }
.knopf.klein { width: auto; padding: 9px 14px; border-radius: 12px; font-size: 15px; }
.knopf:disabled { opacity: .55; }
.reihe { display: flex; gap: 10px; }
.reihe > * { flex: 1; }

/* Kopfschmerz-Schnellkarte */
.ks-gross { display: flex; flex-direction: column; gap: 12px; }
.ks-gross .knopf { padding: 18px; font-size: 18px; border-radius: 18px; background: var(--rot); }
.ks-laeuft { background: var(--rot-zart); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ks-laeuft b { font-size: 20px; }

/* Werte-Raster */
.werte { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.wert { background: var(--flaeche-2); border-radius: 14px; padding: 10px; min-width: 0; }
.wert b { display: block; font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }
.wert span { font-size: 12px; color: var(--text-2); }

/* Ausblick */
.ausblick { border-left: 4px solid var(--gelb); }
.ausblick.ruhig { border-left-color: var(--gruen); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; border-radius: 999px; background: var(--flaeche-2); font-size: 15px; font-weight: 600; border: 2px solid transparent; }
.chip[aria-pressed="true"] { background: var(--akzent-zart); border-color: var(--akzent); color: var(--text); }
.feld { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.feld > label, .feld > .titel { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
input[type=text], input[type=password], input[type=date], input[type=time], textarea {
  width: 100%; min-width: 0; font: inherit; color: var(--text); background: var(--flaeche-2); border: 0; border-radius: 12px; padding: 12px; -webkit-appearance: none; appearance: none; }
textarea { min-height: 70px; resize: vertical; }

/* Stärke 1–10 */
.skala { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.skala button { aspect-ratio: 1; border-radius: 10px; font-weight: 800; background: var(--flaeche-2); font-size: 15px; }
.skala button[aria-pressed="true"] { color: #fff; }

/* Tagescheck */
.check { display: flex; flex-direction: column; gap: 12px; }
.check-zeile { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.check-zeile > span { font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 36px; height: 36px; border-radius: 50%; background: var(--flaeche-2); font-size: 20px; font-weight: 700; }
.stepper b { min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; }

/* 14-Tage-Streifen */
.streifen { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; }
.streifen div { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--text-2); }
.streifen i { width: 100%; aspect-ratio: 1; border-radius: 7px; background: var(--flaeche-2); display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 11px; color: #fff; }

/* Listen */
.eintrag { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--linie); width: 100%; text-align: left; }
.eintrag:first-of-type { border-top: 0; }
.eintrag .punkt { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; }
.eintrag .mitte { flex: 1; min-width: 0; }
.eintrag .mitte b { display: block; }
.eintrag .mitte span { font-size: 13px; color: var(--text-2); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eintrag .rechts { font-size: 14px; color: var(--text-2); text-align: right; flex: none; }

/* Balken */
.balken { display: flex; flex-direction: column; gap: 8px; }
.balken .z { display: grid; grid-template-columns: 110px 1fr 44px; gap: 8px; align-items: center; font-size: 14px; }
.balken .spur { height: 10px; border-radius: 6px; background: var(--flaeche-2); overflow: hidden; }
.balken .spur i { display: block; height: 100%; background: var(--akzent); border-radius: 6px; }
.balken .z b { text-align: right; font-variant-numeric: tabular-nums; }
.wochen { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; align-items: end; height: 120px; }
.wochen div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; font-size: 11px; color: var(--text-2); }
.wochen i { width: 100%; background: var(--akzent); border-radius: 6px 6px 3px 3px; min-height: 2px; }
.wochen b { font-size: 11px; color: var(--text); }

/* Muster-Karten */
.faktor { padding: 12px 0; border-top: 1px solid var(--linie); }
.faktor:first-of-type { border-top: 0; padding-top: 0; }
.faktor h3 { font-size: 16px; display: flex; justify-content: space-between; gap: 8px; }
.faktor h3 span { color: var(--rot); white-space: nowrap; }
.faktor.gut h3 span { color: var(--gruen); }
.vergleich { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--text-2); }
.vergleich .spur { height: 8px; border-radius: 5px; background: var(--flaeche-2); overflow: hidden; margin-top: 3px; }
.vergleich .spur i { display: block; height: 100%; background: var(--rot); }
.vergleich div:last-child .spur i { background: var(--text-2); }
.ki-text { font-size: 15px; line-height: 1.55; user-select: text; -webkit-user-select: text; }
.ki-text h3 { font-size: 16px; margin: 14px 0 4px; }
.ki-text ul { margin: 4px 0; padding-left: 20px; }
.ki-text p { margin: 6px 0; }
.hinweis { background: var(--flaeche-2); border-radius: 14px; padding: 12px; font-size: 14px; color: var(--text-2); }
.warnung { background: var(--rot-zart); border-radius: 14px; padding: 12px; font-size: 14px; }

/* Tab-Leiste */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: color-mix(in srgb, var(--flaeche) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--linie); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--text-2); border-radius: 12px; }
.tabs button svg { width: 24px; height: 24px; }
.tabs button[aria-selected="true"] { color: var(--akzent); }

/* Blatt (Formular) */
.schleier { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; justify-content: center; animation: ein .2s ease; }
.blatt { background: var(--bg); width: 100%; max-width: 640px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom)); animation: hoch .28s cubic-bezier(.2, .9, .3, 1); }
.blatt .griff { width: 40px; height: 5px; border-radius: 3px; background: var(--linie); margin: 0 auto 12px; }
.blatt h2 { font-size: 22px; margin-bottom: 4px; }
.blatt .knoepfe { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
@keyframes ein { from { opacity: 0; } }
@keyframes hoch { from { transform: translateY(100%); } }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 15px; max-width: 90vw; text-align: center; }

/* Anmeldung */
.anmeldung { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.anmeldung form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.anmeldung img { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 6px; }
.versteckt { display: none !important; }
