:root {
  --bg: #13151d;
  --card: #1c1f2a;
  --card2: #252937;
  --line: #2e3242;
  --text: #ece9e4;
  --muted: #8e93a6;
  --sleep: #a3adff;
  --sleep-bg: rgba(163, 173, 255, .14);
  --feed: #ffb48c;
  --feed-bg: rgba(255, 180, 140, .14);
  --diaper: #79d4c8;
  --diaper-bg: rgba(121, 212, 200, .14);
  --warn: #ff8d7e;
  --ok: #9bdc8f;
  --r: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; overscroll-behavior-y: none;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
.boot { padding: 40vh 0; text-align: center; color: var(--muted); }

.wrap { max-width: 560px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 92px); }

/* Kopf */
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.top h1 { font-size: 22px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
.top .age { color: var(--muted); font-size: 13px; text-align: right; }
.sync { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-left: 6px; vertical-align: middle; }
.sync.off { background: var(--warn); }
.sync.pend { background: var(--feed); }

/* Laufende Aktivität */
.live { border-radius: var(--r); padding: 16px 18px; margin-bottom: 12px; display: flex; align-items: center; gap: 14px; }
.live.sleep { background: var(--sleep-bg); }
.live.feed { background: var(--feed-bg); }
.live .what { font-size: 14px; color: var(--muted); }
.live .clock { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.live .grow { flex: 1; }
.live .btns { display: flex; flex-direction: column; gap: 8px; }

/* Prognose */
.pred { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.pcard { background: var(--card); border-radius: var(--r); padding: 14px 15px; min-height: 118px; display: flex; flex-direction: column; }
.pcard .lbl { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.pcard .dot { width: 8px; height: 8px; border-radius: 50%; }
.pcard.sleep .dot { background: var(--sleep); }
.pcard.feed .dot { background: var(--feed); }
.pcard .big { font-size: 24px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.pcard .sub { font-size: 14px; margin-top: 2px; }
.pcard .meta { font-size: 12px; color: var(--muted); margin-top: auto; padding-top: 8px; }
.pcard.now { box-shadow: inset 0 0 0 2px currentColor; }
.pcard.sleep.now { color: var(--sleep); }
.pcard.feed.now { color: var(--feed); }
.pcard.now .big, .pcard.now .sub { color: var(--text); }
.pcard.late .sub { color: var(--warn); }
.pcard .warnline { font-size: 13px; color: var(--warn); margin-top: 4px; }

/* Aktionen */
.acts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.act { background: var(--card); border-radius: var(--r); padding: 14px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; min-height: 84px; justify-content: center; transition: transform .08s; }
.act:active { transform: scale(.96); }
.act .ic { font-size: 26px; line-height: 1; }
.act.sleep { color: var(--sleep); }
.act.feed { color: var(--feed); }
.act.diaper { color: var(--diaper); }
.act span:last-child { color: var(--text); }
.act.on { box-shadow: inset 0 0 0 2px currentColor; }
.act.wide { grid-column: span 3; flex-direction: row; min-height: 64px; gap: 10px; font-size: 16px; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 4px 0 18px; }

/* Liste */
.sec { display: flex; justify-content: space-between; align-items: center; margin: 22px 2px 8px; }
.sec h2 { font-size: 15px; margin: 0; color: var(--muted); font-weight: 600; }
.link { color: var(--sleep); font-size: 14px; padding: 6px 2px; }
.list { background: var(--card); border-radius: var(--r); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); width: 100%; text-align: left; }
.row:first-child { border-top: 0; }
.row .t { font-variant-numeric: tabular-nums; width: 46px; color: var(--muted); font-size: 14px; }
.row .ic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; flex: none; }
.row .ic.sleep { background: var(--sleep-bg); }
.row .ic.feed, .row .ic.bottle { background: var(--feed-bg); }
.row .ic.diaper { background: var(--diaper-bg); }
.row .d { flex: 1; min-width: 0; }
.row .d small { display: block; color: var(--muted); font-size: 12px; }
.row .dur { font-variant-numeric: tabular-nums; font-size: 14px; }
.daysep { padding: 8px 14px; font-size: 12px; color: var(--muted); background: var(--card2); }
.empty { padding: 22px; text-align: center; color: var(--muted); font-size: 14px; }

/* Verlauf */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--card); border-radius: var(--r); padding: 12px 14px; }
.stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.day { background: var(--card); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; }
.day .h { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.day .h span { color: var(--muted); font-size: 12px; }
.bar { position: relative; height: 26px; background: var(--card2); border-radius: 8px; overflow: hidden; }
.bar i { position: absolute; top: 0; bottom: 0; }
.bar i.s { background: var(--sleep); opacity: .75; }
.bar i.f { background: var(--feed); top: 30%; bottom: 30%; border-radius: 3px; min-width: 3px; }
.bar i.now { background: var(--text); width: 2px; opacity: .6; }
.ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 3px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin: 0 2px 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* Formulare */
.card { background: var(--card); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
label.f { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
label.f input, label.f select { display: block; width: 100%; margin-top: 5px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card2); font-size: 16px; }
.btn { display: block; width: 100%; padding: 14px; border-radius: 14px; background: var(--sleep); color: #161827; font-weight: 650; font-size: 16px; text-align: center; }
.btn.sec2 { background: var(--card2); color: var(--text); }
.btn.danger { background: transparent; color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.btn.small { padding: 9px 14px; font-size: 14px; width: auto; display: inline-block; }
.btn + .btn { margin-top: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.note { font-size: 13px; color: var(--muted); line-height: 1.5; }
.err { color: var(--warn); font-size: 14px; margin: 8px 0; min-height: 1em; }
.login { padding-top: 12vh; }
.login h1 { font-size: 26px; }
.users { list-style: none; padding: 0; margin: 0 0 12px; }
.users li { padding: 8px 0; border-bottom: 1px solid var(--line); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.chip { padding: 10px 14px; border-radius: 12px; background: var(--card2); font-size: 15px; }
.chip.sel { background: var(--sleep); color: #161827; font-weight: 600; }

/* Navigation */
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(19, 21, 29, .94); backdrop-filter: blur(10px); border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
nav.tabs button { flex: 1; max-width: 180px; padding: 10px 0 12px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px; }
nav.tabs button .ic { font-size: 20px; filter: grayscale(1); opacity: .7; }
nav.tabs button.on { color: var(--text); }
nav.tabs button.on .ic { filter: none; opacity: 1; }

/* Bottom-Sheet */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 10; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.sheet { background: var(--card); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 10px 18px calc(env(safe-area-inset-bottom) + 18px); max-height: 92vh; overflow: auto; animation: up .18s ease-out; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }
.sheet h3 { margin: 0 0 14px; font-size: 18px; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
@keyframes fade { from { opacity: 0; } }

.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 84px); transform: translateX(-50%); background: var(--card2); padding: 10px 16px; border-radius: 12px; font-size: 14px; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.4); display: flex; gap: 14px; align-items: center; width: max-content; max-width: calc(100% - 32px); }
.toast button { white-space: nowrap; }
.toast button { color: var(--sleep); font-weight: 600; }

/* ---- v2 ---- */
.sync.poll { background: var(--muted); }
.planbtn { font: inherit; font-weight: inherit; color: inherit; padding: 0; }
.badge { display: inline-block; margin-top: 3px; padding: 2px 8px; border-radius: 8px; background: var(--card2); font-size: 11px; color: var(--text); }
.toggles { margin: 12px 0 4px; }
.toggle { display: flex; align-items: center; gap: 12px; padding: 9px 0; font-size: 15px; }
.toggle input { appearance: none; width: 44px; height: 26px; border-radius: 13px; background: var(--card2); position: relative; flex: none; transition: background .15s; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.toggle input:checked { background: var(--sleep-bg); box-shadow: inset 0 0 0 1px var(--sleep); }
.toggle input:checked::after { transform: translateX(18px); background: var(--sleep); }
.users li { display: flex; align-items: center; gap: 10px; }
.users .mname { flex: 1; }
.users .rname { color: var(--muted); font-size: 14px; }
.users select { padding: 7px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); font-size: 14px; }
.users .x { color: var(--warn); font-size: 16px; padding: 6px 8px; }
.invbox { margin-top: 12px; }
.invbox input { width: 100%; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card2); font-size: 13px; }
.card > b { display: block; margin-bottom: 8px; }
.card .btn.sec2 + .btn, .card .btn + .btn.sec2 { margin-top: 10px; }
button.link { display: block; margin: 14px auto; }
#push-btns .btn + .btn { margin-top: 10px; }
