/* ========== 基础重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* 手机版基准：1rem = 屏宽的 13.333%（375px 时恰为 50px）；电脑宽屏时锁定 50px，页面按手机比例居中 */
/* var(--font-scale)：左右滑动手势调节的整体字号倍率，默认 1（见 main.js 末尾） */
html { font-size: calc(min(13.333333vw, 50px) * var(--font-scale, 1)); -webkit-text-size-adjust: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif; background: #f4f1ea; color: #2c3e2d; line-height: 1.5; min-height: 100vh; overflow-x: hidden; }
:root {
  --primary: #4a7c4e;
  --primary-light: #6ba06f;
  --primary-dark: #2d5a3d;
  --accent: #e8a847;
  --accent-light: #f4c373;
  --bg-card: #ffffff;
  --bg-soft: #f9f6ef;
  --text-main: #2c3e2d;
  --text-sub: #6b7c6d;
  --text-muted: #9aa89c;
  --border: #e6e0d3;
  --shadow: 0 2px 12px rgba(74, 124, 78, 0.08);
  --shadow-lg: 0 4px 20px rgba(74, 124, 78, 0.12);
}

/* ========== 整体容器 ========== */
.app { max-width: 750px; margin: 0 auto; background: var(--bg-soft); min-height: 100vh; position: relative; padding-bottom: 0.4rem; }

/* ========== 顶部 Banner ========== */
.hero {
  position: relative;
  padding: 0.6rem 0.4rem 1.2rem;
  background: linear-gradient(160deg, #4a7c4e 0%, #6ba06f 60%, #8bb88f 100%);
  color: #fff;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; top: -2rem; right: -2rem;
  width: 8rem; height: 8rem;
  background: radial-gradient(circle, rgba(255,255,255,0.18) 0%, transparent 70%);
  border-radius: 50%;
}
.hero::after {
  content: '';
  position: absolute; bottom: -3rem; left: -1rem;
  width: 6rem; height: 6rem;
  background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-decor {
  position: absolute; top: 0.3rem; right: 0.3rem; font-size: 0.7rem; opacity: 0.18;
  letter-spacing: 0.1rem;
}
.hero-title {
  position: relative; z-index: 2;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.04rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
  margin-bottom: 0.16rem;
}
.hero-subtitle {
  position: relative; z-index: 2;
  font-size: 0.24rem; opacity: 0.95; font-weight: 300;
  margin-bottom: 0.4rem;
}

/* ========== 通用内容区 ========== */
.section { padding: 0.32rem 0.3rem 0; }
.section-title {
  display: flex; align-items: center; gap: 0.16rem;
  font-size: 0.34rem; font-weight: 700; color: var(--text-main);
  margin-bottom: 0.24rem; padding: 0 0.04rem;
}
.section-title::before {
  content: ''; width: 0.08rem; height: 0.32rem;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 0.04rem;
}
/* ========== 卡片 ========== */
.card {
  background: var(--bg-card); border-radius: 0.28rem;
  padding: 0.32rem 0.28rem; margin-bottom: 0.24rem;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.card-title {
  font-size: 0.3rem; font-weight: 700; color: var(--text-main);
  margin-bottom: 0.2rem; display: flex; align-items: center; justify-content: space-between;
}
.card-title .tag {
  font-size: 0.2rem; padding: 0.04rem 0.16rem;
  background: rgba(74,124,78,0.1); color: var(--primary);
  border-radius: 0.2rem; font-weight: 500;
}

/* ========== 总计卡 ========== */
.total-card {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 70%, var(--primary-light) 100%);
  color: #fff; border-radius: 0.28rem; padding: 0.32rem 0.32rem 0.28rem;
  margin-bottom: 0.24rem; box-shadow: 0 0.12rem 0.3rem rgba(45,90,61,0.28);
}
.total-label { font-size: 0.22rem; opacity: 0.88; letter-spacing: 0.02rem; }
.total-row { display: flex; align-items: baseline; gap: 0.16rem; flex-wrap: wrap; margin-top: 0.08rem; }
.total-kg { font-size: 0.68rem; font-weight: 800; line-height: 1.1; }
.total-unit { font-size: 0.26rem; opacity: 0.92; }
.total-jin { font-size: 0.26rem; font-weight: 600; opacity: 0.95; }
.total-eq { font-size: 0.22rem; opacity: 0.9; margin-top: 0.16rem; }
.total-month { font-size: 0.22rem; opacity: 0.9; margin-top: 0.06rem; }
/* 配比不满 100% 时的说明（浅色胶囊，不抢主数字） */
.total-gap {
  display: block; margin-top: 0.16rem;
  background: rgba(255,255,255,0.18); border-radius: 0.14rem;
  padding: 0.12rem 0.18rem; font-size: 0.22rem; line-height: 1.6;
}
.total-gap:empty { display: none; }

/* 清单 */
.list-note { font-size: 0.2rem; color: var(--text-muted); margin-bottom: 0.08rem; }
.list-total {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 2px solid var(--border); margin-top: 0.1rem; padding-top: 0.18rem;
  font-size: 0.26rem; font-weight: 800; color: var(--primary-dark);
}
.list-total small { font-weight: 400; font-size: 0.2rem; color: var(--text-sub); }

/* ========== 营养浓度 ========== */
.nutrition-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.16rem; }
.nutrition-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.18rem 0.22rem; background: var(--bg-soft);
  border-radius: 0.16rem; font-size: 0.24rem;
}
.nutrition-item .name { color: var(--text-sub); }
.nutrition-item .value { color: var(--primary-dark); font-weight: 700; }
.nutrition-item .value small { font-size: 0.18rem; color: var(--text-muted); font-weight: 400; margin-left: 0.04rem; }

/* ========== 原料库 ========== */

/* ========== 通用工具 ========== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(0.1rem); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.4s ease; }

/* ========== 底部信息 ========== */
.footer {
  text-align: center; padding: 0.4rem 0.2rem 0.2rem;
  font-size: 0.2rem; color: var(--text-muted);
}
.footer .brand { color: var(--primary); font-weight: 600; }

/* ========== 页面最下方：字号调整 + 回到顶部 ========== */
.bottom-tools {
  display: flex; flex-direction: column; gap: 0.16rem;
  padding: 0.2rem 0.3rem 0.3rem;
}
.font-slider {
  display: flex; flex-direction: column; align-items: stretch; gap: 0.12rem;
  background: #fff; border: 1px solid var(--border); border-radius: 0.24rem;
  padding: 0.24rem 0.24rem; box-shadow: var(--shadow);
}
.fs-row { display: flex; align-items: center; gap: 0.12rem; }
.fs-row.fs-chips { gap: 0.1rem; }
.font-slider .fs-label { font-size: 0.22rem; font-weight: 700; color: var(--text-sub); white-space: nowrap; }
.font-slider .fs-unit { font-size: 0.22rem; font-weight: 700; color: var(--text-sub); }
#fontInput {
  width: 1.3rem; text-align: center;
  font-size: 0.26rem; font-weight: 800; color: var(--primary-dark);
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 0.12rem;
  padding: 0.1rem 0.08rem; outline: none;
  -moz-appearance: textfield; appearance: textfield;
}
#fontInput::-webkit-outer-spin-button,
#fontInput::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#fontInput:focus { border-color: var(--primary); background: #fff; }
.fs-chip {
  flex: 1; border: 1px solid var(--border); background: #fff;
  color: var(--text-sub); border-radius: 0.3rem;
  padding: 0.14rem 0.16rem; font-size: 0.22rem; font-weight: 600;
  font-family: inherit; cursor: pointer; text-align: center;
  transition: all 0.15s;
}
.fs-chip:active { transform: scale(0.97); }
.fs-chip.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 0.04rem 0.12rem rgba(74,124,78,0.35);
}
.back-top {
  width: 100%; border: 1px solid var(--border); background: #fff;
  color: var(--text-sub); border-radius: 0.2rem; padding: 0.2rem;
  font-size: 0.24rem; font-family: inherit; cursor: pointer;
}
.back-top:active { background: var(--bg-soft); }

/* ========== 弹窗 ========== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 200; display: none; align-items: flex-end; justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--bg-soft); width: 100%; max-width: 750px;
  border-radius: 0.32rem 0.32rem 0 0; padding: 0.4rem 0.3rem 0.5rem;
  max-height: 80vh; overflow-y: auto; animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 0.8rem; height: 0.08rem; background: var(--border); border-radius: 0.04rem; margin: 0 auto 0.24rem; }
.modal-title { font-size: 0.34rem; font-weight: 700; text-align: center; margin-bottom: 0.24rem; }

/* ========== 阶段选择器 ========== */
.stage-picker {
  display: flex; flex-wrap: wrap; gap: 0.16rem; margin-bottom: 0.2rem;
}
.stage-chip {
  flex: 1 1 calc(33% - 0.16rem); min-width: calc(33% - 0.16rem);
  background: #fff; border: 1px solid var(--border); border-radius: 0.2rem;
  padding: 0.2rem 0.12rem; text-align: center; transition: all 0.2s;
}
.stage-chip:active { transform: scale(0.96); }
.stage-chip.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-color: var(--primary); box-shadow: var(--shadow-lg);
}
.stage-chip .stage-name { display: block; font-size: 0.26rem; font-weight: 700; color: var(--text-main); }
.stage-chip .stage-sub { display: block; font-size: 0.18rem; color: var(--text-muted); margin-top: 0.04rem; }
.stage-chip.active .stage-name { color: #fff; }
.stage-chip.active .stage-sub { color: rgba(255,255,255,0.85); }

/* ========== 提示条 ========== */
.hint-bar {
  background: rgba(74,124,78,0.08); border: 1px dashed rgba(74,124,78,0.35);
  border-radius: 0.16rem; padding: 0.18rem 0.22rem;
  font-size: 0.22rem; color: var(--primary-dark); line-height: 1.7;
}
.hint-bar b { color: var(--primary-dark); }
.hint-bar.small { margin-bottom: 0.2rem; font-size: 0.2rem; color: var(--text-sub); }

/* ========== 要点列表 ========== */
.tips-list {
  list-style: none; font-size: 0.24rem; color: var(--text-main); line-height: 1.7;
}
.tips-list li { position: relative; padding: 0.08rem 0 0.08rem 0.36rem; }
.tips-list li::before {
  content: '✅'; position: absolute; left: 0; top: 0.08rem; font-size: 0.22rem;
}
.tips-list li:nth-child(even)::before { content: '🌿'; }
.tips-list li b { color: var(--primary-dark); }
ol.tips-list { counter-reset: tip; }
ol.tips-list li::before {
  content: counter(tip); counter-increment: tip;
  width: 0.26rem; height: 0.26rem; background: var(--primary); color: #fff;
  border-radius: 50%; font-size: 0.18rem; display: flex; align-items: center; justify-content: center;
  top: 0.14rem;
}

.card-note {
  margin-top: 0.16rem; font-size: 0.2rem; color: var(--text-muted); line-height: 1.7;
}
.card-note b { color: var(--text-sub); }

/* ========== 原料库 ========== */
.ing-left { display: flex; align-items: center; gap: 0.16rem; }
.ing-dot { width: 0.14rem; height: 0.14rem; border-radius: 50%; flex-shrink: 0; }
.ing-dot.rough { background: var(--primary); }
.ing-dot.conc { background: var(--accent); }
.ing-dot.premix { background: #8b7bb8; }

/* ========== 结果分组明细 ========== */
.detail-group {
  background: var(--bg-soft); border-radius: 0.16rem; padding: 0.18rem 0.2rem; margin-bottom: 0.16rem;
}
.detail-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.24rem; font-weight: 700; color: var(--primary-dark);
  padding-bottom: 0.1rem; margin-bottom: 0.06rem;
  border-bottom: 1px dashed var(--border);
}
.detail-head span:first-child { display: inline-flex; align-items: center; gap: 0.1rem; }

/* ========== 简化版单页 ========== */
.hero.slim { padding: 0.44rem 0.4rem 0.5rem; }
.hero.slim .hero-title { font-size: 0.44rem; margin-bottom: 0.1rem; }
.hero.slim .hero-subtitle { font-size: 0.24rem; margin-bottom: 0; }
.title-note { font-size: 0.2rem; font-weight: 400; color: var(--text-muted); margin-left: 0.08rem; }

/* 输入 */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.2rem; margin-bottom: 0.2rem; }
.field label { display: block; font-size: 0.22rem; color: var(--text-sub); margin-bottom: 0.08rem; }
.field-box {
  display: flex; align-items: center; gap: 0.12rem;
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 0.16rem; padding: 0.14rem 0.2rem;
}
.field-box input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  font-size: 0.3rem; font-weight: 700; color: var(--primary-dark);
}
.field-box .unit { font-size: 0.22rem; color: var(--text-muted); flex-shrink: 0; }
/* 单位换算提示 */
.unit-hint {
  font-size: 0.2rem; color: var(--primary-dark); font-weight: 600;
  background: rgba(74,124,78,0.08); border-radius: 0.12rem;
  padding: 0.1rem 0.18rem; margin: -0.06rem 0 0.18rem;
}
.dmi-edit { margin-top: 0.16rem; }
.intake-line {
  display: flex; align-items: center; gap: 0.16rem;
  background: rgba(74,124,78,0.06); border-radius: 0.16rem;
  padding: 0.16rem 0.2rem; font-size: 0.24rem; color: var(--text-main);
}
.intake-line .intake-val { font-weight: 800; color: var(--primary-dark); font-size: 0.28rem; }
.intake-line span:first-child { flex: 1; }

.mini-btn {
  border: 1px solid var(--border); background: #fff; color: var(--text-sub);
  border-radius: 0.4rem; padding: 0.1rem 0.24rem; font-size: 0.22rem;
  transition: all 0.15s; white-space: nowrap;
}
.mini-btn:active { transform: scale(0.95); }
.mini-btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-row { display: flex; align-items: center; gap: 0.16rem; margin-bottom: 0.24rem; }
.pick-count { font-size: 0.22rem; color: var(--text-muted); margin-left: auto; }

/* 母羊阶段/羔数选项行（国标查表） */
.opt-row { display: flex; align-items: center; gap: 0.14rem; margin-bottom: 0.14rem; flex-wrap: wrap; }
.opt-label { font-size: 0.22rem; color: var(--text-sub); min-width: 1.2rem; }
.opt-chip {
  border: 1.5px solid var(--border); background: #fff; border-radius: 0.3rem;
  padding: 0.1rem 0.28rem; font-size: 0.24rem; color: var(--text-main);
}
.opt-chip.active {
  border-color: #4a7c4e; background: rgba(74,124,78,0.1);
  color: #3b6640; font-weight: 700;
}

/* 选料处的即时提醒 */
.pick-hint { font-size: 0.21rem; line-height: 1.6; color: var(--text-muted); margin-bottom: 0.14rem; }
.pick-hint:empty { display: none; }
.pick-hint.warn {
  color: #9a6b1f; background: rgba(232,168,71,0.12);
  border-radius: 0.12rem; padding: 0.1rem 0.16rem;
}

/* 原料选择（折叠下拉） */
.picker-group {
  background: #fff; border: 1px solid var(--border); border-radius: 0.2rem;
  margin-bottom: 0.14rem; overflow: hidden;
}
.picker-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  gap: 0.12rem; background: transparent; border: none;
  padding: 0.24rem 0.24rem; font-size: 0.26rem; font-weight: 700; color: var(--text-main);
  text-align: left;
}
.picker-head:active { background: var(--bg-soft); }
.ph-left { display: flex; flex-direction: column; gap: 0.04rem; min-width: 0; }
.ph-name { font-size: 0.26rem; font-weight: 700; color: var(--text-main); }
.ph-desc { font-size: 0.18rem; font-weight: 400; color: var(--text-muted); }
.ph-total { font-size: 0.2rem; }
.ph-right { display: inline-flex; align-items: center; gap: 0.12rem; font-size: 0.2rem; font-weight: 400; color: var(--text-muted); white-space: nowrap; }
.ph-picked { color: var(--primary-dark); font-weight: 700; background: rgba(74,124,78,0.12); border-radius: 0.2rem; padding: 0.03rem 0.14rem; }
.chev { display: inline-block; transition: transform 0.2s; color: var(--text-muted); }
.picker-group.open .chev { transform: rotate(180deg); }
.picker-body { display: none; padding: 0 0.2rem 0.2rem; }
.picker-group.open .picker-body { display: block; }
.picker-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.12rem; }
.pick-item {
  background: #fff; border: 1.5px solid var(--border); border-radius: 0.18rem;
  padding: 0.16rem 0.18rem; text-align: left; transition: all 0.15s;
}
.pick-item:active { transform: scale(0.97); }
.pick-item .pick-name { display: block; font-size: 0.24rem; font-weight: 600; color: var(--text-main); }
.pick-item .pick-unused { display: block; font-size: 0.18rem; color: var(--text-muted); margin-top: 0.04rem; }
.pick-item.on { border-color: var(--primary); background: rgba(74,124,78,0.07); }
.pick-item.on .pick-name::after { content: ' ✓'; color: var(--primary); font-weight: 800; }
.pick-item.off .pick-name, .pick-item.off .pick-unused { color: var(--text-muted); }

/* ========== 确定按钮 ========== */
.confirm-wrap { padding: 0.2rem 0.3rem 0.1rem; }
.confirm-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.16rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff; border: none; border-radius: 0.24rem;
  padding: 0.28rem 0.32rem; box-shadow: 0 0.1rem 0.24rem rgba(74,124,78,0.26);
  transition: transform 0.15s, box-shadow 0.2s;
}
.confirm-btn:active { transform: scale(0.98); }
.confirm-btn .confirm-main { font-size: 0.3rem; font-weight: 800; white-space: nowrap; }
.confirm-btn .confirm-sub { font-size: 0.22rem; opacity: 0.92; }
.confirm-btn.dirty { animation: btnPulse 1.8s ease-in-out infinite; }
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0.1rem 0.24rem rgba(74,124,78,0.26); }
  50% { box-shadow: 0 0.1rem 0.4rem rgba(74,124,78,0.55); }
}
.confirm-tip {
  max-height: 0; overflow: hidden; opacity: 0;
  font-size: 0.22rem; color: #9a6b1f; line-height: 1.7;
  background: rgba(232,168,71,0.16); border-radius: 0.16rem;
  margin-top: 0; transition: all 0.2s;
}
.confirm-tip.show { max-height: 3rem; opacity: 1; padding: 0.16rem 0.2rem; margin-top: 0.16rem; }

/* 结果区 */
.result-section { scroll-margin-top: 0.2rem; }
.dirty-bar {
  background: rgba(232,168,71,0.16); border: 1px dashed rgba(232,168,71,0.6);
  color: #9a6b1f; font-size: 0.22rem; text-align: center;
  border-radius: 0.16rem; padding: 0.16rem 0.2rem; margin-bottom: 0.22rem;
}

/* 警告 */
.warn-box {
  background: rgba(232,168,71,0.12); border: 1px dashed rgba(232,168,71,0.5);
  border-radius: 0.16rem; padding: 0.18rem 0.22rem; margin-bottom: 0.24rem;
  font-size: 0.22rem; color: #9a6b1f; line-height: 1.8;
}

/* 每天喂几次 + 每次饲喂量 */
.feed-row { margin-top: 0.16rem; }
.feed-row .opt-label { color: rgba(255,255,255,0.85); }
.total-per {
  display: block; margin-top: 0.16rem;
  font-size: 0.3rem; font-weight: 700; color: #fff;
  background: rgba(255,255,255,0.18); border-radius: 0.16rem;
  padding: 0.16rem 0.2rem; line-height: 1.5;
}
.total-per:empty { display: none; }
.mix-feed { display: block; font-size: 0.2rem; color: var(--text-muted); }

/* 模式切换 */
.mode-row { display: flex; align-items: center; gap: 0.16rem; margin-bottom: 0.2rem; }
.mode-label { font-size: 0.24rem; color: var(--text-sub); }
.mode-tabs { display: flex; background: var(--bg-soft); border-radius: 0.3rem; padding: 0.05rem; }
.mode-tab {
  border: none; background: transparent; padding: 0.1rem 0.24rem;
  font-size: 0.22rem; color: var(--text-sub); border-radius: 0.3rem;
}
.mode-tab.active { background: var(--primary); color: #fff; font-weight: 600; }
.sum-badge {
  margin-left: auto; font-size: 0.22rem; font-weight: 700; color: var(--primary-dark);
  background: rgba(74,124,78,0.1); border-radius: 0.3rem; padding: 0.08rem 0.2rem;
}
.sum-badge.bad { color: #b3560f; background: rgba(232,168,71,0.2); }

/* 结果明细 */
.mix-item {
  display: flex; justify-content: space-between; align-items: center; gap: 0.16rem;
  padding: 0.14rem 0; border-bottom: 1px dashed var(--border);
}
.mix-item:last-child { border-bottom: none; }
.mix-left { flex: 1; min-width: 0; }
.mix-name { font-size: 0.24rem; font-weight: 600; color: var(--text-main); }
.mix-range { font-size: 0.18rem; color: var(--text-muted); margin: 0.02rem 0 0.06rem; }
.mix-right { text-align: right; flex-shrink: 0; }
.mix-pct { display: inline-block; font-size: 0.2rem; font-weight: 700; color: var(--primary-dark); background: rgba(74,124,78,0.1); border-radius: 0.16rem; padding: 0.02rem 0.12rem; }
.mix-kg { display: block; font-size: 0.26rem; color: var(--text-main); font-weight: 800; margin-top: 0.04rem; }
.zero { color: var(--text-muted); font-size: 0.2rem; font-weight: 400; }
.mix-edit input {
  width: 1.3rem; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 0.12rem; padding: 0.08rem 0.12rem; font-size: 0.24rem;
  text-align: right; color: var(--text-main); outline: none;
}
.mix-edit.err input { border-color: #d9822b; background: rgba(232,168,71,0.12); color: #9a6b1f; }
.mix-edit.err::after { content: ' 超出建议区间'; font-size: 0.18rem; color: #9a6b1f; }

/* 参考折叠（旧版残留选择器已失效，直接移除，避免 CSS 解析吞掉后面的规则） */

/* ==================================================================
   会员 / 多羊群 / 营养校验（v7 新增）
   ================================================================== */

/* ---------- 会员状态条 ---------- */
.member-bar {
  display: flex; align-items: center; gap: 0.12rem;
  margin: 0.2rem 0.3rem 0;
  padding: 0.13rem 0.18rem;
  border-radius: 0.16rem;
  background: #fff; border: 1px solid var(--border);
  box-shadow: var(--shadow);
  /* 字号跟页面其他说明文字一致（自适应 rem），别做得比正文还醒目 */
  font-size: 0.21rem; line-height: 1.5; color: var(--text-sub);
}
.member-bar[hidden] { display: none; }
.member-bar .mb-dot {
  width: 0.14rem; height: 0.14rem; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-light);
}
.member-bar.trial { background: rgba(232,168,71,0.1); border-color: rgba(232,168,71,0.45); }
.member-bar.trial .mb-dot { background: var(--accent); }
.member-bar.expired, .member-bar.disabled { background: rgba(196,90,60,0.08); border-color: rgba(196,90,60,0.35); }
.member-bar.expired .mb-dot, .member-bar.disabled .mb-dot { background: #c45a3c; }
.member-bar .mb-text { flex: 1; min-width: 0; line-height: 1.5; }
.member-bar .mb-text b { color: var(--text-main); font-weight: 600; }
.member-bar .mb-btn {
  border: 1px solid var(--primary); background: var(--primary); color: #fff;
  border-radius: 0.24rem; padding: 0.07rem 0.18rem; font-size: 0.2rem; font-weight: 600;
  font-family: inherit; white-space: nowrap;
}
.member-bar.trial .mb-btn, .member-bar.expired .mb-btn, .member-bar.disabled .mb-btn {
  background: var(--accent); border-color: var(--accent);
}

/* ---------- 羊群卡片 ---------- */
.group-card {
  background: #fff; border-radius: 0.28rem; padding: 0.26rem 0.24rem 0.28rem;
  margin-bottom: 0.22rem; box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.group-head {
  display: flex; align-items: center; gap: 0.14rem; margin-bottom: 0.2rem;
}
.group-no {
  font-size: 0.2rem; font-weight: 700; color: #fff;
  background: var(--primary); border-radius: 0.2rem; padding: 0.04rem 0.16rem;
}
.group-stage-name { font-size: 0.26rem; font-weight: 700; color: var(--text-main); flex: 1; }
.group-del {
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  border: 1px solid var(--border); background: #fff; color: var(--text-muted);
  font-size: 0.24rem; line-height: 1; font-family: inherit;
}
.group-del:active { background: var(--bg-soft); }
.group-card .stage-picker { gap: 0.12rem; margin-bottom: 0.16rem; }
.group-card .stage-chip { padding: 0.16rem 0.08rem; border-radius: 0.16rem; }
.group-card .stage-chip .stage-name { font-size: 0.23rem; }
.group-card .stage-chip .stage-sub { font-size: 0.16rem; }
.group-card .opt-row { margin-bottom: 0.12rem; }
.group-card .opt-row .opt-label { font-size: 0.2rem; min-width: 1.0rem; }
.group-card .opt-chip { padding: 0.08rem 0.2rem; font-size: 0.21rem; }
.opt-chip.fixed { border-style: dashed; color: var(--primary-dark); background: rgba(74,124,78,0.07); }
.add-group-btn {
  width: 100%; border: 1.5px dashed rgba(74,124,78,0.45); background: rgba(74,124,78,0.05);
  color: var(--primary-dark); border-radius: 0.2rem; padding: 0.22rem;
  font-size: 0.24rem; font-family: inherit; font-weight: 600;
}
.add-group-btn:active { background: rgba(74,124,78,0.1); }
.intake-src { font-size: 0.18rem; color: var(--text-muted); }

/* ---------- 原料营养小字 ---------- */
.pick-nut, .mix-nut {
  display: block; font-size: 0.17rem; line-height: 1.5;
  color: var(--text-muted); margin-top: 0.06rem; font-weight: 400;
}
.pick-item.on .pick-nut { color: var(--primary-dark); opacity: 0.8; }
.mix-nut { font-size: 0.18rem; }

/* ---------- 分群小计 ---------- */
.gsum-row {
  display: flex; justify-content: space-between; align-items: center; gap: 0.16rem;
  padding: 0.16rem 0; border-bottom: 1px dashed var(--border);
}
.gsum-left { min-width: 0; }
.gsum-left b { display: block; font-size: 0.24rem; color: var(--text-main); }
.gsum-left span { display: block; font-size: 0.19rem; color: var(--text-muted); margin-top: 0.04rem; }
.gsum-right { text-align: right; flex-shrink: 0; }
.gsum-right b { display: block; font-size: 0.26rem; color: var(--primary-dark); }
.gsum-right span { display: block; font-size: 0.18rem; color: var(--text-sub); }
.gsum-total {
  display: flex; justify-content: space-between; align-items: center; gap: 0.12rem;
  margin-top: 0.14rem; padding-top: 0.16rem; border-top: 2px solid var(--border);
  font-size: 0.22rem; color: var(--text-sub);
}
.gsum-total b { font-size: 0.24rem; color: var(--primary-dark); text-align: right; }

/* 分群明细（点行展开） */
.gsum-item { border-bottom: 1px dashed var(--border); }
.gsum-item .gsum-row { border-bottom: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.gsum-row .gsum-left b::after { content: ' ▾'; font-size: 0.18rem; font-weight: 400; color: var(--text-muted); }
.gsum-row.open .gsum-left b::after { content: ' ▴'; }
.gsum-detail { padding: 0.04rem 0 0.16rem; }
.gd-head { font-size: 0.19rem; color: var(--text-sub); margin-bottom: 0.1rem; }
.gd-cols, .gd-line { display: grid; grid-template-columns: 1.5fr 0.9fr 0.9fr; gap: 0.1rem; align-items: baseline; }
.gd-cols { font-size: 0.16rem; color: var(--text-muted); padding-bottom: 0.06rem; border-bottom: 1px solid var(--border); }
.gd-line { font-size: 0.2rem; padding: 0.09rem 0; border-bottom: 1px dashed var(--border); }
.gd-name { color: var(--text-main); font-weight: 600; }
.gd-name small { display: block; font-size: 0.16rem; color: var(--text-muted); font-weight: 400; }
.gd-val { color: var(--text-sub); text-align: right; }
.gd-kg { color: var(--primary-dark); font-weight: 700; text-align: right; }
.gd-total { display: flex; justify-content: space-between; gap: 0.12rem; margin-top: 0.12rem; font-size: 0.2rem; color: var(--text-sub); }
.gd-total b { color: var(--primary-dark); }

/* ---------- 营养校验 ---------- */
.nut-row {
  border: 1px solid var(--border); border-radius: 0.18rem;
  padding: 0.18rem 0.2rem; margin-bottom: 0.16rem; background: var(--bg-soft);
}
.nut-row.has-warn { border-color: rgba(232,168,71,0.55); background: rgba(232,168,71,0.06); }
.nut-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.12rem; }
.nut-head b { font-size: 0.23rem; color: var(--text-main); }
.nut-flag { font-size: 0.18rem; color: var(--primary); font-weight: 700; }
.nut-flag.warn { color: #b3560f; }
.nut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.1rem; }
.nut-cell {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "k v" "r j";
  gap: 0.02rem 0.08rem;
  background: #fff; border: 1px solid var(--border); border-radius: 0.14rem;
  padding: 0.1rem 0.14rem; font-size: 0.19rem;
}
.nut-k { grid-area: k; color: var(--text-sub); }
.nut-v { grid-area: v; font-weight: 800; color: var(--primary-dark); font-size: 0.22rem; text-align: right; }
.nut-r { grid-area: r; color: var(--text-muted); font-size: 0.16rem; }
.nut-j { grid-area: j; font-size: 0.16rem; text-align: right; color: var(--primary); }
.nut-cell.low .nut-v, .nut-cell.high .nut-v { color: #b3560f; }
.nut-cell.low .nut-j, .nut-cell.high .nut-j { color: #b3560f; }

/* ---------- 底部抽屉（登录 / 个人中心 / 开通） ---------- */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 300; display: none; align-items: flex-end; justify-content: center;
}
.sheet-mask.show { display: flex; }
.sheet {
  width: 100%; max-width: 750px; background: var(--bg-soft);
  border-radius: 0.32rem 0.32rem 0 0;
  padding: 0.36rem 0.34rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
  max-height: 86vh; overflow-y: auto;
  animation: slideUp 0.28s ease;
}
.sheet-handle { width: 0.8rem; height: 0.08rem; background: var(--border); border-radius: 0.04rem; margin: 0 auto 0.24rem; }
.sheet-title { font-size: 0.34rem; font-weight: 800; color: var(--text-main); text-align: center; margin-bottom: 0.1rem; }
.sheet-sub { font-size: 0.21rem; color: var(--text-sub); text-align: center; line-height: 1.7; margin-bottom: 0.28rem; }
.sheet-close {
  display: block; width: 100%; margin-top: 0.2rem; padding: 0.2rem;
  border: none; background: transparent; color: var(--text-muted);
  font-size: 0.22rem; font-family: inherit;
}
.auth-field {
  display: flex; align-items: center; gap: 0.12rem;
  background: #fff; border: 1px solid var(--border); border-radius: 0.18rem;
  padding: 0.18rem 0.22rem; margin-bottom: 0.18rem;
}
.auth-field input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  font-size: 0.32rem; font-weight: 700; color: var(--primary-dark); letter-spacing: 0.02rem;
}
.auth-btn {
  width: 100%; border: none; border-radius: 0.2rem; padding: 0.24rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff; font-size: 0.28rem; font-weight: 800; font-family: inherit;
  box-shadow: 0 0.08rem 0.2rem rgba(74,124,78,0.28);
}
.auth-btn:active { transform: scale(0.99); }
.auth-btn.ghost { background: #fff; color: var(--text-sub); border: 1px solid var(--border); box-shadow: none; font-weight: 600; }
.auth-hint { font-size: 0.19rem; color: var(--text-muted); line-height: 1.7; margin-top: 0.16rem; text-align: center; }
.auth-err { font-size: 0.2rem; color: #c45a3c; text-align: center; margin-bottom: 0.14rem; min-height: 0.2rem; }

/* 开通弹层：价格 + 收款码 */
.pay-price {
  display: flex; align-items: baseline; justify-content: center; gap: 0.1rem;
  margin-bottom: 0.2rem;
}
.pay-price b { font-size: 0.66rem; font-weight: 800; color: var(--primary-dark); }
.pay-price span { font-size: 0.22rem; color: var(--text-sub); }
.pay-qr-box {
  background: #fff; border: 1px solid var(--border); border-radius: 0.2rem;
  padding: 0.24rem; text-align: center; margin-bottom: 0.2rem;
}
.pay-qr-box img { width: 4.6rem; max-width: 82%; height: auto; display: block; margin: 0 auto 0.12rem; }
.pay-qr-box .qr-tip { font-size: 0.2rem; color: var(--text-sub); line-height: 1.7; }
.pay-qr-box.missing img { display: none; }
.pay-qr-box.missing::before {
  content: '收款码待替换：把微信收款码图片放到 images/pay-qr.png 即可显示';
  display: block; font-size: 0.2rem; color: var(--text-muted);
  border: 1.5px dashed var(--border); border-radius: 0.16rem;
  padding: 0.6rem 0.3rem; margin-bottom: 0.12rem; line-height: 1.7;
}
.pay-steps { font-size: 0.21rem; color: var(--text-sub); line-height: 1.9; margin-bottom: 0.2rem; }
.pay-steps b { color: var(--primary-dark); }
/* 付款注意事项（醒目提示：转账必须备注手机号） */
.pay-notice {
  background: #fff6e3; border: 1px solid #e8c47a; border-radius: 0.16rem;
  padding: 0.18rem 0.22rem; margin-bottom: 0.18rem;
  font-size: 0.21rem; line-height: 1.75; color: #7a5a14; text-align: left;
}
.pay-notice b { color: #b3541e; font-weight: 800; }
/* 已付款等待确认提示（点刷新后仍没开通时出现，带管理员联系方式） */
.pay-wait {
  background: rgba(74, 124, 78, 0.08); border: 1px solid rgba(74, 124, 78, 0.28);
  border-radius: 0.14rem; padding: 0.16rem 0.2rem; margin-bottom: 0.18rem;
  font-size: 0.21rem; line-height: 1.75; color: var(--text-main); text-align: left;
}
.pay-wait b { color: var(--primary-dark); font-weight: 800; }
.pay-wait[hidden] { display: none; }

/* 个人中心 */
.me-head { text-align: center; margin-bottom: 0.24rem; }.me-phone { font-size: 0.42rem; font-weight: 800; color: var(--text-main); letter-spacing: 0.02rem; }
.me-status { font-size: 0.22rem; color: var(--text-sub); margin-top: 0.08rem; }
.me-card {
  background: #fff; border: 1px solid var(--border); border-radius: 0.2rem;
  padding: 0.22rem 0.24rem; margin-bottom: 0.18rem;
}
.me-row { display: flex; justify-content: space-between; align-items: center; padding: 0.1rem 0; font-size: 0.22rem; }
.me-row .k { color: var(--text-sub); }
.me-row .v { color: var(--text-main); font-weight: 700; }
.me-row .v.warn { color: #b3560f; }
.me-actions { display: flex; flex-direction: column; gap: 0.14rem; margin-top: 0.08rem; }

/* ---------- 三档会员选择 ---------- */
.plan-list { display: flex; gap: 0.12rem; margin-bottom: 0.22rem; }
.plan-card {
  flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.04rem;
  background: #fff; border: 1.5px solid var(--border); border-radius: 0.18rem;
  padding: 0.2rem 0.08rem; font-family: inherit; transition: all 0.15s;
}
.plan-card:active { transform: scale(0.98); }
.plan-card.on { border-color: var(--primary); background: rgba(74,124,78,0.07); box-shadow: 0 0.04rem 0.14rem rgba(74,124,78,0.12); }
.plan-name { font-size: 0.22rem; color: var(--text-sub); }
.plan-card.on .plan-name { color: var(--primary-dark); font-weight: 700; }
.plan-price { font-size: 0.17rem; color: var(--text-muted); line-height: 1.2; }
.plan-price b { font-size: 0.36rem; font-weight: 800; color: var(--primary-dark); }
.plan-price i { font-style: normal; }
.plan-tag {
  position: absolute; top: -0.1rem; right: 0.08rem;
  background: var(--accent); color: #fff; font-size: 0.15rem;
  padding: 0.02rem 0.1rem; border-radius: 0.12rem;
}
 