:root {
  --bg: #f6f7f4;
  --card: #ffffff;
  --ink: #1d2420;
  --muted: #6b746e;
  --line: #e4e7e1;
  --brand: #1f7a4d;
  --brand-2: #e8f4ec;
  --accent: #ff7a45;
  --accent-2: #fff1ea;
  --p: #2f6fdb;   /* 蛋白 */
  --c: #e0a106;   /* 碳水 */
  --f: #d0533f;   /* 脂肪 */
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: 26px; } h2 { font-size: 20px; } h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 16px; height: 56px; }
.logo { font-weight: 800; font-size: 19px; color: var(--ink); display: flex; align-items: center; letter-spacing: -.01em; }
.logo .mark { font-style: normal; margin-right: 6px; }
.logo:hover { text-decoration: none; }
.logo span { color: var(--brand); }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; }
.nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); white-space: nowrap; font-size: 14px; }
.nav a.on, .nav a:hover { background: var(--brand-2); color: var(--brand); text-decoration: none; }
main { padding: 20px 0 48px; }
footer { border-top: 1px solid var(--line); padding: 20px 0 32px; color: var(--muted); font-size: 12px; }

/* building blocks */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 10px 18px; font: inherit; font-weight: 600;
  background: var(--brand); color: #fff; cursor: pointer; text-decoration: none !important;
}
.btn:hover { filter: brightness(1.05); }
.btn.ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.light { background: var(--brand-2); color: var(--brand); }
.btn.accent { background: var(--accent); }
.btn.big { padding: 14px 26px; font-size: 17px; border-radius: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #eef0ec; color: var(--muted); }
.pill.vgn { background: #e3f4e4; color: #2c7a35; }
.pill.v { background: #eef6dc; color: #5b7a1d; }
.pill.nuts { background: #fbeee0; color: #a0571a; }
.pill.hp { background: #e5edfb; color: var(--p); }
.flash { background: var(--brand-2); color: var(--brand); padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.error { background: #fdecea; color: #b3261e; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px; font: inherit; background: #fff;
}
input:focus, select:focus { outline: none; border-color: var(--brand); }
label.f { display: block; font-weight: 600; margin: 12px 0 6px; font-size: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* hero */
.hero { padding: 36px 0 12px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; }
.hero h1 { font-size: 34px; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p.lead { font-size: 17px; color: #3b443e; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 28px 0; }
.step { background: #fff; border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.step b { display: block; font-size: 22px; }
.pains { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mock { background: #fff; border-radius: 18px; box-shadow: 0 10px 40px rgba(31,122,77,.15); padding: 16px; border: 1px solid var(--line); }

/* macro bars */
.macros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.macro { background: #f7f8f5; border-radius: 10px; padding: 8px 10px; }
.macro .k { font-size: 12px; color: var(--muted); }
.macro .v { font-weight: 700; font-size: 16px; }
.macro .v small { font-weight: 400; color: var(--muted); font-size: 12px; }
.bar { height: 5px; background: #e6e8e3; border-radius: 9px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 9px; }
.macro.p .bar i { background: var(--p); } .macro.c .bar i { background: var(--c); } .macro.f .bar i { background: var(--f); }

/* date tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; }
.tabs a { padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); white-space: nowrap; color: var(--ink); font-size: 14px; }
.tabs a.on { background: var(--ink); color: #fff; border-color: var(--ink); text-decoration: none; }

/* plans */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: start; }
.plan { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; border: 2px solid transparent; }
.plan.chosen { border-color: var(--brand); }
.plan-h { padding: 16px 16px 10px; }
.plan-h .t { font-weight: 800; font-size: 17px; }
.plan-h .badge { float: right; background: var(--brand); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.meal { border-top: 1px dashed var(--line); padding: 12px 16px; }
.meal-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.meal-h .m { font-weight: 700; }
.meal-h .dc { background: var(--accent-2); color: #b3501f; padding: 1px 8px; border-radius: 6px; font-weight: 700; font-size: 13px; }
.meal-h .kc { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.item { display: flex; gap: 10px; padding: 6px 0; align-items: flex-start; }
.item .qty { min-width: 42px; text-align: center; background: var(--brand-2); color: var(--brand); border-radius: 8px; font-weight: 800; padding: 2px 4px; font-size: 14px; }
.item .nm { flex: 1; min-width: 0; }
.item .zh { font-weight: 600; }
.item .en { font-size: 12px; color: var(--muted); }
.item .nut { font-size: 12px; color: var(--muted); white-space: nowrap; text-align: right; }
.item .nut b { color: var(--ink); }
.fbk { display: flex; gap: 4px; margin-top: 4px; }
.fbk button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 2px 8px; cursor: pointer; font-size: 13px; }
.fbk button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.plan-f { padding: 12px 16px 16px; background: #fafbf8; border-top: 1px solid var(--line); }
.why { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: #3b443e; }
.why li { margin: 2px 0; }

/* menu page */
.dcs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.dcol h3 { display: flex; justify-content: space-between; align-items: baseline; }
.station { margin: 12px 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.dish { padding: 7px 0; border-bottom: 1px solid #f0f1ee; }
.dish:last-child { border-bottom: 0; }
.dish .zh { font-weight: 600; }
.dish .en { font-size: 12px; color: var(--muted); }
.dish .nut { font-size: 12px; margin-top: 2px; }
.dish .nut span { margin-right: 8px; }
.dish.dim { opacity: .35; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 16px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; cursor: pointer; font: inherit; font-size: 14px; }
.chip.on { border-color: var(--brand); background: var(--brand-2); color: var(--brand); font-weight: 600; }

/* onboarding */
.ob { max-width: 640px; margin: 0 auto; }
.progress { height: 6px; background: #e6e8e3; border-radius: 9px; overflow: hidden; margin: 6px 0 24px; }
.progress i { display: block; height: 100%; background: var(--brand); transition: width .3s; }
.q h2 { font-size: 24px; margin-bottom: 4px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.opt { display: flex; gap: 12px; align-items: center; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; font: inherit; color: var(--ink); position: relative; }
.opt:hover { border-color: #b9d8c6; }
.opt.on { border-color: var(--brand); background: var(--brand-2); }
.opt .ic { font-size: 26px; }
.opt .l { font-weight: 700; }
.opt .d { font-size: 13px; color: var(--muted); }
.opt .rank { position: absolute; top: 8px; right: 10px; background: var(--brand); color: #fff; border-radius: 999px; width: 22px; height: 22px; font-size: 12px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.ob-nav { display: flex; gap: 10px; margin-top: 8px; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 8px 14px; font: inherit; cursor: pointer; }
.seg button.on { background: var(--brand); color: #fff; }
.toggle { display: flex; gap: 10px; align-items: center; margin: 8px 0; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--brand); }

/* targets */
.big-kcal { font-size: 54px; font-weight: 800; color: var(--brand); line-height: 1; }
.tgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.tbox { border-radius: 12px; padding: 14px; background: #f7f8f5; }
.tbox .n { font-size: 26px; font-weight: 800; }
.tbox.p .n { color: var(--p); } .tbox.c .n { color: var(--c); } .tbox.f .n { color: var(--f); }
.explain li { margin: 6px 0; }

/* progress */
.spark { width: 100%; height: 160px; }
.taglist { display: flex; flex-wrap: wrap; gap: 6px; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t td, table.t th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }

@media (max-width: 960px) {
  .plans, .dcs { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; }
  .pains { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .opts { grid-template-columns: 1fr; }
  .macros { grid-template-columns: repeat(2, 1fr); }
  .tgrid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 27px; }
  .nav a { padding: 6px 7px; }
  .logo .full { display: none; }
}
.plan.chosen { order: -1; }

/* ---------- 今日推荐：餐次 → 四个食堂 → 三个方案 ---------- */
.daybar { margin-bottom: 16px; }
.drinkbox { background: #eef6fb; border-radius: 12px; padding: 10px 14px; font-size: 14px; line-height: 1.8; min-width: 240px; }
.mealchips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.mchip { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer; }
.mchip.on { border-color: var(--brand); background: var(--brand-2); }
.mealtabs { display: flex; gap: 8px; margin: 4px 0 10px; }
.mtab { flex: 1; max-width: 180px; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 10px; font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.mtab small { font-weight: 400; color: var(--muted); font-size: 12px; }
.mtab.on { border-color: var(--ink); background: var(--ink); color: #fff; }
.mtab.on small { color: #cfd6d1; }
.dcgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: stretch; }
.dccard { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; cursor: pointer; border: 2px solid transparent; display: flex; flex-direction: column; gap: 6px; transition: transform .15s, box-shadow .15s; }
.dccard:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.dccard.picked { border-color: var(--brand); }
.dc-h { display: flex; align-items: center; gap: 6px; }
.dc-name { font-weight: 800; font-size: 17px; }
.badge-best { background: var(--brand); color: #fff; font-size: 12px; padding: 1px 8px; border-radius: 999px; }
.badge-rank { background: #eef0ec; color: var(--muted); font-size: 12px; padding: 1px 8px; border-radius: 999px; }
.macros.mini { grid-template-columns: 1fr 1fr; }
.dc-items { font-size: 14px; flex: 1; }
.dc-items div { padding: 2px 0; }
.dc-items .q { display: inline-block; min-width: 34px; color: var(--brand); font-weight: 800; }
.dc-f { display: flex; font-size: 13px; color: var(--brand); font-weight: 600; border-top: 1px dashed var(--line); padding-top: 8px; }
.warn { color: #a0571a !important; }

.overlay { position: fixed; inset: 0; background: rgba(20, 28, 24, .78); backdrop-filter: blur(4px); z-index: 50; display: flex; flex-direction: column; padding: 18px 16px; overflow-y: auto; }
.overlay[hidden] { display: none; }
.ov-head { display: flex; align-items: center; color: #fff; max-width: 1100px; width: 100%; margin: 0 auto 12px; }
.ov-head > div { flex: 1; }
.ov-title { font-size: 22px; font-weight: 800; }
.ov-close { background: rgba(255,255,255,.15); color: #fff; border: 0; width: 38px; height: 38px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.carousel { position: relative; display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 16px; align-items: start; max-width: 1100px; width: 100%; margin: 0 auto; }
.opt-card { background: #fff; border-radius: 16px; padding: 16px; transition: opacity .25s, transform .25s; border: 2px solid transparent; }
.opt-card.pos-left { grid-column: 1; grid-row: 1; opacity: .45; transform: scale(.92); cursor: pointer; }
.opt-card.pos-center { grid-column: 2; grid-row: 1; box-shadow: 0 16px 48px rgba(0,0,0,.25); }
.opt-card.pos-right { grid-column: 3; grid-row: 1; opacity: .45; transform: scale(.92); cursor: pointer; }
.opt-card.pos-left:hover, .opt-card.pos-right:hover { opacity: .7; }
.opt-card.chosen { border-color: var(--brand); }
.ov-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 14px; }
.ov-nav .btn.ghost { background: rgba(255,255,255,.9); }
#dots { display: flex; gap: 6px; }
#dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.4); }
#dots i.on { background: #fff; }

@media (max-width: 960px) {
  .dcgrid { grid-template-columns: 1fr 1fr; }
  .carousel { grid-template-columns: 12% 76% 12%; gap: 8px; overflow: hidden; }
  .opt-card.pos-left, .opt-card.pos-right { max-height: 70vh; overflow: hidden; }
  .opt-card.pos-left > *, .opt-card.pos-right > * { visibility: hidden; }  /* 手机上两边只露出卡片边缘 */
}
@media (max-width: 560px) {
  .dcgrid { grid-template-columns: 1fr; }
  .mtab { font-size: 15px; padding: 8px 4px; }
  .carousel { grid-template-columns: 7% 86% 7%; }
}

/* 问卷：目标解读页 & 👍👎 打分 */
.explain-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 22px; margin: 6px 0 18px; }
.explain-card h2 { font-size: 24px; }
.xp { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.xp b { font-size: 16px; }
.xp-ex { margin-top: 14px; background: var(--brand-2); border-radius: 12px; padding: 12px 14px; }
.xp-dish { display: flex; gap: 10px; justify-content: space-between; padding: 7px 0; border-top: 1px solid rgba(31,122,77,.12); }
.xp-dish:first-of-type { border-top: 0; }
.rates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.rate { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.rate.up { border-color: var(--brand); background: var(--brand-2); }
.rate.down { border-color: #e0b4a8; background: #fbf1ee; }
.rate .ic { font-size: 28px; }
.rate .l { font-weight: 700; }
.rate .d { font-size: 12px; color: var(--muted); }
.rate .rb { display: flex; gap: 8px; justify-content: center; margin-top: 8px; }
.rate .rb button { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--line); background: #f6f7f4; font-size: 18px; cursor: pointer; }
.rate .rb button.on { border-color: var(--ink); background: #fff; box-shadow: 0 0 0 2px var(--ink) inset; }
@media (max-width: 560px) { .rates { grid-template-columns: 1fr 1fr; } }

/* ---------- 聊天框 ---------- */
.chatbtn { position: fixed; right: 20px; bottom: 20px; z-index: 60; border: 0; border-radius: 999px; padding: 13px 20px; font: inherit; font-weight: 700; color: #fff; background: var(--ink); box-shadow: 0 8px 24px rgba(0,0,0,.2); cursor: pointer; }
.chatbtn:hover { transform: translateY(-1px); }
.chat { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; z-index: 70; background: #fff; box-shadow: -8px 0 32px rgba(0,0,0,.15); display: flex; flex-direction: column; }
.chat[hidden] { display: none; }
.chat-h { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.chat-h > div { flex: 1; }
.ov-close.dark { background: #eef0ec; color: var(--ink); }
.chat-log { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: #fafbf8; }
.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg .b { padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.6; }
.msg.bot { align-self: flex-start; }
.msg.bot .b { background: #fff; border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.user { align-self: flex-end; }
.msg.user .b { background: var(--brand); color: #fff; border-top-right-radius: 4px; }
.msg .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.msg .acts .chip, .chat-sugg .chip { font-size: 13px; padding: 4px 10px; }
.chat-sugg { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px 0; }
.chat-sugg .chip { white-space: nowrap; }
.chat-in { display: flex; gap: 8px; padding: 12px 16px 16px; }
.chat-in input { flex: 1; }
.adjust { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.adjust:empty { display: none; }
.linkbtn { border: 0; background: none; color: var(--brand); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
body.chat-open main .wrap { padding-right: 396px; }
body.chat-open .overlay { right: 380px; }
@media (max-width: 960px) {
  .chat { top: auto; left: 0; width: auto; height: 72vh; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 32px rgba(0,0,0,.2); }
  body.chat-open main .wrap { padding-right: 16px; }
  body.chat-open .overlay { right: 0; bottom: 72vh; }
  .chatbtn { right: 14px; bottom: 14px; }
}

/* ---------- AI 分析报告 ---------- */
.ai-report { margin: 18px 0; padding: 18px; border-radius: 14px; background: linear-gradient(135deg, #eef7f1, #f3f0fb); border: 1px solid #dbe8df; }
.ai-h { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ai-badge { background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.ai-headline { font-size: 18px; font-weight: 800; margin: 6px 0 12px; }
.ai-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ai-card { background: #fff; border-radius: 12px; padding: 12px; }
.ai-card p { margin: 4px 0 0; font-size: 14px; color: #3b443e; }
.ai-report h4 { margin: 16px 0 6px; }
.ai-list { margin: 0; padding-left: 20px; font-size: 14px; }
.ai-list li { margin: 6px 0; }
.ai-loading { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 4px; }
.ai-loading span { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: aib 1s infinite; }
.ai-loading span:nth-child(2) { animation-delay: .15s; } .ai-loading span:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes aib { 0%, 100% { opacity: .2 } 50% { opacity: 1 } }
@media (max-width: 560px) { .ai-grid { grid-template-columns: 1fr; } }

/* ---------- 账号 / 法律页面 ---------- */
.verify-bar { background: #fff6e0; border: 1px solid #f1dfae; color: #6b5214; padding: 10px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.legal { max-width: 820px; margin: 0 auto; line-height: 1.8; }
.legal h2 { font-size: 18px; margin: 26px 0 8px; }
.legal li { margin: 6px 0; }
.legal table.t td, .legal table.t th { vertical-align: top; font-size: 14px; }
footer a { color: var(--muted); text-decoration: underline; }
.danger { border: 1.5px solid #f0c9c2; }
.btn.danger-btn { background: #c0392b; }
