/* Symptomtagebuch – ruhige Wohlfühl-App. Mobile-first, eine Spalte, Karten mit viel Luft. */
:root {
  --bg: #F6F1E7;
  --card: #FFFDF8;
  --text: #1F3D2E;
  --muted: #5B7263;
  --line: #E8DFCE;
  --primary: #1E7A5A;
  --primary-press: #17654A;
  --on-primary: #FFFFFF;
  --mint: #CFEDE0;
  --mint-text: #1F3D2E;
  --lav: #E4DCF3;
  --lav-strong: #6B4FA0;
  --rose: #F6D6DC;
  --rose-strong: #C8557A;
  --rose-deep: #8E2F52;
  --sun: #F4C542;
  --sun-soft: #FBEDC0;
  --sun-text: #5E4A08;
  --deep: #1F3D2E;
  --deep-text: #F6F1E7;
  --deep-accent: #F4C542;
  --pain-1: #D9CCF0;
  --pain-2: #F2B8C6;
  --pain-3: #C8557A;
  --body-fill: #E4F3EB;
  --body-stroke: #9ED3B9;
  --cal-good: #8FD9B6;
  --cal-mid: #FCE39A;
  --cal-bad: #EFA3B8;
  --cal-text: #1F3D2E;
  --shadow: 0 1px 2px rgba(31, 61, 46, .05);
  --font: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 999px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121D17; --card: #1A2A21; --text: #E8F1EB; --muted: #A3B8AA; --line: #2B3E33;
    --primary: #3AA47C; --primary-press: #2F8D69; --on-primary: #0E1913;
    --mint: #1E3A2E; --mint-text: #E8F1EB; --lav: #2A2440; --lav-strong: #B9A3E8;
    --rose: #3A2229; --rose-strong: #E886A6; --rose-deep: #E886A6;
    --sun: #F4C542; --sun-soft: #3A321A; --sun-text: #F8DE8A;
    --deep: #0D1511; --deep-text: #E8F1EB; --deep-accent: #F4C542;
    --body-fill: #22382D; --body-stroke: #3F6B55;
    --cal-good: #2F7A5A; --cal-mid: #8A7426; --cal-bad: #8E3F58; --cal-text: #F4F8F5;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121D17; --card: #1A2A21; --text: #E8F1EB; --muted: #A3B8AA; --line: #2B3E33;
  --primary: #3AA47C; --primary-press: #2F8D69; --on-primary: #0E1913;
  --mint: #1E3A2E; --mint-text: #E8F1EB; --lav: #2A2440; --lav-strong: #B9A3E8;
  --rose: #3A2229; --rose-strong: #E886A6; --rose-deep: #E886A6;
  --sun: #F4C542; --sun-soft: #3A321A; --sun-text: #F8DE8A;
  --deep: #0D1511; --deep-text: #E8F1EB; --deep-accent: #F4C542;
  --body-fill: #22382D; --body-stroke: #3F6B55;
  --cal-good: #2F7A5A; --cal-mid: #8A7426; --cal-bad: #8E3F58; --cal-text: #F4F8F5;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
a { color: var(--primary); }

.app {
  max-width: 620px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px calc(110px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 900px) { .app.wide { max-width: 1040px; } }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 > * { min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }

/* Kopfbereich */
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.top .date { font-size: 14px; color: var(--muted); font-weight: 600; }
.top h1 { font-size: 27px; font-weight: 800; letter-spacing: -.01em; }
.icon-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--lav); color: var(--lav-strong); flex: none;
}
.icon-btn.plain { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.icon-btn svg { width: 22px; height: 22px; }

/* Karten */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.card.tint-mint { background: var(--mint); border-color: transparent; color: var(--mint-text); }
.card.tint-lav { background: var(--lav); border-color: transparent; }
.card.tint-rose { background: var(--rose); border-color: transparent; }
.card.tint-sun { background: var(--sun-soft); border-color: transparent; }
.card.deep { background: var(--deep); color: var(--deep-text); border-color: transparent; }
.card h2 { font-size: 19px; font-weight: 800; }
.card h3 { font-size: 17px; font-weight: 800; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 2px -4px; }
.section-title h2 { font-size: 20px; font-weight: 800; }

/* Befinden */
.mood-num { font-size: 56px; font-weight: 900; line-height: 1; }
.mood-of { font-size: 22px; font-weight: 700; margin-left: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: var(--r-sm); background: var(--card); font-weight: 700; font-size: 15px; }
.pill.bad { color: var(--rose-deep); }
.pill.mid { color: var(--sun-text); }
.pill.good { color: var(--primary); }
.pill.done { background: var(--mint); color: var(--primary); font-size: 14px; padding: 4px 12px; }
.pill.open { background: var(--sun-soft); color: var(--sun-text); font-size: 14px; padding: 4px 12px; }

/* Slider */
.slider { display: flex; flex-direction: column; gap: 6px; }
.slider .lbl { display: flex; justify-content: space-between; font-weight: 700; }
.slider .val { font-weight: 800; font-variant-numeric: tabular-nums; }
.slider .ends { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; margin: 0;
  --pct: 50%; --fill: var(--primary);
}
input[type=range]::-webkit-slider-runnable-track {
  height: 8px; border-radius: 8px;
  background: linear-gradient(to right, var(--fill) var(--pct), var(--card) var(--pct));
  border: 1px solid var(--line);
}
input[type=range]::-moz-range-track { height: 8px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); }
input[type=range]::-moz-range-progress { height: 8px; border-radius: 8px; background: var(--fill); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; border-radius: 50%; margin-top: -11px;
  background: var(--fill); border: 4px solid var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--fill); border: 4px solid var(--card); }
input[type=range].unset::-webkit-slider-thumb { background: var(--muted); }
.slider.rose input { --fill: var(--rose-strong); }
.slider.lav input { --fill: var(--lav-strong); }

/* Check-Kacheln */
.check-tile { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: var(--r-lg); padding: 18px; min-height: 176px; }
.check-tile .ico { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; }
.check-tile .ico.sun { background: var(--sun); color: #5E4A08; }
.check-tile .ico.moon { background: var(--lav); color: var(--lav-strong); }
.check-tile .ico svg { width: 24px; height: 24px; }
.check-tile h3 { font-size: 17px; font-weight: 800; }
.check-tile p { margin: 0; color: var(--muted); font-size: 14.5px; }
.check-tile .spacer { flex: 1; }

/* Buttons */
.btn { min-height: 52px; padding: 12px 22px; border-radius: 16px; border: 0; background: var(--primary); color: var(--on-primary); font-weight: 800; font-size: 16.5px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { background: var(--primary-press); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn.sun { background: var(--sun); color: #3D3005; }
.btn.danger { background: var(--rose-strong); color: #fff; }
.btn.small { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.btn svg { width: 20px; height: 20px; }
.link-btn { background: none; border: 0; color: var(--primary); font-weight: 700; padding: 10px 4px; min-height: 44px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { min-height: 44px; padding: 8px 18px; border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-size: 15px; }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chips.lav .chip[aria-pressed="true"] { background: var(--lav-strong); border-color: var(--lav-strong); color: #fff; }
.chips.rose .chip[aria-pressed="true"] { background: var(--rose-deep); border-color: var(--rose-deep); color: #fff; }
:root[data-theme="dark"] .chips.lav .chip[aria-pressed="true"], :root[data-theme="dark"] .chips.rose .chip[aria-pressed="true"] { color: #1A1426; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chips.lav .chip[aria-pressed="true"], :root:not([data-theme="light"]) .chips.rose .chip[aria-pressed="true"] { color: #1A1426; } }

/* Segmented */
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { min-height: 44px; min-width: 64px; padding: 6px 14px; border: 0; border-radius: 10px; background: transparent; font-weight: 700; font-size: 15px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.seg.full { display: flex; } .seg.full button { flex: 1; }
.seg.grid2x { display: grid; grid-template-columns: 1fr 1fr; }
.seg.grid2x button:last-child:nth-child(odd) { grid-column: 1 / -1; }
.seg.rose button[aria-pressed="true"] { background: var(--rose-deep); color: #fff; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .field > .flabel { font-weight: 700; }
.field-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Stepper */
.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.stepper button { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--bg); font-size: 22px; font-weight: 800; display: grid; place-items: center; }
.stepper output { min-width: 64px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

input[type=time], input[type=date], input[type=text], input[type=number], textarea, select {
  min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); width: 100%;
}
textarea { min-height: 96px; resize: vertical; }

/* Einflüsse */
.inf { border-radius: var(--r-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; text-align: left; border: 1px solid transparent; min-height: 118px; background: var(--card); }
.inf .k { font-size: 14.5px; font-weight: 700; }
.inf .v { font-size: 23px; font-weight: 900; line-height: 1.25; }
.inf .s { font-size: 14px; }
.inf.sun { background: var(--sun-soft); } .inf.sun .k, .inf.sun .s { color: var(--sun-text); }
.inf.rose { background: var(--rose); } .inf.rose .k, .inf.rose .s { color: var(--rose-deep); }
.inf.lav { background: var(--lav); } .inf.lav .k, .inf.lav .s { color: var(--lav-strong); }
.inf.mint { background: var(--mint); } .inf.mint .k, .inf.mint .s { color: var(--primary); }
.inf.plain { border-color: var(--line); } .inf.plain .k, .inf.plain .s { color: var(--rose-deep); }
.inf .v.pending { font-size: 17px; font-weight: 800; opacity: .75; }

/* Fortschritt */
.bar { height: 10px; border-radius: 10px; background: rgba(255,255,255,.15); overflow: hidden; }
.bar > i { display: block; height: 100%; background: #7FD1AC; border-radius: 10px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.steps i { height: 6px; border-radius: 6px; background: var(--line); }
.steps i.on { background: var(--primary); }

/* Check-Kopf */
.check-head { display: flex; gap: 14px; align-items: center; }
.check-head .eyebrow { font-size: 14px; color: var(--muted); font-weight: 600; }
.check-head h1 { font-size: 23px; font-weight: 800; }

/* Körperkarte */
.bodymap { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bodymap figure { margin: 0; text-align: center; }
.bodymap figcaption { font-weight: 800; font-size: 14.5px; margin-bottom: 4px; }
.bodymap svg { width: 100%; max-width: 190px; height: auto; touch-action: manipulation; }
.bodymap .base { fill: var(--body-fill); stroke: var(--body-stroke); stroke-width: 1.2; }
.bodymap .z { fill: var(--body-fill); stroke: var(--body-stroke); stroke-width: 1.2; cursor: pointer; }
.bodymap .z.l1 { fill: var(--pain-1); } .bodymap .z.l2 { fill: var(--pain-2); } .bodymap .z.l3 { fill: var(--pain-3); }
.bodymap .z.sel { stroke: var(--primary); stroke-width: 2.4; stroke-dasharray: 4 3; }
.bodymap .side { font-size: 8px; fill: var(--muted); font-family: var(--font); font-weight: 700; }
.legend { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; font-size: 14.5px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; }
.subgrid { display: grid; gap: 8px; }
.rose-sel .chip[aria-pressed="true"] { background: var(--rose-deep); border-color: var(--rose-deep); color: var(--card); }
.subgrid .chip { padding: 8px 6px; font-size: 14px; }
.zone-list { display: flex; flex-direction: column; }
.zone-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 48px; padding: 6px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; font-weight: 700; width: 100%; }
.zone-row:last-child { border-bottom: 0; }
.zone-row .iv { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.zone-row.sel { color: var(--primary); }
.big-val { font-size: 30px; font-weight: 900; color: var(--rose-deep); }

/* Listen */
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; min-height: 52px; }
.list-row .t { font-weight: 700; }
.check-row { display: flex; align-items: center; gap: 14px; padding: 10px 14px; background: var(--card); border-radius: 14px; min-height: 52px; border: 0; width: 100%; text-align: left; }
.box { width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--muted); display: grid; place-items: center; flex: none; }
.check-row[aria-pressed="true"] .box { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.check-row .t { flex: 1; font-weight: 700; }
.supp-group { font-size: 13px; font-weight: 800; color: var(--sun-text); text-transform: uppercase; letter-spacing: .05em; margin: 6px 2px -4px; }
.supp-note { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.edit-row.supp { flex-wrap: wrap; }
.edit-row.supp input[type=text]:first-child { flex: 1 1 100%; }
.edit-row .note-in { flex: 1 1 120px !important; font-weight: 600 !important; border: 1px solid var(--line) !important; border-radius: 10px; min-height: 40px !important; }
.check-row .when { font-size: 13px; color: var(--sun-text); font-weight: 700; }

/* Banner, Toast */
.banner { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--sun-soft); color: var(--sun-text); }
.banner b { color: var(--text); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); background: var(--deep); color: var(--deep-text); padding: 12px 20px; border-radius: 14px; font-weight: 700; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: calc(100% - 32px); }

/* Navigation */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--card); border-top: 1px solid var(--line);
  padding: 6px max(8px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.nav ul { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); max-width: 620px; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 58px; justify-content: center; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 13px; border-radius: 14px; }
.nav a svg { width: 24px; height: 24px; }
.nav a[aria-current="page"] { color: var(--primary); }
.nav a[aria-current="page"] .pip { background: var(--mint); }
.nav .pip { padding: 4px 18px; border-radius: 999px; display: grid; place-items: center; }

/* Kalender */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .wd { text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); padding-bottom: 2px; }
.cal button { aspect-ratio: 1; max-width: 100%; border: 0; border-radius: 12px; background: var(--bg); font-weight: 800; font-variant-numeric: tabular-nums; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; min-height: 44px; }
.cal button.good { background: var(--cal-good); color: var(--cal-text); }
.cal button.mid { background: var(--cal-mid); color: var(--cal-text); }
.cal button.bad { background: var(--cal-bad); color: var(--cal-text); }
.cal button.today { outline: 2.5px solid var(--primary); outline-offset: 1px; }
.cal button.future { opacity: .4; }
.cal .marks { display: flex; gap: 2px; height: 6px; }
.cal .marks i { width: 6px; height: 6px; border-radius: 50%; }
.m-full { background: var(--lav-strong); } .m-kp { background: #B88A00; } .m-period { background: var(--rose-deep); } .m-black { background: var(--text); } .m-hol { background: var(--primary); }

.notice { font-size: 14px; padding: 10px 14px; border-radius: 12px; background: var(--lav); color: var(--lav-strong); font-weight: 700; }
.editing { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 14px; background: var(--sun-soft); color: var(--sun-text); font-weight: 700; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .gl { stroke: var(--line); }
.chart .ln { stroke: var(--primary); fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.chart .ar { fill: var(--mint); opacity: .6; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }

/* Sheet */
.sheet-bg { position: fixed; inset: 0; background: rgba(15, 30, 22, .45); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 620px; border-radius: 26px 26px 0 0; padding: 22px max(18px, env(safe-area-inset-right, 0px)) calc(22px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; max-height: 88vh; overflow-y: auto; }

.edit-row { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.edit-row input[type=text] { border: 0; background: transparent; min-height: 44px; padding: 6px; flex: 1; min-width: 0; font-weight: 700; }
.edit-row select { width: auto; min-height: 40px; padding: 6px 8px; font-size: 14px; }
.edit-row.hidden-item input { opacity: .5; text-decoration: line-through; }
.edit-row .icon-btn { width: 40px; height: 40px; background: transparent; color: var(--muted); }
details.group { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 4px 18px; }
details.group > summary { min-height: 56px; display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: 17px; cursor: pointer; list-style: none; }
details.group > summary::-webkit-details-marker { display: none; }
details.group[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
details.group .inner { display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; }

@media (min-width: 900px) {
  .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
}
@media (max-width: 370px) {
  .grid2 { gap: 10px; } .inf .v { font-size: 20px; } .top h1 { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
