:root {
  --bg: #B995A1; --surface: #F2ECE6; --border: #D2BAB0;
  --ink: #34222A; --ink-soft: #452F3A; --ink-faint: #5C4550;
  --accent: #F2ECE6; --accent-ink: #34222A;
  --diaper: #5286C5; --diaper-bg: #D5DAE0;
  --feed: #D97B54; --feed-bg: #EED8CC;
  --sleep: #48AD85; --sleep-bg: #D3E1D5;
  --danger: #B14A38;
  --diaper-wet: #5286C5; --diaper-dirty: #DBA32F; --diaper-both: #358E2F;
  --feed-bottle: #D97B54; --feed-nursing: #695BA4; --feed-solid: #48AD85;
  --shadow: 0 1px 2px rgba(44,42,50,0.04), 0 4px 16px rgba(44,42,50,0.06);
  --radius: 20px; --radius-sm: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #241A1F; --surface: #3A2830; --border: #4A3941;
    --ink: #F5EDEA; --ink-soft: #D8C4C0; --ink-faint: #B39B96;
    --accent: #D3AEB8; --accent-ink: #241A1F;
    --diaper: #5285C4; --diaper-bg: #31384D;
    --feed: #C2653F; --feed-bg: #502F28;
    --sleep: #3C9572; --sleep-bg: #2B3C36;
    --danger: #D77A68;
    --diaper-wet: #5285C4; --diaper-dirty: #C08412; --diaper-both: #158312;
    --feed-bottle: #C2653F; --feed-nursing: #8F84D8; --feed-solid: #3C9572;
    --shadow: 0 1px 2px rgba(0,0,0,0.2), 0 4px 20px rgba(0,0,0,0.3);
  }
}
:root[data-theme="dark"] {
  --bg: #241A1F; --surface: #3A2830; --border: #4A3941;
  --ink: #F5EDEA; --ink-soft: #D8C4C0; --ink-faint: #B39B96;
  --accent: #D3AEB8; --accent-ink: #241A1F;
  --diaper: #5285C4; --diaper-bg: #31384D;
  --feed: #C2653F; --feed-bg: #502F28;
  --sleep: #3C9572; --sleep-bg: #2B3C36;
  --danger: #D77A68;
  --diaper-wet: #5285C4; --diaper-dirty: #C08412; --diaper-both: #158312;
  --feed-bottle: #C2653F; --feed-nursing: #8F84D8; --feed-solid: #3C9572;
  --shadow: 0 1px 2px rgba(0,0,0,0.2), 0 4px 20px rgba(0,0,0,0.3);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; padding-bottom: 40px; }
.wrap { max-width: 480px; margin: 0 auto; padding: 0 16px; }
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); padding-top: 18px; padding-bottom: 8px; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.baby-id { display: flex; flex-direction: column; min-width: 0; }
.baby-name { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.baby-age { font-size: 13px; color: var(--ink-soft); font-weight: 600; margin-top: 1px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: pointer; flex: none; color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }
.banner { margin-top: 12px; border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; box-shadow: var(--shadow); animation: rise 0.25s ease; }
@keyframes rise { from { opacity:0; transform: translateY(-6px);} to {opacity:1; transform:none;} }
.banner.sleep { background: var(--sleep-bg); }
.banner.nurse { background: var(--feed-bg); }
.banner-left { display:flex; align-items:center; gap: 10px; min-width:0; }
.banner-emoji { font-size: 22px; }
.banner-text { min-width: 0; }
.banner-title { font-weight: 800; font-size: 14px; }
.banner.sleep .banner-title { color: var(--sleep); }
.banner.nurse .banner-title { color: var(--feed); }
.banner-timer { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.banner-end { border: none; border-radius: 999px; padding: 10px 18px; font-weight: 800; font-size: 13px; cursor: pointer; color: white; flex: none; }
.banner.sleep .banner-end { background: var(--sleep); }
.banner.nurse .banner-end { background: var(--feed); }
.banner-switch { background: transparent; border: 1.5px solid var(--feed); color: var(--feed); border-radius: 999px; padding: 9px 14px; font-weight: 800; font-size: 12px; margin-right: 6px; cursor: pointer; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 16px; }
.quick-btn { border: none; border-radius: var(--radius); padding: 16px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; box-shadow: var(--shadow); font-family: inherit; }
.quick-btn .emoji { font-size: 26px; }
.quick-btn .label { font-size: 13px; font-weight: 800; }
.quick-btn.diaper { background: var(--diaper-bg); color: var(--diaper); }
.quick-btn.feed { background: var(--feed-bg); color: var(--feed); }
.quick-btn.sleep { background: var(--sleep-bg); color: var(--sleep); }
.quick-btn:active { transform: scale(0.96); }
.stats { margin-top: 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 10px; text-align: center; }
.stat-num { font-size: 19px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--ink-soft); font-weight: 700; margin-top: 2px; }
.section-title { margin-top: 26px; margin-bottom: 10px; font-size: 15px; font-weight: 800; color: var(--ink-soft); }
.day-label { font-size: 12px; font-weight: 800; color: var(--ink-faint); margin: 14px 0 8px; }
.entry { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 12px; margin-bottom: 8px; }
.entry-editable { cursor: pointer; }
.entry-emoji { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 17px; flex: none; }
.entry.diaper .entry-emoji { background: var(--diaper-bg); }
.entry.feeding .entry-emoji { background: var(--feed-bg); }
.entry.sleep .entry-emoji { background: var(--sleep-bg); }
.entry-body { flex: 1; min-width: 0; }
.entry-title { font-size: 14px; font-weight: 700; }
.entry-sub { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
.entry-time { font-size: 12px; color: var(--ink-faint); font-weight: 700; white-space: nowrap; flex: none; text-align: right; }
.entry-del { border: none; background: transparent; color: var(--ink-faint); font-size: 16px; cursor: pointer; padding: 4px; flex: none; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-faint); font-size: 14px; font-weight: 600; }
.scrim { position: fixed; inset: 0; background: rgba(20,18,26,0.4); z-index: 40; display: flex; align-items: flex-end; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
.scrim.open { opacity: 1; pointer-events: auto; }
.scrim.center { align-items: center; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 480px; margin: 0 auto; border-radius: 24px 24px 0 0; padding: 10px 20px 26px; transform: translateY(100%); transition: transform 0.25s cubic-bezier(.32,.72,0,1); max-height: 88vh; overflow-y: auto; }
.scrim.center .sheet { border-radius: 24px; transform: scale(0.94); max-width: 380px; }
.scrim.open .sheet { transform: none; }
.sheet-handle { width: 36px; height: 4px; background: var(--border); border-radius: 4px; margin: 6px auto 14px; }
.scrim.center .sheet-handle { display: none; }
.sheet-title { font-size: 18px; font-weight: 800; margin-bottom: 14px; }
.tab-row { display: flex; gap: 8px; margin-bottom: 18px; }
.tab-btn { flex: 1; padding: 10px 4px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); font-weight: 800; font-size: 13px; color: var(--ink-soft); cursor: pointer; font-family: inherit; }
.tab-btn.active.feed { border-color: var(--feed); color: var(--feed); background: var(--feed-bg); }
.tab-btn.active.sleep { border-color: var(--sleep); color: var(--sleep); background: var(--sleep-bg); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.choice-grid.three { grid-template-columns: 1fr 1fr 1fr; }
.choice-btn { padding: 16px 8px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); font-family: inherit; font-weight: 800; font-size: 14px; cursor: pointer; color: var(--ink); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.choice-btn .emoji { font-size: 22px; }
.choice-btn.sel.diaper { border-color: var(--diaper); background: var(--diaper-bg); color: var(--diaper); }
.choice-btn.sel.feed { border-color: var(--feed); background: var(--feed-bg); color: var(--feed); }
.stepper { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 10px 0 18px; }
.stepper-btn { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--surface); font-size: 20px; font-weight: 800; cursor: pointer; color: var(--ink); }
.stepper-val { font-size: 26px; font-weight: 800; min-width: 90px; text-align: center; }
.field-label { font-size: 12px; font-weight: 800; color: var(--ink-soft); margin: 14px 0 6px; }
.field-input, .field-textarea { width: 100%; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-family: inherit; font-size: 14px; background: var(--surface); color: var(--ink); }
.field-textarea { resize: none; min-height: 60px; }
.primary-btn { width: 100%; border: none; border-radius: 999px; padding: 15px; font-weight: 800; font-size: 15px; color: white; cursor: pointer; margin-top: 8px; font-family: inherit; }
.primary-btn.diaper { background: var(--diaper); }
.primary-btn.feed { background: var(--feed); }
.primary-btn.sleep { background: var(--sleep); }
.primary-btn.brand { background: var(--accent); color: var(--accent-ink); border: 1.5px solid var(--accent-ink); }
.primary-btn:disabled { opacity: 0.5; }
.ghost-btn { width: 100%; border: 1.5px solid var(--border); background: transparent; border-radius: 999px; padding: 13px; font-weight: 800; font-size: 14px; color: var(--ink-soft); cursor: pointer; margin-top: 10px; font-family: inherit; }
.side-row { display: flex; gap: 10px; margin-bottom: 16px; }
.side-btn { flex: 1; padding: 22px 8px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); font-weight: 800; font-size: 15px; cursor: pointer; color: var(--ink); font-family: inherit; }
.side-btn.sel { border-color: var(--feed); background: var(--feed-bg); color: var(--feed); }
.loading-screen { display: flex; align-items: center; justify-content: center; min-height: 60vh; color: var(--ink-faint); font-weight: 700; font-size: 14px; text-align: center; padding: 0 30px; }
.config-warning { background: var(--feed-bg); color: var(--feed); border-radius: var(--radius-sm); padding: 14px; font-size: 13px; font-weight: 700; margin: 20px 16px; text-align: left; line-height: 1.5; }
.config-warning code { background: rgba(0,0,0,0.08); padding: 1px 5px; border-radius: 4px; }
.auth-error { background: var(--diaper-bg); color: var(--danger); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; font-weight: 700; margin-top: 12px; }
.auth-link { text-align: center; margin-top: 14px; }
.auth-link a { color: var(--ink-soft); font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: underline; }
.view-tabs { display: flex; gap: 8px; margin-top: 14px; }
.view-tab { flex: 1; padding: 9px 4px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); font-weight: 800; font-size: 13px; color: var(--ink-soft); cursor: pointer; font-family: inherit; }
.view-tab.active { border-color: var(--ink); color: var(--ink); }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.filter-preset { border: 1.5px solid var(--border); background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 8px 14px; font-weight: 800; font-size: 12px; cursor: pointer; font-family: inherit; }
.filter-preset.active { border-color: var(--ink); color: var(--ink); }
.filter-dates { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.filter-dates input { flex: 1; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 9px 10px; font-family: inherit; font-size: 12px; background: var(--surface); color: var(--ink); min-width: 0; }
.filter-dates span { font-size: 11px; color: var(--ink-faint); font-weight: 700; }
.trend-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.trend-header { display: flex; align-items: center; gap: 8px; }
.trend-emoji { font-size: 16px; }
.trend-title { font-weight: 800; font-size: 14px; }
.trend-stats { display: flex; gap: 18px; margin-top: 8px; flex-wrap: wrap; }
.trend-stat-num { font-size: 17px; font-weight: 800; }
.trend-stat-label { font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.trend-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.chart-scroll { overflow-x: auto; margin-top: 16px; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 96px; border-bottom: 1px solid var(--border); position: relative; }
.chart-bar-col { flex: 1; min-width: 4px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; cursor: pointer; position: relative; }
.chart-bar-col.fixed { flex: none; width: 8px; }
.chart-seg { width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; }
.chart-seg:not(:last-child) { margin-bottom: 2px; }
.chart-peak-label { position: absolute; top: -16px; font-size: 10px; font-weight: 800; color: var(--ink-soft); white-space: nowrap; }
.chart-xlabels { display: flex; gap: 3px; margin-top: 6px; }
.chart-xlabel { flex: 1; min-width: 4px; text-align: center; font-size: 10px; color: var(--ink-faint); font-weight: 700; }
.chart-xlabel.fixed { flex: none; width: 8px; }
.chart-tip { position: fixed; transform: translate(-50%,-100%); background: var(--ink); color: var(--bg); font-size: 11px; font-weight: 800; padding: 5px 9px; border-radius: 8px; pointer-events: none; z-index: 60; white-space: nowrap; }
.report-empty { text-align: center; padding: 20px 10px; color: var(--ink-faint); font-size: 13px; font-weight: 600; }
