/* 日系原木主题 */
:root {
  --bg: #f2f6ea;
  --bg2: #e8efdb;
  --card: #ffffff;
  --card2: #f0f4e6;
  --ink: #3f4a38;
  --ink-light: #8a9480;
  --line: #e2e8d4;
  --accent: #6aa84f;
  --accent-deep: #578f3f;
  --green: #6aa84f;
  --green-deep: #578f3f;
  --red: #c26e5a;
  --blue: #7d94a8;
  --pink: #c99a8e;
  --radius: 22px;
  --radius-s: 14px;
  --shadow: 0 8px 24px rgba(106, 168, 79, .13), 0 1px 3px rgba(106, 168, 79, .08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  background:
    radial-gradient(circle at 88% 10%, rgba(142, 203, 106, .20) 0 150px, transparent 150px),
    radial-gradient(circle at 4% 26%, rgba(160, 214, 116, .18) 0 130px, transparent 130px),
    radial-gradient(circle at 92% 62%, rgba(150, 205, 100, .15) 0 170px, transparent 170px),
    radial-gradient(circle at 10% 88%, rgba(142, 203, 106, .16) 0 120px, transparent 120px),
    var(--bg);
  color: var(--ink);
  font-size: 15px;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 78px;
}
h1, h2, h3 { font-weight: 600; margin: 0; }
button { font-family: inherit; border: none; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 16px; color: var(--ink); border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; outline: none; width: 100%; max-width: 100%; appearance: none; -webkit-appearance: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { font-size: 13px; color: var(--ink-light); display: block; margin: 12px 0 5px; }

/* 登录页 */
#login-view { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 30px 24px; }
.login-card { background: linear-gradient(160deg, #ffffff, #f0f6e4); border-radius: 30px; box-shadow: 0 14px 40px rgba(90, 130, 60, .18), 0 2px 6px rgba(90, 130, 60, .08); padding: 34px 26px; width: 100%; max-width: 360px; text-align: center; }
.login-logo { margin-bottom: 4px; }
.login-logo svg { width: 84px; height: 84px; border-radius: 20px; display: block; margin: 0 auto; box-shadow: 0 12px 28px rgba(90, 130, 60, .32), 0 2px 6px rgba(90, 130, 60, .18); }
.login-title { margin: 10px 0 4px; font-size: 20px; letter-spacing: 2px; }
.login-sub { font-size: 12px; color: var(--ink-light); margin-bottom: 18px; }
.tab-btns { display: flex; background: var(--card2); border-radius: 14px; padding: 4px; margin-bottom: 14px; }
.tab-btns button { flex: 1; padding: 9px; border-radius: 11px; background: transparent; color: var(--ink-light); font-size: 14px; }
.tab-btns button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 2px 6px rgba(0,0,0,.06); }

.btn { display: inline-block; width: 100%; padding: 12px; border-radius: var(--radius-s); background: linear-gradient(135deg, #8ecb6a, #5c9a44); box-shadow: 0 4px 14px rgba(106, 168, 79, .32); color: #fff; font-size: 15px; font-weight: 600; letter-spacing: 1px; transition: opacity .15s; }
.btn:active { opacity: .85; }
.btn.green { background: linear-gradient(135deg, #9ed26f, #6aa84f); box-shadow: 0 4px 14px rgba(106, 168, 79, .32); }
.btn.ghost { background: var(--card2); color: var(--ink); }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; border-radius: 11px; }

/* 主框架 */
#app-view { display: none; }
/* 顶部绿色 Hero */
header.appbar {
  position: relative; z-index: 20;
  background: linear-gradient(140deg, #8ecb6a 0%, #6aa84f 60%, #5c9a44 100%);
  padding: 18px 18px 52px; display: flex; align-items: center; justify-content: space-between;
  border-radius: 0 0 30px 30px;
  box-shadow: 0 8px 24px rgba(106, 168, 79, .28);
  overflow: hidden;
}
.hero-deco { position: absolute; left: -8px; top: -6px; width: 104px; height: 104px; pointer-events: none; }
.appbar h1 { font-size: 18px; letter-spacing: 1px; color: #fff; text-shadow: 0 1px 4px rgba(60, 100, 40, .25); }
.brand-row { display: flex; align-items: center; gap: 9px; position: relative; }
.brand-mark { width: 34px; height: 34px; display: inline-block; flex-shrink: 0; background: #fff; border-radius: 11px; padding: 3px; box-shadow: 0 4px 12px rgba(50, 90, 35, .3); }
.brand-mark svg { width: 100%; height: 100%; border-radius: 8px; display: block; }
.appbar .date-nav { display: flex; align-items: center; gap: 8px; position: relative; }
.appbar .date-nav button { background: rgba(255,255,255,.28); border-radius: 10px; width: 30px; height: 30px; font-size: 14px; color: #fff; }
.appbar .date-nav span { color: rgba(255,255,255,.92); font-weight: 600; }
main { padding: 0 16px; position: relative; z-index: 25; margin-top: -34px; }
.page { display: none; animation: fadein .2s; }
.page.on { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none;} }

.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(106, 168, 79, .13), 0 1px 3px rgba(106, 168, 79, .08); border: 1px solid rgba(255, 255, 255, .8); padding: 16px; margin-bottom: 14px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--ink-light); font-size: 12.5px; }

/* 今日页三人卡 */
.member-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.member-card { background: var(--card); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(106, 168, 79, .15), 0 1px 3px rgba(106, 168, 79, .08); border: 1px solid rgba(255, 255, 255, .8); padding: 16px; display: flex; align-items: center; gap: 14px; }
.member-avatar { width: 54px; height: 54px; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 26px; flex-shrink: 0; box-shadow: inset 0 1px 2px rgba(255,255,255,.8); }
.avatar-baby { background: linear-gradient(135deg, #fdeedd, #f7dfc4); }
.avatar-mom { background: linear-gradient(135deg, #f9e3dd, #f0d1c8); }
.avatar-dad { background: linear-gradient(135deg, #e2ecf2, #d0e0ea); }
.member-info { flex: 1; min-width: 0; }
.member-name { font-weight: 700; font-size: 15px; }
.member-desc { font-size: 12px; color: var(--ink-light); margin-top: 2px; }
.kcal-line { margin-top: 8px; display: flex; align-items: center; gap: 8px; }
.kcal-bar { flex: 1; height: 8px; background: var(--card2); border-radius: 5px; overflow: hidden; }
.kcal-bar i { display: block; height: 100%; border-radius: 5px; background: var(--green); }
.kcal-num { font-size: 12px; color: var(--ink-light); white-space: nowrap; }
.member-actions { display: flex; flex-direction: column; gap: 6px; }
.member-actions button { padding: 7px 12px; border-radius: 11px; font-size: 12.5px; font-weight: 600; }
.act-log { background: var(--card2); color: var(--ink); }
.act-recipe { background: var(--green); color: #fff; }

/* 底部导航 */
nav.bottom {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 490px;
  background: rgba(255,255,255,.97); backdrop-filter: blur(10px); border-radius: 24px; box-shadow: 0 8px 28px rgba(80, 120, 60, .25);
  display: flex; padding: 6px; z-index: 30;
}
nav.bottom button { flex: 1; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0; font-size: 10.5px; color: var(--ink-light); border-radius: 18px; }
nav.bottom button .ic { font-size: 19px; }
nav.bottom button.on { background: #e6f2d8; color: var(--accent-deep); font-weight: 700; }

/* 记录表单 */
.seg { display: flex; background: var(--card2); border-radius: var(--radius-s); padding: 4px; margin-bottom: 14px; }
.seg button { flex: 1; padding: 9px 4px; border-radius: 11px; background: transparent; color: var(--ink-light); font-size: 13.5px; font-weight: 600; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.row2 { display: flex; gap: 10px; flex-wrap: wrap; }
.row2 > * { flex: 1; min-width: 0; }
.row2 input { padding: 9px 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 13px; border-radius: 20px; background: var(--card2); color: var(--ink); font-size: 13px; border: 1.5px solid transparent; }
.chip.on { background: #e6f2d8; border-color: var(--accent); font-weight: 600; }

/* 时间线 */
.timeline { }
.tl-item { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px dashed var(--line); }
.tl-item:last-child { border-bottom: none; }
.tl-icon { width: 38px; height: 38px; border-radius: 13px; background: var(--card2); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.tl-body { flex: 1; min-width: 0; }
.tl-title { font-size: 14px; font-weight: 600; }
.tl-sub { font-size: 12px; color: var(--ink-light); margin-top: 2px; line-height: 1.5; }
.tl-time { font-size: 11px; color: var(--ink-light); }
.tl-del { background: none; color: #c0b3a0; font-size: 16px; padding: 4px; }

/* 食材库 */
.food-row { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px dashed var(--line); }
.food-row:last-child { border-bottom: none; }
.food-name { font-size: 14px; font-weight: 600; }
.food-meta { font-size: 11.5px; color: var(--ink-light); margin-top: 1px; }
.food-lock { font-size: 11px; color: #b85c5c; background: #f7e4e0; padding: 3px 8px; border-radius: 8px; white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.status-select { padding: 8px 8px; border-radius: 9px; border: 1.5px solid var(--line); background: #fff; font-size: 16px; width: auto; flex-shrink: 0; }
.cat-tabs { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 6px; }
.cat-tabs button { flex-shrink: 0; padding: 8px 14px; border-radius: 18px; background: var(--card); border: 1.5px solid var(--line); font-size: 13px; color: var(--ink-light); }
.cat-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* 营养进度 */
.macro-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; }
.macro-label { width: 52px; color: var(--ink-light); }
.macro-bar { flex: 1; height: 7px; background: var(--card2); border-radius: 5px; overflow: hidden; }
.macro-bar i { display: block; height: 100%; border-radius: 5px; }
.macro-num { width: 76px; text-align: right; color: var(--ink-light); font-size: 11.5px; }
.pP { background: #d99a6c; } .pC { background: #8a9a7b; } .pF { background: #7d94a8; }

/* 智能食谱 */
.recipe-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.recipe-items { margin: 10px 0; }
.recipe-item { display: flex; justify-content: space-between; padding: 7px 0; font-size: 13.5px; border-bottom: 1px dashed var(--line); }
.recipe-totals { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.rt-chip { background: var(--card2); border-radius: 10px; padding: 6px 10px; font-size: 11.5px; color: var(--ink-light); }
.rt-chip b { color: var(--ink); font-size: 12.5px; }
.warn-line { font-size: 12px; color: #b85c5c; background: #f7e4e0; padding: 8px 10px; border-radius: 10px; margin-top: 8px; }

/* 图表 */
.chart-wrap { overflow-x: auto; }
.chart-box svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-light); margin-top: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(80,65,45,.4); z-index: 50; display: none; align-items: flex-end; justify-content: center; }
.modal-mask.on { display: flex; }
.modal { background: var(--card); width: 100%; max-width: 520px; max-height: 86vh; overflow-y: auto; border-radius: 26px 26px 0 0; padding: 20px 18px 30px; animation: slideup .22s; }
@keyframes slideup { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h2 { font-size: 16px; }
.modal-close { background: var(--card2); border-radius: 50%; width: 30px; height: 30px; font-size: 14px; color: var(--ink-light); }

/* 提醒 */
.remind-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.remind-item input[type=time] { width: 110px; }
.remind-item input[type=text] { flex: 1; }
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { display: none; }
.switch i { position: absolute; inset: 0; background: #d8cdb8; border-radius: 14px; transition: .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { left: 21px; }

/* toast & 通知条 */
#toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); background: rgba(90,78,60,.94); color: #fff; padding: 10px 20px; border-radius: 20px; font-size: 13.5px; z-index: 99; display: none; max-width: 85vw; text-align: center; }
#alarm-bar { position: fixed; top: 0; left: 0; right: 0; background: var(--green-deep); color: #fff; padding: 14px 18px; z-index: 98; display: none; text-align: center; font-size: 14px; }
#alarm-bar button { background: rgba(255,255,255,.25); color: #fff; border-radius: 12px; padding: 6px 16px; margin: 8px 4px 0; font-size: 13px; }

.empty { text-align: center; color: var(--ink-light); font-size: 13px; padding: 26px 0; }
.goal-card { background: linear-gradient(135deg, #eaf4dc, #dff0cb); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; border: 1px solid rgba(255,255,255,.7); }
.mini-btn { background: var(--card2); border-radius: 10px; padding: 6px 11px; font-size: 12px; color: var(--ink); }
.pct-row { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.pct-row label { margin: 0; width: 42px; }
.pct-row input { width: 90px; padding: 8px; flex-shrink: 0; }
.pct-row span { font-size: 13px; color: var(--ink-light); }

/* 科学依据说明 */
.sci-note { background: var(--card2); border-radius: var(--radius-s); padding: 4px 0; margin-top: 14px; }
.sci-note summary { cursor: pointer; padding: 12px 14px; font-size: 14px; font-weight: 600; color: var(--accent-deep); list-style: none; }
.sci-note summary::before { content: '📖 '; }
.sci-note summary::-webkit-details-marker { display: none; }
.sci-note .sci-body { padding: 2px 16px 14px; font-size: 12.5px; line-height: 1.8; color: var(--ink-light); }
.sci-note .sci-body b { color: var(--ink); }
.sci-note .sci-body .src { font-size: 11px; opacity: .8; margin-top: 8px; display: block; }
