:root {
  color-scheme: light;
  --ink: #392f2b;
  --muted: #857975;
  --paper: #fffaf6;
  --card: rgba(255, 255, 255, .88);
  --peach: #ef8d72;
  --peach-dark: #d96f55;
  --peach-soft: #fde6dc;
  --mint: #dff0e6;
  --line: rgba(104, 77, 66, .12);
  --shadow: 0 18px 50px rgba(112, 72, 55, .12);
  font-family: ui-rounded, "SF Pro Rounded", "PingFang SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { min-height: 100vh; min-height: 100dvh; margin: 0; color: var(--ink); background: linear-gradient(180deg, #fff8f2 0%, #fffdfb 50%, #fef8f4 100%); }
button, input, textarea { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }

.ambient { position: fixed; z-index: 0; border-radius: 999px; filter: blur(1px); pointer-events: none; opacity: .65; }
.ambient-one { width: 240px; height: 240px; top: -100px; right: -90px; background: radial-gradient(circle, #ffd8c9, transparent 70%); }
.ambient-two { width: 220px; height: 220px; bottom: -100px; left: -100px; background: radial-gradient(circle, #deeee4, transparent 70%); }

.app-shell { position: relative; z-index: 1; width: min(100%, 620px); min-height: 100dvh; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 20px calc(116px + env(safe-area-inset-bottom)); }
.app-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 12px 2px 22px; }
.eyebrow { margin: 0 0 7px; color: var(--peach-dark); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1, h2, h3, p { margin-top: 0; }
.app-header h1 { margin-bottom: 0; font-size: clamp(24px, 7vw, 34px); line-height: 1.18; letter-spacing: -.035em; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.7); font-size: 22px; cursor: pointer; }

.date-bar { position: relative; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.7); box-shadow: 0 8px 26px rgba(115, 76, 59, .06); overflow: hidden; }
.date-arrow, .date-center { min-height: 64px; border: 0; background: transparent; cursor: pointer; }
.date-arrow { font-size: 30px; color: var(--peach-dark); }
.date-center { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.date-center strong { font-size: 17px; }
.date-center span { margin-top: 2px; color: var(--muted); font-size: 12px; }
#date-picker { position: absolute; width: 1px; height: 1px; left: 50%; bottom: 0; opacity: 0; pointer-events: none; }

.summary-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 12px; }
.summary-card { min-height: 140px; padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); }
.summary-card span, .summary-card small { display: block; color: var(--muted); font-size: 13px; }
.summary-card strong { display: block; margin: 16px 0 8px; font-size: 24px; letter-spacing: -.03em; }
.summary-card #since-last-feed { font-size: clamp(19px, 5.2vw, 25px); line-height: 1.18; }
.summary-card .next-feed-time { margin-top: 6px; color: #c56c53; font-size: 10px; font-weight: 700; line-height: 1.3; }
.summary-card strong b { font-size: 34px; }
.total-card { background: linear-gradient(145deg, #ef987f, #e97f65); color: white; border-color: transparent; }
.total-card span, .total-card small { color: rgba(255,255,255,.8); }

.weight-card { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 12px; width: 100%; margin-top: 12px; padding: 14px; border: 1px solid rgba(79,119,144,.16); border-radius: 22px; background: linear-gradient(135deg, rgba(242,250,255,.95), rgba(255,255,255,.9)); box-shadow: 0 10px 32px rgba(75,105,121,.08); text-align: left; cursor: pointer; }
.baby-avatar { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 18px; background: linear-gradient(145deg, #9ecbd8, #6e9eb4); color: white; font-family: Georgia, serif; font-size: 25px; font-weight: 700; }
.baby-profile-copy b, .baby-profile-copy small, .weight-card-value span, .weight-card-value small, .weight-card-value b, .weight-card-value em { display: block; }
.baby-profile-copy b { font-size: 16px; }
.baby-profile-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.weight-card-value { text-align: right; }
.weight-card-value small { color: var(--muted); font-size: 10px; }
.weight-card-value b { margin: 3px 0; font-size: 18px; }
.weight-card-value em { color: #4c879e; font-size: 9px; font-style: normal; }

.feeding-guide { margin-top: 12px; padding: 17px; border: 1px solid rgba(112,142,116,.16); border-radius: 22px; background: linear-gradient(145deg, rgba(247,253,248,.96), rgba(255,255,255,.9)); box-shadow: 0 10px 32px rgba(72,111,79,.07); }
.feeding-guide-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.feeding-guide-heading .eyebrow { margin-bottom: 4px; color: #58916d; }
.feeding-guide-heading h2 { margin-bottom: 0; font-size: 17px; }
.guide-status { padding: 6px 9px; border-radius: 999px; background: #edf4ef; color: #5e7d66; font-size: 9px; font-weight: 750; }
.guide-status.low { background: #fff1dc; color: #9a6b27; }
.guide-status.good { background: #e7f7ec; color: #378458; }
.guide-status.high { background: #fff0ed; color: #ad5648; }
.guide-progress { height: 7px; margin: 15px 0; border-radius: 99px; background: #e7eee8; overflow: hidden; }
.guide-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8ac29e, #5fa97b); transition: width .25s; }
.guide-numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.guide-numbers > div + div { padding-left: 12px; border-left: 1px solid var(--line); }
.guide-numbers span, .guide-numbers strong { display: block; }
.guide-numbers span { color: var(--muted); font-size: 9px; }
.guide-numbers strong { margin-top: 4px; font-size: 18px; }
.guide-plan { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 10px; margin-top: 14px; padding: 11px 12px; border-radius: 14px; background: white; border: 1px solid var(--line); }
.guide-plan-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--peach-soft); font-size: 19px; }
.guide-plan b, .guide-plan small { display: block; }
.guide-plan b { font-size: 12px; }
.guide-plan small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.guide-detail { margin: 10px 2px 0; color: var(--muted); font-size: 9px; line-height: 1.5; }

.records-section { margin-top: 30px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.section-heading h2 { margin-bottom: 0; font-size: 19px; }
.section-heading span { color: var(--muted); font-size: 12px; }
.records-list { display: grid; gap: 10px; }
.record-card { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 14px; width: 100%; padding: 15px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.82); text-align: left; box-shadow: 0 8px 30px rgba(110, 75, 62, .06); cursor: pointer; }
.record-time { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 58px; border-radius: 15px; background: var(--peach-soft); color: var(--peach-dark); }
.record-time b { font-size: 16px; }
.record-time small { margin-top: 2px; font-size: 10px; text-transform: uppercase; }
.record-main strong { display: block; font-size: 21px; }
.record-main p { margin: 5px 0 0; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
.record-tags { display: flex; justify-content: flex-end; gap: 5px; margin-top: 6px; }
.record-tags span { padding: 4px 7px; border-radius: 999px; background: var(--mint); font-size: 10px; }
.record-chevron { color: #bba9a1; font-size: 22px; }
.empty-state { padding: 44px 20px; color: var(--muted); text-align: center; }
.empty-state h3 { margin: 10px 0 6px; color: var(--ink); font-size: 17px; }
.empty-state p { font-size: 13px; }
.empty-illustration { font-size: 42px; }

.floating-add { position: fixed; z-index: 5; left: 50%; bottom: max(22px, calc(14px + env(safe-area-inset-bottom))); transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: 8px; width: min(calc(100% - 40px), 580px); min-height: 58px; border: 0; border-radius: 20px; background: #3f3632; color: white; box-shadow: 0 14px 38px rgba(55, 44, 39, .25); font-weight: 750; cursor: pointer; }
.floating-add span { font-size: 24px; font-weight: 400; }

.sheet-backdrop { position: fixed; z-index: 20; inset: 0; background: rgba(54, 43, 39, .38); backdrop-filter: blur(4px); }
.record-sheet { position: fixed; z-index: 21; left: 50%; bottom: 0; transform: translateX(-50%); width: min(100%, 620px); max-height: 92dvh; padding: 10px 22px calc(22px + env(safe-area-inset-bottom)); border-radius: 30px 30px 0 0; background: #fffdfa; box-shadow: 0 -20px 60px rgba(52, 41, 37, .18); overflow: auto; animation: sheet-in .24s ease-out; }
@keyframes sheet-in { from { transform: translate(-50%, 24px); opacity: .4; } }
.sheet-handle { width: 42px; height: 5px; margin: 0 auto 18px; border-radius: 99px; background: #dfd5d0; }
.sheet-header { display: flex; justify-content: space-between; align-items: flex-start; }
.sheet-header h2 { margin-bottom: 18px; font-size: 26px; }
.field-label { display: flex; justify-content: space-between; margin: 18px 0 9px; font-size: 13px; font-weight: 750; }
.field-label span { color: var(--muted); font-weight: 500; }
.scoop-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.scoop-grid button { min-height: 62px; padding: 8px 3px; border: 1px solid var(--line); border-radius: 14px; background: white; cursor: pointer; }
.scoop-grid b, .scoop-grid span { display: block; }
.scoop-grid b { font-size: 14px; }
.scoop-grid span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.scoop-grid button.active { border-color: var(--peach); background: var(--peach-soft); color: var(--peach-dark); box-shadow: inset 0 0 0 1px var(--peach); }
.scoop-grid button.active span { color: var(--peach-dark); }
.formula-result { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 11px; margin-top: 10px; padding: 11px 12px; border: 1px solid #ead9ca; border-radius: 14px; background: #fff8ee; }
.formula-brand { display: grid; place-items: center; width: 46px; height: 34px; border-radius: 10px; background: #2873a7; color: white; font-size: 11px; font-weight: 850; letter-spacing: .06em; }
.formula-result b, .formula-result small { display: block; }
.formula-result b { font-size: 12px; }
.formula-result small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.text-input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; outline: none; background: white; color: var(--ink); font-size: 15px; }
.time-input { min-height: 54px; font-size: 21px; font-weight: 750; text-align: center; }
.time-chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 9px; }
.time-chips button { padding: 9px 2px; border: 1px solid var(--line); border-radius: 12px; background: white; font-size: 11px; cursor: pointer; }
.time-chips button:first-child { border-color: var(--peach); background: var(--peach-soft); color: var(--peach-dark); font-weight: 750; }
.text-input:focus, .password-row input:focus { border-color: var(--peach); box-shadow: 0 0 0 3px rgba(239,141,114,.13); }
textarea { resize: vertical; }
.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle-card { position: relative; display: grid; grid-template-columns: 34px 1fr 32px; align-items: center; gap: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 16px; background: white; cursor: pointer; }
.toggle-card input { position: absolute; opacity: 0; }
.toggle-icon { font-size: 23px; }
.toggle-card b, .toggle-card small { display: block; }
.toggle-card b { font-size: 13px; }
.toggle-card small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.toggle-card i { width: 32px; height: 19px; padding: 2px; border-radius: 99px; background: #ded7d3; transition: .2s; }
.toggle-card i::after { content: ""; display: block; width: 15px; height: 15px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s; }
.toggle-card:has(input:checked) { border-color: #67b486; background: #e8f8ee; box-shadow: inset 0 0 0 1px #67b486, 0 7px 20px rgba(73,151,105,.12); }
.toggle-card input:checked ~ i { background: #74b991; }
.toggle-card input:checked ~ i::after { transform: translateX(13px); }
.toggle-card:has(input:checked) .toggle-status { color: #37865a; font-weight: 750; }
.form-error { min-height: 18px; margin: 10px 0 0; color: #c64e4e; font-size: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.primary-button, .danger-button { min-height: 50px; padding: 0 20px; border: 0; border-radius: 15px; font-weight: 750; cursor: pointer; }
.primary-button { background: var(--peach); color: white; }
.save-button { flex: 1; }
.danger-button { background: #fff0ed; color: #bd5143; }

.login-view { position: relative; z-index: 2; display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.login-card { width: min(100%, 430px); padding: 34px 26px; border: 1px solid var(--line); border-radius: 28px; background: rgba(255,255,255,.88); box-shadow: var(--shadow); }
.brand-mark { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 22px; border-radius: 19px; background: var(--peach-soft); font-size: 29px; transform: rotate(-5deg); }
.login-card h1 { margin-bottom: 8px; font-size: 32px; }
.login-copy { color: var(--muted); font-size: 14px; }
.login-card label { display: block; margin: 28px 0 8px; font-size: 12px; font-weight: 700; }
.password-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.password-row input { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; outline: none; }
.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px); padding: 11px 16px; border-radius: 999px; background: #3f3632; color: white; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; white-space: nowrap; }
.toast.visible { transform: translate(-50%, 0); opacity: 1; }

.weight-sheet { padding-bottom: calc(36px + env(safe-area-inset-bottom)); }
.growth-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.growth-summary > div { padding: 13px 14px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.growth-summary span { display: block; color: var(--muted); font-size: 10px; }
.growth-summary strong { display: block; margin-top: 5px; font-size: 19px; }
.chart-toolbar { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 9px; font-size: 12px; font-weight: 750; }
.chart-ranges { display: flex; gap: 4px; }
.chart-ranges button { padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; background: white; color: var(--muted); font-size: 10px; cursor: pointer; }
.chart-ranges button.active { border-color: #6e9eb4; background: #eaf5f8; color: #3c7890; }
.growth-chart-wrap { padding: 8px 4px 1px; border: 1px solid var(--line); border-radius: 18px; background: white; overflow: hidden; }
#growth-chart { display: block; width: 100%; height: auto; }
.growth-insight { margin-top: 10px; padding: 13px 14px; border-radius: 14px; background: #edf7f9; color: #315f70; font-size: 12px; line-height: 1.55; }
.medical-note { margin: 9px 2px 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.weight-form { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.weight-form h3, .weight-history-heading h3 { margin-bottom: 12px; font-size: 16px; }
.weight-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.weight-form label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 10px; }
.weight-form label input { margin-top: 6px; color: var(--ink); font-size: 14px; }
.weight-form .save-button { width: 100%; }
.weight-history-heading { display: flex; align-items: baseline; justify-content: space-between; margin-top: 24px; }
.weight-history-heading h3 { margin-bottom: 8px; }
.weight-history-heading span { color: var(--muted); font-size: 9px; }
.weight-history { display: grid; gap: 7px; }
.weight-history-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.weight-history-row b, .weight-history-row small { display: block; }
.weight-history-row small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.weight-history-row > strong { font-size: 15px; }
.weight-delete { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 9px; background: #fff0ed; color: #bd5143; cursor: pointer; }
.weight-birth-badge { padding: 5px 7px; border-radius: 999px; background: #edf7f9; color: #4c879e; font-size: 9px; }

@media (max-width: 390px) {
  .app-shell { padding-left: 15px; padding-right: 15px; }
  .summary-card { min-height: 130px; padding: 16px; }
  .summary-card strong b { font-size: 30px; }
  .record-card { grid-template-columns: 58px 1fr auto; gap: 10px; padding: 12px; }
  .weight-card { grid-template-columns: 48px 1fr; }
  .baby-avatar { width: 48px; height: 48px; }
  .weight-card-value { grid-column: 1 / -1; display: flex; align-items: baseline; justify-content: space-between; padding: 9px 10px 0; border-top: 1px solid var(--line); text-align: left; }
  .weight-card-value b { margin-left: auto; margin-right: 8px; }
  .toggle-grid { grid-template-columns: 1fr; }
  .time-chips { grid-template-columns: 1fr 1fr; }
  .record-sheet { padding-left: 18px; padding-right: 18px; }
}

@media (min-width: 760px) {
  body { padding: 28px 0; }
  .app-shell { min-height: calc(100dvh - 56px); border: 1px solid var(--line); border-radius: 32px; background: rgba(255,250,246,.76); box-shadow: 0 30px 80px rgba(89,59,47,.12); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
