/* Design "1e-ring", per docs/design/mock-konzept.html.
   The app is always light except inside the configured night window; the OS
   prefers-color-scheme is deliberately ignored (owner override, see
   docs/61-gap-analysis.md). Dark is a token swap (body[data-theme="dark"] /
   body.night), not a second set of rules -- every rule below reads its colours
   from the variables. */
:root {
  --ground: #eef3fb;
  --surface: #ffffff;
  --sky: #d6e6fa;
  --sky-deep: #9dbfe6;
  --lav: #e3ddf7;
  --lav-deep: #b3a7df;
  --mint: #d8ecec;
  --ink: #222c3f;
  --ink-soft: #56637c;
  --page: linear-gradient(168deg, #f4f7fd 0%, #e9eff9 55%, #eae7f6 100%);
  --card-wash: linear-gradient(155deg, rgba(214, 230, 250, .72), rgba(227, 221, 247, .55) 62%, rgba(255, 255, 255, 0) 100%);
  --grad: linear-gradient(150deg, #bcd6f4, #c9c2ee);
  --grad-soft: linear-gradient(160deg, #cfe0f8, #ddd6f5);
  --ring-a: #9dbfe6;
  --ring-b: #b3a7df;
  --tint: rgba(157, 191, 230, .38);
  --sel: rgba(214, 230, 250, .7);
  --ring-track: rgba(157, 191, 230, .28);
  --hair: rgba(120, 150, 190, .10);
  --hair-strong: rgba(120, 150, 190, .16);
  --lift: 0 22px 44px -22px rgba(74, 101, 150, .42), 0 4px 14px -8px rgba(74, 101, 150, .30);
  --lift-lo: 0 12px 26px -16px rgba(74, 101, 150, .38);
  --warn-bg: #fbe8c8;
  --warn-line: #dd9f33;
  --warn-ink: #5a3c05;
  --warn-btn-ink: #2e2000;
  --r: 26px;
}

body[data-theme="light"] {
  --ground: #eef3fb;
  --surface: #ffffff;
  --sky: #d6e6fa;
  --sky-deep: #9dbfe6;
  --lav: #e3ddf7;
  --lav-deep: #b3a7df;
  --mint: #d8ecec;
  --ink: #222c3f;
  --ink-soft: #56637c;
  --page: linear-gradient(168deg, #f4f7fd 0%, #e9eff9 55%, #eae7f6 100%);
  --card-wash: linear-gradient(155deg, rgba(214, 230, 250, .72), rgba(227, 221, 247, .55) 62%, rgba(255, 255, 255, 0) 100%);
  --grad: linear-gradient(150deg, #bcd6f4, #c9c2ee);
  --grad-soft: linear-gradient(160deg, #cfe0f8, #ddd6f5);
  --ring-a: #9dbfe6;
  --ring-b: #b3a7df;
  --tint: rgba(157, 191, 230, .38);
  --sel: rgba(214, 230, 250, .7);
  --ring-track: rgba(157, 191, 230, .28);
  --hair: rgba(120, 150, 190, .10);
  --hair-strong: rgba(120, 150, 190, .16);
  --lift: 0 22px 44px -22px rgba(74, 101, 150, .42), 0 4px 14px -8px rgba(74, 101, 150, .30);
  --lift-lo: 0 12px 26px -16px rgba(74, 101, 150, .38);
  --warn-bg: #fbe8c8;
  --warn-line: #dd9f33;
  --warn-ink: #5a3c05;
  --warn-btn-ink: #2e2000;
}

body[data-theme="dark"],
body.night {
  --ground: #101214;
  --surface: #181c22;
  --sky: #232c3a;
  --sky-deep: #7e9dc4;
  --lav: #232236;
  --lav-deep: #5d5688;
  --mint: #1d2b2b;
  --ink: #ccd6e4;
  --ink-soft: #93a0b1;
  --page: #101214;
  --card-wash: linear-gradient(155deg, rgba(35, 44, 58, .8), rgba(35, 34, 54, .6) 62%, rgba(24, 28, 34, 0) 100%);
  --grad: linear-gradient(150deg, #35496a, #3c3765);
  --grad-soft: linear-gradient(160deg, #2b3b56, #302c50);
  --ring-a: #7e9dc4;
  --ring-b: #6f8fc0;
  --tint: rgba(126, 157, 196, .26);
  --sel: rgba(126, 157, 196, .34);
  --ring-track: rgba(126, 157, 196, .22);
  --hair: rgba(147, 160, 177, .12);
  --hair-strong: rgba(147, 160, 177, .18);
  --lift: 0 22px 44px -22px rgba(0, 0, 0, .6), 0 4px 14px -8px rgba(0, 0, 0, .5);
  --lift-lo: 0 12px 26px -16px rgba(0, 0, 0, .55);
  --warn-bg: #3a2e15;
  --warn-line: #b9822c;
  --warn-ink: #f0d9a8;
  --warn-btn-ink: #150e03;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", "SF Pro Text", system-ui, -apple-system, Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

.phone {
  max-width: 390px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--ground);
  box-shadow: var(--lift);
}

.scroll { padding: 0 14px 96px; }

section[hidden] { display: none !important; }

/* ---- Kopfzeile ---- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px 8px;
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 600;
  letter-spacing: .04em;
}

/* ---- Hauptkarte ---- */
.card {
  position: relative;
  background: var(--surface);
  border-radius: var(--r);
  /* The emoji rail and the Schreien button live in a fixed-width gutter pinned
     to the card's right edge (docs/design/mock-konzept.html); the wide right
     padding keeps the ring, range and status text clear of it. */
  padding: 14px 78px 18px 18px;
  box-shadow: var(--lift-lo);
  background-image: var(--card-wash);
}

.side { display: flex; justify-content: flex-end; gap: 8px; }

.side button {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--surface);
  box-shadow: var(--lift-lo);
}

.side button.on { background: var(--grad-soft); color: var(--ink); }

/* ---- Emoji-Leiste + Schreien ----
   One column pinned to the card's right edge, per docs/design/mock-konzept.html.
   The gutter spans the full card height (top 14 / bottom 18); Schreien is fixed
   at the bottom, level with the "Schlaf starten" button, and the icon rail takes
   whatever height is left and scrolls inside it -- so the card never has to grow
   to fit eight buttons. `.card` reserves a 78 px right padding to clear it. */
.gutter {
  position: absolute;
  top: 14px;
  right: 10px;
  bottom: 18px;
  width: 58px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 3;
}

.rail {
  flex: 1;
  min-height: 0;              /* let the flex child shrink below content so it can scroll */
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: none;      /* a scrollbar in a 58 px column would overlap the buttons */
}

.rail::-webkit-scrollbar { display: none; }

.cry { flex: 0 0 auto; }      /* never shrink; stays pinned at the gutter's bottom */

.cue {
  position: relative;
  width: 58px;
  height: 52px;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--lift-lo);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
}

.cue .emo { font-size: 20px; line-height: 1; }
.cue .txt { font-size: 8.5px; font-weight: 600; color: var(--ink-soft); }
.cue:active { transform: translateY(1px); }

/* logged state: filled + a count badge (docs/30-ux-flows.md §3.4). */
.cue.is-on { background: var(--grad); }
.cue.is-on .txt { color: var(--ink); }

.cue .badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font-size: 10px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.cue .badge[hidden] { display: none; }

/* ---- Ring ---- */
.ringbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 2px 0 12px;
}

.ringwrap {
  position: relative;
  width: 190px;
  height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ringwrap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
/* var() does not resolve inside SVG presentation attributes -- style it here. */
.ring-a { stop-color: var(--ring-a); }
.ring-b { stop-color: var(--ring-b); }
.ring-bg { stroke: var(--ring-track); }
.ring-in { position: relative; z-index: 2; text-align: center; }
.ring-word { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }

.ring-time {
  margin: 0;
  font-size: 52px;
  line-height: 1;
  font-weight: 200;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
}

.fcrow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.range {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  background: var(--tint);
  border-radius: 18px;
  padding: 6px 14px;
  text-align: center;
  margin: 0;
}

.rlbl {
  display: block;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 1px;
}
.rlbl[hidden] { display: none; }

.fcemoji { margin-right: 4px; }
.fcemoji[hidden] { display: none; }

.ritual { text-align: center; font-size: 13px; font-weight: 600; margin: 0; }

.primary {
  width: 100%;
  min-height: 68px;
  border: 0;
  border-radius: 22px;
  cursor: pointer;
  font: inherit;
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  background: var(--grad);
  box-shadow: 0 18px 30px -18px rgba(74, 101, 150, .62);
}

/* Bottom of .gutter, level with the "Schlaf starten" button (mock-konzept.html). */
.cry {
  width: 58px;
  height: 68px;
  border: 0;
  border-radius: 22px;
  cursor: pointer;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 8.5px;
  font-weight: 700;
  color: #6d2f34;
  background: linear-gradient(150deg, #f3bdb6, #eaa9b6);
  box-shadow: 0 10px 20px -12px rgba(150, 74, 88, .7);
}

.cry .emo { font-size: 20px; line-height: 1; }
.cry.on { background: linear-gradient(150deg, #e2867e, #d4707f); color: #fff; }

/* ---- Timeline ---- */
h2 { font-size: 15px; font-weight: 600; margin: 22px 4px 10px; }
.cal-range { font-size: 12px; font-weight: 500; color: var(--ink-soft); }

.collapsible summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible summary h2 { flex: 1; }
.collapsible summary .chev { color: var(--ink-soft); font-size: 14px; margin: 0 6px 0 2px; transition: transform .15s; }
.collapsible[open] summary .chev { transform: rotate(180deg); }

.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--lift-lo);
}

/* Höhe proportional zur Dauer, neuestes oben: oben = späte Zeit, unten = frühe Zeit */
.span {
  position: relative;
  padding: 8px 12px;
  cursor: pointer;
  /* visible, not hidden: the floating .ev bubbles are centred on their own
     time-point, so an entry near a span edge sits half outside the box and must
     not be clipped. Nothing else here overflows (the head is one short line in a
     >=96 px box). */
  overflow: visible;
  border: 0;
  width: 100%;
  text-align: left;
  font: inherit;
  display: block;
}

.span.sleep { background: var(--lav-deep); color: #fff; }
.span.awake { background: var(--sky); color: var(--ink); }
.span .head { position: relative; z-index: 1; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.span .lbl { font-size: 12.5px; font-weight: 700; }
.span .dur { font-size: 11.5px; font-variant-numeric: tabular-nums; font-weight: 600; opacity: .8; }

/* Schreien overlay: the baby is awake while crying (owner override, Sept
   2026), so this is a stripe inside .span.awake, not a block of its own --
   same red as the lit Schreien button (.cry.on). z-index 0 keeps .span .head
   readable on top; the floating .ev bubbles (z-index 2) stay above both. */
.cry-overlay {
  position: absolute;
  left: 0; right: 0;
  z-index: 0;
  background: linear-gradient(150deg, rgba(226, 134, 126, .55), rgba(212, 112, 127, .55));
  border-left: 3px solid #d4707f;
  cursor: pointer;
}

/* schwebende Emoji-Einträge, an ihrer Uhrzeit positioniert. Entries within 5
   minutes of each other are clustered by renderTimeline() into one .ev-group
   per cluster (across .span boundaries, since two spans can sit pixel-
   adjacent), so overlapping icons sit next to each other (flexbox,
   right-aligned, wrapping) instead of stacking on the same point. Positioned
   against #timeline, not the individual .span -- .ev-group is a direct
   sibling of the .span elements, absolutely placed by its own top offset.
   left/right are fixed px (matching .span's own 8px/12px padding), not a %
   cut -- a % inset shrank the available row on narrow phones exactly where
   two full-text bubbles (a diaper's "💧 💩" pair, a bottle's "vor H:MM")
   need the room to sit side by side without wrapping. */
.ev-group {
  position: absolute;
  right: 12px;
  left: 8px;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.ev {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 4px 4px 9px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 6px 14px -8px rgba(34, 44, 63, .7);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  border: 0;
}

.ev .emo { font-size: 22px; line-height: 1; }

/* "· vor H:MM" on the newest 🍼 bubble -- muted, so the time-point still reads first */
.ev .ago { color: var(--ink-soft); font-weight: 600; }

.ev .del {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  flex: 0 0 22px;
  background: var(--hair-strong);
  color: var(--ink-soft);
}

/* ---- 7 Tage ---- */
.cal {
  background: var(--surface);
  border-radius: var(--r);
  padding: 16px 14px;
  box-shadow: var(--lift-lo);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.cal .sub { margin: -4px 0 2px; font-size: 11.5px; color: var(--ink-soft); }
.axis, .row { display: grid; grid-template-columns: 26px 1fr 40px; align-items: center; gap: 6px; }
.axis { font-size: 9.5px; color: var(--ink-soft); font-weight: 700; letter-spacing: .06em; }
.axis .ticks { display: flex; justify-content: space-between; }
.day { font-size: 10.5px; font-weight: 700; color: var(--ink-soft); }
.sum { font-size: 10.5px; font-weight: 600; text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.hours { position: relative; height: 15px; border-radius: 4px; background: var(--hair); overflow: hidden; }
.hours i.s { position: absolute; top: 0; bottom: 0; min-width: 4px; background: var(--lav-deep); border-radius: 2px; cursor: pointer; }

.cal { position: relative; }
.cal-tip {
  position: absolute;
  transform: translate(-50%, -100%);
  margin-top: -6px;
  background: var(--ink);
  color: var(--surface);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 10.5px; color: var(--ink-soft); font-weight: 600; margin-top: 2px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.key { width: 16px; height: 12px; border-radius: 4px; display: inline-block; }
.key.s { background: var(--lav-deep); }
.key.e { background: var(--hair); }

/* ---- Footer-Menü ---- */
.nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  z-index: 10;
  width: 100%;
  max-width: 390px;
  display: flex;
  background: var(--surface);
  gap: 6px;
  padding: 8px 10px calc(14px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -14px 28px -18px rgba(74, 101, 150, .55);
}

.nav button {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
  min-height: 48px;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.nav button .emo { font-size: 15px; }
.nav button[aria-current="page"] { background: var(--sel); color: var(--ink); }

/* ---- Modale ---- */
dialog {
  border: 0;
  border-radius: var(--r);
  padding: 20px 18px;
  width: min(320px, 88vw);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--lift);
  font-family: inherit;
}

dialog::backdrop { background: rgba(34, 44, 63, .38); }
dialog h3 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
dialog label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); margin: 12px 0 4px; }
dialog input[type=range] { width: 100%; accent-color: var(--lav-deep); }

dialog input[type=time],
dialog input[type=date] {
  font: inherit;
  font-size: 16px;
  padding: 8px 10px;
  border: 1px solid var(--sky-deep);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}

/* Von/Bis in dlgSpan: date + time side by side under one label. */
.dt-row { display: flex; gap: 8px; }
.dt-row input[type=date] { flex: 1.3; min-width: 0; }
.dt-row input[type=time] { flex: 1; min-width: 0; }

#evEmo { font-size: 22px; }

/* Ticket 08: diaper level sliders -- one native range each, big 3am-friendly
   thumb (>=44px) on a generous track. No library, styling lives here not inline. */
.diaper-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  margin: 4px 0 2px;
  background: transparent;
  accent-color: var(--lav-deep);
}
.diaper-range:focus { outline: none; }
.diaper-range::-webkit-slider-runnable-track {
  height: 14px;
  border-radius: 8px;
  background: var(--sky-deep);
}
.diaper-range::-moz-range-track {
  height: 14px;
  border-radius: 8px;
  background: var(--sky-deep);
}
.diaper-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 44px;
  margin-top: -15px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--lav-deep);
  cursor: pointer;
}
.diaper-range::-moz-range-thumb {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--lav-deep);
  cursor: pointer;
}
.diaper-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--sky-deep); }
.diaper-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--sky-deep); }

.modal-actions { display: flex; gap: 8px; margin-top: 20px; align-items: center; }

.modal-actions .btn {
  flex: 1;
  border: 0;
  border-radius: 18px;
  min-height: 48px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  background: var(--sel);
  color: var(--ink);
}

.modal-actions .btn.save { background: var(--grad); }

.modal-actions .trash {
  flex: 0 0 48px;
  min-height: 48px;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--lift-lo);
  font-size: 17px;
}

/* ---- Schlaf-Sheet (dlgSeg): Stepper + Chips, kein Tastatur-Eingabefeld ---- */
.seg-row { margin: 14px 0 4px; }
.seg-lbl {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.seg-stepper { display: flex; align-items: center; gap: 8px; }
.seg-time {
  flex: 1;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.seg-step, .seg-now {
  border: 0;
  border-radius: 14px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 12px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  background: var(--tint);
  color: var(--ink);
}
.seg-now { font-size: 12px; }
.seg-chips { display: flex; gap: 8px; }
.seg-chips .seg-chip {
  flex: 1;
  border: 0;
  border-radius: 14px;
  min-height: 44px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  background: var(--tint);
  color: var(--ink-soft);
}
.seg-chips .seg-chip.is-on { background: var(--grad); color: var(--ink); }
#segAccuracy[hidden] { display: none; }

/* Ticket 14 A: "Ende zurückdatieren" chips above the end stepper. */
#segLongStop { margin: 14px 0 0; }
#segLongStop .seg-step { flex: 1; }
#segLongStop[hidden] { display: none; }

/* ---- Übermüdung-Sheet (dlgOvertired) + Inline-Zeile auf Jetzt ---- */
.ot-dur {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ot-toggle {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  background: var(--tint);
  color: var(--ink-soft);
}

.ot-toggle[aria-pressed="true"] { background: var(--grad); color: var(--ink); }

.ot-asleep {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  background: var(--grad);
  color: var(--ink);
}

/* "Schreien läuft · H:MM" running row on Jetzt -- Schreien is a Zeitraum with a
   live timer, same shape as .timerrun; red, matching .cry.on / .cry-overlay. */
.cry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: linear-gradient(150deg, #e2867e, #d4707f);
  color: #fff;
}
.cry-row[hidden] { display: none; }
.cry-row-dur {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cry-row button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, .22);
  color: #fff;
}

.ot-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--tint);
}

.ot-row[hidden] { display: none; }

.ot-row-open {
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.ot-row-actions { display: flex; gap: 8px; }

.ot-row-actions button {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--lift-lo);
}

/* Ticket 14 B: "Timer läuft seit H:MM — noch aktiv?" passive nudge on Jetzt.
   Amber, but the wording alone carries the meaning (docs/30-ux-flows §7). */
.timerrun {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-ink);
}
.timerrun[hidden] { display: none; }
.timerrun-txt {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.timerrun button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  background: var(--warn-line);
  color: var(--warn-btn-ink);
}

/* ---- App-Teile, die im Mock nicht vorkommen ---- */
:focus-visible { outline: 3px solid #6f8fc0; outline-offset: 2px; }

.snackbar {
  position: fixed;
  bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  left: 16px;
  right: 16px;
  max-width: 358px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #222c3f;
  color: #fff;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  z-index: 1000;
  animation: slideUp .3s ease;
}

.snack-undo {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .snackbar { animation: none; }
}

.empty { padding: 20px 4px; color: var(--ink-soft); font-size: 13px; text-align: center; }

/* Verlauf: Tagesliste */
.dayblock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 4px;
  border: 0;
  border-top: 1px solid var(--hair);
  background: transparent;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.dayblock .meta { color: var(--ink-soft); font-size: 12px; flex: 0 0 auto; }
.cue-marks { font-size: 13px; color: var(--ink-soft); margin: 8px 0 0; }

/* Statistik: Ø/Median pro Ereignistyp, ersetzt vorerst die Verlauf-Tagesliste */
.stat-sub { margin: -4px 4px 6px; font-size: 12.5px; color: var(--ink-soft); }
.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 4px;
  border-top: 1px solid var(--hair);
}
.stat-row:first-child { border-top: 0; }
.stat-emo { font-size: 20px; line-height: 1; flex: 0 0 auto; }
.stat-body { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; min-width: 0; }
.stat-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.stat-vals { font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.stat-n { font-size: 11.5px; color: var(--ink-soft); flex: 0 0 auto; }

/* Einstellungen */
.set-field { display: block; margin-bottom: 14px; font-weight: 600; font-size: 14px; color: var(--ink); }

.set-hint {
  margin: -8px 0 14px;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-soft);
}

.set-input {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--ink-soft);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;               /* < 16px makes iOS zoom on focus */
  font-weight: 400;
}

.set-link {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--ink-soft);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.set-sub {
  font-size: 15px;
  font-weight: 700;
  margin: 22px 0 6px;
  color: var(--ink);
}

.set-hint-free {
  margin: 0 0 12px;
}

.set-hint code, .token-new code {
  font-family: monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.token-new {
  margin: 10px 0 14px;
}

.token-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.token-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--ink-soft) 40%, transparent);
  flex-wrap: wrap;
}

.token-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  flex: 1 1 auto;
}

.token-meta {
  font-size: 12px;
  color: var(--ink-soft);
  flex: 1 1 100%;
  order: 3;
}

.token-revoke {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--ink-soft);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  flex: 0 0 auto;
}

.token-empty {
  font-size: 13px;
  color: var(--ink-soft);
  padding: 6px 0;
}

/* Info-Seite */
.info-prose { font-size: 14px; line-height: 1.55; color: var(--ink); padding-bottom: 24px; }
.info-prose h1 { font-size: 20px; margin: 4px 0 12px; }
.info-prose h2 { font-size: 15px; margin: 22px 0 6px; }
.info-prose p { margin: 0 0 10px; }
.info-prose a { color: inherit; }
.info-prose code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.info-src { font-size: 12px; color: var(--ink-soft); }

.info-formula {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  padding: 8px 10px;
  background: var(--ground);
  border-radius: 8px;
}

.info-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0 10px; }

/* Config examples in the Sprachassistenten guide: YAML indentation matters, so
   no wrapping -- the block scrolls sideways on its own instead of the page. */
.info-code {
  margin: 4px 0 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--ink-soft) 35%, transparent);
  border-radius: 8px;
  overflow-x: auto;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.45;
}
.info-code code { font-size: inherit; }
.info-table td code { white-space: nowrap; }   /* "/sleep/start, /sleep/stop" breaks at the comma only */
.info-prose p code { overflow-wrap: anywhere; } /* long URLs in running text */
.info-table th, .info-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--ink-soft); }

/* ---- Anmeldung / Registrierung + Rechtstexte (issues/09) -----------------
   Reuse the app's tokens and .phone / .card / .primary. These screens are
   always light -- no forecast drives a theme here -- so they set the light
   palette on :root and never read the night swap. */
.auth-phone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 32px 16px 28px;
  background: var(--ground);
}

.auth-card { width: 100%; padding: 22px 20px 24px; }
.auth-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.auth-sub { margin: 4px 0 18px; font-size: 13px; color: var(--ink-soft); }

.auth-tabs {
  display: flex;
  gap: 6px;
  background: var(--tint);
  border-radius: 16px;
  padding: 4px;
  margin-bottom: 8px;
}
.auth-tabs button {
  flex: 1;
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  background: transparent;
}
.auth-tabs button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--lift-lo);
}

#auth-form label {
  display: block;
  margin: 12px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
#auth-form label[hidden] { display: none; }
#auth-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--ink-soft);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;               /* < 16px makes iOS zoom on focus */
}
#auth-form .primary { margin-top: 18px; min-height: 56px; font-size: 17px; }

.auth-hint { margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); }
.auth-hint[hidden] { display: none; }

.auth-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-ink);
  font-size: 13px;
  font-weight: 600;
}
.auth-error[hidden] { display: none; }

.auth-switch { margin: 14px 0 0; font-size: 13px; color: var(--ink-soft); text-align: center; }

.linklike {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  text-decoration: underline;
  cursor: pointer;
  padding: 6px 4px;
  min-height: 32px;
}

.auth-legal { margin: 0; font-size: 12px; color: var(--ink-soft); text-align: center; }
.auth-legal a { color: inherit; }

/* ---- Onboarding (Name + Geburtsdatum) ----------------------------------------
   Lives inside .phone and is toggled by app.js; while it is up, renderOnboarding
   hides .topbar, .scroll and .nav. Reuses the app's tokens and .card / .primary
   / .set-field / .set-input -- always light, no forecast drives a theme here. */
#onboarding[hidden] { display: none !important; }
.topbar[hidden], .scroll[hidden], .nav[hidden] { display: none !important; }

.onboard-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  min-height: 100dvh;
  padding: 40px 16px 28px;
}
.onboard-card { width: 100%; padding: 24px 20px 26px; }
.onboard-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.onboard-sub { margin: 6px 0 20px; font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
#onboard-form .set-field { margin-bottom: 16px; }
#onboard-form .primary { margin-top: 8px; min-height: 56px; font-size: 17px; }
#onboard-logout { margin-top: 16px; text-align: center; }

/* Impressum / Datenschutz link row at the bottom of Einstellungen */
.set-legal { margin: 12px 4px 0; font-size: 12px; color: var(--ink-soft); }
.set-legal a { color: inherit; }

/* Standalone legal pages */
.legal {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 20px 56px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
}
.legal h1 { font-size: 22px; margin: 0 0 16px; }
.legal h2 { font-size: 15px; margin: 24px 0 6px; }
.legal p { margin: 0 0 10px; }
.legal a { color: inherit; }
.legal .back { display: inline-block; margin-bottom: 18px; font-size: 13px; font-weight: 600; }
.legal .stand { margin-top: 24px; font-size: 12px; color: var(--ink-soft); }

/* ---- Desktop layout -----------------------------------------------------
   `.phone` is a mobile-width column by design (1e-ring, docs/design/) and on
   a wide viewport otherwise sits square-cornered and flush to the screen
   edges, with a lot of unused space either side. Below widens and frames it
   -- but only where the "Jetzt" tracker screen is not the one showing:
   login (no #view-jetzt at all) and, inside the app, the Statistik /
   Einstellungen / Info / Sprachassistenten tabs. `:has()` reads which
   section app.js left un-hidden, so this needs no JS and never fires for
   Jetzt or onboarding (owner request, Sept 2026: Jetzt stays pixel-identical
   on every screen size). The legal pages have no `.phone` and are untouched
   either way. */
@media (min-width: 900px) {
  body:has(.phone):not(:has(#view-jetzt:not([hidden]))) {
    display: flex;
    justify-content: center;
    align-items: center;
  }

  body:has(.phone):not(:has(#view-jetzt:not([hidden]))) .phone {
    max-width: 640px;
    margin: 40px auto 0;
    border-radius: var(--r) var(--r) 0 0;
    min-height: calc(100dvh - 40px);
  }

  /* Login/Registrierung has no .nav pinning it to the real viewport bottom,
     so nothing needs the card flush there -- let it size to its content and
     sit centered instead of stretched. */
  body:has(.phone):not(:has(#view-jetzt:not([hidden]))) .auth-phone {
    margin: 0 auto;
    min-height: auto;
  }

  body:has(.phone):not(:has(#view-jetzt:not([hidden]))) .auth-card {
    max-width: 420px;
  }

  /* Statistik/Einstellungen keep .nav fixed to the real viewport bottom,
     same mechanism as on Jetzt -- so .phone still needs to reach the bottom
     edge for the two to line up; only the top gets rounded and margined. */
  body:has(.phone):not(:has(#view-jetzt:not([hidden]))) .nav {
    max-width: 640px;
  }

  body:has(.phone):not(:has(#view-jetzt:not([hidden]))) #view-statistik,
  body:has(.phone):not(:has(#view-jetzt:not([hidden]))) #view-einstellungen {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }

  body:has(.phone):not(:has(#view-jetzt:not([hidden]))) .info-prose {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }
}
