:root {
  /* 暖色中性底 + 低饱和绿色：避免"医疗 App"感，也避免过度卡通（设计文档 21） */
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f4f1ea;
  --line: #e6e0d6;
  --text: #2f2b26;
  --text-dim: #7c7468;
  --accent: #6f8f6a;
  --accent-soft: #eef2ea;
  --warn: #c98a4b;
  --warn-soft: #fbf2e6;
  --danger: #b4614f;
  --danger-soft: #fbeeeb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(47, 43, 38, .06), 0 6px 18px rgba(47, 43, 38, .05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

#app { max-width: 480px; margin: 0 auto; padding: 0 0 84px; min-height: 100vh; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(250, 247, 242, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px 12px;
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 650; letter-spacing: .2px; }
.topbar .sub { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }

/* ---------- 通用块 ---------- */
.page { padding: 14px 16px 8px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }
.card h2 { margin: 0 0 10px; font-size: 15.5px; font-weight: 650; }
.card h3 { margin: 0 0 6px; font-size: 14px; font-weight: 620; }
.muted { color: var(--text-dim); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.divider { height: 1px; background: var(--line); margin: 10px -14px; }
.empty { color: var(--text-dim); font-size: 13px; padding: 10px 0; text-align: center; }

/* ---------- 按钮 ---------- */
button { font-family: inherit; font-size: 13.5px; cursor: pointer; }
.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 9px 13px; font-weight: 560;
  transition: transform .06s ease, background .15s ease;
}
.btn:active { transform: scale(.975); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 9px; font-size: 11.5px; color: var(--text-dim);
}
.chip.accent { background: var(--accent-soft); border-color: #dbe5d6; color: #4d6849; }
.chip.warn { background: var(--warn-soft); border-color: #f0dfc9; color: #96652f; }
.chip.danger { background: var(--danger-soft); border-color: #f0d6cf; color: #8f4a3b; }

/* ---------- 周计划 ---------- */
.day-header {
  display: flex; align-items: baseline; gap: 8px;
  margin: 16px 0 8px; font-weight: 620; font-size: 14px;
}
.day-header .date { color: var(--text-dim); font-weight: 400; font-size: 12.5px; }
.day-header .today-badge {
  background: var(--accent); color: #fff; border-radius: 6px;
  padding: 1px 6px; font-size: 11px; font-weight: 500;
}
.meal-item { display: flex; flex-direction: column; gap: 8px; }
.meal-type {
  font-size: 11.5px; color: var(--text-dim); background: var(--surface-2);
  border-radius: 6px; padding: 2px 7px; flex: none;
}
.recipe-name { font-weight: 600; font-size: 14.5px; }
.reasons { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.reasons li { font-size: 12px; color: var(--text-dim); }
.reasons li::before { content: "· "; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }

/* ---------- 列表 ---------- */
.list-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: none; }
.list-item .title { font-weight: 580; font-size: 14px; }
.list-item .meta { color: var(--text-dim); font-size: 12px; }

/* ---------- 表单 ---------- */
input[type=text], input[type=search], input[type=number], textarea, select {
  font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 11px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
label.field { display: block; margin-bottom: 10px; }
label.field > span { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 4px; }
.search-bar { margin-bottom: 12px; }

/* 可编辑的解析结果：让用户一眼看出哪些是 AI 填的、哪些要自己确认 */
.editable-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.editable-row input { padding: 7px 9px; font-size: 13px; }
.editable-row .name { flex: 2; }
.editable-row .amount { flex: 1; min-width: 64px; }
.editable-row .unit { flex: 1; min-width: 54px; }

/* ---------- 反馈 ---------- */
.feedback-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.feedback-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px;
  padding: 12px 4px; display: flex; flex-direction: column; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--text-dim);
}
.feedback-btn .emoji { font-size: 22px; line-height: 1; }
.feedback-btn[aria-pressed=true] { border-color: var(--accent); background: var(--accent-soft); color: #47603f; }
.feedback-btn[aria-pressed=true] .emoji { transform: scale(1.08); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  max-width: 480px; margin: 0 auto;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
.tabbar button {
  border: none; background: none; display: flex; flex-direction: column;
  align-items: center; gap: 3px; padding: 6px 0; color: var(--text-dim); font-size: 10.5px;
}
.tabbar button .icon { font-size: 19px; line-height: 1; filter: grayscale(1) opacity(.55); }
.tabbar button[aria-current=page] { color: var(--accent); font-weight: 600; }
.tabbar button[aria-current=page] .icon { filter: none; }

/* ---------- 弹层 ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(47, 43, 38, .35); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet {
  background: var(--bg); width: 100%; max-width: 480px;
  border-radius: 18px 18px 0 0; padding: 16px 16px max(16px, env(safe-area-inset-bottom));
  max-height: 86vh; overflow-y: auto;
  animation: slideUp .18s ease;
}
@keyframes slideUp { from { transform: translateY(14px); opacity: .6 } to { transform: translateY(0); opacity: 1 } }
.sheet h2 { margin: 0 0 12px; font-size: 16px; }
.sheet .handle { width: 38px; height: 4px; background: var(--line); border-radius: 999px; margin: -6px auto 12px; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%);
  background: #34302a; color: #fff; padding: 10px 16px; border-radius: 10px;
  font-size: 13px; z-index: 60; max-width: 88vw; text-align: center;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translate(-50%, 6px) } to { opacity: 1; transform: translate(-50%, 0) } }

.progress { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.progress .step { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); }
.progress .step .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.progress .step.done { color: var(--text); }
.progress .step.done .dot { background: var(--accent); }
.progress .step.active .dot { background: var(--warn); animation: pulse 1.1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }
