/* 轻卡日记 — 网页端样式（响应式 · 明暗主题） */
:root {
  --bg: #f5f7f4;
  --bg-soft: #eef3ec;
  --card: #ffffff;
  --card-2: #f8faf7;
  --text: #17201a;
  --muted: #6b7a70;
  --line: #e2e9e2;
  --primary: #2f9e63;
  --primary-dark: #247d4d;
  --primary-soft: #e8f5ee;
  --accent: #ff8a4c;
  --accent-soft: #fff1e8;
  --danger: #e05757;
  --danger-soft: #fdeeee;
  --warn: #d9962b;
  --good: #2f9e63;
  --blue: #5b7bd5;
  --shadow: 0 10px 30px rgba(23, 32, 26, 0.07);
  --shadow-sm: 0 4px 14px rgba(23, 32, 26, 0.06);
  --radius: 20px;
  --radius-sm: 13px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #0f1512;
  --bg-soft: #141c17;
  --card: #19221c;
  --card-2: #1e2821;
  --text: #e9f0ea;
  --muted: #91a398;
  --line: #2b3830;
  --primary: #48b97d;
  --primary-dark: #2f9e63;
  --primary-soft: #1c3327;
  --accent: #ff9d68;
  --accent-soft: #33251c;
  --danger: #ee7676;
  --danger-soft: #35201f;
  --warn: #e3ad54;
  --good: #48b97d;
  --blue: #7b96e3;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
::selection { background: rgba(47, 158, 99, 0.22); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- 按钮与表单 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--card-2);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: transform 0.16s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 8px 20px rgba(47, 158, 99, 0.26);
}
.btn.primary:hover { box-shadow: 0 10px 24px rgba(47, 158, 99, 0.34); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--primary); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-ghost { background: transparent; border-color: var(--line); color: var(--danger); }
.btn.danger-ghost:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn.small { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; margin-top: 4px; }
.link-btn {
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  padding: 4px;
  border-radius: 8px;
}
.link-btn:hover { text-decoration: underline; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.icon-btn.small { width: 30px; height: 30px; border-radius: 9px; }
.icon-btn.small .ico { width: 15px; height: 15px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input,
.field select,
.search-field input {
  height: 44px;
  width: 100%;
  padding: 0 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.field input::placeholder,
.search-field input::placeholder { color: var(--muted); opacity: 0.75; }
.field input:focus,
.field select:focus,
.search-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 158, 99, 0.16);
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.three { grid-template-columns: repeat(3, 1fr); }
/* 短信验证码：输入框 + 发送按钮同排 */
.code-row { display: flex; gap: 10px; align-items: stretch; }
.code-row input { flex: 1; min-width: 0; }
.code-row .btn { flex: 0 0 auto; height: 44px; white-space: nowrap; }
/* 已发码后手机号锁定：只读观感，需点击「更换」才能重新输入 */
.code-row input.locked {
  color: var(--muted);
  background: var(--card-2);
  cursor: not-allowed;
}
/* 只读资料项（手机号）：外观与输入框一致，但没有任何编辑入口 */
.field .readonly-value {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 13px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: var(--card-2);
  color: var(--muted);
  font-size: 14px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.search-field {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.search-field .ico { position: absolute; left: 13px; color: var(--muted); }
.search-field input { padding-left: 40px; }
.switch {
  width: 46px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex: none;
}
.switch span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}
.switch[aria-checked="true"] { background: var(--primary); border-color: var(--primary); }
.switch[aria-checked="true"] span { transform: translateX(20px); }

.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
}
.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  height: 34px;
  padding: 0 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.seg-btn.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.segmented.small .seg-btn { height: 28px; padding: 0 13px; font-size: 12px; }

/* ---------- 品牌 ---------- */
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: 0 8px 18px rgba(47, 158, 99, 0.25);
}
.brand-mark svg { width: 28px; height: 28px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong, .brand-text { font-size: 17px; font-weight: 800; letter-spacing: 0.01em; }
.brand-text small { font-size: 9px; letter-spacing: 0.18em; color: var(--muted); font-weight: 600; margin-top: 3px; }
.brand-light .brand-mark { background: rgba(255, 255, 255, 0.94); color: #2f9e63; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18); }
.brand-light .brand-text { color: #fff; }
.brand-light .brand-text small { color: rgba(255, 255, 255, 0.72); }

/* ---------- 登录 / 注册 ---------- */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 0.95fr; }
.auth-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 46px clamp(30px, 5vw, 70px);
  background: linear-gradient(155deg, #3aa86c 0%, #247d4d 55%, #145a37 100%);
  color: #fff;
}
.auth-visual::before,
.auth-visual::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
}
.auth-visual::before { width: 420px; height: 420px; top: -140px; right: -120px; }
.auth-visual::after { width: 260px; height: 260px; bottom: -90px; left: -70px; background: rgba(255, 255, 255, 0.055); }
.auth-visual > * { position: relative; z-index: 1; }
.auth-copy .eyebrow { color: rgba(255, 255, 255, 0.78); }
.auth-copy h1 {
  margin: 14px 0 18px;
  font-size: clamp(40px, 5.2vw, 66px);
  line-height: 1.06;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.auth-copy p { max-width: 420px; margin: 0; color: rgba(255, 255, 255, 0.82); font-size: 15px; }
.auth-download { display: flex; align-items: center; gap: 16px; }
.auth-download[hidden] { display: none; }
.auth-qr {
  width: 126px;
  height: 126px;
  flex: none;
  padding: 8px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}
.auth-qr svg { display: block; width: 100%; height: 100%; }
.auth-download-copy { display: flex; flex-direction: column; gap: 4px; }
.auth-download-copy strong { font-size: 15px; font-weight: 800; }
.auth-download-copy span { font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.auth-stats { display: flex; gap: 34px; flex-wrap: wrap; }
.auth-stats div { display: flex; flex-direction: column; }
.auth-stats strong { font-size: 26px; font-weight: 800; }
.auth-stats span { font-size: 12px; color: rgba(255, 255, 255, 0.7); letter-spacing: 0.06em; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--bg); }
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.auth-brand-mobile { display: none; }
.auth-card h2 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
.auth-sub { margin: 8px 0 20px; color: var(--muted); font-size: 14px; }
.auth-card .segmented { width: 100%; margin-bottom: 20px; }
.auth-card .segmented .seg-btn { flex: 1; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-hint { margin: 20px 0 0; font-size: 12px; color: var(--muted); line-height: 1.7; }

/* ---------- 应用布局 ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 254px;
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 28px 20px 24px;
  background: var(--card);
  border-right: 1px solid var(--line);
  z-index: 30;
}
.side-nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 14px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  transition: background 0.18s ease, color 0.18s ease;
}
.nav-item .ico { width: 19px; height: 19px; }
.nav-item:hover { color: var(--text); background: var(--bg-soft); }
.nav-item.active { color: var(--primary); background: var(--primary-soft); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--card-2);
  border: 1px solid var(--line);
}
.user-chip div { min-width: 0; display: flex; flex-direction: column; }
.user-chip strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip small { font-size: 11px; color: var(--muted); }
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  flex: none;
  text-transform: uppercase;
}
.sync-mini { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); padding-left: 4px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; transition: background 0.2s ease; }
.dot.online { background: var(--primary); box-shadow: 0 0 0 3px rgba(47, 158, 99, 0.16); }
.dot.offline { background: var(--danger); }
.dot.pending { background: var(--warn); }

.main { flex: 1; min-width: 0; padding: 20px clamp(16px, 3vw, 40px) 56px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1180px;
  margin: 0 auto 22px;
  padding: 12px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
}
.top-title h1 { margin: 2px 0 0; font-size: 24px; letter-spacing: -0.02em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12px;
  color: var(--muted);
}
.sync-pill .dot.online { background: var(--primary); }
.sync-pill .dot.offline { background: var(--danger); }
.top-avatar { width: 38px; height: 38px; font-size: 14px; }

.view { max-width: 1180px; margin: 0 auto; display: grid; gap: 18px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h3 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stack { display: grid; gap: 18px; align-content: start; }
.pill {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

/* ---------- 公告 ---------- */
.announce-bar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--accent-soft);
}
.announce-bar .ico { color: var(--accent); margin-top: 2px; }
.announce-bar > div { flex: 1; min-width: 0; }
.announce-bar strong { display: block; font-size: 14px; }
.announce-bar p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------- 首页 ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 28px;
  background:
    radial-gradient(120% 130% at 0% 0%, var(--primary-soft) 0%, transparent 62%),
    var(--card);
  overflow: hidden;
}
.hero h2 { margin: 14px 0 8px; font-size: clamp(30px, 4vw, 46px); line-height: 1.1; letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hero h2 span { color: var(--primary); font-variant-numeric: tabular-nums; }
.hero h2 small { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.hero-sub { margin: 0 0 20px; color: var(--muted); font-size: 14px; max-width: 46ch; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-meta { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--muted); }
.hero-meta b { color: var(--text); font-size: 14px; }

.ring-wrap { position: relative; width: 208px; height: 208px; flex: none; }
.calorie-ring { width: 208px; height: 208px; display: block; }
.ring-track { fill: none; stroke: color-mix(in srgb, var(--primary) 14%, transparent); stroke-width: 13; }
.ring-bar {
  fill: none;
  stroke: var(--primary);
  stroke-width: 13;
  stroke-linecap: round;
  stroke-dasharray: 515.22;
  stroke-dashoffset: 515.22;
  transform: rotate(-90deg);
  transform-origin: 100px 100px;
  transition: stroke-dashoffset 0.6s cubic-bezier(0.22, 1, 0.36, 1), stroke 0.3s ease;
}
.ring-bar.over { stroke: var(--accent); }
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.ring-center strong { font-size: 30px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ring-center span { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.macro-list { display: flex; flex-direction: column; gap: 14px; }
.macro-row { display: flex; flex-direction: column; gap: 6px; }
.macro-top { display: flex; justify-content: space-between; font-size: 13px; }
.macro-top span { color: var(--muted); font-weight: 600; }
.macro-top b { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 7px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width 0.5s ease; }
.bar.protein i { background: linear-gradient(90deg, #4fb7c9, #2f9e63); }
.bar.fat i { background: linear-gradient(90deg, #f3b15c, #ff8a4c); }
.bar.carbs i { background: linear-gradient(90deg, #8d9ee6, #5b7bd5); }
.bar.calories i { background: linear-gradient(90deg, #58c58a, #2f9e63); }
.bar.sodium i { background: linear-gradient(90deg, #e8a0bf, #d4617a); }
.macro-sodium { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.macro-top b.over { color: var(--danger); }

.weight-brief { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; margin-bottom: 8px; }
.weight-brief strong { font-size: 38px; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.weight-brief > span { color: var(--muted); font-size: 14px; }
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.good { background: var(--primary-soft); color: var(--primary); }
.badge.warn { background: var(--accent-soft); color: var(--accent); }
.badge.risk { background: var(--danger-soft); color: var(--danger); }
.weight-mini { height: 62px; margin: 4px 0 12px; }
.weight-mini svg { width: 100%; height: 100%; display: block; }
.weight-brief .badge { margin-left: auto; }
.weight-foot { display: flex; justify-content: space-between; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 12.5px; color: var(--muted); }
.weight-foot b { color: var(--text); }

.meal-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.meal-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--card-2);
  text-align: left;
  transition: border-color 0.18s ease, transform 0.16s ease, background 0.18s ease;
}
.meal-card:hover { border-color: var(--meal-color, var(--primary)); transform: translateY(-2px); }
.meal-card .meal-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--meal-color, var(--primary)); flex: none; }
.meal-card > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.meal-card strong { font-size: 13.5px; }
.meal-card small { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.meal-card .meal-add { color: var(--muted); }
.meal-breakfast { --meal-color: #e9a23b; }
.meal-lunch { --meal-color: #2f9e63; }
.meal-dinner { --meal-color: #5b7bd5; }
.meal-snack { --meal-color: #c27bb4; }

.insight-list { display: flex; flex-direction: column; gap: 10px; }
.insight-item {
  display: flex;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 13px;
}
.insight-item .dot { margin-top: 7px; }
.insight-item strong { display: block; font-size: 13px; }
.insight-item p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.insight-item.good .dot { background: var(--good); }
.insight-item.warn .dot { background: var(--warn); }
.insight-item.risk .dot { background: var(--danger); }
.insight-list .muted { margin: 0; }

/* ---------- 饮食页 ---------- */
.date-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 18px;
}
.date-box { display: flex; align-items: center; gap: 10px; }
.date-box input[type="date"] {
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card-2);
  font-size: 14px;
}
.date-box span { font-size: 13px; color: var(--muted); font-weight: 600; }
.toolbar-stats { display: flex; gap: 20px; flex-wrap: wrap; margin-left: auto; font-size: 12.5px; color: var(--muted); }
.toolbar-stats b { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.diet-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
.meal-section {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--meal-color, var(--primary));
}
.meal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.meal-head > div { display: flex; align-items: baseline; gap: 9px; }
.meal-head strong { font-size: 14.5px; }
.meal-head span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.entry-rows { display: flex; flex-direction: column; }
.entry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
}
.entry-row:first-child { border-top: 0; }
.entry-row .entry-main { flex: 1; min-width: 0; }
.entry-row strong { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-row small { color: var(--muted); font-size: 11.5px; }
.entry-row .entry-kcal { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.entry-row .entry-actions { display: flex; gap: 2px; opacity: 0.6; transition: opacity 0.15s ease; }
.entry-row:hover .entry-actions { opacity: 1; }
.mini-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mini-btn:hover { background: var(--bg-soft); color: var(--primary); }
.mini-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.mini-btn .ico { width: 15px; height: 15px; }
.empty-line { margin: 4px 0 2px; color: var(--muted); font-size: 12.5px; padding: 8px 2px 12px; }

/* ---------- 体重页 ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
  padding: 14px;
  border-radius: 14px;
  background: var(--card-2);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat span { font-size: 11.5px; color: var(--muted); }
.stat strong { font-size: 24px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat small { font-size: 11.5px; color: var(--muted); }
.stat strong.down { color: var(--primary); }
.stat strong.up { color: var(--danger); }
.hint { margin: 14px 0 0; font-size: 12px; color: var(--muted); line-height: 1.7; }
.chart { min-height: 240px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-empty { display: grid; place-items: center; min-height: 220px; color: var(--muted); font-size: 13px; text-align: center; gap: 8px; }
.chart-empty .ico { width: 30px; height: 30px; color: var(--line); }
.chart-tip { font-size: 12px; color: var(--muted); margin-top: 8px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

.weight-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 2px;
  border-top: 1px dashed var(--line);
  font-size: 13px;
}
.weight-row:first-child { border-top: 0; }
.weight-row time { width: 88px; flex: none; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.weight-row .w-kg { font-weight: 700; font-variant-numeric: tabular-nums; }
.weight-row .w-fat { color: var(--muted); font-size: 11.5px; }
.weight-row .w-note { flex: 1; min-width: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 分析页 ---------- */
.analysis-tabs { justify-self: start; }
.analysis-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.analysis-head h2 { margin: 6px 0 4px; font-size: 22px; letter-spacing: -0.02em; }
.analysis-hero { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.score-ring {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--primary) calc(var(--score, 0) * 1%), var(--bg-soft) 0);
  position: relative;
  flex: none;
}
.score-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--card); }
.score-ring > div { position: relative; text-align: center; line-height: 1.1; }
.score-ring strong { font-size: 30px; display: block; letter-spacing: -0.02em; }
.score-ring span { font-size: 11px; color: var(--muted); }
.analysis-summary { margin: 0 0 6px; font-size: 14px; line-height: 1.7; }
.analysis-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.analysis-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.analysis-stats .stat strong { font-size: 20px; }
.analysis-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.finding-list, .suggestion-list { display: flex; flex-direction: column; gap: 9px; }
.finding, .suggestion {
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 13px;
}
.finding strong, .suggestion strong { display: block; font-size: 13px; margin-bottom: 2px; }
.finding p, .suggestion p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.65; }
.finding.good { border-left: 3px solid var(--good); }
.finding.warn { border-left: 3px solid var(--warn); }
.finding.risk { border-left: 3px solid var(--danger); }
.suggestion .prio { float: right; font-size: 10.5px; color: var(--muted); background: var(--bg-soft); border-radius: 999px; padding: 1px 7px; }

.plan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.plan-card { padding: 14px; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); border-top: 3px solid var(--meal-color, var(--primary)); }
.plan-card strong { font-size: 13.5px; display: block; }
.plan-card .plan-kcal { font-size: 19px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.plan-card p { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.plan-totals { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; font-size: 12.5px; color: var(--muted); }
.plan-totals b { color: var(--text); font-size: 14px; }

.daily-bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 8px; }
.daily-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; height: 100%; justify-content: flex-end; }
.daily-bar i { width: 100%; max-width: 18px; border-radius: 5px 5px 2px 2px; background: var(--primary-soft); min-height: 2px; }
.daily-bar i.filled { background: linear-gradient(180deg, #59c68b, var(--primary)); }
.daily-bar span { font-size: 9px; color: var(--muted); white-space: nowrap; transform: rotate(-0deg); }
.daily-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }

.engine-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--primary-soft);
  font-size: 12.5px;
  color: var(--primary-dark);
  line-height: 1.6;
}
[data-theme="dark"] .engine-note { color: var(--primary); }

/* ---------- 我的 ---------- */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 2px; border-top: 1px dashed var(--line); }
.setting-row:first-of-type { border-top: 0; }
.setting-row strong { font-size: 13.5px; }
.setting-row p { margin: 1px 0 0; font-size: 12px; color: var(--muted); }
.note-card p { margin: 0; line-height: 1.8; }

/* ---------- 移动端底部导航 ---------- */
.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
}
.mobile-nav .nav-item { flex: 1; flex-direction: column; gap: 2px; height: 52px; font-size: 10.5px; padding: 0; justify-content: center; }
.mobile-nav .nav-item .ico { width: 21px; height: 21px; }
.mobile-nav .nav-item.active { background: transparent; color: var(--primary); }

/* ---------- 模态 ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(12, 20, 16, 0.5);
  backdrop-filter: blur(4px);
  animation: fade 0.18s ease;
}
.modal {
  width: min(580px, 100%);
  max-height: min(88vh, 820px);
  overflow: auto;
  background: var(--card);
  border-radius: 24px;
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
  animation: pop 0.22s ease;
}
.modal.small { width: min(420px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 14px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-head p { margin: 3px 0 0; }
.modal-body { padding: 16px 22px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 22px; border-top: 1px solid var(--line); margin-top: 6px; }
.modal .segmented { margin: 0 22px 2px; }

.food-results { max-height: 250px; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; }
.food-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--card-2);
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.food-item:hover { border-color: var(--primary); }
.food-item.active { border-color: var(--primary); background: var(--primary-soft); }
.food-item > div { flex: 1; min-width: 0; }
.food-item strong { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.food-item small { font-size: 11.5px; color: var(--muted); }
.food-item .food-kcal { font-weight: 700; font-size: 13px; color: var(--primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.food-results .empty { margin: 10px 0 14px; text-align: center; }
/* 搜索行 */
.search-row { display: flex; align-items: center; gap: 8px; }
.search-row .search-field { flex: 1; }
.btn.sm { height: 38px; padding: 0 14px; font-size: 13px; border-radius: 10px; white-space: nowrap; }

/* 食物项多选标记 */
.food-check {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  background: var(--card);
  transition: all 0.15s;
}
.food-check.checked { background: var(--primary); border-color: var(--primary); }
.food-check.checked::after { content: ''; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* AI 查找 */
.ai-lookup { margin-top: 8px; text-align: center; }

/* 批量模式面板 */
.batch-pane { margin-top: 12px; padding: 12px; border-radius: 13px; background: var(--bg-soft); }
.batch-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.batch-list { display: flex; flex-direction: column; gap: 6px; }
.batch-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--card); border: 1px solid transparent; }
.batch-row.invalid { border-color: var(--danger); background: rgba(214, 69, 69, 0.08); }
.batch-row.invalid .batch-amount { border-color: var(--danger); }
.batch-name-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.batch-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-conv { font-size: 11px; color: var(--muted); white-space: nowrap; }
.batch-conv:empty { display: none; }
.batch-amount { width: 70px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-2); padding: 0 8px; font-size: 13px; }
.batch-unit { width: auto; min-width: 60px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--card-2); padding: 0 6px; font-size: 13px; }
.batch-remove { width: 28px; height: 28px; flex-shrink: 0; color: var(--muted); }
.batch-remove:hover { color: var(--danger); }
.batch-totals { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--primary-soft); font-size: 13px; font-weight: 600; text-align: center; }
.batch-error { margin: 8px 0 0; padding: 8px 10px; border-radius: 8px; background: rgba(214, 69, 69, 0.1); color: var(--danger); font-size: 12.5px; line-height: 1.5; }
.batch-list .empty { margin: 6px 0; text-align: center; font-size: 12px; }

.calc-line {
  margin: 0;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--bg-soft);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}
.calc-line b { color: var(--primary); font-size: 16px; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 15px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 13px;
  animation: slide 0.24s ease;
}
.toast .dot { margin-top: 6px; }
.toast.success .dot { background: var(--good); }
.toast.error .dot { background: var(--danger); }
.toast.info .dot { background: var(--warn); }
.toast p { margin: 0; line-height: 1.5; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes slide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .sidebar { width: 224px; padding: 24px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .analysis-columns { grid-template-columns: 1fr; }
  .meal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plan-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .mobile-nav { display: flex; }
  .main { padding: 12px 16px calc(84px + env(safe-area-inset-bottom)); }
  .topbar { padding: 8px 0; margin-bottom: 16px; }
  .top-title h1 { font-size: 20px; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { padding: 30px 24px 34px; gap: 20px; min-height: auto; }
  .auth-copy h1 { font-size: 38px; margin: 10px 0 12px; }
  .auth-copy p { font-size: 13.5px; }
  .auth-stats { gap: 24px; }
  .auth-stats strong { font-size: 21px; }
  .auth-qr { width: 108px; height: 108px; padding: 7px; border-radius: 12px; }
  .auth-panel { padding: 22px 16px 36px; }
  .auth-card { padding: 24px; border-radius: 22px; }
  .auth-card h2, .auth-sub, .auth-card .segmented { display: none; }
  .auth-brand-mobile { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-weight: 800; font-size: 17px; }
  .auth-brand-mobile .brand-mark { width: 38px; height: 38px; }
}

@media (max-width: 720px) {
  .auth-qr { width: 100px; height: 100px; }
  .auth-download { gap: 12px; }
  .auth-download-copy span { display: none; }
  .hero { grid-template-columns: 1fr; padding: 22px; gap: 18px; }
  .ring-wrap { width: 168px; height: 168px; justify-self: center; }
  .calorie-ring { width: 168px; height: 168px; }
  .ring-center strong { font-size: 25px; }
  .hero-meta { gap: 16px; }
  .form-grid, .form-row, .form-row.three, .analysis-stats { grid-template-columns: 1fr 1fr; }
  .form-grid .span-2 { grid-column: span 2; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .diet-grid { grid-template-columns: 1fr; }
  .date-toolbar { gap: 8px; }
  .toolbar-stats { margin-left: 0; width: 100%; gap: 14px; }
  .analysis-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .analysis-summary { text-align: left; }
  .analysis-meta { justify-content: center; }
  .chart { overflow-x: auto; }
  .chart svg { min-width: 520px; }
  .top-avatar { display: none; }
  .toast-wrap { right: 12px; left: 12px; bottom: 84px; max-width: none; }
  .modal-body .form-row.three { grid-template-columns: 1fr 1fr; }
  #amount-field { grid-column: span 2; }
}

@media (max-width: 460px) {
  .meal-grid { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
  .form-grid, .analysis-stats { grid-template-columns: 1fr 1fr; }
  .auth-stats div:last-child { display: none; }
  .sync-pill span:last-child { display: none; }
  .sync-pill { width: 32px; padding: 0; justify-content: center; }
  .card { padding: 16px; border-radius: 17px; }
  .stat strong { font-size: 21px; }
  .weight-row time { width: 70px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
