:root {
  color-scheme: light dark;
  --ink: #24302c;
  --ink-soft: #4d5b56;
  --muted: #68746f;
  --primary: #476f5f;
  --primary-dark: #315446;
  --primary-soft: #e4ede8;
  --on-primary: #ffffff;
  --sage: #91ad9f;
  --sage-soft: #edf2ee;
  --clay: #bd7458;
  --clay-soft: #f5e8e1;
  --ochre: #c9953f;
  --ochre-soft: #f6edda;
  --blue: #78989d;
  --blue-soft: #e7eff0;
  --danger: #a94747;
  --danger-soft: #f8e8e6;
  --success: #287348;
  --success-soft: #e4f3e9;
  --success-line: #9bc9ac;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --surface-soft: #f2f4f1;
  --canvas: #f2f0ea;
  --line: #d9ded8;
  --line-strong: #c7cfc8;
  --shadow-sm: 0 1px 2px rgba(37, 49, 44, .05), 0 8px 24px rgba(37, 49, 44, .06);
  --shadow-md: 0 2px 5px rgba(37, 49, 44, .05), 0 22px 56px rgba(37, 49, 44, .08);
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --motion-fast: 120ms;
  --motion-base: 220ms;
  --motion-slow: 380ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  font-family: "Avenir Next", Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 0, rgba(145, 173, 159, .13), transparent 28rem),
    var(--canvas);
  color: var(--ink);
}
button, input { font: inherit; }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; cursor: pointer; }
button {
  transition: transform var(--motion-fast) ease, background-color var(--motion-base) ease, border-color var(--motion-base) ease, color var(--motion-base) ease, opacity var(--motion-base) ease;
}
button:active { transform: scale(.975); }
button:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .42; transform: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, strong { text-wrap: balance; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Authentication */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 18%, rgba(145, 173, 159, .18), transparent 12rem),
    var(--canvas);
}
.auth-card {
  width: min(100%, 420px);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.auth-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 34px; }
.logo {
  width: 56px;
  height: 56px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 17px;
  background: var(--primary-dark);
  box-shadow: var(--shadow-sm);
}
.logo img { display: block; width: 100%; height: 100%; }
.language-toggle {
  min-width: 48px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}
.language-toggle:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.auth-card h1 { margin-bottom: 10px; font-size: clamp(27px, 8vw, 35px); font-weight: 650; letter-spacing: -.035em; }
label { display: block; margin-top: 22px; color: var(--ink-soft); font-size: 13px; font-weight: 650; }
input {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  padding: 13px 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
input:focus { border-color: var(--primary); box-shadow: none; }
input:focus-visible { outline: 2px solid var(--primary); outline-offset: 0; }
input[aria-invalid="true"] { border-color: var(--danger); }
.error { min-height: 22px; margin: 12px 0 0; color: var(--danger); font-size: 13px; font-weight: 650; }
.primary {
  border: 0;
  border-radius: 14px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 700;
}
.primary:hover { background: var(--primary-dark); }
.primary:active { background: color-mix(in srgb, var(--primary-dark) 88%, black); }
.full { width: 100%; min-height: 52px; padding: 14px 18px; }
.async-button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.button-spinner {
  display: none;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  border: 2px solid rgba(255,255,255,.38);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: button-spin 720ms linear infinite;
}
.async-button.is-loading .button-spinner { display: inline-block; }
.async-button.is-loading:disabled, .async-button.is-success:disabled { cursor: wait; opacity: 1; }
.async-button.is-success { background: var(--primary-dark); }

/* App shell */
.app-shell {
  position: relative;
  isolation: isolate;
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px calc(46px + env(safe-area-inset-bottom));
}
.world-decor { display: none; }
.app-shell:not([hidden]) > :not(.world-decor) { animation: content-rise var(--motion-slow) var(--ease-out) both; }
.app-shell:not([hidden]) > :nth-child(3) { animation-delay: 40ms; }
.app-shell:not([hidden]) > :nth-child(4) { animation-delay: 80ms; }
.app-shell:not([hidden]) > :nth-child(5) { animation-delay: 120ms; }
/* Overview */
.hero-stage {
  position: relative;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.hero-stage::after, .stage-cloud { display: none; }
.day-card {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  color: var(--ink);
}
.day-arrow, .date-button { border: 0; background: transparent; color: inherit; }
.day-arrow { min-height: 50px; color: var(--muted); font-size: 25px; }
.day-arrow:hover { color: var(--primary-dark); }
.date-button { min-height: 50px; padding: 6px; }
.date-button strong, .date-button span { display: block; }
.date-button strong { font-size: 15px; font-weight: 700; }
.date-button span { margin-top: 2px; color: var(--muted); font-size: 11px; }
#date-input { position: absolute; left: 50%; bottom: 0; width: 1px; height: 1px; min-height: 1px; margin: 0; padding: 0; opacity: 0; pointer-events: none; }
.hero-row { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(108px, .68fr) minmax(0, 1.45fr); align-items: center; gap: 12px; min-height: 164px; }
.mascot-scene { position: relative; height: 148px; }
.baby-mascot {
  position: absolute;
  left: 50%;
  bottom: 18px;
  width: 112px;
  height: 112px;
  overflow: visible;
  transform: translateX(-50%);
}
.baby-halo { fill: var(--sage-soft); }
.baby-head { fill: #f1d5bc; stroke: #587568; stroke-width: 2.25; }
.baby-cradle { fill: #a8bcae; stroke: #587568; stroke-width: 2.25; stroke-linejoin: round; }
.baby-curl, .baby-eye, .baby-mouth, .baby-blanket-fold, .baby-cradle-rim, .baby-rocker { fill: none; stroke: #354a42; stroke-linecap: round; stroke-linejoin: round; }
.baby-curl { stroke-width: 2.7; }
.baby-eye, .baby-mouth { stroke-width: 2.3; }
.baby-blanket-fold { stroke: #7f9c8f; stroke-width: 2; }
.baby-cradle-rim { stroke: #587568; stroke-width: 3; }
.baby-rocker { stroke: #587568; stroke-width: 2.5; }
.mascot-scene.is-celebrating .baby-mascot { animation: mascot-cheer 560ms var(--ease-spring); }
.recommendation-card {
  position: relative;
  padding: 17px;
  border: 1px solid #e6ddcf;
  border-radius: 16px;
  background: #f8f3ea;
  color: var(--ink);
}
.recommendation-card::before { display: none; }
.recommendation-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-soft); font-size: 11px; font-weight: 700; }
.recommendation-method { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; background: var(--ochre-soft); color: #785624; font-size: 10px; }
.recommendation-values { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin: 10px 0 6px; }
.recommendation-values strong { font-size: clamp(21px, 6vw, 28px); font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.recommendation-values span { color: #a49b8c; }
#recommendation-basis { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

/* Summary and growth */
.summary-grid { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin-top: 8px; }
.summary-grid article {
  min-width: 0;
  padding: 11px 5px 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
}
.summary-grid .icon { display: block; width: 19px; height: 19px; margin: 0 auto 5px; }
.stat-milk .icon { color: var(--clay); }
.stat-feed .icon { color: var(--ochre); }
.stat-pee .icon { color: var(--blue); }
.stat-poop .icon { color: var(--primary); }
.summary-grid span { display: block; margin-bottom: 2px; color: var(--muted); font-size: 10px; font-weight: 650; white-space: nowrap; }
.summary-grid strong { display: block; overflow: hidden; font-size: clamp(16px, 5vw, 21px); font-weight: 650; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.summary-grid small { color: var(--muted); font-size: 9px; font-weight: 550; }
.weight-card { position: relative; z-index: 2; margin-top: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--sage-soft); }
.health-card { display: block; color: var(--ink); }
.health-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.profile-identity { display: flex; align-items: center; min-width: 0; gap: 9px; }
.profile-avatar { flex: 0 0 auto; width: 42px; height: 42px; overflow: hidden; border: 1px solid rgba(255,255,255,.82); border-radius: 13px; background: var(--primary-dark); box-shadow: var(--shadow-sm); }
.profile-avatar img { display: block; width: 100%; height: 100%; }
.profile-heading-copy { min-width: 0; }
.profile-heading-copy > span { display: block; margin-bottom: 1px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .08em; }
.profile-heading-copy h1 { max-width: 10em; margin: 0; overflow: hidden; color: var(--ink); font-size: 17px; font-weight: 700; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
.age-display { flex: 0 0 auto; padding: 5px 9px; border: 1px solid #cfddd5; border-radius: 999px; background: rgba(255,255,255,.62); color: var(--primary-dark); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.health-editors { display: grid; gap: 8px; }
.health-editor { min-width: 0; display: grid; grid-template-columns: minmax(84px, auto) minmax(0, 1fr) auto; align-items: center; gap: 7px; }
.health-editor > label { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--ink-soft); font-size: 11px; font-weight: 650; white-space: nowrap; }
.health-editor > label .icon { width: 16px; height: 16px; color: var(--primary); }
.health-editor > input, .birth-date-form > input { min-width: 0; min-height: 44px; margin: 0; padding: 8px 10px; border: 2px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 650; }
.health-editor > input:focus, .birth-date-form > input:focus { border-color: var(--primary); }
.birth-date-display, .birth-date-form, .weight-display, .weight-form { grid-column: 2 / -1; min-width: 0; }
.birth-date-display, .weight-display { min-height: 44px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding-left: 12px; border: 1px solid var(--line); border-radius: 11px; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.birth-date-display strong, .weight-display strong { min-width: 0; overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.birth-date-form, .weight-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 7px; }
.profile-edit, .profile-cancel { min-width: 52px; min-height: 44px; padding: 0 11px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.profile-edit { border: 0; background: transparent; color: var(--primary-dark); }
.profile-edit:hover { background: var(--primary-soft); }
.profile-cancel { border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); }
.profile-cancel:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.health-editor.weight-editor { display: grid; }
.weight-input { display: flex; align-items: center; width: 100%; padding: 0 9px; border: 2px solid var(--line); border-radius: 11px; background: var(--surface); }
.weight-input:focus-within { border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: 0; }
.weight-input input { min-width: 0; min-height: 44px; margin: 0; padding: 8px 2px; border: 0; background: transparent; text-align: right; font-size: 16px; font-weight: 700; box-shadow: none; }
.weight-input input:focus, .weight-input input:focus-visible { border-color: transparent; outline: none; box-shadow: none; }
.weight-input span { color: var(--muted); font-size: 11px; font-weight: 650; }
.weight-save { min-width: 52px; min-height: 44px; padding: 0 11px; border: 1px solid var(--primary); border-radius: 11px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 700; }
.weight-save:hover { background: var(--primary-dark); }
.health-error { min-height: 0; margin: 8px 0 0; color: var(--danger); font-size: 11px; font-weight: 650; }
.health-error:not(:empty) { min-height: 16px; }
.health-note { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }

/* Baby app hub */
.baby-hub-panel { overflow: hidden; }
.baby-hub-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.baby-hub-logo { width: 72px; height: 72px; flex: 0 0 auto; overflow: hidden; border: 1px solid rgba(255,255,255,.82); border-radius: 21px; background: var(--primary-dark); box-shadow: var(--shadow-sm); }
.baby-hub-logo img { display: block; width: 100%; height: 100%; }
.baby-hub-copy { min-width: 0; }
.baby-hub-copy > span { display: block; margin-bottom: 3px; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.baby-hub-copy h2 { margin: 0; color: var(--ink); font-size: clamp(24px, 7vw, 30px); font-weight: 700; letter-spacing: -.04em; }
.baby-hub-copy p { margin: 3px 0 0; color: var(--muted); font-size: 13px; font-weight: 550; line-height: 1.45; }
.baby-hub-note { margin: 14px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.profile-utilities { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.profile-utility,
.profile-utility.language-toggle {
  min-width: 0;
  min-height: 72px;
  display: grid;
  grid-template-rows: 22px auto;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 9px 7px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}
.profile-utility .icon { width: 20px; height: 20px; }
button.profile-utility:hover { border-color: var(--line-strong); background: var(--surface); }
.sync-status { transition: background-color var(--motion-base) ease, border-color var(--motion-base) ease, color var(--motion-base) ease, box-shadow var(--motion-base) ease; }
.sync-icon { position: relative; width: 24px; height: 22px; display: grid; place-items: center; }
.sync-icon::after { position: absolute; right: -5px; bottom: -4px; width: 15px; height: 15px; display: grid; place-items: center; border: 2px solid var(--surface); border-radius: 50%; color: white; font-size: 9px; font-weight: 900; line-height: 1; }
.sync-status.is-connecting { border-color: color-mix(in srgb, var(--blue) 48%, var(--line)); background: var(--blue-soft); color: var(--blue); }
.sync-status.is-connected { border-color: var(--success-line); background: var(--success-soft); color: var(--success); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--success-line) 42%, transparent); }
.sync-status.is-connected .sync-icon::after { content: "✓"; background: var(--success); }
.sync-status.is-unavailable { border-color: color-mix(in srgb, var(--danger) 44%, var(--line)); background: var(--danger-soft); color: var(--danger); }
.sync-status.is-unavailable .sync-icon::after { content: "!"; background: var(--danger); }
.profile-logout { border-color: color-mix(in srgb, var(--danger) 22%, var(--line)); background: var(--danger-soft); color: var(--danger); }
button.profile-logout:hover { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: color-mix(in srgb, var(--danger-soft) 78%, var(--surface)); }

/* Care actions */
.panel { margin-top: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.feed-panel, .diaper-panel { border-color: var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.heading-title { display: flex; align-items: center; min-width: 0; gap: 10px; }
.heading-title h2 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: -.025em; }
.panel-icon { flex: 0 0 auto; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; }
.panel-icon .icon { width: 21px; height: 21px; }
.bottle-icon { background: var(--clay-soft); color: var(--clay); }
.diaper-icon { background: var(--sage-soft); color: var(--primary); }
.time-field { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.time-field input { width: auto; min-width: 112px; min-height: 44px; margin: 0; padding: 7px 9px; border-radius: 11px; color: var(--ink); font-size: 16px; font-weight: 650; }
.segmented { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.segmented button { min-height: 44px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
.segmented button.active { border-color: var(--line); background: var(--surface); color: var(--primary-dark); }
.amount-control { display: grid; grid-template-columns: 58px 1fr 58px; align-items: center; margin: 20px 0 14px; text-align: center; }
.amount-control button { width: 48px; height: 48px; margin: auto; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); color: var(--primary-dark); font-size: 25px; font-weight: 500; }
.amount-control button:hover { border-color: var(--primary); background: var(--primary-soft); }
.amount-orb { position: relative; display: inline-flex; align-items: baseline; justify-content: center; min-height: 66px; }
.amount-orb::before { content: ""; position: absolute; z-index: 0; top: 50%; left: 50%; width: 104px; height: 58px; border-radius: 18px; background: var(--sage-soft); transform: translate(-50%, -50%); }
.amount-orb strong, .amount-orb span { position: relative; z-index: 1; }
.amount-control strong { font-size: clamp(42px, 13vw, 53px); font-weight: 600; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.amount-control span { margin-left: 5px; color: var(--muted); font-size: 13px; font-weight: 650; }
.amount-orb.is-updating { animation: amount-pop 240ms var(--ease-spring); }
.presets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.presets button { min-width: 0; min-height: 44px; padding: 8px 2px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 650; }
.presets button:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.presets button.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.save-button { position: relative; margin-top: 16px; min-height: 54px; overflow: hidden; font-size: 15px; letter-spacing: .01em; }
.save-button::after { display: none; }
.diaper-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.diaper-actions button { min-width: 0; min-height: 82px; display: grid; place-items: center; align-content: center; gap: 7px; padding: 9px 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); }
.diaper-actions button:nth-child(1) .action-icon { background: var(--blue-soft); color: var(--blue); }
.diaper-actions button:nth-child(2) .action-icon { background: var(--ochre-soft); color: #8a642a; }
.diaper-actions button:nth-child(3) .action-icon { background: var(--sage-soft); color: var(--primary); }
.diaper-actions button:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.action-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; }
.action-icon .icon { width: 20px; height: 20px; }
.diaper-actions strong { max-width: 100%; overflow: hidden; font-size: 13px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }

/* Feed statistics */
.feed-record-panel { margin-top: 14px; }
.feed-record-heading { margin-bottom: 14px; }
.feed-stat-icon { background: var(--blue-soft); color: var(--blue); }
.feed-chart-empty { min-height: 132px; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; }
.feed-chart-empty .icon { width: 36px; height: 36px; color: var(--blue); }
.feed-chart-empty p { max-width: 25em; margin: 0; font-size: 13px; font-weight: 650; line-height: 1.5; }
.feed-chart-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.feed-chart-metrics p { min-width: 0; margin: 0; padding: 12px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.feed-chart-metrics span, .feed-chart-metrics strong { display: block; }
.feed-chart-metrics span { color: var(--muted); font-size: 11px; font-weight: 700; }
.feed-chart-metrics strong { margin-top: 4px; overflow: hidden; font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.feed-chart-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin-top: 14px; color: var(--muted); font-size: 11px; font-weight: 650; }
.feed-chart-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.feed-legend-bar { width: 8px; height: 13px; border-radius: 4px 4px 2px 2px; background: var(--clay); }
.feed-legend-bar.current { width: 12px; background: var(--primary); }
.feed-chart-figure { display: grid; grid-template-columns: 38px minmax(0, 1fr); margin-top: 7px; }
.feed-chart-y-axis { height: 190px; display: flex; flex-direction: column; justify-content: space-between; padding: 10px 7px 26px 0; color: var(--muted); font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.feed-chart-plot { position: relative; min-width: 0; height: 190px; }
.feed-chart-plot::before { content: ""; position: absolute; inset: 10px 0 26px; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line-strong); background: repeating-linear-gradient(to top, transparent 0, transparent calc(33.333% - 1px), color-mix(in srgb, var(--line) 62%, transparent) calc(33.333% - 1px), color-mix(in srgb, var(--line) 62%, transparent) 33.333%); }
.feed-chart-marks { position: absolute; inset: 10px 0 26px; }
.feed-chart-mark { position: absolute; bottom: 0; left: calc(var(--feed-x) * 1%); width: 38px; height: 100%; transform: translateX(-50%); }
.feed-chart-bar { position: absolute; bottom: 0; left: 50%; width: 12px; height: calc(var(--feed-height) * 1%); min-height: 4px; border-radius: 6px 6px 2px 2px; background: var(--clay); transform: translateX(-50%); }
.feed-chart-mark.is-current .feed-chart-bar { width: 20px; background: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent); }
.feed-chart-value { position: absolute; left: 50%; bottom: calc(var(--feed-height) * 1% + 5px); color: var(--ink-soft); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; transform: translateX(-50%); white-space: nowrap; }
.feed-chart-mark.is-current .feed-chart-value { color: var(--primary-dark); }
.feed-chart-x-axis { position: absolute; right: 0; bottom: 0; left: 0; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.feed-target-comparison { margin-top: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.feed-target-heading, .feed-target-labels { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.feed-target-heading { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.feed-target-heading strong { color: var(--primary-dark); font-size: 18px; font-variant-numeric: tabular-nums; }
.feed-target-track { position: relative; height: 36px; margin-top: 10px; overflow: hidden; border-radius: 10px; background: color-mix(in srgb, var(--sage) 24%, var(--surface)); }
.feed-target-current { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--primary); transition: width var(--motion-slow) var(--ease-out); }
.feed-target-labels { margin-top: 8px; color: var(--muted); font-size: 11px; font-weight: 650; font-variant-numeric: tabular-nums; }
.feed-target-labels strong { color: var(--primary-dark); }
.feed-target-status { margin: 6px 0 0; color: var(--muted); font-size: 12px; font-weight: 650; line-height: 1.4; }

/* Feedback */
.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 28px); display: flex; align-items: center; gap: 9px; padding: 10px 11px 10px 14px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: #294238; color: white; box-shadow: 0 14px 34px rgba(31,49,42,.2); opacity: 0; pointer-events: none; transform: translate(-50%, 18px); transition: opacity var(--motion-base) ease, transform var(--motion-base) var(--ease-out); }
.toast.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.toast .icon { flex: 0 0 auto; color: #dfbd77; }
.toast span { min-width: 0; overflow-wrap: anywhere; font-size: 13px; font-weight: 650; }
.toast button { min-width: 44px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px; background: rgba(255,255,255,.1); color: #f1d59a; font-size: 12px; font-weight: 700; }
.fx-layer { position: fixed; z-index: 200; inset: 0; overflow: hidden; pointer-events: none; }
.fx-particle { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--particle-color, var(--ochre)); opacity: 0; animation: particle-burst 620ms var(--ease-out) forwards; }

/* Primary navigation and route visibility */
.app-shell[data-active-page="baby"] [data-route-page]:not([data-route-page="baby"]),
.app-shell[data-active-page="feed"] [data-route-page]:not([data-route-page="feed"]),
.app-shell[data-active-page="diaper"] [data-route-page]:not([data-route-page="diaper"]) { display: none; }
.app-shell [data-route-page] { animation: route-page-enter var(--motion-base) var(--ease-out) both; }
.app-shell[data-active-page="baby"] .day-card { display: none; }
.app-shell[data-active-page="baby"] .weight-card { margin-top: 0; }
.bottom-nav {
  position: relative;
  z-index: 20;
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin: 0 auto 14px;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 12px 32px rgba(30, 48, 40, .12);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
.bottom-nav-item {
  min-width: 0;
  min-height: 54px;
  display: grid;
  grid-template-columns: auto auto;
  place-content: center;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.15;
}
.bottom-nav-item:hover { background: var(--surface-soft); color: var(--ink-soft); }
.bottom-nav-item.active { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 16px rgba(49, 84, 70, .18); }
.bottom-nav-item:active { transform: scale(.97); }
.bottom-nav-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; }
.bottom-nav-icon .icon { width: 21px; height: 21px; stroke-width: 1.9; }
.bottom-nav-item.active .bottom-nav-icon { background: rgba(255,255,255,.12); }

@media (max-width: 759px), (max-height: 500px) and (orientation: landscape) and (max-width: 932px) {
  .app-shell { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  .bottom-nav {
    position: fixed;
    z-index: 90;
    left: max(12px, env(safe-area-inset-left));
    right: max(12px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    max-width: 520px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: 0 16px 42px rgba(30, 48, 40, .18);
    margin-inline: auto;
  }
  .bottom-nav-item {
    min-height: 60px;
    grid-template-rows: 28px auto;
    grid-template-columns: none;
    place-items: center;
    gap: 2px;
    padding: 7px 4px 6px;
    font-size: 11px;
  }
  .bottom-nav-item:active { transform: scale(.96); }
  .app-shell[data-active-page="feed"] .feed-panel .save-button { position: sticky; z-index: 6; bottom: calc(88px + env(safe-area-inset-bottom)); box-shadow: 0 12px 28px rgba(49, 84, 70, .22); }
  .toast { bottom: calc(90px + env(safe-area-inset-bottom)); }
}

@keyframes content-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes button-spin { to { transform: rotate(360deg); } }
@keyframes mascot-cheer { 0%,100% { transform: translateX(-50%) scale(1); } 45% { transform: translateX(-50%) translateY(-8px) scale(1.035); } }
@keyframes amount-pop { 0%,100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes particle-burst { 0% { opacity: 0; transform: translate(0, 0) scale(.3); } 18% { opacity: .85; } 100% { opacity: 0; transform: translate(var(--particle-x), var(--particle-y)) scale(.8); } }
@keyframes route-page-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 760px) {
  .app-shell { padding-inline: 24px; }
  .hero-stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 18px; }
  .day-card, .hero-row, .summary-grid, .weight-card { grid-column: 1 / -1; }
  .hero-row { grid-template-columns: 180px minmax(0, 1fr); min-height: 178px; }
  .summary-grid { gap: 10px; margin-top: 0; }
  .summary-grid article { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 12px 14px; text-align: left; }
  .summary-grid .icon { grid-row: 1 / 3; width: 25px; height: 25px; margin: 0; }
  .summary-grid span { margin: 0; font-size: 11px; }
  .summary-grid strong { font-size: 20px; }
  .health-editors { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .baby-hub-panel { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr); align-items: center; column-gap: 24px; }
  .profile-utilities { margin-top: 0; padding-top: 0; padding-left: 24px; border-top: 0; border-left: 1px solid var(--line); }
  .baby-hub-note { grid-column: 1; margin-top: 14px; }
}

@media (min-width: 1024px) {
  .hero-stage { padding: 20px; }
  .hero-row { grid-template-columns: 190px minmax(0, 1fr); }
  .mascot-scene { height: 168px; }
  .recommendation-card { padding: 20px; }
  .panel { padding: 22px; }
}

@media (max-width: 520px) {
  .health-editor { grid-template-columns: minmax(0, 1fr) auto; }
  .health-editor > label { grid-column: 1 / -1; }
  .birth-date-display, .birth-date-form, .weight-display, .weight-form { grid-column: 1 / -1; }
  html[lang="en"] .hero-row { grid-template-columns: 88px minmax(0, 1fr); gap: 8px; }
  html[lang="en"] .baby-mascot { bottom: 28px; width: 92px; height: 92px; }
  html[lang="en"] .recommendation-card { padding: 14px; }
  html[lang="en"] .recommendation-heading { gap: 6px; }
  html[lang="en"] .recommendation-values { gap: 6px; margin-top: 8px; }
  html[lang="en"] .recommendation-values strong { font-size: clamp(21px, 6vw, 25px); }
  html[lang="en"] #recommendation-basis { font-size: 10.5px; line-height: 1.45; }
  html[lang="en"] .feed-chart-metrics span { min-height: 2.5em; line-height: 1.25; }
}

@media (max-width: 374px) {
  .app-shell { padding-inline: 10px; }
  .hero-stage { padding: 10px; border-radius: 20px; }
  .hero-row { grid-template-columns: 100px minmax(0, 1fr); gap: 7px; }
  .baby-mascot { width: 96px; height: 96px; bottom: 26px; }
  .recommendation-card { padding: 13px; }
  .summary-grid { gap: 5px; }
  .panel { padding: 15px; }
  .section-heading { align-items: flex-start; }
  .time-field { display: block; text-align: right; }
  .time-field input { display: block; margin-top: 4px; }
  .presets { gap: 4px; }
  .health-heading { align-items: flex-start; }
  .age-display { max-width: 58%; white-space: normal; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .app-shell { padding-top: 8px; }
  .hero-row { min-height: 140px; }
  .mascot-scene { height: 132px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f0f2ee;
    --ink-soft: #c8d0cb;
    --muted: #a4aea9;
    --primary: #9fc5b3;
    --primary-dark: #d2e7dc;
    --primary-soft: #2b4137;
    --on-primary: #183128;
    --sage: #76998a;
    --sage-soft: #26332d;
    --clay: #d8997f;
    --clay-soft: #442f28;
    --ochre: #dfb86f;
    --ochre-soft: #403621;
    --blue: #9bb9bd;
    --blue-soft: #26383b;
    --danger: #ef9b96;
    --danger-soft: #442827;
    --success: #8fd3a8;
    --success-soft: #20392a;
    --success-line: #467455;
    --paper: #1e2622;
    --surface: #222b27;
    --surface-soft: #2a342f;
    --canvas: #171d1a;
    --line: #3a4640;
    --line-strong: #4b5a52;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.12), 0 10px 28px rgba(0,0,0,.14);
    --shadow-md: 0 2px 5px rgba(0,0,0,.18), 0 24px 64px rgba(0,0,0,.2);
  }
  html { background: var(--canvas); }
  body { background: radial-gradient(circle at 8% 0, rgba(112,153,135,.12), transparent 28rem), var(--canvas); }
  input { color-scheme: dark; }
  .auth-card { background: var(--surface); }
  .recommendation-card { border-color: #4a4336; background: #302d26; }
  .recommendation-method { color: #efd39c; }
  .recommendation-values span { color: #8f8a80; }
  .weight-card { background: var(--sage-soft); }
  .age-display { border-color: #40544a; background: rgba(255,255,255,.04); }
  .health-editor > input, .weight-input { background: var(--surface); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
