:root {
  color-scheme: light;
  --bg: #f3efe8;
  --card: #fffcf8;
  --text: #1f1a17;
  --muted: #6f675f;
  --line: #e5ddd3;
  --shadow: 0 10px 30px rgba(70, 45, 20, 0.06);
  --sleep: #4d6bdc;
  --bottle: #d9922f;
  --diaper: #2f9d90;
  --solid: #e07a45;
  --routine: #8b6fd4;
  --pump: #d16b98;
  --growth: #3f9460;
  --health: #8d97d4;
  --medical: #d15a5a;
  --vaccine: #c45b8a;
  --milestone: #b8922a;
  --first: #3d97be;
  --settings: #6d7b8c;
  --danger: #b42318;
  --ok: #2f7d4a;
  --tab: rgba(255, 252, 248, 0.92);
  --tab-bottom: 8px;
  font-family: "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #12110f;
    --card: #1d1b18;
    --text: #f6f1ea;
    --muted: #b7aea4;
    --line: #34302b;
    --shadow: none;
    --sleep: #9aaef2;
    --bottle: #e2b15d;
    --diaper: #6ec4b8;
    --solid: #f0a27a;
    --routine: #b6a4e6;
    --pump: #e59ab8;
    --growth: #7dbe96;
    --health: #b7b8e6;
    --medical: #e58b8b;
    --vaccine: #e39ab8;
    --milestone: #e2c56a;
    --first: #7ec3de;
    --settings: #c5d0da;
    --danger: #ffb4ab;
    --ok: #8fd4a8;
    --tab: rgba(29, 27, 24, 0.92);
  }
}
@media (display-mode: standalone) {
  :root {
    --tab-bottom: max(8px, calc(env(safe-area-inset-bottom, 0px) - 22px));
  }
}

* { box-sizing: border-box; }
html, body, #root { min-height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 16px; }
button { cursor: pointer; }
html, body { overflow-x: hidden; max-width: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  touch-action: manipulation;
}
.app {
  width: min(520px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px calc(66px + var(--tab-bottom));
  padding-top: calc(12px + constant(safe-area-inset-top));
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
}
.gate-links { display: flex; justify-content: center; }
.gate-links a { color: var(--text); }
.panel {
  width: min(420px, 100%);
  background: var(--card);
  border-radius: 28px;
  padding: 28px 22px;
  box-shadow: var(--shadow);
}
h1 { font-size: 1.8rem; margin: 0 0 6px; letter-spacing: -0.03em; }
h2 { font-size: 1.2rem; margin: 0; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 0.92rem; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}
textarea { min-height: 88px; resize: vertical; }
.primary, .ghost, .danger {
  border: 0;
  border-radius: 16px;
  min-height: 48px;
  padding: 0 16px;
}
.primary { background: var(--sleep); color: white; font-weight: 700; }
.ghost { background: transparent; border: 1px solid var(--line); }
.danger {
  background: var(--danger);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}
.header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.child-switch { position: relative; }
.child-switch-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
}
.child-switch-btn h1 { margin: 0; }
.child-switch-btn .muted { margin: 0; }
.child-chev { color: var(--muted); flex: none; transition: transform 160ms ease; }
.child-chev.up { transform: rotate(180deg); }
.child-menu {
  position: absolute;
  z-index: 6;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  display: grid;
  gap: 2px;
  padding: 6px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
.child-option {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 8px 10px;
  text-align: left;
  color: var(--text);
}
.child-option.on { background: color-mix(in srgb, var(--growth) 22%, transparent); }
.child-option span { color: var(--muted); font-size: 0.84rem; }
.account-foot { display: grid; gap: 10px; margin-top: 8px; }
.account-logout {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 16px;
  background: #3e4c5c;
  color: #f4f7fa;
  font-weight: 700;
}
.danger-zone {
  display: grid;
  gap: 10px;
  margin-top: 8px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, var(--card));
}
.danger-zone h2 { margin: 0; color: var(--danger); font-size: 1rem; }
.danger-zone .danger, .danger-zone .ghost { width: 100%; }
.danger-zone .danger:disabled { opacity: 0.45; }
@media (prefers-color-scheme: dark) {
  .account-logout { background: var(--settings); color: #16130f; }
}
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  display: grid;
  place-items: center;
}
.icon-row { display: flex; gap: 8px; }
.card {
  display: flex;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 0;
  border-radius: 22px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.activity-card { position: relative; overflow: hidden; display: block; }
.card-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 52px;
  background: color-mix(in srgb, var(--c) 34%, transparent);
  pointer-events: none;
}
.card-mark {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
}
.card-stain {
  position: absolute;
  inset: 0;
  background: var(--c);
}
.card-glyph { position: relative; color: white; }
@media (prefers-color-scheme: dark) {
  .card-glyph { color: #16130f; }
}
.card-main, .sleep-list, .inline-actions { position: relative; z-index: 1; }
.add-btn {
  background: var(--c);
  color: white;
  border: 0;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--c) 40%, transparent);
}
@media (prefers-color-scheme: dark) {
  .add-btn, .danger { color: #16130f; }
}
.bubble {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  flex: none;
  background: var(--c);
}
@media (prefers-color-scheme: dark) {
  .bubble { color: #16130f; }
}
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.card h3 { margin: 0; font-size: 1.05rem; }
.grouped-head { align-items: center; min-height: 36px; }
.metric-list { margin: 8px -14px -14px; }
.metric-row {
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 16px;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  color: inherit;
}
.metric-ico {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, currentColor 16%, transparent);
}
.metric-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.metric-copy strong { font-size: 0.98rem; font-weight: 650; }
.metric-copy span, .metric-value { color: var(--muted); font-size: 0.84rem; }
.metric-copy span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-value { font-size: 0.95rem; }
.metric-chev { color: var(--muted); }
.card-main {
  display: flex;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  align-items: flex-start;
}
.timer { display: block; font-variant-numeric: tabular-nums; font-size: 1.7rem; font-weight: 700; letter-spacing: -0.04em; line-height: 1.1; }
.meta { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; color: var(--muted); font-size: 0.92rem; }
.sub { display: block; color: var(--muted); font-size: 0.92rem; }
.older-day {
  width: 100%;
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  min-height: 40px;
  font-size: 0.86rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.inline-actions { display: flex; gap: 8px; margin-top: 8px; }
.inline-actions button { flex: 1; }
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 12px var(--tab-bottom);
  background: var(--tab);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  z-index: 10;
  box-sizing: border-box;
}
.tabs button {
  border: 0;
  background: transparent;
  border-radius: 16px;
  min-height: 58px;
  min-width: 0;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.78rem;
  line-height: 1.1;
  padding: 6px 4px;
}
.tabs button svg { flex: none; }
.tabs button.active { color: var(--text); background: color-mix(in srgb, var(--sleep) 18%, transparent); }
.sheet-backdrop, .overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.45);
  z-index: 20;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 1;
  transition: opacity 200ms ease;
}
.sheet, .overlay {
  width: min(520px, 100%);
  max-height: min(88dvh, 900px);
  overflow: auto;
  background: var(--card);
  border-radius: 28px 28px 0 0;
  padding: 18px 16px calc(24px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}
.sheet-backdrop.sheet-open > .sheet,
.sheet-backdrop.sheet-open > .overlay,
.overlay-backdrop.sheet-open > .sheet,
.overlay-backdrop.sheet-open > .overlay {
  transform: translate3d(0, 0, 0);
}
.sheet-backdrop.sheet-pre,
.overlay-backdrop.sheet-pre { opacity: 0; }
.sheet-backdrop.sheet-pre > .sheet,
.sheet-backdrop.sheet-pre > .overlay,
.overlay-backdrop.sheet-pre > .sheet,
.overlay-backdrop.sheet-pre > .overlay {
  transform: translate3d(0, 100%, 0);
}
.sheet-backdrop.sheet-out,
.overlay-backdrop.sheet-out {
  opacity: 0;
  transition: opacity 180ms ease-in;
}
.sheet-backdrop.sheet-out > .sheet,
.sheet-backdrop.sheet-out > .overlay,
.overlay-backdrop.sheet-out > .sheet,
.overlay-backdrop.sheet-out > .overlay {
  transform: translate3d(0, 100%, 0);
  transition: transform 180ms cubic-bezier(0.4, 0, 1, 1);
}
@media (prefers-reduced-motion: reduce) {
  .sheet-backdrop, .overlay-backdrop, .sheet, .overlay { transition: none; }
}
.sheet-head, .day-nav, .seg { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet.toned > .sheet-head, .overlay.toned > .sheet-head {
  margin: -18px -16px 12px;
  padding: 16px 16px 14px;
  background: color-mix(in srgb, var(--c, var(--sleep)) 46%, var(--card));
  border-radius: 28px 28px 0 0;
}
.seg { background: color-mix(in srgb, var(--line) 65%, transparent); border-radius: 14px; padding: 4px; margin: 12px 0; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 12px; min-height: 40px; }
.seg button.active { background: var(--card); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button, .time-row button { border: 1px solid var(--line); background: transparent; border-radius: 999px; min-height: 40px; padding: 0 12px; }
.chips button.on { background: var(--c, var(--sleep)); color: white; border-color: transparent; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.history-item, .trend-list button, .edit-row {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  background: var(--card);
  border: 0;
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
}
.bar { width: 8px; align-self: stretch; border-radius: 99px; background: var(--c); }
.chart { width: 100%; height: 140px; display: block; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-cell { background: var(--card); border-radius: 16px; min-height: 72px; padding: 8px; box-shadow: var(--shadow); }
.day-cell strong { display: block; font-size: 0.95rem; }
.error { color: var(--danger); margin: 0; }
.section { margin: 18px 0; }
.growth-line { width: 100%; height: 90px; }
.section-title { margin: 22px 0 4px; }
.growth-note { color: var(--muted); font-size: 0.84rem; line-height: 1.4; margin: 8px 0 12px; }
.growth-card {
  background: var(--card);
  border-radius: 20px;
  padding: 14px 10px 12px;
  margin: 0 0 12px;
  box-shadow: var(--shadow);
}
.growth-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 0 6px; }
.growth-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.growth-head h3 { margin: 0; font-size: 1rem; }
.growth-plain { margin: 8px 6px 0; color: var(--muted); font-size: 0.84rem; line-height: 1.35; }
.growth-head p { margin: 4px 0 0; font-size: 0.84rem; }
.growth-now { text-align: right; }
.growth-now strong { display: block; font-size: 1.35rem; letter-spacing: -0.03em; line-height: 1.1; }
.growth-pct {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--growth);
  background: color-mix(in srgb, var(--growth) 16%, transparent);
  border-radius: 999px;
  padding: 3px 8px;
}
.growth-pct.out {
  color: var(--milestone);
  background: color-mix(in srgb, var(--milestone) 18%, transparent);
}
.growth-chart { width: 100%; height: auto; display: block; touch-action: manipulation; }
.growth-grid { stroke: var(--line); stroke-width: 1; }
.growth-axis { fill: var(--muted); font-size: 11px; }
.growth-band { fill: color-mix(in srgb, var(--growth) 24%, transparent); }
.growth-edge { fill: none; stroke: color-mix(in srgb, var(--growth) 70%, var(--muted)); stroke-width: 1.15; }
.growth-mid { fill: none; stroke: color-mix(in srgb, var(--text) 72%, var(--muted)); stroke-width: 1.35; stroke-dasharray: 5 3; }
.growth-child { fill: none; stroke: var(--growth); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.growth-now-line { stroke: var(--text); stroke-opacity: 0.35; stroke-dasharray: 2 3; }
.growth-dot { fill: var(--card); stroke: var(--growth); stroke-width: 2; }
.growth-dot.last { fill: var(--growth); stroke: var(--card); stroke-width: 1.5; }
.growth-hit { fill: transparent; cursor: pointer; }
.growth-legend {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 6px 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.growth-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.key-line, .key-band, .key-mid { flex: none; display: inline-block; }
.key-line { width: 22px; height: 10px; position: relative; }
.key-line::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  height: 2px;
  border-radius: 99px;
  background: var(--growth);
}
.key-line::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 1px;
  width: 8px;
  height: 8px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--growth);
}
.key-band {
  width: 18px;
  height: 5px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--growth) 28%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--growth) 45%, transparent);
}
.key-mid {
  width: 18px;
  height: 0;
  border-top: 1.5px dashed color-mix(in srgb, var(--text) 70%, var(--muted));
}
.growth-ref { color: var(--muted); font-size: 0.78rem; line-height: 1.35; margin: 8px 6px 0; }
.note { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
ol.steps { padding-left: 18px; display: grid; gap: 8px; }
.small { font-size: 0.82rem; }

.sleep-list { display: grid; gap: 0; margin-top: 12px; }
.sleep-row + .sleep-row {
  border-top: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  border-radius: 0;
}
.sleep-row {
  display: grid;
  grid-template-columns: 108px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: transparent;
  min-height: 48px;
  padding: 8px 6px;
  text-align: left;
  color: var(--muted);
  font-size: 0.95rem;
}
.sleep-row.plain {
  grid-template-columns: 72px 1fr;
}
.sleep-row.plain .sleep-len { justify-self: end; }
.sleep-row.diaper-log { grid-template-columns: 72px minmax(0, 1fr); }
.diaper-log-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--diaper) 32%, transparent);
  color: var(--text);
}
.diaper-log-main strong { font-size: 0.95rem; }
.diaper-dots { display: inline-flex; gap: 4px; align-items: center; }
.diaper-dots i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 25%, transparent);
}
.diaper-extra { color: var(--text); font-size: 0.82rem; opacity: 0.85; }
.sleep-when { display: flex; flex-direction: column; justify-content: center; line-height: 1.15; }
.sleep-day { font-size: 0.72rem; opacity: 0.8; }
.sleep-track, .duration-track {
  display: block;
  height: 8px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--sleep) 18%, transparent);
  overflow: hidden;
}
.sleep-track > span, .duration-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--fill, var(--sleep));
}
.sleep-track > span.live {
  position: relative;
  z-index: 1;
  overflow: hidden;
  transition: width 1s linear;
  background: var(--fill, var(--sleep));
}
.sleep-track > span.live::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(100% + 64px);
  background-image: repeating-linear-gradient(
    90deg,
    transparent 0,
    color-mix(in srgb, white 72%, transparent) 32px,
    transparent 64px
  );
  animation: sleep-flow 1.5s linear infinite;
}
.sleep-track.live {
  position: relative;
}
.sleep-track.live::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(100% + 64px);
  z-index: 0;
  background-image: repeating-linear-gradient(
    90deg,
    color-mix(in srgb, var(--fill, var(--sleep)) 16%, transparent) 0,
    color-mix(in srgb, var(--fill, var(--sleep)) 55%, transparent) 32px,
    color-mix(in srgb, var(--fill, var(--sleep)) 16%, transparent) 64px
  );
  animation: sleep-flow 1.5s linear infinite;
  pointer-events: none;
}
@keyframes sleep-flow {
  from { transform: translateX(0); }
  to { transform: translateX(-64px); }
}
.sleep-len { font-variant-numeric: tabular-nums; color: var(--text); }
.sleep-len.live {
  color: var(--fill, var(--sleep));
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 12px 0; }
.week-strip button {
  border: 0;
  background: transparent;
  border-radius: 14px;
  min-height: 58px;
  display: grid;
  justify-items: center;
  gap: 2px;
  color: var(--muted);
  padding: 6px 0;
}
.week-strip button.on { background: var(--sleep); color: white; }
.week-strip span { font-size: 0.72rem; text-transform: lowercase; }
.week-chart { display: grid; grid-template-columns: 28px 1fr; gap: 6px; height: 440px; margin-bottom: 16px; }
.hour-gutter { position: relative; }
.hour-gutter span {
  position: absolute;
  right: 0;
  transform: translateY(-50%);
  font-size: 0.68rem;
  color: var(--muted);
}
.hour-gutter span:first-child { transform: none; }
.week-plot { position: relative; }
.hour-lines, .week-cols { position: absolute; inset: 0; }
.hour-lines { pointer-events: none; }
.hour-lines span { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.week-cols { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.history-plot .week-col {
  position: relative;
  flex: none;
  align-self: stretch;
  height: auto;
  scroll-snap-align: start;
  overflow: hidden;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.week-block { position: absolute; left: 0; right: 0; border: 0; border-radius: 0; padding: 0; min-height: 0; }
.week-block.point { min-height: 6px; }
.history-chart { flex: 1; min-height: 240px; display: flex; }
.history-scroll {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}
.history-track { height: 100%; display: flex; flex-direction: column; }
.history-heads, .history-plot { display: flex; gap: 6px; }
.history-heads { flex: none; height: 44px; }
.history-plot { position: relative; flex: 1; min-height: 0; }
.gutter-sticky, .history-plot .hour-gutter {
  position: sticky;
  left: 0;
  width: 32px;
  flex: none;
  z-index: 2;
  background: var(--bg);
}
.history-plot .hour-gutter { align-self: stretch; }
.day-head {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  scroll-snap-align: start;
}
.day-head button {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 2px 0 4px;
  border-radius: 12px;
}
.day-head button.on { background: var(--sleep); color: white; }
.history-plot .hour-lines {
  position: absolute;
  left: 32px;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
}
.history-screen .history-chart { min-height: 0; }
.day-summary { display: grid; margin: 8px 0 18px; }
.summary-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.summary-row .bubble { width: 36px; height: 36px; }
.timeline-title { margin: 8px 0 10px; font-size: 1.15rem; }
.history-item .duration-track { margin-top: 6px; }
.trend-days { display: grid; gap: 8px; }
.trend-row {
  display: grid;
  grid-template-columns: 1.2fr auto auto 1.4fr;
  gap: 8px;
  align-items: center;
  background: var(--card);
  border-radius: 16px;
  padding: 10px 12px;
}
.trend-date { color: var(--muted); font-size: 0.85rem; }
.trend-row .duration-track > span { background: var(--sleep); }
.field-label { margin: 8px 0 0; color: var(--muted); font-size: 0.9rem; }
.diaper-picks { display: flex; justify-content: center; gap: 22px; }
.diaper-picks button {
  width: 78px;
  height: 78px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: transparent;
  padding: 6px;
  font-size: 0.82rem;
}
.diaper-picks button.on { background: var(--diaper); color: #16130f; border-color: transparent; font-weight: 700; }
.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: center; }
.swatch {
  width: min(100%, 46px);
  aspect-ratio: 1;
  height: auto;
  margin: 0 auto;
  border-radius: 50%;
  border: 2px solid transparent;
  padding: 0;
}
.swatch.on { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--text); }
.diaper-flags { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.diaper-flags button {
  min-height: 48px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}
.diaper-flags button.on { background: var(--diaper); color: #16130f; border-color: transparent; font-weight: 650; }
.texture-picks { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.texture-picks button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 16px;
  min-height: 74px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  padding: 8px 2px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.1;
}
.texture-picks button.on { background: var(--diaper); color: #16130f; border-color: transparent; font-weight: 650; }
.meal-picks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.meal-picks button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 16px;
  min-height: 72px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  padding: 8px 4px;
}
.meal-picks button.on { background: var(--solid); color: #16130f; border-color: transparent; font-weight: 650; }
.food-chosen { display: grid; }
.food-chosen-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
}
.food-picker { z-index: 30; }
.food-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 14px 16px;
  background: var(--solid);
  color: #16130f;
  border-radius: 28px 28px 0 0;
}
.food-sheet-head h2 { margin: 0; flex: 1; text-align: center; color: #16130f; }
.food-sheet-head .icon-btn { color: var(--text); }
.picker-sheet {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px));
}
.picker-fixed { flex: none; padding: 0 16px 8px; }
.picker-fixed .food-sheet-head { margin: 0 -16px 8px; }
.picker-body {
  overflow: auto;
  min-height: 0;
  padding: 0 16px 8px;
}
.food-search { margin-top: 0; }
.search-field { position: relative; }
.search-field .food-search { padding-right: 42px; }
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--text) 14%, transparent);
  color: var(--text);
}
.food-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 6px;
  padding: 7px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--picker, var(--solid)) 20%, transparent);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.picker-body > .food-group:first-child,
.picker-body > div:first-child > .food-group { margin-top: 4px; }
.food-group::before {
  content: "";
  width: 4px;
  height: 14px;
  border-radius: 99px;
  background: var(--picker, var(--solid));
  flex: none;
}
.food-row {
  width: 100%;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  color: var(--text);
  padding: 6px 0;
}
.food-ico {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--solid) 22%, transparent);
  color: var(--solid);
}
.food-name { min-width: 0; }
.food-add {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex: none;
}
.food-row.on .food-add { background: var(--solid); color: #16130f; border-color: transparent; }
.catalog-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  color: var(--text);
  padding: 8px 0;
}
.catalog-row strong { display: block; font-weight: 650; }
.catalog-row small { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.edit-activities { display: flex; justify-content: center; margin: 14px 0 6px; }
.family-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}
.family-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 12px 0;
  color: inherit;
}
.family-main span, .family-note { color: var(--muted); font-size: 0.86rem; }
.family-static { flex: 1; padding: 12px 0; }
.family-static strong, .family-main strong { display: block; }
.family-card {
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: visible;
}
.family-card-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 22px 22px 0 0;
  background: color-mix(in srgb, var(--c, var(--settings)) 34%, transparent);
}
.family-card-head h2 { margin: 0; font-size: 1.15rem; }
.family-card-body { display: grid; gap: 10px; padding: 12px 16px 16px; }
.family-card .ghost { width: 100%; }
.family-card .family-row:last-of-type { border-bottom: 0; }
.lang-select { position: relative; }
.family-card:has(.lang-menu) { position: relative; z-index: 3; }
.lang-trigger {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--text) 22%, var(--line));
  background: color-mix(in srgb, var(--text) 6%, var(--card));
  text-align: left;
  outline: none;
}
.lang-trigger strong { flex: 1; font-weight: 650; }
.lang-chev { color: var(--muted); transition: transform 160ms ease; }
.lang-trigger.open { border-color: var(--settings); }
.lang-trigger.open .lang-chev { transform: rotate(180deg); }
.lang-trigger:focus-visible {
  border-color: var(--settings);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--settings) 40%, transparent);
}
.lang-menu {
  position: absolute;
  z-index: 4;
  left: -16px;
  right: -16px;
  top: calc(100% + 8px);
  display: grid;
  gap: 2px;
  padding: 6px;
  background: color-mix(in srgb, var(--text) 7%, var(--card));
  border: 1px solid color-mix(in srgb, var(--text) 16%, var(--line));
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.lang-option {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  color: var(--text);
}
.lang-name { flex: 1; font-weight: 650; }
.lang-mark { flex: none; opacity: 0; color: var(--settings); }
.lang-option.on { background: color-mix(in srgb, var(--settings) 24%, transparent); }
.lang-option.on .lang-mark { opacity: 1; }
.flag {
  width: 26px;
  height: 18px;
  border-radius: 2px;
  overflow: hidden;
  flex: 0 0 26px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.flag svg { display: block; width: 26px; height: 18px; }
.family-card .settings-note { text-align: left; }
.family-form { display: grid; gap: 16px; }
.family-form > label { font-weight: 650; }
.family-form input:not([type="date"]):not([type="checkbox"]) {
  min-height: 48px;
  background: color-mix(in srgb, var(--text) 6%, var(--card));
  border-color: color-mix(in srgb, var(--text) 22%, var(--line));
}
.family-form input:focus {
  border-color: var(--settings);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--settings) 40%, transparent);
}
.family-form .field-label { margin: 0 0 8px; font-weight: 650; color: var(--text); }
.family-sex {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--text) 22%, var(--line));
  background: color-mix(in srgb, var(--text) 6%, var(--card));
}
.family-sex button {
  border: 0;
  background: transparent;
  border-radius: 12px;
  min-height: 42px;
  padding: 0 4px;
  font-size: 0.92rem;
}
.family-sex button.on { background: var(--settings); color: #f4f7fa; }
.date-face {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--text) 22%, var(--line));
  background: color-mix(in srgb, var(--text) 6%, var(--card));
}
.date-face strong { font-weight: 650; }
.date-face svg { color: var(--muted); flex: none; }
.date-face input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}
.date-face:focus-within {
  border-color: var(--settings);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--settings) 40%, transparent);
}
.family-age { margin: -8px 0 0; color: var(--muted); font-size: 0.92rem; }
.family-form .check-row { align-items: center; min-height: 44px; }
.family-form .danger { width: 100%; }
@media (prefers-color-scheme: dark) {
  .family-sex button.on { color: #16130f; }
}

.history-screen {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 12px - env(safe-area-inset-top, 0px) - 66px - var(--tab-bottom));
  min-height: 0;
}
.history-screen .header { margin-bottom: 8px; }
.history-toolbar {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
  height: 32px;
  margin-bottom: 4px;
}
.history-month { font-size: 0.95rem; font-weight: 700; line-height: 1; }
.history-nudge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--text);
}
.history-screen .week-chart, .history-screen .history-chart { flex: 1; height: auto; min-height: 0; margin-bottom: 0; }
.summary-band { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: 0.85rem; margin: 0 0 8px; }
.day-sheet h3 { margin: 6px 0 0; font-size: 1rem; }
.day-cats { display: grid; gap: 8px; }
.day-cat {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 16px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--c, var(--sleep)) 18%, var(--card));
}
.day-cat strong { display: block; }
.day-cat > div > span { color: var(--muted); font-size: 0.84rem; }
.day-cat .bubble { color: #fff; background: var(--c); }
@media (prefers-color-scheme: dark) {
  .day-cat .bubble { color: #16130f; }
}
.day-group { display: grid; }
.day-group h3 { margin: 16px 0 2px; font-size: 0.95rem; }
.day-timeline { display: grid; }
.day-line {
  display: grid;
  grid-template-columns: 96px 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 8px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  color: var(--text);
}
.day-line .bubble { width: 32px; height: 32px; }
.week-block { pointer-events: none; }
.time-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  min-height: 52px;
  padding: 0;
}
.sheet-head h2 { flex: 1; text-align: center; }
.text-btn { border: 0; background: transparent; color: var(--sleep); font-weight: 700; min-height: 44px; }
.big-time { display: flex; align-items: center; justify-content: center; gap: 8px; }
.big-clock { font-size: 2.3rem; font-weight: 650; margin: 0; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.big-clock small { font-size: 0.85rem; margin: 0 10px 0 2px; color: var(--muted); font-weight: 600; }
.wheel {
  position: relative;
  display: grid;
  grid-template-columns: 1.5fr 0.7fr 0.7fr;
  gap: 4px;
  height: 200px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--line) 45%, transparent);
  overflow: hidden;
}
.wheel::before {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 80px;
  height: 40px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--sleep) 22%, var(--card));
  pointer-events: none;
}
.wheel-col {
  height: 200px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  position: relative;
  z-index: 1;
  mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
}
.wheel-item {
  height: 40px;
  scroll-snap-align: center;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.05rem;
}
.wheel-item.on { color: var(--text); font-weight: 700; font-size: 1.15rem; }
.wheel-pad { height: 80px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.trend-compare {
  margin: 0 2px 14px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}
.trend-section {
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  margin: 0 0 14px;
  overflow: hidden;
}
.trend-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--c, var(--sleep)) 34%, transparent);
}
.trend-section-head h2 { margin: 0; font-size: 1.2rem; }
.trend-section-head p { margin: 2px 0 0; color: var(--muted); font-size: 0.84rem; }
.trend-body { padding: 2px 14px 8px; }
.trend-body .growth-note { margin-top: 10px; }
.stat-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.trend-body .stat-row:last-child { border-bottom: 0; }
.stat-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-label small { color: var(--muted); font-size: 0.75rem; }
.stat-ico {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--c, var(--sleep)) 22%, transparent);
  color: var(--c, var(--sleep));
}
.hint { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.4; }
.check-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
}
.check-row input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.check-row span { flex: 1; min-width: 0; line-height: 1.35; }
.nap-row { display: flex; align-items: center; gap: 8px; }
.nap-row .time-row { flex: 1; border-bottom: 0; }
.delta { font-size: 0.8rem; color: var(--muted); justify-self: end; white-space: nowrap; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.ml-hero { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.sheet-side { width: 44px; flex: none; }
.settings-block {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--text) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
}
.settings-block h3 { margin: 0; font-size: 1.02rem; }
.settings-chips { justify-content: center; }
.settings-sheet .primary,
.settings-sheet .ghost,
.settings-sheet .danger {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.settings-sheet .primary { background: #3e4c5c; color: #f4f7fa; }
.settings-sheet .chips button.on { background: #3e4c5c; color: #f4f7fa; border-color: transparent; }
.settings-sheet .ghost {
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 34%, transparent);
}
.settings-sheet .danger {
  border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.settings-sheet button:disabled { opacity: 0.65; }
.settings-sheet input {
  background: color-mix(in srgb, var(--text) 10%, var(--card));
  border-color: color-mix(in srgb, var(--text) 38%, transparent);
}
.settings-sheet input:focus {
  border-color: var(--settings);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--settings) 40%, transparent);
}
.settings-note { margin: 0; font-size: 0.9rem; text-align: center; }
.settings-note.ok { color: var(--ok); }
.settings-note.bad { color: var(--danger); }
.settings-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-weight: 650;
  text-align: center;
}
.settings-status i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.settings-status.on { color: var(--ok); }
.settings-status.on i { background: var(--ok); }
@media (prefers-color-scheme: dark) {
  .settings-sheet .primary,
  .settings-sheet .chips button.on { background: var(--settings); color: #16130f; }
}
