/* ============================================================
   每日晨秤 · 样式
   移动端：顶部标题 + 底部标签；桌面端（≥900px）：左侧导航 + 居中内容列。
   ============================================================ */

:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --soft: #F7F8FA;
  --ink: #14161A;
  --ink-2: #626875;
  --ink-3: #9AA1AE;
  --line: #E8EAEF;
  --line-2: #EDEFF3;
  --dark: #14161A;
  --brand: #16C79A;
  --brand-ink: #0E8C6C;
  --brand-soft: #E7F8F3;
  --accent: #FF6A3D;
  --accent-soft: #FFEFE9;
  --amber: #E8A33D;
  --amber-ink: #B87A18;
  --amber-soft: #FDF3E4;
  --danger: #E5484D;
  --danger-soft: #FDECEC;
  --blue-soft: #EEF2FB;
  --blue-ink: #3D5A9A;
  --r: 8px;
  --r-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.04);
  --tabbar-h: 58px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
input, select { font: inherit; }

/* ---------- 外壳 ---------- */

.app { min-height: 100vh; }

.rail { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 52px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line-2);
}

.nav-title { font-size: 17px; font-weight: 600; }

.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px 6px 0;
  background: none;
  border: 0;
  color: var(--brand-ink);
  cursor: pointer;
  font-size: 14px;
}

.nav-back[hidden] { display: none; }

.screen {
  padding: 0 12px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 18px);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  background: #FFFFFF;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: var(--tabbar-h);
  padding: 0;
  background: none;
  border: 0;
  color: var(--ink-3);
  font-size: 11px;
  cursor: pointer;
}

.tab.on { color: var(--ink); font-weight: 600; }
.tab svg { display: block; }

/* ---------- 布局工具 ---------- */

.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.baseline { align-items: baseline; }
.row.gap-8 { gap: 8px; }
.grow { flex: 1; min-width: 0; }
.auto { margin-left: auto; }
.mt-8 { margin-top: 8px; }
.mt-4 { margin-top: 4px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.pt-16 { padding-top: 16px; }
.border-top { border-top: 1px solid var(--line); }

/* ---------- 卡片与区块 ---------- */

.card {
  background: var(--surface);
  border-radius: var(--r);
  padding: 16px;
  margin-top: 12px;
  box-shadow: var(--shadow);
}

.card:first-child { margin-top: 12px; }

.sec-head { display: flex; align-items: center; margin-bottom: 12px; }
.sec-icon { display: inline-flex; margin-right: 7px; }
.sec-title { font-size: 15px; font-weight: 600; }

.sec-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  padding: 4px 0;
  background: none;
  border: 0;
  color: var(--ink-3);
  font-size: 12.5px;
  cursor: pointer;
}

.sec-link:active { color: var(--brand-ink); }

/* ---------- 文字 ---------- */

.t-body { font-size: 13.5px; color: var(--ink-2); line-height: 1.68; }
.t-sub { font-size: 12.5px; color: var(--ink-2); }
.t-cap { font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.t-strong { font-weight: 600; font-size: 13.5px; }
.light { color: rgba(255, 255, 255, 0.55); }

/* ---------- hero ---------- */

.card.hero {
  background: var(--dark);
  color: #FFFFFF;
  padding: 18px;
  box-shadow: none;
}

.hero-top { display: flex; align-items: center; gap: 8px; }
.hero-date { font-size: 13px; color: rgba(255, 255, 255, 0.62); }
.hero-label { font-size: 13px; color: rgba(255, 255, 255, 0.62); }
.hero-level { margin-left: auto; font-size: 12px; color: rgba(255, 255, 255, 0.55); }

.hero-value { display: flex; align-items: flex-end; margin-top: 10px; }
.hero-num {
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.hero-unit { font-size: 14px; color: rgba(255, 255, 255, 0.55); margin: 0 0 5px 6px; }

.hero-delta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.75);
}
.hero-delta.down { color: var(--brand); }
.hero-delta.up { color: #FFB199; }

.hero-sub { margin-top: 8px; font-size: 12.5px; color: rgba(255, 255, 255, 0.55); line-height: 1.6; }
.hero-hint { margin-top: 10px; font-size: 12px; color: rgba(255, 255, 255, 0.5); line-height: 1.6; text-align: center; }

.hero-title { margin-top: 10px; font-size: 22px; font-weight: 600; line-height: 1.3; }
.hero-body { margin-top: 8px; font-size: 12.5px; color: rgba(255, 255, 255, 0.66); line-height: 1.7; }
.hero-meta { margin-top: 8px; font-size: 12px; color: rgba(255, 255, 255, 0.5); }
.hero-spec { margin-top: 6px; font-size: 14px; color: #FFB199; font-variant-numeric: tabular-nums; }

/* ---------- 徽章与标签 ---------- */

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  line-height: 1.6;
  background: var(--soft);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.good { background: var(--brand-soft); color: var(--brand-ink); }
.chip.warn { background: var(--danger-soft); color: var(--danger); }
.chip.info { background: var(--blue-soft); color: var(--blue-ink); }
.chip.amber { background: var(--amber-soft); color: var(--amber-ink); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.mintSoft { background: rgba(22, 199, 154, 0.16); color: #A9E7D6; }
.chip.peach { background: rgba(255, 106, 61, 0.22); color: #FFD9C9; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
  white-space: nowrap;
}
.badge.mint { background: var(--brand); color: #06251D; font-weight: 600; }
.badge.peach { background: rgba(255, 106, 61, 0.22); color: #FFD9C9; }

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  background: var(--soft);
  color: var(--ink);
  transition: opacity 0.15s ease, background 0.15s ease;
}
.btn:active { opacity: 0.85; }
.btn svg { display: block; flex: 0 0 auto; }
.btn.wide { width: 100%; }
.btn.grow { flex: 1; }
.btn.accent { background: var(--accent); color: #FFFFFF; }
.btn.dark { background: var(--dark); color: #FFFFFF; }
.btn.brand { background: var(--brand); color: #06251D; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.danger { background: var(--danger); color: #FFFFFF; }
.btn.sm { height: 36px; font-size: 13px; padding: 0 14px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  margin-left: 6px;
  background: none;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}
.icon-btn:active { background: var(--soft); }

.link-btn {
  background: none;
  border: 0;
  color: var(--brand-ink);
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px 0;
}

.sticky-actions {
  position: sticky;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px);
  z-index: 20;
  margin-top: 12px;
  padding: 10px;
  border-radius: var(--r);
  background: rgba(244, 245, 247, 0.92);
  backdrop-filter: blur(8px);
}

/* ---------- 进度条 / 堆叠条 ---------- */

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--line-2);
  overflow: hidden;
}
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width 0.3s ease; }

.stack { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line-2); }
.stack > i { display: block; height: 100%; }

/* ---------- 指标 ---------- */

.metrics { display: flex; }
.metric { flex: 1; min-width: 0; }
.metric-v { display: block; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.metric-l { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.unit { font-size: 11.5px; color: var(--ink-3); margin-left: 3px; font-weight: 400; }

.grid3, .grid4 { display: grid; gap: 10px; }
.grid3 { grid-template-columns: repeat(3, 1fr); }
.grid4 { grid-template-columns: repeat(2, 1fr); }
.grid3.border-top, .grid4.border-top { border-top: 1px solid var(--line); }

.meta-v { display: block; font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.meta-l { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.macro-row { display: flex; }
.macro { flex: 1; min-width: 0; }
.macro-label { display: flex; align-items: center; font-size: 11.5px; color: var(--ink-3); }
.macro-label > i { width: 7px; height: 7px; border-radius: 2px; margin-right: 5px; }
.macro-v { display: block; font-size: 16px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }

.kcal-num { font-size: 34px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.kcal-unit { font-size: 12.5px; color: var(--ink-3); margin-left: 8px; }

/* ---------- 提示条 ---------- */

.flag { display: flex; gap: 9px; padding: 12px; border-radius: var(--r-sm); background: var(--soft); margin-top: 10px; }
.flag-icon { display: inline-flex; margin-top: 1px; }
.flag-body { min-width: 0; }
.flag-title { font-size: 13px; font-weight: 600; }
.flag-text { font-size: 12.5px; color: var(--ink-2); line-height: 1.65; margin-top: 4px; }
.flag-good { background: var(--brand-soft); }
.flag-warn { background: var(--danger-soft); }
.flag-info { background: var(--blue-soft); }

.note-box {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--soft);
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
}
.note-box svg { flex: 0 0 auto; margin-top: 2px; }

/* ---------- 键值表 ---------- */

.kv { border-top: 1px solid var(--line); }
.kv-row { display: flex; align-items: baseline; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: 0; }
.kv-k { flex: 0 0 auto; width: 132px; font-size: 13px; color: var(--ink-2); }
.kv-v { flex: 1; text-align: right; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kv-note { flex: 1; text-align: right; font-size: 12px; color: var(--ink-3); }

/* ---------- 记录行 ---------- */

.rec-row { display: flex; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.rec-row:last-child { border-bottom: 0; }
.rec-date { display: block; font-size: 13px; }
.rec-note { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.rec-delta { font-size: 11.5px; color: var(--ink-3); margin-right: 10px; font-variant-numeric: tabular-nums; }
.rec-delta.down { color: var(--brand-ink); }
.rec-delta.up { color: var(--accent); }
.rec-weight { font-size: 14px; font-weight: 600; min-width: 48px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- 分段控件 ---------- */

.seg { display: flex; gap: 4px; padding: 3px; border-radius: var(--r-sm); background: var(--line-2); }
.seg.small { width: 150px; margin-left: auto; }
.seg-item {
  flex: 1;
  height: 34px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
}
.seg-item.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow); }

/* ---------- 表单 ---------- */

.field { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.field:last-of-type { border-bottom: 0; }
.field-label { flex: 0 0 auto; width: 84px; font-size: 13.5px; }
.field input, .field select {
  flex: 1;
  min-width: 0;
  text-align: right;
  border: 0;
  background: none;
  outline: none;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.field input:focus { color: var(--brand-ink); }
.field-unit { flex: 0 0 auto; margin-left: 5px; font-size: 12px; color: var(--ink-3); }

/* ---------- 打卡输入 ---------- */

.weight-input { display: flex; align-items: flex-end; justify-content: center; margin-top: 14px; }
.weight-input input {
  width: 168px;
  border: 0;
  background: none;
  outline: none;
  color: #FFFFFF;
  font-size: 54px;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.weight-input input::-webkit-outer-spin-button,
.weight-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.weight-input input::placeholder { color: rgba(255, 255, 255, 0.28); }
.weight-unit { font-size: 15px; color: rgba(255, 255, 255, 0.55); margin-bottom: 10px; }

.step-row { display: flex; justify-content: center; gap: 8px; margin-top: 12px; }
.step {
  min-width: 68px;
  height: 38px;
  border: 0;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.step.ghost { min-width: 46px; background: rgba(255, 255, 255, 0.06); display: inline-flex; align-items: center; justify-content: center; }
.step:active { background: rgba(255, 255, 255, 0.22); }

.hint {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  font-size: 12.5px;
  line-height: 1.6;
}
.hint.good { background: rgba(22, 199, 154, 0.18); color: #7FE7CB; }

.tag-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--soft);
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
}
.tag.on { background: var(--brand-soft); border-color: #A9E7D6; color: var(--brand-ink); font-weight: 600; }

/* ---------- 目标选择 ---------- */

.goal-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.goal-item {
  display: block;
  text-align: left;
  padding: 11px;
  border: 2px solid transparent;
  border-radius: var(--r-sm);
  background: var(--soft);
  cursor: pointer;
}
.goal-item.on { background: var(--brand-soft); border-color: var(--brand); }
.goal-name { display: block; font-size: 13.5px; font-weight: 600; }
.goal-desc { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.5; }

/* ---------- 横向滚动条 ---------- */

.chip-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; -webkit-overflow-scrolling: touch; }
.chip-scroll::-webkit-scrollbar { height: 0; }

.group-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
}
.group-chip.on { background: var(--dark); border-color: var(--dark); color: #FFFFFF; font-weight: 600; }
.group-count { font-size: 10.5px; opacity: 0.6; }

.day-chip {
  flex: 0 0 auto;
  min-width: 118px;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
}
.day-chip.on { background: var(--dark); border-color: var(--dark); }
.day-chip-name { display: block; font-size: 13.5px; font-weight: 600; }
.day-chip-focus { display: block; font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.day-chip.on .day-chip-name { color: #FFFFFF; }
.day-chip.on .day-chip-focus { color: rgba(255, 255, 255, 0.55); }

/* ---------- 计划 ---------- */

.plan-name { font-size: 17px; font-weight: 600; }
.plan-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.plan-freq { display: flex; align-items: center; gap: 5px; margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.plan-daylist { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.6; }

/* ---------- 动作清单 ---------- */

.ex-item { display: flex; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ex-item:last-child { border-bottom: 0; padding-bottom: 0; }
.ex-no {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--soft);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 22px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ex-title { font-size: 14.5px; font-weight: 600; }
.ex-spec { font-size: 12.5px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ex-tags { display: flex; gap: 6px; margin-top: 6px; }
.mini-tag { padding: 1px 7px; border-radius: 4px; background: var(--soft); color: var(--ink-2); font-size: 11px; }
.ex-cue { font-size: 12px; color: var(--ink-3); line-height: 1.6; margin-top: 6px; }

.ex-row {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 13px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  cursor: pointer;
}
.ex-row:last-child { border-bottom: 0; }
.ex-row:active { background: var(--soft); }
.ex-name { display: block; font-size: 14.5px; font-weight: 600; }
.ex-meta { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

/* ---------- 折叠面板 ---------- */

.acc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.acc-title-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.acc-title { font-size: 14.5px; font-weight: 600; }
.acc-sub { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }
.acc-toggle { flex: 0 0 auto; font-size: 12.5px; color: var(--brand-ink); }

.key-list { margin-top: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--soft); }
.key-list > li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 7px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.65;
}
.key-list > li:last-child { margin-bottom: 0; }
.key-list > li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--brand);
}
.key-list.amber > li::before { background: var(--amber); }

.steps { counter-reset: step; }
.steps > li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.steps > li:last-child { border-bottom: 0; padding-bottom: 0; }
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 22px;
  text-align: center;
}
.steps.numbered > li::before { background: var(--dark); color: #FFFFFF; border-radius: 5px; }
.step-text { font-size: 13.5px; line-height: 1.65; }
.step-title { display: block; font-size: 14.5px; font-weight: 600; }

.err-list > li {
  position: relative;
  padding-left: 14px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.65;
}
.err-list > li:last-child { margin-bottom: 0; }
.err-list > li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--danger);
}

/* ---------- 食物库 ---------- */

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.search-box input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 13.5px; }

.food-row { display: flex; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.food-row:last-child { border-bottom: 0; }
.food-name { font-size: 14.5px; font-weight: 600; }
.food-macro { display: block; font-size: 11.5px; color: var(--ink-2); margin-top: 5px; font-variant-numeric: tabular-nums; }
.food-note { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.55; }
.food-right { flex: 0 0 auto; text-align: right; margin-left: 12px; min-width: 74px; }
.food-kcal { display: block; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.food-unit { display: block; font-size: 10.5px; color: var(--ink-3); margin-top: 1px; }

/* ---------- 营养 ---------- */

.macro-item { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.macro-item:last-of-type { border-bottom: 0; }
.dot { display: block; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 2px; }
.macro-name { display: block; font-size: 13.5px; font-weight: 600; }
.macro-hint { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.macro-right { flex: 0 0 auto; text-align: right; }
.macro-big { display: block; font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.macro-pct { display: block; font-size: 11px; color: var(--ink-3); margin-top: 1px; }

.quick-links { margin-top: 12px; border-radius: var(--r); background: var(--surface); overflow: hidden; box-shadow: var(--shadow); }
.quick-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.quick-link:last-child { border-bottom: 0; }
.quick-link:active { background: var(--soft); }
.list-value { font-size: 12.5px; color: var(--ink-3); }

.tip-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.tip-item:last-child { border-bottom: 0; padding-bottom: 0; }
.sup-row { display: flex; align-items: flex-start; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.sup-row:last-child { border-bottom: 0; }
.sup-name { font-size: 13.5px; font-weight: 600; }
.sup-why { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.6; }
.sup-dose { flex: 0 0 auto; max-width: 128px; text-align: right; font-size: 11.5px; color: var(--ink-2); }

/* ---------- 饮食指南 ---------- */

.hand-row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.hand-row:last-child { border-bottom: 0; }
.hand-part { flex: 0 0 auto; width: 52px; font-size: 13px; font-weight: 600; color: var(--brand-ink); }
.hand-what { display: block; font-size: 13.5px; font-weight: 600; }
.hand-ex { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.hand-amount { flex: 0 0 auto; text-align: right; font-size: 11.5px; color: var(--ink-2); }

.meal-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.meal-item:last-child { border-bottom: 0; padding-bottom: 0; }
.meal-name { font-size: 14.5px; font-weight: 600; }
.meal-note { margin-top: 8px; padding: 8px 10px; border-radius: 5px; background: var(--soft); font-size: 11.5px; color: var(--ink-3); line-height: 1.6; }

.out-item { padding: 11px 0; border-bottom: 1px solid var(--line); }
.out-item:last-child { border-bottom: 0; padding-bottom: 0; }
.out-name { display: block; font-size: 14px; font-weight: 600; }

/* ---------- 图表 ---------- */

.chart-wrap { margin-top: 6px; }
#wchart { display: block; width: 100%; height: 230px; }

.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.legend-item { display: inline-flex; align-items: center; font-size: 11.5px; color: var(--ink-3); }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(154, 161, 174, 0.75); margin-right: 5px; }
.legend-line { width: 14px; height: 3px; border-radius: 2px; background: var(--brand); margin-right: 5px; }
.legend-dash { width: 14px; border-top: 2px dashed var(--accent); margin-right: 5px; }
.legend-dash.gray { border-top-color: var(--ink-3); }

/* ---------- 阅读卡 ---------- */

.read-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.read-item:last-child { border-bottom: 0; padding-bottom: 0; }
.read-title { font-size: 15px; font-weight: 600; margin-top: 6px; }
.read-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; }

.workout-name { font-size: 19px; font-weight: 600; margin-top: 4px; }

/* ---------- 数据管理 ---------- */

/* ---------- 饮食记录 ---------- */

.hero-bar { height: 10px; background: rgba(255, 255, 255, 0.14); }

.prog-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.prog-row:last-of-type { border-bottom: 0; }
.prog-label { font-size: 13.5px; font-weight: 600; }
.prog-value { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.entry-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.entry-row:last-child { border-bottom: 0; }
.entry-name { display: block; font-size: 14.5px; font-weight: 600; }
.entry-sub { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.entry-kcal {
  flex: 0 0 auto;
  min-width: 54px;
  text-align: right;
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.picked { padding: 12px; border-radius: var(--r-sm); background: var(--soft); }
.qty-field {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.qty-field input {
  width: 66px;
  border: 0;
  outline: none;
  background: none;
  font-size: 15px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.picked-macros { font-size: 12px; color: var(--ink-2); text-align: right; font-variant-numeric: tabular-nums; }

button.food-row {
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.food-row { display: flex; align-items: center; gap: 6px; }
.food-pick {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.quick-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 12.5px;
  cursor: pointer;
}
.quick-chip:active { background: var(--brand-soft); border-color: #A9E7D6; }
.quick-chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.quick-chip .qc-sub { font-size: 11px; color: var(--ink-3); }

/* ---------- 计划编辑器 ---------- */

.field-input-wrap { flex: 1; min-width: 0; display: flex; justify-content: flex-end; }
.field-input-wrap input {
  width: 100%;
  text-align: right;
  border: 0;
  outline: none;
  background: none;
  font-size: 13.5px;
}

.day-chip.add { border-style: dashed; color: var(--brand-ink); }
.link-btn.auto { margin-left: auto; }

.edit-ex { padding: 12px 0; border-bottom: 1px solid var(--line); }
.edit-ex:last-of-type { border-bottom: 0; }
.edit-ex-name {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  font-size: 14.5px;
  font-weight: 600;
}
.edit-ex-fields { display: flex; gap: 8px; margin-top: 8px; }
.edit-ex-fields label {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--soft);
}
.edit-ex-fields span { font-size: 11.5px; color: var(--ink-3); flex: 0 0 auto; }
.edit-ex-fields input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  font-size: 13.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.picker { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }

/* ---------- 减脂计划的档位表 ---------- */

.tier-table { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.tier-row {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  text-align: right;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.tier-row:last-child { border-bottom: 0; }
.tier-row.head {
  background: var(--soft);
  color: var(--ink-3);
  font-size: 12px;
  cursor: default;
}
.tier-name { text-align: left; color: var(--ink); }
.tier-row.on { background: var(--brand-soft); }
.tier-row.on .tier-name { color: var(--brand-ink); font-weight: 600; }

.tool-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.tool-row:last-child { border-bottom: 0; }
.tool-row:active { opacity: 0.6; }
.tool-row.danger { color: var(--danger); }
.tool-hint { flex: 0 0 auto; font-size: 12.5px; color: var(--brand-ink); }

/* ---------- 空状态 ---------- */

.empty { display: flex; flex-direction: column; align-items: center; padding: 26px 12px; text-align: center; }
.empty-title { margin-top: 12px; font-size: 14.5px; font-weight: 600; }
.empty-text { margin-top: 6px; font-size: 12.5px; color: var(--ink-3); line-height: 1.65; max-width: 34em; }
.empty .btn { margin-top: 16px; }

.disclaimer { padding: 16px 4px 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.65; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 72px);
  z-index: 60;
  transform: translate(-50%, 8px);
  max-width: 80vw;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(20, 22, 26, 0.92);
  color: #FFFFFF;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 模态 ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 22, 26, 0.45);
}
.modal {
  width: 100%;
  max-width: 360px;
  padding: 20px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(20, 22, 26, 0.24);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-text { margin-top: 8px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-actions .btn { height: 38px; font-size: 13.5px; padding: 0 16px; }

/* ============================================================
   桌面端：左侧导航 + 居中的内容列
   ============================================================ */

@media (min-width: 900px) {
  .app { display: grid; grid-template-columns: 236px minmax(0, 1fr); }

  .rail {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 14px;
    background: var(--dark);
    color: #FFFFFF;
  }

  .rail-head { display: flex; align-items: center; gap: 10px; padding: 0 8px 20px; }
  .rail-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 9px;
    background: rgba(22, 199, 154, 0.14);
  }
  .rail-text { display: flex; flex-direction: column; }
  .rail-name { font-size: 15.5px; font-weight: 600; }
  .rail-tagline { font-size: 11.5px; color: rgba(255, 255, 255, 0.45); margin-top: 1px; }

  .rail-nav { display: flex; flex-direction: column; gap: 2px; }
  .rail-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: rgba(255, 255, 255, 0.62);
    font-size: 13.5px;
    text-align: left;
    cursor: pointer;
  }
  .rail-item:hover { background: rgba(255, 255, 255, 0.06); }
  .rail-item.on { background: rgba(255, 255, 255, 0.1); color: #FFFFFF; font-weight: 600; }
  .rail-item.on::before {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 16px;
    border-radius: 0 3px 3px 0;
    background: var(--brand);
  }

  .rail-foot {
    margin-top: auto;
    padding: 0 8px;
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.38);
    line-height: 1.7;
  }

  .main { min-width: 0; padding: 0 32px 64px; }
  .topbar {
    max-width: 760px;
    margin: 0 auto;
    height: 64px;
    padding: 0;
    background: none;
    backdrop-filter: none;
    border-bottom: 1px solid var(--line);
  }
  .nav-title { font-size: 19px; }

  .screen {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 0 40px;
  }

  .tabbar { display: none; }
  .toast { bottom: 48px; }
  .sticky-actions {
    bottom: 16px;
    box-shadow: 0 6px 24px rgba(20, 22, 26, 0.08);
    background: rgba(255, 255, 255, 0.94);
  }

  .card { padding: 20px; margin-top: 16px; }
  .hero-num { font-size: 52px; }
  .grid4 { grid-template-columns: repeat(4, 1fr); }
  #wchart { height: 280px; }
  .goal-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
