/* 健身工作台 · 样式（多主题：html[data-theme] 切换） */
:root,
[data-theme='matcha'] {
  --bg: #f2f5ec;
  --card: #ffffff;
  --ink: #303C33;
  --ink-body: #4C584D;
  --ink-sub: #697568;
  --muted: #697568;
  --line: #e3e9da;
  --soft: #edf1e3;
  --softer: #f0f4e8;
  --grid-line: #e8ecdf;
  --axis: #9aa48f;
  --stub: #dfe6d2;
  --accent: #7fa25f;
  --accent-2: #95b877;
  --accent-soft: #e4f0d9;
  --green: #3d8f63;
  --green-soft: #e2f1e8;
  --blue: #4a7fb5;
  --blue-soft: #e3edf7;
  --red: #cf5147;
  --amber: #dea94c;
  --shadow: 0 1px 3px rgba(46, 56, 44, 0.05), 0 6px 18px rgba(46, 56, 44, 0.06);
  --auth-grad: linear-gradient(135deg, #b3cf97 0%, #7fa25f 45%, #5e8443 100%);
  --radius: 16px;
  --tg-bg: #e4f0dc; --tg-ink: #5e8443;
  --ty-bg: #fcf3d9; --ty-ink: #a87f2e;
  --tb-bg: #dceaf7; --tb-ink: #4a7fb5;
  --tp-bg: #fadee3; --tp-ink: #c25b70;
  --tv-bg: #e9e1f2; --tv-ink: #7b5ea7;
  --hero-grad: linear-gradient(160deg, #63885a 0%, #4f7347 55%, #416039 100%);
}
[data-theme='paper'] {
  --bg: #faf9f6;
  --card: #ffffff;
  --ink: #1a2321;
  --ink-body: #37403d;
  --ink-sub: #5e6864;
  --muted: #5e6864;
  --line: #e9e7e0;
  --soft: #f1efe9;
  --softer: #f5f4ef;
  --grid-line: #eeece5;
  --axis: #a0a29c;
  --stub: #e4e2da;
  --accent: #b0813e;
  --accent-2: #c9a25f;
  --accent-soft: #f5ead4;
  --green: #4a8f63;
  --green-soft: #e6f2ea;
  --blue: #4a7fb5;
  --blue-soft: #e6eef8;
  --red: #c8524a;
  --amber: #d9a13f;
  --auth-grad: linear-gradient(135deg, #e6d9bd 0%, #cbb07f 45%, #a98545 100%);
  --tg-bg: #e7f0e7; --tg-ink: #4e7d5b;
  --ty-bg: #faf0d7; --ty-ink: #a1762a;
  --tb-bg: #e3ecf6; --tb-ink: #4c78a8;
  --tp-bg: #f8e3e7; --tp-ink: #bd5f77;
  --tv-bg: #eee8f4; --tv-ink: #7a63a5;
  --hero-grad: linear-gradient(160deg, #857250 0%, #71603f 55%, #5f5033 100%);
}
[data-theme='lake'] {
  --bg: #eef4fa;
  --card: #ffffff;
  --ink: #1f2c3a;
  --ink-body: #3a4a5a;
  --ink-sub: #5e6e7d;
  --muted: #5e6e7d;
  --line: #dde7f0;
  --soft: #e8eff6;
  --softer: #f0f5fa;
  --grid-line: #e6edf4;
  --axis: #94a3b1;
  --stub: #dbe5ee;
  --accent: #2f6fed;
  --accent-2: #5b8df2;
  --accent-soft: #e2ecfd;
  --green: #2e9e5b;
  --green-soft: #e3f5ea;
  --blue: #2f6fed;
  --blue-soft: #e2ecfd;
  --red: #d93025;
  --amber: #e8a33d;
  --auth-grad: linear-gradient(135deg, #7fa8e8 0%, #2f6fed 45%, #1d4fb8 100%);
  --radius: 14px;
  --tg-bg: #e3f3e9; --tg-ink: #2e7d54;
  --ty-bg: #fcf2d9; --ty-ink: #a07d24;
  --tb-bg: #dfeaf8; --tb-ink: #3a6fc4;
  --tp-bg: #fbe4ea; --tp-ink: #c14a72;
  --tv-bg: #ebe6f8; --tv-ink: #6d59b0;
  --hero-grad: linear-gradient(160deg, #4a6f9c 0%, #3a5c88 55%, #2f4c72 100%);
}
[data-theme='orange'] {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1a2233;
  --ink-body: #3a4353;
  --ink-sub: #5f6875;
  --muted: #5f6875;
  --line: #e6eaf1;
  --soft: #eef1f6;
  --softer: #f1f3f7;
  --grid-line: #eceff4;
  --axis: #9aa3b2;
  --stub: #e3e7ee;
  --accent: #f4511e;
  --accent-2: #ff7043;
  --accent-soft: #fdece7;
  --green: #2e9e5b;
  --green-soft: #e6f5ec;
  --blue: #2f6fed;
  --blue-soft: #e8f0fe;
  --red: #d93025;
  --amber: #f5a623;
  --auth-grad: linear-gradient(135deg, #ff8a65 0%, #f4511e 45%, #d84315 100%);
  --radius: 14px;
  --tg-bg: #e6f5ec; --tg-ink: #25844f;
  --ty-bg: #fdf3d8; --ty-ink: #a97e1c;
  --tb-bg: #e8f0fe; --tb-ink: #2f6fed;
  --tp-bg: #fde7ee; --tp-ink: #d6336c;
  --tv-bg: #f0e9fb; --tv-ink: #7048b6;
  --hero-grad: linear-gradient(160deg, #cc5f33 0%, #b34a1f 55%, #993a11 100%);
}
[data-theme='dark'] {
  --bg: #13191c;
  --card: #1b2328;
  --ink: #e6ebee;
  --ink-body: #c6d1d6;
  --ink-sub: #93a3ab;
  --muted: #93a3ab;
  --line: #2a343a;
  --soft: #242f36;
  --softer: #202a30;
  --grid-line: #263038;
  --axis: #6d7d86;
  --stub: #2c363d;
  --accent: #4cc38a;
  --accent-2: #3aa875;
  --accent-soft: #173629;
  --green: #4cc38a;
  --green-soft: #173629;
  --blue: #6aa6e0;
  --blue-soft: #1b3247;
  --red: #e0655c;
  --amber: #d8ae5c;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.3);
  --auth-grad: linear-gradient(135deg, #23313a 0%, #17211f 45%, #0d1517 100%);
  color-scheme: dark;
  --tg-bg: #1c312a; --tg-ink: #7fd4a3;
  --ty-bg: #322a18; --ty-ink: #e0c078;
  --tb-bg: #18293d; --tb-ink: #7db1e8;
  --tp-bg: #3a2029; --tp-ink: #e58fa3;
  --tv-bg: #281f3a; --tv-ink: #b39ddb;
  --hero-grad: linear-gradient(160deg, #2e3f39 0%, #263530 55%, #1e2a26 100%);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink-body);
  font-size: 15px;
  line-height: 1.65;
  transition: background .25s, color .25s;
}
.hidden { display: none !important; }
.flex1 { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }

/* ---------- 登录 ---------- */
.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--auth-grad);
  padding: 20px;
}
.auth-box { width: 380px; max-width: 100%; padding: 36px 34px; text-align: center; }
.auth-logo { font-size: 52px; }
.auth-box h1 { font-size: 24px; margin: 6px 0 2px; }
.auth-sub { color: var(--muted); margin-bottom: 18px; }
.auth-tabs { display: flex; background: var(--soft); border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.auth-tabs button {
  flex: 1; border: 0; background: transparent; padding: 8px; font-size: 15px;
  border-radius: 8px; cursor: pointer; color: var(--muted);
}
.auth-tabs button.active { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
#auth-form { text-align: left; }
#auth-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
#auth-form input {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink);
}
#auth-form input:focus { outline: 2px solid var(--accent-2); border-color: transparent; }
.auth-error { color: var(--red); font-size: 13px; margin-bottom: 10px; }

/* ---------- 通用 ---------- */
.btn {
  border: 0; cursor: pointer; border-radius: 10px; font-size: 14px;
  padding: 9px 16px; background: var(--soft); color: var(--ink); transition: filter .15s;
}
.btn:hover { filter: brightness(.96); }
.btn.primary { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; font-weight: 600; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.danger { background: var(--accent-soft); color: var(--red); }
.btn.block { width: 100%; padding: 11px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; border: 1px solid var(--line); }
.card h3 { font-size: 16px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.card h3 .sub { font-size: 12px; color: var(--muted); font-weight: 400; }

.chip {
  display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px;
  background: var(--soft); font-size: 13.5px; cursor: pointer; user-select: none; border: 1px solid transparent;
}
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-2); font-weight: 600; }

input[type="text"], input[type="number"], input[type="date"], input[type="password"], select, textarea {
  padding: 8px 10px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--ink); font-family: inherit;
}
/* 控件尺寸统一：无 type 的 input 兜底、下拉高度对齐输入框、去掉 number 的调节箭头 */
input:not([type]) { padding: 8px 10px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font-family: inherit; }
select { height: 35px; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); border-color: transparent; }
textarea { resize: vertical; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 0 22px; height: 56px;
}
.logo { font-weight: 700; font-size: 17px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tabs button {
  border: 0; background: transparent; padding: 8px 14px; font-size: 15px; cursor: pointer;
  color: var(--muted); border-radius: 10px; white-space: nowrap;
}
.tabs button.active { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.user-box { display: flex; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; }
.user-box button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 13px; color: var(--muted); }
.account-btn {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--soft);
  border-radius: 999px; padding: 3px 12px 3px 3px; cursor: pointer; font-size: 14px; color: var(--ink);
}
.account-btn:hover { filter: brightness(.97); }
.avatar-mini { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none; }
.avatar-lg { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.avatar-initial { background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; }

main { max-width: 1080px; margin: 18px auto 40px; padding: 0 18px; }
.foot { text-align: center; padding: 10px 16px 30px; }

/* ---------- 总览 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; border: 1px solid var(--line); position: relative; overflow: hidden; }
.stat-card .num { font-size: 30px; font-weight: 800; line-height: 1.2; }
.stat-card .num small { font-size: 14px; font-weight: 500; color: var(--muted); }
.stat-card .label { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stat-card .sub { font-size: 12px; color: var(--muted); margin-top: 8px; position: relative; }
.stat-card .deco { position: absolute; right: 0; bottom: -12px; font-size: 58px; line-height: 1; opacity: .18; pointer-events: none; transform: rotate(-10deg); }
.stat-card.accent .deco { opacity: .32; }
.stat-card.accent .sub { color: rgba(255,255,255,.82); }
.stat-card.accent { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #fff; border-color: transparent; }
.stat-card.accent .num small, .stat-card.accent .label { color: rgba(255,255,255,.85); }
.dash-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.progress { height: 10px; background: var(--soft); border-radius: 999px; overflow: hidden; margin: 6px 0 2px; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .4s; }
.progress.green > i { background: linear-gradient(90deg, #4caf50, var(--green)); }

.week-strip { display: flex; gap: 8px; margin-top: 8px; }
.week-day {
  flex: 1; text-align: center; padding: 8px 0 6px; border-radius: 10px; background: var(--softer); font-size: 12px; color: var(--muted);
}
.week-day b { display: block; font-size: 15px; color: var(--ink); }
.week-day.done { background: var(--green-soft); color: var(--green); }
.week-day.done b { color: var(--green); }
.week-day.today { outline: 2px solid var(--accent-2); }
.week-strip { display: flex; gap: 6px; margin-top: 2px; }
.week-day.future { opacity: .45; }

.acc-exit { display: flex; flex-direction: column; align-items: center; padding: 4px 0 12px; }
.btn.exit-btn {
  color: var(--red); border: 1px solid color-mix(in srgb, var(--red) 32%, transparent);
  background: color-mix(in srgb, var(--red) 7%, var(--card)); padding: 10px 32px; font-weight: 600;
}

.recent-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.recent-item:last-child { border-bottom: 0; }
.recent-item .date { font-size: 13px; color: var(--muted); width: 92px; }
/* 固定高度滚动区：默认约 3 条，其余滚动查看（最近打卡 / 本月天气心情共用） */
.recent-scroll { max-height: 130px; overflow-y: auto; padding-right: 6px; scrollbar-width: thin; }
.recent-scroll::-webkit-scrollbar { width: 5px; }
.recent-scroll::-webkit-scrollbar-thumb { background: var(--stub); border-radius: 3px; }
.daily-row { cursor: pointer; border-radius: 8px; padding: 10px 6px; }
.daily-row:hover { background: var(--accent-soft); }
/* 计划表里可点击看 GIF 演示的动作名 */
.ex-demo { cursor: pointer; border-bottom: 1px dashed var(--accent-2); padding-bottom: 1px; }
.ex-demo:hover { color: var(--accent); border-bottom-style: solid; }

/* 食物速查（饮食记录页底部） */
.fr-body { max-height: 300px; }
.fr-head {
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(168deg, color-mix(in srgb, var(--accent-soft) 55%, #fff), var(--accent-soft));
  border-radius: 10px; padding: 7px 12px; margin: 12px 0 6px;
}
.fr-head:first-child { margin-top: 2px; }
.fr-head b { font-size: 14px; }
.fr-head .fr-ico { font-size: 18px; }
.fr-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.fr-row:last-child { border-bottom: 0; }
.fr-emo { font-size: 17px; line-height: 1; flex: none; width: 20px; text-align: center; }
.fr-emo.none { display: inline-block; }
.fr-img { width: 22px; height: 22px; flex: none; object-fit: contain; border-radius: 50%; background: #fff; }
.fr-row .fr-name { flex: 0 0 auto; max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-row b { margin-left: auto; font-size: 13px; white-space: nowrap; }
.fr-row b i { font-style: normal; font-size: 11px; color: var(--muted); font-weight: 400; }
.fr-row b.hot { color: var(--red); }
.k-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; min-width: 60px; }
.k-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.k-bar.hot i { background: linear-gradient(90deg, #e29088, var(--red)); }
.gi-bar { flex: 1; height: 5px; border-radius: 3px; background: var(--soft); overflow: hidden; min-width: 50px; }
.gi-bar i { display: block; height: 100%; border-radius: 3px; }
.gi-bar.low i { background: var(--green); }
.gi-bar.mid i { background: var(--amber); }
.gi-bar.high i { background: var(--red); }
.p-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--soft); overflow: hidden; min-width: 60px; }
.p-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.gi-badge { margin-left: 0; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; flex: none; }
.gi-low { background: var(--green-soft); color: var(--green); }
.gi-mid { background: var(--ty-bg); color: var(--ty-ink); }
.gi-high { background: var(--tp-bg); color: var(--red); }
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; background: var(--accent-soft); color: var(--accent); margin-right: 4px; }

/* 月度图表 */
.chart-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.chart-box h4 { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.chart-box svg { width: 100%; height: auto; display: block; }
@media (max-width: 900px) { .chart-grid2 { grid-template-columns: 1fr; } }

/* ---------- 日历 ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-title { font-size: 17px; font-weight: 600; min-width: 120px; text-align: center; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-banner {
  margin-top: 12px; border-radius: 12px; padding: 10px 16px; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 10px; font-size: 13.5px;
  background: linear-gradient(120deg, var(--accent-soft), color-mix(in srgb, var(--ty-bg) 55%, #fff));
}
.cal-banner b { font-size: 16px; color: var(--accent); padding: 0 2px; }
.cal-banner .cb-ghost { position: absolute; right: 12px; top: -8px; font-size: 46px; opacity: .15; transform: rotate(12deg); }
.cal-banner .cb-tip { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-wk { text-align: center; font-size: 12.5px; color: var(--muted); padding: 3px 0; font-weight: 600; }
.cal-cell {
  height: 58px; border-radius: 12px; background: var(--softer); display: flex; flex-direction: column;
  align-items: center; justify-content: center; cursor: pointer; color: var(--ink);
  position: relative; border: 1.5px solid transparent;
  transition: transform .12s ease, box-shadow .12s ease;
}
.cal-cell:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.empty:hover { transform: none; box-shadow: none; }
.cal-cell .num { font-size: 15px; line-height: 1.15; }
.cal-lunar { font-size: 10px; color: var(--muted); line-height: 1; margin-top: 3px; }
.cal-lunar.fest { color: var(--red); font-weight: 700; }
.cal-cell.done .cal-lunar { color: var(--accent); opacity: .8; }
.cal-badge {
  position: absolute; bottom: 4px; right: 4px; font-size: 9px; font-weight: 700; line-height: 1;
  color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-radius: 999px; padding: 2px 5px;
}
.cal-cell.today { border-color: var(--accent-2); font-weight: 700; }
.cal-cell.today .num { color: var(--accent); }
.cal-cell.today::after {
  content: '今'; position: absolute; top: 3px; right: 5px; font-size: 10px;
  color: var(--accent); font-weight: 700; opacity: .85;
}
.cal-cell.sel { border-color: var(--accent); background: var(--accent-soft); }
/* 已打卡：浅绿渐变底 + 绿色徽章 */
.cal-cell.done { background: linear-gradient(168deg, color-mix(in srgb, var(--accent-soft) 45%, #fff), var(--accent-soft)); }
.cal-cell.done .num { color: var(--accent); font-weight: 700; }
.cal-legend { margin-top: 10px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lv-item { display: inline-flex; align-items: center; gap: 4px; }
.lv { width: 12px; height: 12px; border-radius: 4px; display: inline-block; flex: none; }
.lv.done { background: linear-gradient(135deg, var(--accent-2), var(--accent)); }
.lv.today { background: transparent; border: 1.5px solid var(--accent-2); }
.lv.sel { background: var(--accent-soft); border: 1.5px solid var(--accent); }

/* 记录卡片 */
.rec-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 12px; border: 1px solid var(--line); }
.rec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.rec-head .date { font-weight: 600; }
.rec-ops { margin-left: auto; display: inline-flex; gap: 6px; }
.ex-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 6px; }
.ex-table th, .ex-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.ex-table th { color: var(--muted); font-weight: 500; font-size: 12px; }
.rec-notes { margin-top: 8px; font-size: 13px; color: var(--muted); background: var(--softer); border-radius: 8px; padding: 8px 10px; }
.feel { font-size: 12px; padding: 1px 8px; border-radius: 999px; }
.feel.easy { background: var(--green-soft); color: var(--green); }
.feel.ok { background: var(--blue-soft); color: var(--blue); }
.feel.hard { background: var(--accent-soft); color: var(--accent); }

/* ---------- 饮食 ---------- */
.diet-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
/* 今日摄入汇总 */
.sum-hero { display: flex; align-items: baseline; gap: 10px; }
.sum-num { font-size: 34px; font-weight: 800; letter-spacing: -1px; }
.sum-num small { font-size: 14px; font-weight: 400; color: var(--muted); }
.sum-pct { font-size: 26px; font-weight: 800; color: var(--accent); }
.sum-pct small { font-size: 14px; }
.sum-macros { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.m-chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 12px;
  border-radius: 999px; background: var(--soft); font-size: 13px; color: var(--muted);
}
.m-chip b { color: var(--ink); font-size: 13.5px; }
.m-chip.mp { background: var(--green-soft); color: var(--green); }
.m-chip.mp b { color: var(--green); }
.m-chip.muted { background: transparent; padding: 4px 2px; }
/* 餐组长条：左侧餐标 + 右侧内容 */
.meal-strip {
  display: flex; align-items: stretch; border-radius: var(--radius); overflow: hidden;
  margin-bottom: 10px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow);
}
.ms-side {
  flex: none; width: 112px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; padding: 14px 8px; border-right: 1px dashed var(--line);
}
.ms-ico { font-size: 24px; line-height: 1; }
.ms-name { font-weight: 700; font-size: 14.5px; }
.ms-kcal { font-size: 12px; color: var(--muted); }
.ms-add { margin-top: 7px; }
.ms-body { flex: 1; padding: 8px 16px; min-width: 0; align-self: center; }
.meal-strip.tint-y .ms-side { background: linear-gradient(168deg, color-mix(in srgb, var(--ty-bg) 55%, #fff), var(--ty-bg)); }
.meal-strip.tint-g .ms-side { background: linear-gradient(168deg, color-mix(in srgb, var(--tg-bg) 55%, #fff), var(--tg-bg)); }
.meal-strip.tint-b .ms-side { background: linear-gradient(168deg, color-mix(in srgb, var(--tb-bg) 55%, #fff), var(--tb-bg)); }
.meal-strip.tint-p .ms-side { background: linear-gradient(168deg, color-mix(in srgb, var(--tp-bg) 55%, #fff), var(--tp-bg)); }
.meal-strip.tint-y .ms-name { color: var(--ty-ink); }
.meal-strip.tint-g .ms-name { color: var(--tg-ink); }
.meal-strip.tint-b .ms-name { color: var(--tb-ink); }
.meal-strip.tint-p .ms-name { color: var(--tp-ink); }
@media (max-width: 640px) {
  .meal-strip { flex-direction: column; }
  .ms-side { width: auto; flex-direction: row; gap: 10px; border-right: 0; border-bottom: 1px dashed var(--line); padding: 10px 14px; }
  .ms-add { margin-top: 0; margin-left: auto; }
  .ms-body { padding: 8px 14px; }
}
.meal-group { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 12px; border: 1px solid var(--line); }
.meal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.meal-head h4 { font-size: 15px; }
.meal-head .kcal { margin-left: auto; color: var(--muted); font-size: 13px; }
.meal-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.meal-item:last-of-type { border-bottom: 0; }
.meal-item .name { min-width: 130px; }
.meal-item { }
.meal-item .kcal { font-weight: 600; margin-left: auto; }
.meal-item .del { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; }
.meal-item .del:hover { color: var(--red); }
.empty-hint { color: var(--muted); font-size: 13px; padding: 6px 0; }

/* ---------- 知识库 ---------- */
.k-subnav { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 4px; }
.k-subnav button {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 15px;
  font-size: 14px; cursor: pointer; white-space: nowrap; color: var(--muted);
}
.k-subnav button.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

.stage { border-left: 4px solid var(--accent-2); padding-left: 16px; margin-bottom: 20px; position: relative; }
.stage::before { content: ''; position: absolute; left: -9px; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent-2); border: 3px solid var(--card); box-shadow: 0 0 0 2px var(--accent-2); }
.stage .weeks { font-size: 12px; color: var(--accent); font-weight: 600; letter-spacing: 1px; }
.stage h3 { margin: 2px 0 4px; font-size: 17px; color: var(--ink); font-weight: 600; }
.stage .goal { color: var(--ink-sub); font-size: 13.5px; line-height: 1.7; margin-bottom: 8px; }
.stage ul { margin: 6px 0 10px 18px; font-size: 14px; line-height: 1.75; color: var(--ink-body); }
.stage ul li { margin-bottom: 5px; }
.stage ul li:last-child { margin-bottom: 0; }
.stage .milestone { background: var(--green-soft); color: var(--green); border-radius: 8px; padding: 8px 12px; font-size: 13.5px; }

.ability-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ability-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; border: 1px solid var(--line); }
.ability-card .head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.ability-card .head .icon { font-size: 26px; }
.ability-card .head h3 { margin: 0; font-size: 17px; }
.ability-card .sub { color: var(--accent); font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.ability-card .why { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.ck-list { list-style: none; font-size: 14px; }
.ck-list li { padding: 5px 0 5px 26px; position: relative; border-bottom: 1px dashed var(--line); }
.ck-list li:last-child { border-bottom: 0; }
.ck-list li::before { content: '✓'; position: absolute; left: 4px; color: var(--green); font-weight: 800; }
.read-link { display: inline-block; margin: 4px 6px 0 0; font-size: 13px; color: var(--blue); cursor: pointer; text-decoration: none; }
.read-link:hover { text-decoration: underline; }

.plan-day h4 { margin: 12px 0 6px; font-size: 15px; color: var(--accent); }
.plan-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.plan-table th, .plan-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.plan-table th { color: var(--muted); font-size: 12px; }

.art-cat { margin-bottom: 4px; }
.art-cat h4 { font-size: 15px; margin: 12px 0 6px; }
.art-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.art-item { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 5px 2px; cursor: pointer; border-radius: 6px; color: var(--ink-body); }
.art-item:hover { background: var(--accent-soft); }
.art-item .min { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

.move-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.move-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.move-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; cursor: pointer; border: 1px solid var(--line); }
.move-card img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #222; display: block; }
.move-card .name { padding: 8px 12px; font-size: 13.5px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.move-card .name .mini { font-weight: 400; color: var(--muted); font-size: 12.5px; }

.chart-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.chart-grid img { width: 100%; border-radius: 10px; cursor: zoom-in; background: var(--card); border: 1px solid var(--line); }
.anat-cell { display: flex; flex-direction: column; gap: 4px; }
.anat-cell .mini { font-size: 12px; color: var(--muted); text-align: center; }

/* 拉伸图解 */
.stretch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .stretch-grid { grid-template-columns: 1fr; } }
.stretch-item { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); display: flex; flex-direction: column; }
.stretch-item img { width: 100%; cursor: zoom-in; background: var(--softer); }
.st-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.st-body b { font-size: 14px; }
.st-body .mini { font-size: 12px; }
.st-tip { color: var(--ink); line-height: 1.5; }
.st-warn { color: var(--red); font-size: 12.5px; line-height: 1.5; }

.glossary-list { columns: 2; column-gap: 30px; }
.glossary-item { break-inside: avoid; margin-bottom: 10px; }
.glossary-item b { color: var(--accent); }
.glossary-item p { font-size: 13.5px; color: var(--muted); }

.faq-item { border-bottom: 1px solid var(--line); padding: 10px 0; cursor: pointer; }
.faq-item .q { font-weight: 600; font-size: 14.5px; }
.faq-item .q::before { content: 'Q '; color: var(--accent); }
.faq-item .a { color: var(--muted); font-size: 14px; margin-top: 4px; padding-left: 20px; }
.faq-item.closed .a { display: none; }

/* ---------- 账户页 ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.theme-card { border: 2px solid var(--line); border-radius: 12px; padding: 8px; cursor: pointer; text-align: center; font-size: 13.5px; color: var(--ink); background: var(--card); }
.theme-card:hover { filter: brightness(.97); }
.theme-card.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.theme-demo { height: 44px; border-radius: 8px; position: relative; margin-bottom: 6px; border: 1px solid rgba(0,0,0,.08); }
.theme-demo i { position: absolute; left: 8px; bottom: 8px; width: 14px; height: 14px; border-radius: 50%; }
.theme-demo b { position: absolute; right: 8px; top: 8px; width: 26px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,.08); }
@media (max-width: 900px) { .theme-grid { grid-template-columns: repeat(3, 1fr); } }

/* ---------- 弹窗/Toast ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal { background: var(--card); border-radius: 16px; width: 640px; max-width: 100%; padding: 24px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h3 { margin-bottom: 14px; font-size: 17px; }
.modal .close-x { float: right; border: 0; background: var(--softer); color: var(--ink); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 14px; }
.form-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.form-row label { flex: 1; min-width: 130px; font-size: 13px; color: var(--muted); }
.form-row input, .form-row select, .form-row textarea { width: 100%; margin-top: 4px; }
.ex-row { display: grid; grid-template-columns: 1.6fr .5fr .8fr .8fr 32px; gap: 8px; margin-bottom: 8px; align-items: center; }
.ex-row input { width: 100%; }
.ex-name-wrap { display: flex; gap: 4px; align-items: center; min-width: 0; }
.ex-name-wrap .ex-name { flex: 1; min-width: 0; }
.ex-pick {
  border: 1px solid var(--line); background: var(--card); border-radius: 8px; cursor: pointer;
  padding: 7px 9px; color: var(--accent); font-size: 13px; line-height: 1; flex: none;
}
.ex-pick:hover { background: var(--accent-soft); }
.mp-item { padding: 8px 10px; border-bottom: 1px dashed var(--line); cursor: pointer; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.mp-item:hover { background: var(--accent-soft); }
.mp-item:last-child { border-bottom: 0; }
/* 浮层选择器（贴输入框弹出） */
.mp-pop {
  position: absolute; z-index: 200; width: 274px; max-height: 320px;
  background: var(--card); border: 1px solid var(--accent-2); border-radius: 14px;
  box-shadow: 0 10px 32px rgba(46, 56, 44, .2); padding: 8px; overflow: hidden;
  background-image: linear-gradient(168deg, color-mix(in srgb, var(--accent-soft) 30%, var(--card)), var(--card) 42%);
  animation: mp-in .14s ease;
}
@keyframes mp-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.mp-pop .mp-q { width: 100%; margin-bottom: 6px; border-radius: 8px; }
.mp-pop .mp-list { max-height: 240px; overflow-y: auto; }
.mp-pop .mp-item { border-radius: 8px; }
.mp-pop .mp-item:hover { background: var(--accent-soft); }
.ex-row .rm { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; }
.reader { white-space: normal; font-size: 15.5px; line-height: 1.8; color: var(--ink-body); max-height: 65vh; overflow-y: auto; background: var(--softer); border-radius: 10px; padding: 18px 20px; -webkit-overflow-scrolling: touch; }
.reader.is-txt { white-space: pre-wrap; } /* 仅纯文本回退保留 pre-wrap */
.reader p { margin: .72em 0; }
.reader h2 { font-size: 17.5px; color: var(--ink); font-weight: 600; margin: 1.25em 0 .45em; line-height: 1.5; border-left: 3px solid var(--accent-2); padding-left: 10px; }
.reader h3 { font-size: 15.5px; margin: 1.05em 0 .4em; line-height: 1.5; }
.reader h2:first-child, .reader h3:first-child { margin-top: .2em; }
.reader figure { margin: 14px 0; text-align: center; }
.reader figure img { max-width: 100%; height: auto; border-radius: 8px; display: inline-block; }
.reader .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 12px 0; }
.reader table { border-collapse: collapse; font-size: 14px; min-width: 60%; }
.reader table th, .reader table td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; white-space: nowrap; }
.reader table th { background: var(--soft); font-weight: 600; }
.reader .toc { background: var(--card); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 14px; margin: 0 0 14px; font-size: 13.5px; }
.reader .toc summary { cursor: pointer; color: var(--muted); user-select: none; }
.reader .toc ol { margin: 6px 0 2px; padding-left: 20px; }
.reader .toc a { color: var(--accent); text-decoration: none; }
@media (max-width: 640px) { .reader { font-size: 15px; padding: 14px; } .reader h2 { font-size: 16.5px; } }
.viewer-img { max-width: 100%; border-radius: 10px; display: block; margin: 0 auto; }

.toast { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); background: rgba(20, 26, 38, .92); color: #fff; padding: 10px 22px; border-radius: 999px; font-size: 14px; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.25); }

/* ---------- 模块彩色底（手账风：上深下浅渐变 + 顶角柔光斑，无边框） ---------- */
.tint-g, .tint-y, .tint-b, .tint-p, .tint-v { border-color: transparent; }
.tint-g {
  background: var(--tg-bg);
  background:
    radial-gradient(circle 130px at 88% 0%, color-mix(in srgb, var(--tg-bg) 72%, transparent), transparent 72%),
    linear-gradient(168deg, var(--tg-bg) 0%, color-mix(in srgb, var(--tg-bg) 42%, #fff) 100%);
}
.tint-y {
  background: var(--ty-bg);
  background:
    radial-gradient(circle 130px at 88% 0%, color-mix(in srgb, var(--ty-bg) 72%, transparent), transparent 72%),
    linear-gradient(168deg, var(--ty-bg) 0%, color-mix(in srgb, var(--ty-bg) 42%, #fff) 100%);
}
.tint-b {
  background: var(--tb-bg);
  background:
    radial-gradient(circle 130px at 88% 0%, color-mix(in srgb, var(--tb-bg) 72%, transparent), transparent 72%),
    linear-gradient(168deg, var(--tb-bg) 0%, color-mix(in srgb, var(--tb-bg) 42%, #fff) 100%);
}
.tint-p {
  background: var(--tp-bg);
  background:
    radial-gradient(circle 130px at 88% 0%, color-mix(in srgb, var(--tp-bg) 72%, transparent), transparent 72%),
    linear-gradient(168deg, var(--tp-bg) 0%, color-mix(in srgb, var(--tp-bg) 42%, #fff) 100%);
}
.tint-v {
  background: var(--tv-bg);
  background:
    radial-gradient(circle 130px at 88% 0%, color-mix(in srgb, var(--tv-bg) 72%, transparent), transparent 72%),
    linear-gradient(168deg, var(--tv-bg) 0%, color-mix(in srgb, var(--tv-bg) 42%, #fff) 100%);
}
.stat-card.tint-g .num { color: var(--tg-ink); }
.stat-card.tint-y .num { color: var(--ty-ink); }
.stat-card.tint-b .num { color: var(--tb-ink); }
.stat-card.tint-p .num { color: var(--tp-ink); }
.stat-card.tint-v .num { color: var(--tv-ink); }
.meal-group.tint-g .meal-head h4 { color: var(--tg-ink); }
.meal-group.tint-y .meal-head h4 { color: var(--ty-ink); }
.meal-group.tint-b .meal-head h4 { color: var(--tb-ink); }
.meal-group.tint-p .meal-head h4 { color: var(--tp-ink); }
.ability-card.tint-g h3, .ability-card.tint-g .sub { color: var(--tg-ink); }
.ability-card.tint-y h3, .ability-card.tint-y .sub { color: var(--ty-ink); }
.ability-card.tint-b h3, .ability-card.tint-b .sub { color: var(--tb-ink); }
.ability-card.tint-p h3, .ability-card.tint-p .sub { color: var(--tp-ink); }
.ability-card.tint-v h3, .ability-card.tint-v .sub { color: var(--tv-ink); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid2, .ability-grid { grid-template-columns: 1fr; }
  .move-grid { grid-template-columns: repeat(3, 1fr); }
  .chart-grid { grid-template-columns: repeat(2, 1fr); }
  .art-list { grid-template-columns: 1fr; }
  .glossary-list { columns: 1; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px 6px; gap: 10px; }
  .logo { font-size: 15px; }
  #user-nickname { display: none; }
  /* 主导航：四个入口完整可见，不再横向滚动 */
  .tabs { order: 3; width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; overflow: visible; }
  .tabs button { padding: 9px 2px; font-size: 14px; text-align: center; }
  /* 知识库分类：3 列网格全可见 */
  .k-subnav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; overflow: visible; }
  .k-subnav button { padding: 9px 4px; font-size: 13px; text-align: center; white-space: nowrap; }
  main { padding: 0 10px; }
  .move-grid { grid-template-columns: repeat(2, 1fr); }
  /* 动作明细改上下卡片式：名称整行，组/次/重三列 */
  .ex-row { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-areas: 'name name rm' 'sets reps weight'; gap: 6px; border: 1px dashed var(--line); border-radius: 10px; padding: 8px; margin-bottom: 10px; }
  .ex-name-wrap { grid-area: name; }
  .ex-sets { grid-area: sets; }
  .ex-reps { grid-area: reps; }
  .ex-weight { grid-area: weight; }
  .ex-row .rm { grid-area: rm; justify-self: end; width: 32px; height: 32px; }
}

/* ---------- 大卡装饰：右上角水印 + 今日深色主卡 ---------- */
.has-deco { position: relative; overflow: hidden; }
.deco-tr { position: absolute; top: -18px; right: -8px; font-size: 76px; line-height: 1; opacity: .15; transform: rotate(10deg); pointer-events: none; }
.hero { color: #fff; background: var(--hero-grad); border-color: transparent; }
.hero h3 { color: #fff; }
.hero h3 .sub { color: rgba(255,255,255,.75); }
.hero .muted, .hero .empty-hint { color: rgba(255,255,255,.72); }
.hero .progress { background: rgba(255,255,255,.22); }
.hero .progress > i { background: linear-gradient(90deg, #ffffff, #dcecd2); }
.hero .macro-row { color: rgba(255,255,255,.78); }
.hero .macro-row b { color: #fff; }
.hero .btn { background: rgba(255,255,255,.16); color: #fff; }
.hero .btn.primary { background: #fff; color: #26331f; }
.hero .btn.ghost { background: transparent; border: 1px solid rgba(255,255,255,.45); }
.hero .deco-br { position: absolute; right: -8px; bottom: -16px; font-size: 90px; line-height: 1; opacity: .18; transform: rotate(-10deg); pointer-events: none; }

/* ---------- 今日卡横向板块 ---------- */
#dash-today { display: flex; flex-direction: column; }
.today-grid { display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: 1fr; gap: 12px; position: relative; flex: 1; align-content: stretch; }
.t-block { background: rgba(255,255,255,.13); border-radius: 12px; padding: 14px 16px; cursor: pointer; transition: background .15s; display: flex; flex-direction: column; justify-content: center; }
.t-block:hover { background: rgba(255,255,255,.22); }
.t-block .k { font-size: 11.5px; color: rgba(255,255,255,.65); }
.t-block .v { font-size: 16px; font-weight: 700; color: #fff; margin-top: 4px; line-height: 1.4; }
.t-note { font-size: 11.5px; color: rgba(255,255,255,.55); margin-top: 10px; text-align: center; }
.tip-bar { background: rgba(255,255,255,.14); border-left: 3px solid rgba(255,255,255,.85); padding: 8px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; color: #fff; }
@media (max-width: 900px) { .today-grid { grid-template-columns: repeat(2, 1fr); } }

/* 图文版文章阅读器 */
.reader img { max-width: 100%; height: auto; border-radius: 8px; margin: 10px auto; display: block; }
.reader p { margin: 8px 0; }

/* 身体指标页 */
.metrics-me { display: flex; gap: 12px; position: relative; flex-wrap: wrap; }
.mm { flex: 1; min-width: 120px; background: var(--card); border-radius: 12px; padding: 10px 14px; text-align: center; border: 1px solid var(--line); }
.mm .k { font-size: 12px; color: var(--muted); }
.mm .v { font-size: 26px; font-weight: 800; color: var(--accent); line-height: 1.3; }
.metrics-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .metrics-grid2 { grid-template-columns: 1fr; } }
.metrics-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 900px) { .metrics-grid3 { grid-template-columns: 1fr; } }
.mt-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-bottom: 1px dashed var(--line); font-size: 13.5px; color: var(--ink-body); }
.mt-row:last-child { border-bottom: 0; }
.mt-row.me { background: var(--green-soft); border-radius: 8px; border-bottom-color: transparent; }
.mt-row b { font-size: 13px; white-space: nowrap; }
.mt-kcal { max-height: 300px; overflow-y: auto; padding-right: 4px; }
.badge.tb { background: var(--tb-bg); color: var(--tb-ink); }
.badge.tg { background: var(--tg-bg); color: var(--tg-ink); }
.badge.ty { background: var(--ty-bg); color: var(--ty-ink); }
.badge.tp { background: var(--tp-bg); color: var(--tp-ink); }
.soma { background: var(--softer); border-radius: 12px; padding: 12px 14px; }
.soma b { font-size: 14px; display: block; margin-bottom: 4px; }
.soma p { margin: 3px 0; line-height: 1.55; }
.tip-card { background: var(--softer); border-radius: 12px; padding: 12px 14px; }
.tip-card > b { display: block; margin-bottom: 6px; font-size: 14px; color: var(--ink); font-weight: 600; }

/* 新增打卡方式选择（按计划 / 空白） */
.wk-chooser { display: flex; flex-direction: column; gap: 10px; }
.wkc {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--card);
  padding: 16px 18px; cursor: pointer; text-align: left; min-height: 64px;
}
.wkc b { font-size: 15px; color: var(--ink); }
.wkc:hover { border-color: var(--accent); background: var(--accent-soft); }

/* 知识库：全局搜索 + 分组导航 */
.k-search-card { margin-bottom: 12px; }
.k-search-pop {
  margin-top: 8px; border: 1.5px dashed var(--accent-2); border-radius: 12px;
  background: var(--card); padding: 6px; max-height: 300px; overflow-y: auto;
}
.k-subnav { flex-direction: column; gap: 6px; overflow: visible; }
.k-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kg-label { font-size: 11.5px; color: var(--muted); min-width: 50px; letter-spacing: 1px; }
.mv-tag { font-style: normal; font-size: 10.5px; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 0 6px; margin-left: 2px; }
@media (max-width: 640px) {
  .k-subnav { display: flex; }
  .kg-label { min-width: 100%; }
}

/* 动作库：静态封面 + 播放角标（点击进弹窗播放） */
.mv-thumb { position: relative; }
.mv-cv { width: 100%; display: block; border-radius: 10px 10px 0 0; background: var(--softer); min-height: 90px; }
.mv-play {
  position: absolute; right: 8px; bottom: 8px; width: 30px; height: 30px; line-height: 30px;
  text-align: center; border-radius: 50%; background: rgba(255,255,255,.88); color: var(--accent);
  font-size: 13px; box-shadow: 0 2px 8px rgba(46,56,44,.25); pointer-events: none;
}

/* ===== 移动端适配与安全区域 ===== */
/* 安全区：顶部导航与底部内容避开刘海/手势条 */
.topbar { padding-top: env(safe-area-inset-top); }
.foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
.modal { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
@media (max-width: 640px) {
  .modal { padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); width: 100%; }
  /* 触控目标 ≥44px：主导航与知识库分类 */
  .tabs button { padding: 12px 2px; min-height: 44px; }
  .k-subnav button { padding: 11px 6px; min-height: 44px; }
  /* 日历：极窄屏格子仍可点（7 列约 41px 宽） */
  .calendar { gap: 2px; }
  .cal-cell { height: 54px; border-radius: 8px; }
  .cal-cell .num { font-size: 14px; }
  .cal-lunar { font-size: 9.5px; }
  .cal-cell.today::after { font-size: 9px; top: 2px; right: 3px; }
  .cal-wk { font-size: 11.5px; }
  /* 长表格自身滚动，页面不横滚 */
  .plan-table, .ex-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .plan-table th, .plan-table td, .ex-table th, .ex-table td { white-space: nowrap; }
  /* 卡片标题长中文换行 */
  .card h3 { flex-wrap: wrap; }
}
/* 手机端：弹窗底部保存键吸底，键盘弹出也不被埋 */
@media (max-width: 640px) {
  .modal > .btn.primary.block { position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)) ; margin-top: 12px; z-index: 2; }
}

/* ===== 全站统一搜索框（无提交按钮：输入/回车/清除即搜） ===== */
.search-box { position: relative; display: flex; align-items: center; width: 100%; }
.search-box .s-ico { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; flex: none; }
.search-box input { width: 100%; padding-left: 34px; padding-right: 34px; border-radius: 10px; }
.search-box .s-clear {
  position: absolute; right: 5px; width: 26px; height: 26px; border: 0; background: transparent;
  color: var(--muted); cursor: pointer; border-radius: 50%; display: none;
  align-items: center; justify-content: center; font-size: 12px; line-height: 1;
}
.search-box.has-val .s-clear { display: inline-flex; }
.search-box .s-clear:hover { background: var(--soft); color: var(--ink); }
input::placeholder { color: var(--muted); opacity: .72; }

/* ===== 知识库导航线性图标 ===== */
.k-subnav button { display: inline-flex; align-items: center; gap: 6px; }
.kico { width: 15px; height: 15px; flex: none; }

/* ===== 顶部账户入口：去边框，纯头像+昵称 ===== */
.account-btn { border: 0 !important; background: transparent !important; padding: 4px 8px 4px 4px; border-radius: 999px; }
.account-btn:hover { background: var(--soft) !important; filter: none; }
#user-nickname { color: var(--ink-body); font-size: 13.5px; }
.mp-pop .search-box { margin-bottom: 6px; }
@media (max-width: 640px) { .dash-grid2 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .dash-grid2 > .card { min-width: 0; } .dash-grid2 > .card input, .dash-grid2 > .card select { min-width: 0; width: 100%; } }

/* ===== 饮食日历（月度视图 + 日期选择，主题变量驱动） ===== */
.diet-cal { padding: 14px 16px; }
.dc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dc-title { font-size: 16px; font-weight: 700; min-width: 104px; text-align: center; }
.dc-nav {
  width: 32px; height: 32px; border: 1px solid var(--line); background: var(--card);
  border-radius: 10px; cursor: pointer; font-size: 17px; color: var(--muted); line-height: 1;
}
.dc-nav:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-2); }
.dc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dc-wk { text-align: center; font-size: 11.5px; color: var(--muted); font-weight: 600; padding: 3px 0; }
.dc-cell {
  position: relative; height: 44px; border: 1.5px solid transparent; border-radius: 10px;
  background: var(--softer); cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2px 1px; color: var(--ink); min-width: 0;
}
.dc-cell.empty { background: transparent; cursor: default; }
.dc-cell .dc-d { font-size: 13.5px; line-height: 1.1; }
.dc-cell .dc-kcal { font-size: 9px; line-height: 1.1; color: var(--accent); font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-cell.today { border-color: var(--accent-2); }
.dc-cell.today .dc-d { color: var(--accent); font-weight: 700; }
.dc-cell.sel { background: var(--accent-soft); border-color: var(--accent); }
.dc-cell.sel .dc-d { color: var(--accent); font-weight: 700; }
.dc-cell.has { background: linear-gradient(168deg, color-mix(in srgb, var(--accent-soft) 40%, var(--softer)), var(--accent-soft)); }
.dc-cell.has.sel { border-color: var(--accent); }
.dc-cell:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.dc-stats { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.dc-stats b { color: var(--accent); font-size: 14px; padding: 0 1px; }
@media (max-width: 640px) {
  .diet-cal { padding: 12px 10px; }
  .dc-cell { height: 42px; border-radius: 8px; }
  .dc-cell .dc-d { font-size: 12.5px; }
  .dc-cell .dc-kcal { font-size: 8.5px; }
  .dc-title { min-width: 88px; font-size: 15px; }
}

/* 资料库：全部视图分组 */
.art-group { margin-bottom: 14px; }
.art-group h4 { font-size: 14.5px; margin: 10px 0 6px; color: var(--tg-ink); display: flex; align-items: baseline; gap: 8px; }
.art-group h4::before { content: ''; width: 4px; height: 14px; border-radius: 2px; background: var(--accent-2); display: inline-block; transform: translateY(2px); }

/* 身体指标摘要：区分年龄、估算结果和参考资料 */
.metrics-summary { background: var(--card); }
.metrics-summary-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.metrics-summary-head h3 { margin: 0 0 4px; }
.metrics-summary-head p { margin: 0; }
.metrics-age { flex-shrink: 0; padding: 6px 12px; border-radius: 999px; background: var(--softer); color: var(--muted); font-size: 13px; }
.metrics-summary .metrics-me { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metrics-summary .mm { min-width: 0; padding: 16px 18px; text-align: left; background: var(--softer); border: 0; }
.metrics-summary .mm .v { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin: 6px 0; font-size: 30px; }
.metrics-unit { font-size: 12px; font-weight: 400; color: var(--muted); }
.metrics-explanation { margin-top: 14px; font-size: 12px; color: var(--muted); }
.metrics-explanation summary { cursor: pointer; width: fit-content; }
.metrics-explanation p { max-width: 75ch; line-height: 1.7; margin: 8px 0 0; }
.metrics-explanation a { color: inherit; margin-left: 6px; text-decoration: underline; }
.metrics-reference-title { margin: 22px 0 12px; }
.metrics-reference-grid { align-items: start; }
.metrics-reference-grid .mt-row { flex-wrap: wrap; }
@media (max-width: 600px) {
  .metrics-summary-head { align-items: flex-start; }
  .metrics-summary .metrics-me { grid-template-columns: 1fr; gap: 8px; }
  .metrics-summary .mm { padding: 12px 14px; }
  .metrics-summary .mm .v { font-size: 27px; }
}

.metrics-reference-column { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.metrics-reference-column > .card { margin-bottom: 0; }

/* 个人训练空间：登录与注册共用轻量科技运动背景 */
.auth-view { position: relative; isolation: isolate; overflow: hidden; min-height: 100vh; min-height: 100svh; gap: clamp(48px, 8vw, 150px); padding: 64px max(24px, calc((100vw - 1200px)/2)); background: radial-gradient(ellipse at 18% 36%, #214c3b 0, transparent 48%), radial-gradient(ellipse at 90% 95%, #1b3e35 0, transparent 42%), #091b18; }
.auth-atmosphere { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background-image: linear-gradient(#b4ef9c08 1px, transparent 1px),linear-gradient(90deg,#b4ef9c08 1px,transparent 1px); background-size: 64px 64px; }
.auth-track { position: absolute; width: 115%; height: 115%; left: -20%; bottom: -33%; opacity: .6; }
.auth-orbit { position: absolute; width: 560px; height: 560px; top: -370px; right: -170px; border: 1px solid #adf47730; border-radius: 50%; box-shadow: 0 0 0 60px #adf47705,0 0 0 120px #adf47704; }
.auth-story { flex: 1; max-width: 620px; color: #eff8ed; }
.auth-eyebrow { display: flex; align-items: center; gap: 10px; color: #b4d2ba; font-size: 10px; letter-spacing: 2px; font-weight: 600; }
.auth-eyebrow > span { width: 7px; height: 7px; border-radius: 50%; background: #b9f477; box-shadow: 0 0 16px #b9f47780; }
.auth-story h2 { font-size: clamp(40px,4.4vw,66px); line-height: 1.25; letter-spacing: -2px; margin: 27px 0 22px; color: #f1f8ec; font-weight: 800; }
.auth-story h2 span { color: #c0f685; }
.auth-manifesto { color: #adc6b8; line-height: 1.9; font-size: 15px; margin: 0; }
.auth-training-art { max-width: 420px; margin: 28px 0 24px; }
.auth-training-art svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 0 22px #97e95f16); }
.auth-art-caption { display: block; color: #a4c29e; font-size: 11px; letter-spacing: 4px; text-align: center; }
.auth-pillars { display: flex; gap: 24px; padding-top: 20px; border-top: 1px solid #d3edc91f; color: #c2d3c8; font-size: 12px; }
.auth-pillars b { color: #9dbb91; font: 11px monospace; margin-right: 6px; }
.auth-view .auth-box { position: relative; flex: 0 0 400px; width: 400px; padding: 34px; margin: 0; border: 1px solid #ffffffb3; border-radius: 24px; box-shadow: 0 24px 90px #00000040; background: #fbfdf8; color: #23352d; --card:#fbfdf8; --ink:#23352d; --muted:#748272; --soft:#edf3e7; --line:#dce5d5; --accent:#658b46; --accent-2:#a9c98c; }
.auth-view .auth-logo { font-size: 40px; }
.auth-view .auth-box h1 { font-size: 25px; margin-top: 10px; }
.auth-view .auth-sub { font-size: 12px; margin: 6px 0 22px; }
.auth-view #auth-form input { background: #fff; color: #23352d; }
.auth-view #auth-submit { background: #305d43; color: #fff; min-height: 46px; }
.auth-view #auth-submit:hover { background: #244d35; }
@media (max-width: 850px) {
 .auth-view { flex-direction: column; align-items: center; gap: 28px; padding: 38px 20px; }
 .auth-story { flex: none; width: 100%; max-width: 400px; }
 .auth-story h2 { font-size: 38px; margin: 18px 0 12px; letter-spacing: -1px; }
 .auth-story h2 br { display: none; }
 .auth-manifesto { font-size: 13px; }
 .auth-training-art, .auth-pillars { display: none; }
 .auth-view .auth-box { flex: none; width: 400px; max-width: 100%; padding: 26px; }
 .auth-eyebrow { font-size: 9px; letter-spacing: 1.5px; }
 .auth-track { width: 200%; left: -70%; bottom: -15%; }
}
@media (max-width: 360px) { .auth-story h2 { font-size: 32px; } .auth-view { padding: 28px 16px; } .auth-view .auth-box { padding: 22px; } }

/* 顶栏 Logo 图标 */
.logo { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 17px; white-space: nowrap; letter-spacing: -0.3px; }
.logo .logo-ico { width: 22px; height: 22px; flex: none; }

/* 登录页 Logo 图标 */
.auth-logo svg { width: 44px; height: 44px; }

/* 邀请码分享链接按钮 */
.copy-link-btn {
  border: 1px solid var(--accent-2); background: var(--accent-soft); color: var(--accent);
  border-radius: 6px; padding: 3px 8px; cursor: pointer; font-size: 12px; white-space: nowrap;
  font-family: inherit;
}
.copy-link-btn:hover { background: var(--accent-2); color: #fff; }
