* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --warm-bg: #FFF9ED;
  --butter: #FFE8A3;
  --butter-deep: #F5D060;
  --butter-text: #8B6914;
  --white-card: #FFFFFF;
  --border-soft: rgba(0,0,0,0.06);
  --txt-main: #2D2A26;
  --txt-muted: #8A857A;
  --txt-light: #B5B0A5;
  --feed-bg: #F0EAFF; --feed-accent: #9B8CE8; --feed-text: #4A3D8F;
  --pump-bg: #E8E0FF; --pump-accent: #7B6BD4; --pump-text: #3A2E7A;
  --sleep-bg: #E4F2FF; --sleep-accent: #6BAFE8; --sleep-text: #1E5F99;
  --diaper-bg: #E4F7ED; --diaper-accent: #5CC98E; --diaper-text: #1D6B42;
  --temp-bg: #FFE8EC; --temp-accent: #F08B9E; --temp-text: #993046;
  --med-bg: #FFF0E0; --med-accent: #F0A854; --med-text: #8A5A14;
  --note-bg: #FFF4F8; --note-accent: #E8A0BE; --note-text: #8A3A5E;
  --r: 14px;
}
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--warm-bg);
  color: var(--txt-main);
  -webkit-tap-highlight-color: transparent;
}
body { overflow-y: auto; }
input, select, button, textarea { font-family: inherit; }
button { cursor: pointer; -webkit-appearance: none; }
input[type="time"], input[type="number"], input[type="text"], select, textarea {
  font-size: 16px;
  border-radius: 10px;
  border: 0.5px solid var(--border-soft);
  padding: 8px 10px;
  background: var(--warm-bg);
  color: var(--txt-main);
  width: 100%;
}
textarea { resize: vertical; min-height: 40px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238A857A' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }

.date-input-wrap { position: relative; }
.date-input-wrap .date-display { font-size: 16px; border-radius: 10px; border: 0.5px solid var(--border-soft); padding: 8px 10px; background: var(--warm-bg); color: var(--txt-main); width: 100%; pointer-events: none; }
.date-input-wrap input[type="date"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; padding: 0; border: 0; background: transparent; }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; padding-bottom: 20px; }
.header { background: linear-gradient(180deg, var(--butter) 0%, var(--warm-bg) 100%); padding: 16px 20px 12px; text-align: center; }
.header h1 { font-size: 20px; font-weight: 600; color: var(--butter-text); letter-spacing: -0.3px; }
.header .date { font-size: 13px; color: var(--butter-text); opacity: 0.65; margin-top: 2px; }

.tabs { display: flex; background: var(--white-card); margin: 0 16px; border-radius: 12px; overflow: hidden; border: 0.5px solid var(--border-soft); }
.tabs button { flex: 1; padding: 10px 0; font-size: 13px; font-weight: 400; border: none; background: var(--white-card); color: var(--txt-muted); transition: all 0.15s; }
.tabs button.active { background: var(--butter); color: var(--butter-text); font-weight: 500; }

.content { padding: 14px 16px 0; }

.type-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.type-btn { padding: 10px 4px 8px; font-size: 12px; border-radius: var(--r); border: 0.5px solid var(--border-soft); background: var(--white-card); color: var(--txt-main); display: flex; flex-direction: column; align-items: center; gap: 4px; transition: all 0.15s; }
.type-btn.active { font-weight: 500; }
.type-btn svg { width: 22px; height: 22px; }

.form-card { background: var(--white-card); border-radius: var(--r); padding: 14px; margin-bottom: 14px; border: 0.5px solid var(--border-soft); }
.form-row { display: flex; gap: 8px; margin-bottom: 10px; }
.form-row > div { flex: 1; }
.form-row label, .form-card > label { font-size: 11px; color: var(--txt-muted); display: block; margin-bottom: 3px; }
.save-btn { width: 100%; padding: 10px; color: white; border: none; border-radius: 10px; font-size: 14px; font-weight: 500; transition: opacity 0.15s; }
.save-btn:active { opacity: 0.8; }

.timeline-header { margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.timeline-header span { font-size: 13px; font-weight: 500; }
.refresh-btn { font-size: 11px; color: var(--txt-muted); border: 0.5px solid var(--border-soft); background: var(--white-card); padding: 4px 10px; border-radius: 8px; }
.header-actions { position: relative; display: flex; gap: 6px; }
.export-menu { position: absolute; right: 0; top: 100%; margin-top: 4px; background: var(--white-card); border: 0.5px solid var(--border-soft); border-radius: 8px; padding: 4px; display: flex; flex-direction: column; gap: 2px; z-index: 10; box-shadow: 0 4px 12px rgba(0,0,0,0.08); min-width: 120px; }
.export-menu button { font-size: 12px; padding: 8px 12px; background: transparent; border: 0; color: var(--txt-main); text-align: left; border-radius: 4px; }
.export-menu button:hover { background: var(--warm-bg); }
.entry-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--white-card); border-radius: 12px; border: 0.5px solid var(--border-soft); margin-bottom: 6px; cursor: pointer; transition: background 0.1s; }
.entry-card:active { background: var(--warm-bg); }
.entry-card.note-card { background: var(--note-bg); border-color: rgba(232,160,190,0.2); }
.entry-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.entry-icon svg { width: 18px; height: 18px; }
.entry-body { flex: 1; min-width: 0; }
.entry-body .main { font-size: 14px; color: var(--txt-main); }
.entry-body .sub { font-size: 11px; color: var(--txt-muted); }
.entry-time { font-size: 12px; color: var(--txt-light); flex-shrink: 0; }

.summary-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.summary-nav button { font-size: 12px; color: var(--txt-muted); background: var(--white-card); border: 0.5px solid var(--border-soft); padding: 5px 10px; border-radius: 8px; }
.summary-nav .current { font-size: 14px; font-weight: 500; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.stat-card { background: var(--white-card); border-radius: var(--r); padding: 14px; border: 0.5px solid var(--border-soft); }
.stat-card .label-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.stat-card .icon-sm { width: 24px; height: 24px; border-radius: 7px; display: flex; align-items: center; justify-content: center; }
.stat-card .icon-sm svg { width: 14px; height: 14px; }
.stat-card .label { font-size: 11px; color: var(--txt-muted); }
.stat-card .value { font-size: 24px; font-weight: 500; line-height: 1.1; }
.stat-card .detail { font-size: 11px; color: var(--txt-muted); margin-top: 2px; }

.chart-card { background: var(--white-card); border-radius: var(--r); padding: 14px; margin-bottom: 10px; border: 0.5px solid var(--border-soft); }
.chart-title { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.chart-title .icon-sm { width: 20px; height: 20px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.chart-title .icon-sm svg { width: 12px; height: 12px; }
.chart-title span { font-size: 13px; font-weight: 500; }
.bar-row { display: flex; gap: 5px; align-items: flex-end; margin-bottom: 6px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.bar-col .bar-val { font-size: 11px; color: var(--txt-light); }
.bar-col .bar { width: 100%; border-radius: 6px 6px 2px 2px; min-height: 2px; transition: height 0.3s; }
.bar-col.today .bar-val { font-weight: 500; }
.day-labels { display: flex; gap: 5px; }
.day-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--txt-light); }
.day-labels span.today { font-weight: 500; }

.overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--warm-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 100; }
.overlay h2 { font-size: 20px; color: var(--butter-text); margin-bottom: 8px; }
.overlay p { font-size: 14px; color: var(--txt-muted); margin-bottom: 16px; text-align: center; padding: 0 40px; }
.auth-btn { padding: 12px 24px; background: var(--butter); color: var(--butter-text); border: none; border-radius: 12px; font-size: 15px; font-weight: 500; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--butter); border-top-color: var(--butter-text); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

.size-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.size-pill { padding: 6px 12px; border-radius: 8px; font-size: 13px; border: 0.5px solid var(--border-soft); background: var(--white-card); color: var(--txt-main); }
.size-pill.active { background: var(--diaper-bg); color: var(--diaper-text); border-color: var(--diaper-accent); font-weight: 500; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--txt-main); color: white; padding: 10px 20px; border-radius: 10px; font-size: 13px; z-index: 200; opacity: 0; transition: opacity 0.3s; pointer-events: none; }
.toast.show { opacity: 1; }

.editing-banner { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: var(--butter); border-radius: 10px; margin-bottom: 10px; font-size: 12px; color: var(--butter-text); font-weight: 500; }
.editing-banner button { font-size: 12px; color: var(--butter-text); background: none; border: none; text-decoration: underline; cursor: pointer; }
.form-actions { display: flex; gap: 8px; }
.form-actions .save-btn { flex: 1; }
.form-actions .delete-action { padding: 10px 16px; border-radius: 10px; border: 0.5px solid var(--temp-accent); background: var(--temp-bg); color: var(--temp-text); font-size: 14px; font-weight: 500; }
