/* Henry-Sitting – warme Labrador-Farben, Geschirr-Blau als Akzent (wie Henry in Run Teddy) */
:root {
  --bg: #fbf6ec; --card: #fffdf8; --ink: #3a2414; --muted: #8a7563; --line: #eadfcd;
  --accent: #2d3f9a; --accent-ink: #fff; --lab: #f3e3bd; --lab-d: #e0c690;
  --ok: #2f9a5a; --ok-bg: #e2f5e8; --warn: #d98a00; --warn-bg: #fff1d6; --maybe: #6a5acd; --maybe-bg: #ece9fb; --bad: #c8463d; --bad-bg: #fbe5e2;
  --money: #b5640f; --money-bg: #fdeedd;
  --r: 18px; --shadow: 0 1px 0 rgba(58,36,20,.04), 0 6px 20px rgba(58,36,20,.07);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1813; --card: #2a211a; --ink: #f6ead8; --muted: #b4a08b; --line: #3d3127;
    --accent: #8ea0ff; --accent-ink: #141a3a; --lab: #4a3b2a; --lab-d: #6a5438;
    --ok: #6fd69a; --ok-bg: #1f3a29; --warn: #ffbf4d; --warn-bg: #3d2f14; --maybe: #b3a8ff; --maybe-bg: #2c2848; --bad: #ff8a80; --bad-bg: #44221f;
    --money: #ffb36b; --money-bg: #3f2a16; --shadow: 0 6px 20px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.4; }
body.noscroll { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea { font: inherit; font-size: 16px; color: var(--ink); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.8rem; font-weight: 900; }
h2 { font-size: 1.3rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.vh { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
.err { color: var(--bad); font-weight: 600; margin: 10px 0 0; }
.note { background: var(--warn-bg); color: var(--ink); border-radius: 12px; padding: 10px 12px; font-size: .92rem; margin: 10px 0; }
.ico { width: 1.3em; height: 1.3em; vertical-align: -.3em; color: var(--accent); }
img.mini { width: 1.5em; height: 1.5em; border-radius: 6px; vertical-align: -.4em; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border-radius: 14px; background: var(--lab); font-weight: 700; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px rgba(45,63,154,.25); }
.btn.big { width: 100%; padding: 15px; font-size: 1.08rem; margin-top: 12px; }
.btn.wide { width: 100%; margin-top: 10px; }
.btn.ghost { background: transparent; border: 2px dashed var(--lab-d); color: var(--ink); }
.btn.danger { background: var(--bad-bg); color: var(--bad); }
.linkbtn { color: var(--accent); font-weight: 700; padding: 14px; display: block; margin: 8px auto 0; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; font-size: 1.6rem; line-height: 1; background: var(--lab); font-weight: 800; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 11px; border-radius: 999px; background: var(--lab); font-size: .85rem; font-weight: 700; white-space: nowrap; }
.chip.on { background: var(--accent); color: var(--accent-ink); }
.chip.st.s-offen { background: var(--warn-bg); color: var(--warn); }
.chip.st.s-zugesagt { background: var(--ok-bg); color: var(--ok); }
.chip.st.s-vielleicht { background: var(--maybe-bg); color: var(--maybe); }
.chip.st.s-abgesagt { background: var(--bad-bg); color: var(--bad); }
.chip.paid { background: var(--ok-bg); color: var(--ok); }
.chip.unpaid { background: var(--money-bg); color: var(--money); }
.banner { display: block; width: calc(100% - 32px); max-width: 528px; margin: 10px auto 0; text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.banner.warn { width: 100%; margin: 0 0 12px; background: var(--warn-bg); color: var(--ink); border: 2px solid var(--warn); }

/* Login & Anleitung */
.login, .guide { max-width: 440px; margin: 0 auto; padding: calc(28px + var(--safe-t)) 20px calc(30px + var(--safe-b)); text-align: center; }
.login-henry, .guide-henry { display: block; margin: 0 auto 4px; filter: drop-shadow(0 8px 14px rgba(58,36,20,.15)); }
.login form { margin-top: 22px; text-align: left; }
.who { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.who-btn input { position: absolute; opacity: 0; pointer-events: none; }
.who-btn span { display: block; text-align: center; padding: 12px 4px; border-radius: 14px; background: var(--lab); font-weight: 800; border: 2px solid transparent; }
.who-btn input:checked + span { background: var(--accent); color: var(--accent-ink); }
.who-btn input:focus-visible + span { border-color: var(--ink); }
.field { display: block; margin-top: 12px; }
.field > span:first-child { display: block; font-size: .85rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea, .answer textarea, .dt-row input { width: 100%; border: 2px solid var(--line); background: var(--bg); border-radius: 12px; padding: 11px 12px; outline: none; }
.field input:focus, .field textarea:focus, .answer textarea:focus, .dt-row input:focus { border-color: var(--accent); }
.guide h1 { font-size: 1.5rem; margin-top: 6px; }
.guide .card { text-align: left; margin-top: 18px; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.steps li:last-child { border-bottom: 0; }
.steps small { display: block; color: var(--muted); margin-top: 3px; }
.num { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 900; }

/* App-Rahmen */
#app { min-height: 100%; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); max-width: 560px; margin: 0 auto; }
.top-henry { border-radius: 10px; }
.top-title { flex: 1; display: flex; flex-direction: column; }
.top-title b { font-size: 1.1rem; font-weight: 900; }
.top-title span { font-size: .8rem; color: var(--muted); font-weight: 700; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--lab); font-weight: 900; font-size: 1.1rem; display: grid; place-items: center; }
.avatar.big { width: 72px; height: 72px; font-size: 2rem; margin: 0 auto 8px; background: var(--accent); color: var(--accent-ink); }
.main { max-width: 560px; margin: 0 auto; padding: 12px 16px calc(110px + var(--safe-b)); }

/* Tabs unten */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: space-around; align-items: center; padding: 8px 20px calc(8px + var(--safe-b)); background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tab { position: relative; flex: 1; max-width: 160px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px; color: var(--muted); font-size: .78rem; font-weight: 800; border-radius: 14px; }
.tab svg { width: 27px; height: 27px; }
.tab.on { color: var(--accent); }
.tab .dot { position: absolute; top: 0; left: calc(50% + 8px); min-width: 19px; height: 19px; border-radius: 10px; background: var(--bad); color: #fff; font-style: normal; font-size: .72rem; display: grid; place-items: center; padding: 0 5px; }
.fab { width: 62px; height: 62px; margin-top: -30px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 8px 22px rgba(45,63,154,.4); border: 4px solid var(--bg); flex: 0 0 auto; transition: transform .1s; }
.fab:active { transform: scale(.94); }
.fab svg { width: 28px; height: 28px; }

/* Kalender */
.cal { padding: 14px 10px 12px; position: relative; }
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; }
.cal-head h2 { font-size: 1.2rem; }
.today-chip { display: table; margin: -4px auto 8px; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.wd span { text-align: center; font-size: .75rem; font-weight: 800; color: var(--muted); padding-bottom: 6px; }
.day { aspect-ratio: 1 / 1.08; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; padding-top: 6px; border-radius: 12px; margin: 1px; }
.day .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .95rem; }
.day.other { opacity: .35; }
.day.past .n { color: var(--muted); }
.day.today .n { box-shadow: inset 0 0 0 2px var(--accent); color: var(--accent); }
.day.sel .n { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.day:active { background: var(--lab); }
.pills { display: flex; gap: 3px; height: 7px; }
.pill { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.s-offen { background: var(--warn); }
.pill.s-zugesagt { background: var(--ok); }
.pill.s-vielleicht { background: var(--maybe); }
.pill.s-abgesagt { background: var(--bad); opacity: .55; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 10px; font-size: .75rem; color: var(--muted); font-weight: 700; }
.legend .pill { margin-right: 4px; vertical-align: 0; }
.day-head { padding: 18px 4px 8px; }

/* Termin-Karten */
.ev { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 12px 12px 14px; margin-bottom: 10px; border-left: 6px solid var(--muted); }
.ev.s-offen { border-left-color: var(--warn); }
.ev.s-zugesagt { border-left-color: var(--ok); }
.ev.s-vielleicht { border-left-color: var(--maybe); }
.ev.s-abgesagt { border-left-color: var(--bad); opacity: .75; }
.ev:active { transform: scale(.99); }
.ev-date { flex: 0 0 44px; display: flex; flex-direction: column; align-items: center; background: var(--lab); border-radius: 12px; padding: 6px 0; }
.ev-date b { font-size: 1.3rem; font-weight: 900; line-height: 1; }
.ev-date small { font-size: .72rem; font-weight: 800; color: var(--muted); }
.ev-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ev-time { font-weight: 800; }
.ev-meta { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.ev-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.ev-reply { font-size: .85rem; font-style: italic; }
.chev { color: var(--muted); font-size: 1.5rem; }
.empty { text-align: center; padding: 18px 10px 10px; color: var(--muted); }
.empty img { opacity: .9; }
.empty p { margin: 6px 0 12px; font-weight: 700; }

/* Liste */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { text-align: left; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 1.8rem; font-weight: 900; line-height: 1; }
.stat span { font-size: .82rem; font-weight: 700; color: var(--muted); }
.stat.warn { background: var(--warn-bg); }
.stat.warn b { color: var(--warn); }
.stat.money { background: var(--money-bg); }
.stat.money b { color: var(--money); }
.stat.ok b { color: var(--ok); }
.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip { padding: 8px 14px; font-size: .9rem; }
.month-h { margin: 14px 4px 8px; font-size: .9rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* Bottom Sheet */
#sheet-root .backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(30,18,10,.4); opacity: 0; transition: opacity .2s; }
#sheet-root .sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-width: 560px; margin: 0 auto; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 24px 24px 0 0; padding: 8px 20px calc(24px + var(--safe-b)); transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.9,.3,1); }
#sheet-root.open .backdrop { opacity: 1; }
#sheet-root.open .sheet { transform: none; }
.grab { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 14px; }
.sheet h2 { margin-bottom: 8px; }
.sheet .center img { display: block; margin: 0 auto 6px; }
.detail h2 { margin-top: 10px; }
.big-time { font-size: 1.2rem; font-weight: 800; margin: 4px 0 6px; }
.note-box, .reply-box { background: var(--bg); border-radius: 12px; padding: 12px; margin-top: 10px; }
.reply-box { background: var(--maybe-bg); }
.answer { margin-top: 18px; }
.answer h3 { margin-bottom: 10px; }
.answer-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.btn.ans { flex-direction: column; gap: 2px; font-size: 1.5rem; padding: 12px 6px; border: 2px solid transparent; }
.btn.ans span { font-size: .9rem; }
.btn.ans.yes { background: var(--ok-bg); color: var(--ok); }
.btn.ans.maybe { background: var(--maybe-bg); color: var(--maybe); }
.btn.ans.no { background: var(--bad-bg); color: var(--bad); }
.btn.ans.on { border-color: currentColor; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.pay { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--money-bg); }
.pay.is-paid { background: var(--ok-bg); }
.field.inline { display: flex; align-items: center; justify-content: space-between; margin: 0; }
.field.inline > span:first-child { margin: 0; }
.money-in { position: relative; display: block; }
.field.inline .money-in { width: 130px; }
.money-in input { padding-right: 32px !important; text-align: right; }
.money-in em { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-weight: 800; color: var(--muted); }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.slider { width: 52px; height: 30px; border-radius: 15px; background: var(--line); position: relative; transition: background .2s; flex: 0 0 auto; }
.slider::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::after { transform: translateX(22px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.form .presets { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.dt-row { display: grid; grid-template-columns: 34px 1fr 108px; gap: 8px; align-items: center; margin-top: 12px; }
.dt-label { font-weight: 800; color: var(--muted); font-size: .9rem; }
.dt-row input { padding: 10px 8px; min-height: 46px; -webkit-appearance: none; appearance: none; }
.settings { margin: 14px 0 10px; }
.set-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }

/* Toast */
#toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 20px); z-index: 60; background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: all .25s; max-width: calc(100% - 40px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }

@media (min-width: 700px) { .main { padding-top: 20px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
