: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;
  --feed-breast: #4f806c;
  --feed-breast-soft: #e2eee8;
  --feed-formula: #ae7529;
  --feed-formula-soft: #f6ead6;
  --avatar-fill: #9bb6a7;
  --avatar-line: #365648;
  --avatar-bg: #edf1ed;
  --danger: #a94747;
  --danger-soft: #f8e8e6;
  --danger-action: #9f3f3f;
  --on-danger: #ffffff;
  --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, select { 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; }
.today-insights { margin-top: 14px; }
.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(110px, 2fr) minmax(0, 3fr); align-items: stretch; gap: 10px; min-height: 160px; }
.recommendation-visual { min-width: 0; display: flex; align-self: stretch; }
.recommendation-visual.is-celebrating .milk-capacity-compact { animation: capacity-cue 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.55; white-space: pre-line; }

/* 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-weight .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; }
.profile-card { position: relative; z-index: 2; margin-top: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--sage-soft); }
.baby-profile-card { overflow: hidden; background: linear-gradient(145deg, color-mix(in srgb, var(--sage-soft) 88%, var(--surface)), var(--surface)); }
.baby-profile-card::before { content: ""; position: absolute; z-index: -1; top: -96px; right: -82px; width: 210px; height: 210px; border-radius: 50%; background: color-mix(in srgb, var(--ochre-soft) 58%, transparent); pointer-events: none; }
.baby-profile-spotlight { min-width: 0; display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 18px; padding: 4px 2px 18px; }
.baby-profile-avatar { position: relative; width: 88px; height: 88px; display: grid; place-items: center; padding: 0; border: 2px solid color-mix(in srgb, var(--surface) 86%, var(--line)); border-radius: 50%; background: var(--avatar-bg); color: var(--avatar-line); box-shadow: var(--shadow-sm); }
.baby-profile-avatar:hover { border-color: color-mix(in srgb, var(--primary) 48%, var(--surface)); background: color-mix(in srgb, var(--avatar-bg) 90%, var(--primary-soft)); }
.baby-profile-avatar[aria-expanded="true"] { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-soft) 84%, transparent); }
.baby-avatar-icon { position: relative; z-index: 1; width: 68px; height: 68px; stroke-width: 1.7; }
.avatar-shape { fill: var(--avatar-fill); stroke: var(--avatar-line); }
.avatar-secondary { fill: var(--avatar-bg); stroke: var(--avatar-line); }
.avatar-detail-fill { fill: var(--avatar-line); stroke: none; }
.avatar-detail-line { fill: none; stroke: var(--avatar-line); stroke-width: 1.8; }
.avatar-edit-indicator { position: absolute; z-index: 2; right: -1px; bottom: 2px; width: 25px; height: 25px; display: grid; place-items: center; border: 2px solid var(--avatar-bg); border-radius: 50%; background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.avatar-edit-indicator .icon { width: 12px; height: 12px; stroke-width: 2; }
.avatar-picker { margin: -4px 0 16px; padding: 12px; border: 1px solid color-mix(in srgb, var(--line) 76%, transparent); border-radius: 16px; background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: var(--shadow-sm); }
.avatar-picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.avatar-picker-heading strong { color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.avatar-picker-close { min-width: 48px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--primary-dark); font-size: 12px; font-weight: 750; }
.avatar-picker-close:hover { background: var(--primary-soft); }
.avatar-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
.avatar-option { position: relative; min-width: 0; min-height: 68px; display: grid; grid-template-rows: 43px auto; place-items: center; gap: 2px; padding: 5px 2px 4px; border: 1px solid transparent; border-radius: 13px; background: transparent; color: var(--avatar-line); }
.avatar-option:hover { background: var(--avatar-bg); }
.avatar-option[aria-pressed="true"] { border-color: var(--primary); background: var(--avatar-bg); box-shadow: inset 0 0 0 1px var(--primary); }
.avatar-option[aria-pressed="true"]::after { content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border: 2px solid var(--surface); border-radius: 50%; background: var(--primary); }
.avatar-option .icon { width: 43px; height: 43px; stroke-width: 1.7; }
.avatar-option span { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 9px; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.avatar-option[aria-pressed="true"] span { color: var(--primary-dark); }
.baby-profile-intro { min-width: 0; }
.baby-profile-intro h1 { max-width: 13ch; margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: clamp(34px, 11vw, 52px); font-weight: 750; letter-spacing: -.055em; line-height: 1.02; text-wrap: balance; }
.baby-profile-intro h1:focus { outline: none; }
.baby-name-display { display: flex; align-items: center; gap: 4px; min-width: 0; }
.inline-edit-button { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); opacity: .62; }
.inline-edit-button .icon { width: 17px; height: 17px; }
.inline-edit-button:hover { background: var(--primary-soft); color: var(--primary-dark); opacity: 1; }
.inline-edit-button:focus-visible { outline: 3px solid var(--primary); outline-offset: 1px; opacity: 1; }
.inline-edit-button:disabled { opacity: .3; }
.baby-primary-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.baby-primary-fact { min-width: 0; min-height: 94px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid color-mix(in srgb, var(--line) 76%, transparent); border-radius: 15px; background: color-mix(in srgb, var(--surface) 86%, transparent); box-shadow: var(--shadow-sm); }
.baby-primary-fact > span { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; }
.baby-primary-fact > span .icon { width: 16px; height: 16px; color: var(--primary); }
.baby-primary-fact strong { overflow-wrap: anywhere; color: var(--ink); font-size: clamp(17px, 5vw, 22px); font-weight: 750; line-height: 1.22; font-variant-numeric: tabular-nums; }
.fact-value-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fact-value-row strong { min-width: 0; }
.baby-birthday-fact { grid-column: 1 / -1; min-height: 82px; }
.baby-age-fact { background: color-mix(in srgb, var(--ochre-soft) 46%, var(--surface)); }
.baby-age-fact strong { color: var(--primary-dark); }
.baby-weight-fact { background: color-mix(in srgb, var(--blue-soft) 44%, var(--surface)); }
.baby-weight-fact > span .icon { color: var(--blue); }
.inline-edit-form { min-width: 0; }
.baby-name-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 7px; }
.baby-name-form input,
.birth-date-form > input { min-width: 0; min-height: 46px; margin: 0; padding: 8px 11px; border: 2px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 650; }
.baby-name-form input:focus,
.birth-date-form > input:focus { border-color: var(--primary); }
.birth-date-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 7px; }
.profile-cancel { min-width: 52px; min-height: 44px; padding: 0 11px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.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); }
.profile-save { min-width: 52px; min-height: 44px; padding: 0 12px; border: 1px solid var(--primary); border-radius: 11px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 700; white-space: nowrap; }
.profile-save:hover { background: var(--primary-dark); }
.health-error { min-height: 0; margin: 7px 0 0; color: var(--danger); font-size: 11px; font-weight: 650; }
.health-error:not(:empty) { min-height: 16px; }
/* Settings */
.settings-panel { overflow: hidden; }
.settings-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.settings-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); }
.settings-logo img { display: block; width: 100%; height: 100%; }
.settings-copy { min-width: 0; }
.settings-copy > span { display: block; margin-bottom: 3px; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.settings-title-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.settings-copy h1 { margin: 0; color: var(--ink); font-size: clamp(24px, 7vw, 30px); font-weight: 700; letter-spacing: -.04em; }
.settings-copy h1:focus { outline: none; }
.app-version { color: var(--muted); font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; white-space: nowrap; }
.reminder-setting { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 11px; margin-top: 18px; padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-soft); }
.reminder-setting-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: var(--ochre-soft); color: #785624; }
.reminder-setting-copy { min-width: 0; }
.reminder-setting-copy strong, .reminder-setting-copy span { display: block; }
.reminder-setting-copy strong { color: var(--ink); font-size: 14px; }
.reminder-setting-copy span { margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.setting-switch { position: relative; width: 52px; min-width: 52px; height: 44px; padding: 0; border: 0; border-radius: 999px; background: transparent; }
.setting-switch::before { content: ""; position: absolute; inset: 6px 0; border-radius: 999px; background: var(--line-strong); transition: background-color var(--motion-base) ease; }
.setting-switch > span { position: absolute; top: 10px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 4px rgba(37,49,44,.22); transition: transform var(--motion-base) var(--ease-out); }
.setting-switch[aria-checked="true"]::before { background: var(--success); }
.setting-switch[aria-checked="true"] > span { transform: translateX(20px); }
.setting-switch:disabled { opacity: .58; }
.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); }
.feed-method-option { display: flex; align-items: center; justify-content: center; gap: 7px; }
.feed-method-option .icon { width: 18px; height: 18px; stroke-width: 1.9; }
.feed-method-option.is-breast-milk.active { border-color: color-mix(in srgb, var(--feed-breast) 32%, var(--line)); background: var(--feed-breast-soft); color: var(--feed-breast); }
.feed-method-option.is-formula.active { border-color: color-mix(in srgb, var(--feed-formula) 32%, var(--line)); background: var(--feed-formula-soft); color: var(--feed-formula); }
.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; }
.today-diaper-panel { padding: 14px 16px; }
.diaper-compact-heading { margin-bottom: 10px; }
.diaper-actions-compact { gap: 7px; }
.diaper-actions-compact button { min-height: 52px; grid-template-columns: 28px auto; place-content: center; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 12px; }
.diaper-actions-compact .action-icon { width: 28px; height: 28px; border-radius: 9px; }
.diaper-actions-compact .action-icon .icon { width: 17px; height: 17px; }
.record-details > summary { min-height: 44px; display: grid; grid-template-columns: minmax(0, 1fr) auto 24px; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 750; cursor: pointer; list-style: none; }
.record-details > summary::-webkit-details-marker { display: none; }
.record-details > summary::after,
.weight-data-details > summary::after { content: ""; width: 24px; height: 24px; display: block; flex: 0 0 auto; border-radius: 50%; background-color: var(--surface-soft); background-image: linear-gradient(45deg, transparent 48%, var(--primary-dark) 49% 58%, transparent 59%), linear-gradient(135deg, transparent 48%, var(--primary-dark) 49% 58%, transparent 59%); background-position: calc(50% - 3px) calc(50% - 1px), calc(50% + 3px) calc(50% - 1px); background-size: 7px 7px; background-repeat: no-repeat; transition: transform var(--motion-fast) ease, background-color var(--motion-fast) ease; }
.record-details[open] > summary::after,
.weight-data-details[open] > summary::after { transform: rotate(180deg); background-color: var(--sage-soft); }
.record-details > summary:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 10px; }
.record-details-count { min-width: 24px; padding: 3px 7px; border-radius: 999px; background: var(--surface-soft); color: var(--ink-soft); font-size: 10px; line-height: 1.4; text-align: center; font-variant-numeric: tabular-nums; }
.compact-records { margin-top: 10px; border-top: 1px solid var(--line); }
.compact-records > summary { padding: 8px 2px 0; }
.compact-records .record-list { margin-top: 8px; }
.compact-records .record-list-row { min-height: 54px; }

/* Weight tracking */
.baby-weight-grid { display: grid; gap: 14px; margin-top: 14px; }
.baby-weight-grid > .panel { margin-top: 0; }
.weight-icon { background: var(--ochre-soft); color: var(--ochre); }
.weight-trend-icon { background: var(--blue-soft); color: var(--blue); }
.weight-entry-panel { --weight-control-height: 58px; }
.weight-entry-panel .section-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(142px, 170px); align-items: end; gap: 12px; }
.weight-date-field { min-width: 0; display: grid; gap: 4px; }
.weight-date-field > span { padding-left: 2px; color: var(--muted); font-size: 10px; font-weight: 700; }
.weight-date-field input { width: 100%; min-width: 0; min-height: 44px; margin: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); font-size: 13px; }
.weight-entry-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; gap: 10px; }
.weight-entry-field { margin: 0; }
.weight-entry-field > span:first-child { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.weight-entry-input { height: var(--weight-control-height); display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--paper); transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease, background-color var(--motion-fast) ease; }
.weight-entry-input:focus-within { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.weight-entry-input input { width: 100%; min-width: 0; min-height: 44px; margin: 0; padding: 4px 0; border: 0; appearance: textfield; background: transparent; color: var(--ink); font-size: clamp(27px, 8vw, 34px); font-weight: 680; letter-spacing: -.035em; text-align: left; box-shadow: none; }
.weight-entry-input input::-webkit-inner-spin-button,
.weight-entry-input input::-webkit-outer-spin-button { margin: 0; appearance: none; }
.weight-entry-input input:focus,
.weight-entry-input input:focus-visible { border: 0; outline: 0; box-shadow: none; }
.weight-entry-input input[aria-invalid="true"] { color: var(--danger); }
.weight-entry-input strong { min-width: 42px; min-height: 34px; display: grid; place-items: center; padding: 0 8px; border-radius: 9px; background: var(--sage-soft); color: var(--primary-dark); font-size: 12px; font-weight: 750; }
.weight-entry-error { min-height: 0; margin: 8px 0 0; color: var(--danger); font-size: 11px; font-weight: 650; }
.weight-entry-error:not(:empty) { min-height: 16px; }
.weight-entry-panel .weight-save-button { width: 100%; height: var(--weight-control-height); min-height: var(--weight-control-height); margin: 0; border-radius: 13px; font-size: 14px; }
.weight-trend-heading { margin-bottom: 13px; }
.weight-trend-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.weight-trend-metrics p { min-width: 0; margin: 0; padding: 12px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.weight-trend-metrics span,
.weight-trend-metrics strong { display: block; }
.weight-trend-metrics span { color: var(--muted); font-size: 11px; font-weight: 700; }
.weight-trend-metrics strong { margin-top: 4px; color: var(--primary-dark); font-size: 21px; font-weight: 750; font-variant-numeric: tabular-nums; }
.weight-trend-empty { min-height: 164px; display: grid; place-items: center; align-content: center; gap: 10px; color: var(--muted); text-align: center; }
.weight-trend-empty .icon { width: 38px; height: 38px; color: var(--ochre); }
.weight-trend-empty p { max-width: 28em; margin: 0; font-size: 13px; font-weight: 650; line-height: 1.5; }
.weight-chart-figure { display: grid; grid-template-columns: 54px minmax(0, 1fr); margin-top: 15px; }
.weight-chart-y-axis { height: 184px; display: flex; flex-direction: column; justify-content: space-between; padding: 16px 7px 24px 0; color: var(--muted); font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }
.weight-chart-plot { min-width: 0; }
.weight-chart-plot svg { width: 100%; height: auto; display: block; aspect-ratio: 15 / 8; overflow: visible; }
.weight-chart-grid { stroke: color-mix(in srgb, var(--line) 72%, transparent); stroke-width: 1; vector-effect: non-scaling-stroke; }
.weight-chart-area { fill: color-mix(in srgb, var(--primary) 12%, transparent); }
.weight-chart-line { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.weight-chart-point { fill: var(--surface); stroke: var(--primary); stroke-width: 3; vector-effect: non-scaling-stroke; cursor: pointer; }
.weight-chart-point:hover,
.weight-chart-point:focus { fill: var(--ochre-soft); stroke: var(--ochre); outline: none; }
.weight-chart-x-axis { display: flex; justify-content: space-between; margin-top: -2px; color: var(--muted); font-size: 10px; font-weight: 650; font-variant-numeric: tabular-nums; }
.weight-data-details { margin-top: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.weight-data-details summary { min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 9px 12px; color: var(--primary-dark); font-size: 11px; font-weight: 750; cursor: pointer; list-style: none; }
.weight-data-details summary::-webkit-details-marker { display: none; }
.weight-data-details summary::after { margin-left: auto; }
.weight-data-details summary:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 10px; }
.weight-trend-data { display: grid; gap: 0; margin: 0; padding: 0 12px 10px; list-style: none; }
.weight-trend-data li { min-height: 52px; display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; align-items: center; gap: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.weight-trend-data strong { color: var(--ink); font-size: 12px; font-variant-numeric: tabular-nums; }
.weight-trend-delete-button { justify-self: end; color: color-mix(in srgb, var(--danger) 62%, var(--muted)); }
.weight-trend-delete-button:hover,
.weight-trend-delete-button:focus-visible { color: var(--danger); }
.weight-record-row .record-list-icon { background: var(--ochre-soft); color: var(--ochre); }

/* 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; }
.milk-capacity { min-height: 122px; display: grid; grid-template-columns: 82px minmax(0, 1fr); align-items: center; gap: 14px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); }
.milk-capacity-visual { width: 72px; height: 98px; display: grid; place-items: center; }
.milk-capacity-visual svg { width: 64px; height: 96px; display: block; overflow: visible; }
.milk-capacity-fill { fill: color-mix(in srgb, var(--primary) 72%, var(--sage)); }
.milk-capacity-shell { fill: color-mix(in srgb, var(--surface) 88%, var(--primary-soft)); }
.milk-capacity-nipple, .milk-capacity-outline, .milk-capacity-levels { stroke: var(--primary-dark); stroke-linecap: round; stroke-linejoin: round; }
.milk-capacity-nipple { fill: var(--surface); stroke-width: 2.2; }
.milk-capacity-collar { fill: var(--surface); stroke: var(--primary-dark); stroke-width: 2.2; }
.milk-capacity-outline { fill: none; stroke-width: 2.4; }
.milk-capacity-levels { stroke: color-mix(in srgb, var(--primary-dark) 58%, transparent); stroke-width: 1.6; }
.milk-capacity-copy { min-width: 0; }
.milk-capacity-values { min-width: 0; display: flex; align-items: baseline; gap: clamp(3px, 1.4vw, 7px); margin: 5px 0 0; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.milk-capacity-values strong { color: var(--ink); font-size: clamp(22px, 7.5vw, 31px); font-weight: 740; letter-spacing: -.035em; }
.milk-capacity-values strong:first-child { color: var(--primary-dark); }
.milk-capacity-values > span { font-size: 18px; font-weight: 600; }
.milk-capacity-values small { font-size: 11px; font-weight: 700; }
.milk-capacity.is-unavailable .milk-capacity-outline { stroke-dasharray: 4 4; }
.milk-capacity.is-unavailable .milk-capacity-fill { opacity: 0; }
.milk-capacity.is-complete .milk-capacity-fill { fill: var(--success); }
.milk-capacity-compact { width: 100%; height: 100%; min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: 84px auto; justify-items: center; align-content: center; gap: 2px; padding: 7px 8px 10px; text-align: center; }
.milk-capacity-compact .milk-capacity-visual { width: 62px; height: 84px; }
.milk-capacity-compact .milk-capacity-visual svg { width: 59px; height: 84px; }
.milk-capacity-compact .milk-capacity-copy { width: 100%; display: grid; justify-items: center; align-content: center; }
.milk-capacity-compact .milk-capacity-values { justify-content: center; gap: 2px; margin: 0; }
.milk-capacity-compact .milk-capacity-values strong { font-size: clamp(16px, 4.6vw, 20px); letter-spacing: -.035em; }
.milk-capacity-compact .milk-capacity-values > span { font-size: 14px; }
.milk-capacity-compact .milk-capacity-values small { font-size: 9px; }
.milk-capacity-compact .feed-target-status { width: 100%; margin-top: 4px; overflow: hidden; font-size: 10px; line-height: 1.3; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.feed-chart-figure { margin-top: 2px; }
.feed-chart-plot { min-width: 0; }
.feed-stream { position: relative; display: grid; gap: 4px; padding-block: 2px; }
.feed-stream::before { content: ""; position: absolute; z-index: 0; top: 19px; bottom: 19px; left: 55px; width: 2px; border-radius: 999px; background: var(--line-strong); }
.feed-stream-event { position: relative; z-index: 1; min-width: 0; min-height: 44px; display: grid; grid-template-columns: 41px 24px minmax(0, 1fr) 44px; align-items: center; column-gap: 7px; }
.feed-stream-event time { color: var(--muted); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.feed-stream-node { width: 24px; height: 24px; display: grid; place-items: center; border: 2px solid var(--surface); border-radius: 50%; background: var(--clay-soft); color: var(--clay); box-shadow: 0 0 0 1px var(--line-strong); }
.feed-stream-node .icon { width: 13px; height: 13px; stroke-width: 2; }
.feed-stream-measure { min-width: 0; display: grid; grid-template-columns: minmax(34px, 1fr) auto; align-items: center; gap: 8px; }
.feed-stream-track { height: 12px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--feed-color-soft) 60%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--feed-color) 22%, var(--line)); }
.feed-stream-track > i { width: calc(var(--amount-percent) * 1%); height: 100%; display: block; border-radius: inherit; background: var(--feed-color); }
.feed-stream-event.is-breast-milk { --feed-color: var(--feed-breast); --feed-color-soft: var(--feed-breast-soft); }
.feed-stream-event.is-formula { --feed-color: var(--feed-formula); --feed-color-soft: var(--feed-formula-soft); }
.feed-stream-event.is-feed .feed-stream-node { background: var(--feed-color-soft); color: var(--feed-color); }
.feed-stream-value { min-width: 48px; display: grid; justify-items: end; line-height: 1.05; }
.feed-stream-value strong { color: var(--ink); font-size: 14px; font-weight: 760; font-variant-numeric: tabular-nums; white-space: nowrap; }
.feed-stream-value strong small { color: var(--muted); font-size: 9px; font-weight: 650; }
.feed-stream-value > small { margin-top: 3px; color: var(--feed-color); font-size: 9px; font-weight: 750; white-space: nowrap; }
.feed-stream-event.is-diaper .feed-stream-node { background: var(--blue-soft); color: var(--blue); }
.feed-stream-event.is-poop .feed-stream-node { background: var(--clay-soft); color: var(--clay); }
.feed-stream-event.is-both .feed-stream-node { background: var(--sage-soft); color: var(--primary); }
.feed-stream-diaper-label { min-width: 0; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.timeline-delete-button { justify-self: end; color: color-mix(in srgb, var(--danger) 58%, var(--muted)); }
.timeline-delete-button:hover,
.timeline-delete-button:focus-visible { color: var(--danger); }
.feed-target-status { margin: 5px 0 0; color: var(--muted); font-size: 12px; font-weight: 650; line-height: 1.4; }
.milk-capacity.is-complete .feed-target-status { color: var(--success); }


/* Daily records */
.daily-records { margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--line); }
.daily-records > summary { color: var(--ink-soft); font-size: 13px; }
.daily-records .record-list { margin-top: 9px; }
.record-list { display: grid; gap: 7px; }
.record-list-item { min-width: 0; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); overflow: hidden; }
.record-list-row { width: 100%; min-height: 60px; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 9px; padding: 8px 10px; border: 0; background: transparent; color: var(--ink); text-align: left; }
.diaper-record-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
.record-list-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--sage-soft); color: var(--primary); }
.record-list-icon .icon { width: 18px; height: 18px; }
.record-list-copy { min-width: 0; display: grid; gap: 2px; }
.record-list-copy strong { font-size: 14px; font-weight: 750; font-variant-numeric: tabular-nums; }
.record-list-copy span { overflow: hidden; color: var(--muted); font-size: 11px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.record-list-amount { color: var(--primary-dark); font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.record-list-amount small { color: var(--muted); font-size: 10px; font-weight: 650; }
.record-delete-button { width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 12px; background: transparent; color: color-mix(in srgb, var(--danger) 78%, var(--muted)); }
.record-delete-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; transition: background-color var(--motion-fast) ease, color var(--motion-fast) ease; }
.record-delete-icon .icon { width: 17px; height: 17px; }
.record-delete-button:hover .record-delete-icon { background: var(--danger-soft); color: var(--danger); }
.record-delete-button:active .record-delete-icon { background: color-mix(in srgb, var(--danger-soft) 78%, var(--surface)); }
.record-delete-button .button-spinner { width: 16px; height: 16px; border-color: color-mix(in srgb, var(--danger) 28%, transparent); border-top-color: currentColor; }
.record-delete-button.is-loading .record-delete-icon { display: none; }
.record-delete-button:disabled { cursor: wait; opacity: .58; }

/* Destructive confirmation */
body.dialog-open { overflow: hidden; }
.confirm-dialog {
  position: fixed;
  inset: 0;
  width: min(calc(100% - 32px), 380px);
  max-width: none;
  height: max-content;
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(29, 39, 35, .24);
}
.confirm-dialog[open] { animation: confirm-dialog-enter var(--motion-base) var(--ease-out) both; }
.confirm-dialog::backdrop { background: rgba(24, 32, 29, .48); backdrop-filter: blur(5px); animation: confirm-backdrop-enter var(--motion-base) ease both; }
.confirm-dialog-panel { padding: 22px; text-align: center; }
.confirm-dialog-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 15px; background: var(--danger-soft); color: var(--danger); }
.confirm-dialog-icon .icon { width: 22px; height: 22px; stroke-width: 1.9; }
.confirm-dialog h2 { margin: 0; font-size: 21px; font-weight: 750; letter-spacing: -.025em; }
.confirm-dialog-detail { min-height: 21px; margin: 8px 0 20px; color: var(--muted); font-size: 13px; font-weight: 650; line-height: 1.6; overflow-wrap: anywhere; }
.confirm-dialog-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.confirm-dialog-actions button { min-height: 48px; padding: 12px 16px; border-radius: 13px; font-size: 14px; font-weight: 750; }
.confirm-dialog-cancel { border: 1px solid var(--line); background: var(--surface-soft); color: var(--ink-soft); }
.confirm-dialog-cancel:hover { border-color: var(--line-strong); background: var(--paper); color: var(--ink); }
.confirm-dialog-delete { border: 1px solid transparent; background: var(--danger-action); color: var(--on-danger); }
.confirm-dialog-delete:hover { background: color-mix(in srgb, var(--danger-action) 88%, #6d2626); }
.confirm-dialog-delete .button-spinner { border-color: rgba(255,255,255,.38); border-top-color: currentColor; }

/* 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="today"] [data-route-page]:not([data-route-page="today"]),
.app-shell[data-active-page="settings"] [data-route-page]:not([data-route-page="settings"]) { display: none; }
.app-shell[data-active-page="settings"] #baby-overview { display: none; }
.app-shell [data-route-page] { animation: route-page-enter var(--motion-base) var(--ease-out) both; }
.app-shell[data-active-page="baby"] .profile-card { margin-top: 0; }
.bottom-nav {
  position: relative;
  z-index: 20;
  width: min(100%, 420px);
  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) {
  html { scroll-snap-type: none; }
  body { overscroll-behavior-y: none; }
  .app-shell:not([hidden]) {
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    scroll-behavior: smooth;
    scroll-padding-block: max(12px, env(safe-area-inset-top)) calc(104px + env(safe-area-inset-bottom));
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .app-shell { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  .app-shell:not([hidden]) :is(
    #baby-overview,
    #feed-page,
    #today-insights,
    #diaper-page,
    #feed-record-panel,
    #weight-page,
    #weight-trend-panel,
    .settings-panel
  ) {
    scroll-snap-align: start;
    scroll-snap-stop: always;
    scroll-margin-top: max(12px, env(safe-area-inset-top));
  }
  .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: 420px;
    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); }
  .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 capacity-cue { 0%,100% { transform: scale(1); } 45% { transform: scale(1.035); } }
@keyframes confirm-dialog-enter { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes confirm-backdrop-enter { from { opacity: 0; } to { opacity: 1; } }
@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, .profile-card { grid-column: 1 / -1; }
  .hero-row { min-height: 158px; }
  .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; }
  .baby-primary-facts { grid-template-columns: minmax(0, 1.35fr) minmax(150px, .8fr) minmax(150px, .8fr); }
  .baby-birthday-fact { grid-column: auto; }
  .baby-weight-grid { grid-template-columns: minmax(350px, .92fr) minmax(0, 1.08fr); align-items: start; }
  .settings-panel { display: grid; grid-template-columns: minmax(200px, .7fr) minmax(260px, 1fr); align-items: center; column-gap: 24px; }
  .settings-brand { grid-row: 1 / 3; }
  .reminder-setting, .profile-utilities { grid-column: 2; }
  .reminder-setting { grid-row: 1; margin-top: 0; }
  .profile-utilities { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
}

@media (min-width: 1024px) {
  .hero-stage { padding: 20px; }
  .recommendation-card { padding: 20px; }
  .panel { padding: 22px; }
}

@media (max-width: 520px) {
  .baby-profile-intro h1 { max-width: 11ch; }
  .baby-name-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .baby-name-form > input { grid-column: 1 / -1; }
  .baby-name-form .profile-save,
  .baby-name-form .profile-cancel { width: 100%; }
  .birth-date-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .birth-date-form > input { grid-column: 1 / -1; }
  html[lang="en"] .hero-row { gap: 8px; }
  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; }
  .weight-entry-panel .section-heading { grid-template-columns: minmax(0, 1fr) minmax(136px, 158px); }
}

@media (max-width: 374px) {
  .app-shell { padding-inline: 10px; }
  .hero-stage { padding: 10px; border-radius: 20px; }
  .hero-row, html[lang="en"] .hero-row { gap: 7px; }
  .milk-capacity-compact { grid-template-columns: minmax(0, 1fr); grid-template-rows: 76px auto; gap: 2px; padding-inline: 5px; }
  .milk-capacity-compact .milk-capacity-visual { width: 56px; height: 76px; }
  .milk-capacity-compact .milk-capacity-visual svg { width: 54px; height: 76px; }
  .milk-capacity-compact .milk-capacity-values strong { font-size: 14.5px; }
  .milk-capacity-compact .milk-capacity-values > span { font-size: 12px; }
  .milk-capacity-compact .feed-target-status { font-size: 9.5px; }
  .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; }
  .baby-profile-spotlight { grid-template-columns: 72px minmax(0, 1fr); gap: 13px; }
  .baby-profile-avatar { width: 72px; height: 72px; }
  .baby-avatar-icon { width: 56px; height: 56px; }
  .baby-profile-intro h1 { font-size: clamp(31px, 11vw, 40px); }
  .baby-primary-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .baby-birthday-fact { grid-column: 1 / -1; }
}

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

@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;
    --feed-breast: #9bcbb5;
    --feed-breast-soft: #263c33;
    --feed-formula: #e6bc72;
    --feed-formula-soft: #41351f;
    --avatar-fill: #9bb6a7;
    --avatar-line: #29483b;
    --avatar-bg: #e4ebe6;
    --danger: #ef9b96;
    --danger-soft: #442827;
    --danger-action: #e18b86;
    --on-danger: #241817;
    --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, select { color-scheme: dark; }
  .auth-card { background: var(--surface); }
  .recommendation-card { border-color: #4a4336; background: #302d26; }
  .recommendation-method { color: #efd39c; }
  .recommendation-values span { color: #8f8a80; }
  .profile-card { background: var(--sage-soft); }
  .baby-profile-card { background: linear-gradient(145deg, var(--sage-soft), var(--surface)); }
  .baby-primary-fact { background: color-mix(in srgb, var(--surface) 92%, transparent); }
  .baby-age-fact { background: color-mix(in srgb, var(--ochre-soft) 46%, var(--surface)); }
  .birth-date-form > input, .baby-name-form 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; }
}
