/* 嘉诚禾宝 · 农产品质量安全「3+1」平台 · 移动端 App · 生产版设计系统 */
:root {
  /* 品牌色阶 · 清新浅绿田园风 */
  --brand: #4c9a52;
  --brand-deep: #3a7d40;
  --brand-ink: #2c5f33;
  --brand-bright: #67b76d;
  --brand-soft: #eef3ea;
  --brand-line: #d5e4cb;

  /* 强调橙 */
  --accent: #f2994a;
  --accent-deep: #ef7d1a;
  --accent-soft: #fdf0e2;

  --text: #1e2721;
  --text-2: #4c5560;
  --text-3: #6b7280;
  --text-4: #9aa3ad;

  --surface: #f7f8f3;
  --card: #ffffff;
  --border: rgba(30, 39, 33, 0.12);
  --border-soft: rgba(30, 39, 33, 0.065);

  --green: #16a34a;
  --green-soft: #e8f7ee;
  --amber: #c28404;
  --amber-soft: #fbf3e0;
  --red: #dc2626;
  --red-soft: #fdecec;
  --blue: #2563eb;
  --blue-soft: #e9f0fd;
  --lock: #67707c;
  --lock-soft: #eff1f4;

  --r-s: 8px;
  --r-m: 14px;
  --r-l: 18px;
  --r-xl: 24px;

  /* 分层阴影 */
  --shadow-s: 0 1px 2px rgba(44, 95, 51, 0.05), 0 1px 3px rgba(44, 95, 51, 0.04);
  --shadow-m: 0 2px 6px rgba(44, 95, 51, 0.05), 0 10px 28px rgba(44, 95, 51, 0.09);
  --shadow-l: 0 8px 16px rgba(44, 95, 51, 0.08), 0 24px 56px rgba(44, 95, 51, 0.14);
  --shadow-brand: 0 6px 18px rgba(76, 154, 82, 0.32);

  --ease: cubic-bezier(0.22, 0.9, 0.32, 1);
  --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* 字号标尺 / 行高 / 字重令牌 */
  --fs-2xs: 10px;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-base: 14px;
  --fs-lg: 16px;
  --fs-xl: 18px;
  --fs-2xl: 20px;
  --fs-3xl: 26px;
  --fs-display: 40px;
  --lh-body: 1.55;
  --lh-title: 1.3;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  overflow-wrap: anywhere;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 50% -10%, #e6efdd 0%, #eef1e6 55%, #eaece2 100%);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; border: 0; background: none; color: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: var(--fs-base); color: var(--text); outline: none; }
img { display: block; max-width: 100%; }
::selection { background: rgba(76, 154, 82, 0.18); }
.ic { display: inline-block; vertical-align: -3px; flex: none; }

.shell {
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 80px rgba(21, 24, 27, 0.14);
}
.view {
  flex: 1; display: flex; flex-direction: column; min-height: 100vh;
  padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  animation: pageIn 0.28s var(--ease);
}
.view.no-tabs { padding-bottom: 0; }
/* 有底部操作栏时预留高度，避免最后一张卡片被固定按钮遮住 */
.view.has-action { padding-bottom: calc(142px + env(safe-area-inset-bottom, 0px)); }
.view.no-tabs.has-action { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 顶部栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 56px; display: flex; align-items: center; gap: 8px;
  padding: 0 14px; background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border-soft);
}
.topbar .ttl { flex: 1; font-size: var(--fs-lg); font-weight: var(--fw-semibold); letter-spacing: -0.2px; line-height: var(--lh-title); }
.topbar .ttl small { display: block; font-size: var(--fs-xs); font-weight: var(--fw-normal); color: var(--text-3); letter-spacing: 0; margin-top: 1px; }
.topbar .back { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: var(--fs-2xl); color: var(--text-2); transition: background 0.15s; }
.topbar .back:active { background: var(--surface); }
.topbar .right { display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); font-size: var(--fs-xl); transition: background 0.15s; }
.icon-btn:hover { background: var(--surface); }

/* ---------- 内容 ---------- */
.content { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.content.flush { padding: 0; gap: 0; }
.section-title { font-size: var(--fs-lg); font-weight: var(--fw-semibold); color: var(--text-2); display: flex; align-items: center; justify-content: space-between; margin-top: 2px; letter-spacing: 0.01em; line-height: var(--lh-title); }
.section-title a { font-size: var(--fs-sm); color: var(--brand); font-weight: var(--fw-medium); }

.card {
  background: var(--card); border-radius: var(--r-l); border: 1px solid var(--border-soft);
  padding: 16px; box-shadow: var(--shadow-s);
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.card.flat { border: 1px solid var(--border); box-shadow: none; }
.card.tight { padding: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-3); font-size: var(--fs-sm); line-height: 1.5; }
.tiny { font-size: var(--fs-xs); color: var(--text-4); line-height: 1.5; }
.strong { font-weight: var(--fw-bold); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; font-size: 0.94em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 徽标 ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: var(--fs-xs); font-weight: var(--fw-semibold); white-space: nowrap; letter-spacing: 0.01em;
}
.tag .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2.5px currentColor; opacity: 0.9; }
.tag .dot { box-shadow: none; }
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-amber { background: var(--amber-soft); color: var(--amber); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-blue { background: var(--blue-soft); color: var(--blue); }
.tag-lock { background: var(--lock-soft); color: var(--lock); }
.tag-brand { background: var(--brand-soft); color: var(--brand); }
.tag-line { border: 1px solid var(--border); color: var(--text-2); background: #fff; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 46px; padding: 0 20px; border-radius: 13px; font-size: var(--fs-base); font-weight: var(--fw-semibold);
  border: 1px solid transparent; white-space: nowrap; letter-spacing: 0.01em;
  transition: transform 0.12s var(--ease), box-shadow 0.2s var(--ease), background 0.15s, filter 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-p {
  background: #e8f1e5; color: #2f6b38; font-weight: var(--fw-bold);
  border-color: rgba(76, 154, 82, 0.3);
  box-shadow: none;
}
.btn-p:hover { background: #dfecdb; }
.btn-p:active { background: #d5e6d1; }
.btn-s { background: #fff; border-color: var(--border); color: var(--text); box-shadow: var(--shadow-s); }
.btn-s:hover { border-color: rgba(21, 24, 27, 0.22); }
.btn-ghost { background: var(--brand-soft); color: var(--brand-deep); }
.btn-ghost:hover { background: #ddefe6; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #fbdcdc; }
.btn-block { display: flex; width: 100%; }
.btn-sm { height: 34px; font-size: var(--fs-md); padding: 0 13px; border-radius: 10px; box-shadow: none; }
.btn-xs { height: 28px; font-size: var(--fs-sm); padding: 0 10px; border-radius: 8px; box-shadow: none; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label { font-size: var(--fs-sm); color: var(--text-2); font-weight: var(--fw-semibold); letter-spacing: 0.01em; }
.field .hint { font-size: var(--fs-xs); color: var(--text-4); }
.input, .select, .textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: 12px; background: #fff;
  padding: 12px 13px; min-height: 46px; font-size: var(--fs-base);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: rgba(21, 24, 27, 0.2); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 4px rgba(76, 154, 82, 0.12);
}
.textarea { min-height: 78px; resize: vertical; line-height: 1.6; }
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #6b7280 50%), linear-gradient(135deg, #6b7280 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.check { display: flex; gap: 9px; align-items: flex-start; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.6; }
.check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--brand); }

/* ---------- 首页 Hero ---------- */
.hero {
  background:
    radial-gradient(420px 240px at 92% -12%, rgba(103, 183, 109, 0.22) 0%, transparent 60%),
    radial-gradient(300px 200px at 4% 118%, rgba(242, 153, 74, 0.1) 0%, transparent 55%),
    linear-gradient(150deg, #e9f5e0 0%, #f5f8ee 58%, #fdfbf2 100%);
  color: var(--brand-ink); padding: 22px 18px 24px; border-radius: 0 0 26px 26px;
  position: relative; overflow: hidden;
  box-shadow: 0 12px 32px rgba(58, 125, 64, 0.12);
}
.hero-row { display: flex; gap: 14px; align-items: flex-start; }
.hero-brand { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); font-weight: var(--fw-bold); color: var(--brand-deep); letter-spacing: 0.04em; }
.hero-brand img { width: 30px; height: 30px; filter: drop-shadow(0 1px 3px rgba(44, 95, 51, 0.18)); }
.hero-illust {
  width: 172px; flex: none; margin: -14px -22px -18px 0; opacity: 0.96;
  -webkit-mask-image: radial-gradient(ellipse 72% 70% at 52% 50%, #000 38%, transparent 68%);
  mask-image: radial-gradient(ellipse 72% 70% at 52% 50%, #000 38%, transparent 68%);
}
.hero .hello { font-size: var(--fs-sm); color: var(--text-3); letter-spacing: 0.04em; margin-top: 14px; }
.hero h1 { font-size: var(--fs-2xl); font-weight: var(--fw-bold); margin-top: 5px; letter-spacing: -0.3px; color: var(--brand-ink); line-height: var(--lh-title); }
.hero .role-chip {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 11px; padding: 5px 11px;
  border-radius: 999px; background: #fff; border: 1px solid var(--brand-line);
  font-size: var(--fs-sm); color: var(--brand-deep); box-shadow: var(--shadow-s);
}
.metrics {
  display: flex; margin-top: -34px; position: relative; z-index: 2;
  background: #fff; border: 1px solid var(--border-soft);
  border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-m);
}
.metrics div { flex: 1; padding: 12px 8px; text-align: center; border-right: 1px solid var(--border-soft); }
.metrics div:last-child { border-right: 0; }
.metrics b { display: block; font-size: var(--fs-xl); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; letter-spacing: -0.2px; color: var(--brand-deep); }
.metrics span { font-size: var(--fs-xs); color: var(--text-3); letter-spacing: 0.02em; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.quick {
  display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px;
  background: #fff; border-radius: 13px; font-size: var(--fs-md); color: var(--text); text-align: left;
  border: 1px solid var(--border-soft); box-shadow: var(--shadow-s);
  transition: background 0.15s, transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.quick:active { background: #fdfefd; transform: scale(0.97); }
.quick .qi {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: var(--fs-lg); flex: none;
  background: var(--brand-soft); color: var(--brand-deep);
  transition: transform 0.18s var(--ease);
}
.quick:active .qi { transform: scale(0.92); }
.quick.amber .qi { color: var(--accent-deep); background: var(--accent-soft); }
.quick.blue .qi { color: var(--blue); background: var(--blue-soft); }
.quick.red .qi { color: var(--red); background: var(--red-soft); }
.quick.lock .qi { color: var(--lock); }
.quick b { font-weight: var(--fw-medium); }

/* ---------- 列表 ---------- */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px;
  background: #fff; border-radius: var(--r-m); border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-s);
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), border-color 0.15s;
}
.list-item:active { transform: scale(0.99); background: #fdfefd; }
.list-item .ico-box {
  width: 42px; height: 42px; border-radius: 13px; background: var(--brand-soft); color: var(--brand-deep);
  display: grid; place-items: center; font-size: var(--fs-xl); flex: none;
}
.list-item .t { font-size: var(--fs-base); font-weight: var(--fw-semibold); letter-spacing: -0.1px; }
.list-item .s { font-size: var(--fs-sm); color: var(--text-3); margin-top: 3px; }
.list-item .r { text-align: right; font-size: var(--fs-xs); color: var(--text-4); }

/* ---------- 链路节点 ---------- */
.chain { display: flex; align-items: flex-start; }
.chain .node { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; position: relative; text-align: center; }
.chain .node::before { content: ""; position: absolute; top: 15px; left: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.chain .node:last-child::before { display: none; }
.chain .node.ok::before { background: var(--green); }
.chain .node .dot {
  width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-md);
  background: var(--lock-soft); color: var(--lock); position: relative; z-index: 1; border: 2.5px solid #fff;
  box-shadow: var(--shadow-s);
}
.chain .node.ok .dot { background: var(--green); color: #fff; }
.chain .node.warn .dot { background: var(--amber); color: #fff; }
.chain .node.run .dot { background: var(--blue); color: #fff; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18); }
.chain .node .n { font-size: var(--fs-sm); font-weight: var(--fw-semibold); }
.chain .node .d { font-size: var(--fs-xs); color: var(--text-3); }
.chain .node .gaps { margin-top: 2px; display: flex; flex-direction: column; gap: 3px; }
.chain .node .gaps a { font-size: var(--fs-xs); color: var(--brand); text-decoration: underline; }

/* ---------- 进度 ---------- */
.progress { height: 7px; border-radius: 5px; background: #eceef0; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-bright), var(--brand)); border-radius: 5px; transition: width 0.5s var(--ease); }
.parts { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.part { display: flex; align-items: center; gap: 8px; font-size: var(--fs-sm); }
.part .k { width: 72px; color: var(--text-2); flex: none; }
.part .bar { flex: 1; height: 5px; border-radius: 3px; background: #eef0f1; overflow: hidden; }
.part .bar i { display: block; height: 100%; background: var(--brand); border-radius: 3px; transition: width 0.5s var(--ease); }
.part .v { width: 42px; text-align: right; color: var(--text-4); font-size: var(--fs-xs); }

/* ---------- 时间线 ---------- */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 10px; padding-bottom: 14px; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 1.5px; background: var(--border); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-item .dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2.5px solid var(--brand); margin-top: 4px; flex: none; z-index: 1; }
.tl-item .body { flex: 1; min-width: 0; }
.tl-item .ttl { font-size: var(--fs-md); font-weight: var(--fw-semibold); display: flex; justify-content: space-between; gap: 8px; }
.tl-item .ttl span { font-size: var(--fs-xs); color: var(--text-4); font-weight: var(--fw-normal); flex: none; }
.tl-item .desc { font-size: var(--fs-sm); color: var(--text-3); margin-top: 3px; line-height: var(--lh-body); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 460px;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px) saturate(1.5); -webkit-backdrop-filter: blur(18px) saturate(1.5);
  border-top: 1px solid var(--border-soft);
  display: flex; z-index: 40;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: var(--fs-2xs); color: var(--text-3); letter-spacing: 0.02em;
  transition: color 0.15s;
}
.tabbar a .ti { font-size: var(--fs-2xl); line-height: 1; transition: transform 0.2s var(--ease); }
.tabbar a.on { color: var(--brand); font-weight: 700; }
.tabbar a.on .ti { transform: translateY(-1px) scale(1.12); }
.tabbar a:active .ti { transform: scale(0.88); }

/* ---------- 底部操作栏 ---------- */
.actionbar {
  position: fixed; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 460px; padding: 12px 14px 14px;
  background: linear-gradient(180deg, rgba(245, 248, 238, 0), rgba(245, 248, 238, 0.97) 32%);
  display: flex; gap: 8px; z-index: 35;
}
.actionbar .btn { flex: 1; }
.view.no-tabs .actionbar { bottom: 0; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 52px 24px; color: var(--text-3); }
.empty .e { font-size: var(--fs-display); opacity: 0.32; margin-bottom: 14px; filter: grayscale(0.3); }
.empty p { font-size: var(--fs-md); line-height: 1.7; }
.empty .btn { margin-top: 18px; }

/* ---------- 登录 ---------- */
.login {
  min-height: 100vh; display: flex; flex-direction: column;
  background:
    radial-gradient(500px 300px at 85% 2%, rgba(103, 183, 109, 0.16) 0%, transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #f5f8ee 46%, #edf5e4 100%);
  padding: 0 22px 30px;
}
.login .brand { padding: 58px 4px 24px; color: var(--brand-ink); display: flex; align-items: center; gap: 14px; }
.login .logo {
  width: 62px; height: 62px; flex: none;
  display: grid; place-items: center; margin-bottom: 0;
  filter: drop-shadow(0 6px 16px rgba(58, 125, 64, 0.22));
}
.login .logo img { width: 100%; height: 100%; object-fit: contain; }
.login h1 { font-size: var(--fs-3xl); font-weight: var(--fw-bold); letter-spacing: -0.4px; line-height: var(--lh-title); }
.login h1 span { display: block; font-size: var(--fs-sm); font-weight: var(--fw-normal); color: var(--text-3); letter-spacing: 0.05em; margin-top: 7px; }
.login .panel {
  background: #fff; border-radius: 22px; padding: 22px 18px;
  box-shadow: 0 4px 10px rgba(44, 95, 51, 0.04), 0 24px 60px rgba(58, 125, 64, 0.14);
}
.login .panel h2 { font-size: var(--fs-lg); margin-bottom: 5px; letter-spacing: -0.2px; line-height: var(--lh-title); }
.login .panel .sub { font-size: var(--fs-sm); color: var(--text-3); margin-bottom: 18px; }
.login .demo { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); }
.login .demo .chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.chip {
  padding: 7px 11px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border-soft); font-size: var(--fs-sm); color: var(--text-2);
  transition: all 0.15s;
}
.chip:active { background: var(--brand-soft); color: var(--brand); border-color: var(--brand-line); }
.chip-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.chip-row .chip { cursor: pointer; }
.chip-row .chip.on { background: var(--brand-soft); color: var(--brand-deep); border-color: var(--brand); font-weight: var(--fw-semibold); }
.th-img { width: 44px; height: 44px; border-radius: 11px; object-fit: cover; flex: none; border: 1px solid var(--border-soft); background: var(--brand-soft); }
.login .legal { margin-top: auto; padding-top: 26px; text-align: center; font-size: var(--fs-xs); color: var(--text-4); line-height: 1.7; }

/* ---------- 扫码验真 ---------- */
.verify-hero {
  background:
    radial-gradient(300px 180px at 92% -10%, rgba(255, 255, 255, 0.16) 0%, transparent 60%),
    linear-gradient(140deg, #67b76d, #4c9a52 55%, #3a7d40);
  border-radius: var(--r-l); padding: 20px 18px; color: #fff;
  box-shadow: 0 10px 26px rgba(58, 125, 64, 0.24);
}
.verify-hero h2 { font-size: var(--fs-xl); letter-spacing: -0.2px; line-height: var(--lh-title); }
.verify-hero p { font-size: var(--fs-sm); opacity: 0.82; margin-top: 4px; }
.verify-hero .input { margin-top: 14px; background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.28); color: #fff; }
.verify-hero .input::placeholder { color: rgba(255, 255, 255, 0.62); }
.verify-hero .input:focus { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.5); }
.result-banner { border-radius: var(--r-l); padding: 18px; color: #fff; position: relative; overflow: hidden; box-shadow: var(--shadow-m); animation: pageIn 0.3s var(--ease); }
.result-banner::after { content: ""; position: absolute; right: -40px; top: -50px; width: 150px; height: 150px; border-radius: 50%; background: rgba(255, 255, 255, 0.1); }
.result-banner.ok { background: linear-gradient(135deg, #1db35a, #0f7a3a); }
.result-banner.bad { background: linear-gradient(135deg, #e23b3b, #991b1b); }
.result-banner.warn { background: linear-gradient(135deg, #d69a0b, #a16207); }
.result-banner .big { font-size: var(--fs-2xl); font-weight: var(--fw-bold); margin-top: 6px; position: relative; line-height: var(--lh-title); }
.result-banner .sub { font-size: var(--fs-sm); opacity: 0.88; margin-top: 4px; position: relative; }

/* ---------- 商品 ---------- */
.mall-tabs { display: flex; gap: 22px; padding: 12px 16px 0; border-bottom: 1px solid var(--border-soft); }
.mall-tabs button {
  height: 38px; font-size: var(--fs-base); font-weight: var(--fw-medium); padding: 0 2px; position: relative;
  background: none; border: 0; color: var(--text-3); transition: color 0.18s var(--ease);
}
.mall-tabs button.on { color: var(--brand-ink); font-weight: var(--fw-bold); }
.mall-tabs button.on::after {
  content: ""; position: absolute; left: 50%; bottom: -1px; transform: translateX(-50%);
  width: 22px; height: 3px; border-radius: 999px; background: var(--brand);
}
.crowd-bar { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: var(--r-m); background: #fff; }
.crowd-head { display: flex; align-items: center; gap: 5px; font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--brand-ink); margin-bottom: 8px; }
.crowd-head span { font-weight: var(--fw-regular); color: var(--text-4); font-size: var(--fs-xs); margin-left: auto; }
.crowd-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.crowd-scroll::-webkit-scrollbar { display: none; }
.crowd-chip {
  flex: none; height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  background: #fff; color: var(--text-3); font-size: var(--fs-sm); white-space: nowrap;
}
.crowd-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: var(--fw-bold); }
.crowd-tag {
  display: inline-block; margin-right: 4px; padding: 1px 6px; border-radius: 6px;
  background: var(--brand-soft); color: var(--brand-deep); font-size: var(--fs-2xs); line-height: 1.6;
}
.product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.product {
  background: #fff; border-radius: var(--r-m); border: 1px solid var(--border-soft); overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow-s);
  transition: transform 0.18s var(--ease), box-shadow 0.22s var(--ease);
}
.product:active { transform: scale(0.985); box-shadow: var(--shadow-m); }
.product .thumb {
  height: 132px; position: relative; overflow: hidden;
  background: var(--surface);
}
.product .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease); }
.product:active .thumb img { transform: scale(1.04); }
.product .thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 62%, rgba(30, 39, 33, 0.1)); pointer-events: none; }
.product .thumb .badge {
  position: absolute; left: 8px; top: 8px; z-index: 1;
  background: rgba(255, 255, 255, 0.88); border: 1px solid rgba(255, 255, 255, 0.6);
  color: var(--brand-deep); font-weight: 600; font-size: var(--fs-2xs); padding: 2px 7px; border-radius: 999px; backdrop-filter: blur(3px);
}
.product .body { padding: 10px 11px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; border-top: 1px solid var(--border-soft); }
.product .nm { font-size: var(--fs-md); font-weight: var(--fw-semibold); line-height: 1.35; letter-spacing: -0.1px; }
.product .spec { font-size: var(--fs-xs); color: var(--text-4); }
.product .price { color: var(--accent-deep); font-size: var(--fs-xl); font-weight: var(--fw-bold); margin-top: auto; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; }
.product .price small { font-size: var(--fs-xs); font-weight: var(--fw-normal); color: var(--text-4); }
.product .buy { margin-top: 8px; height: 36px; border-radius: 999px; font-size: var(--fs-md); }
.mall-note { display: flex; gap: 8px; align-items: flex-start; padding: 11px 12px; background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: 11px; font-size: var(--fs-xs); color: var(--brand-deep); line-height: 1.6; }

/* ---------- 订单 ---------- */
.order-card { background: #fff; border-radius: var(--r-m); border: 1px solid var(--border-soft); padding: 13px 14px; display: flex; flex-direction: column; gap: 9px; box-shadow: var(--shadow-s); }
.order-card .oh { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-xs); color: var(--text-4); }
.order-card .oi { display: flex; gap: 10px; align-items: center; }
.order-card .oi .th { width: 44px; height: 44px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: var(--fs-xl); flex: none; }
.order-card .of { display: flex; justify-content: space-between; align-items: center; border-top: 1px dashed var(--border-soft); padding-top: 10px; }
.order-card .amount { font-size: var(--fs-xl); font-weight: var(--fw-bold); color: var(--accent-deep); font-variant-numeric: tabular-nums; }

/* ---------- 详情行 ---------- */
.kv { display: flex; padding: 9px 0; border-bottom: 1px dashed var(--border-soft); font-size: var(--fs-md); gap: 12px; }
.kv:last-child { border-bottom: 0; }
.kv .k { width: 92px; color: var(--text-3); flex: none; font-size: var(--fs-sm); }
.kv .v { flex: 1; text-align: right; font-weight: var(--fw-medium); word-break: break-all; }

/* ---------- 步骤条 ---------- */
.steps { display: flex; flex-direction: column; }
.step { display: flex; gap: 10px; position: relative; padding-bottom: 16px; }
.step::before { content: ""; position: absolute; left: 8px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.step:last-child { padding-bottom: 0; }
.step:last-child::before { display: none; }
.step .sdot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); background: #fff; flex: none; z-index: 1; display: grid; place-items: center; font-size: var(--fs-2xs); color: transparent; }
.step.done .sdot { border-color: var(--green); background: var(--green); color: #fff; }
.step.now .sdot { border-color: var(--brand); background: var(--brand); color: #fff; box-shadow: 0 0 0 4px rgba(76, 154, 82, 0.15); }
.step .st { font-size: var(--fs-md); font-weight: var(--fw-semibold); }
.step .sd { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }

/* ---------- 激活 / 介质 ---------- */
.medium-card { border: 1.5px dashed var(--brand-line); background: var(--brand-soft); border-radius: var(--r-m); padding: 13px; display: flex; flex-direction: column; gap: 6px; }
.medium-code { font-family: var(--mono); font-size: var(--fs-base); font-weight: var(--fw-bold); letter-spacing: 1px; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.media-list { display: flex; flex-direction: column; gap: 7px; max-height: 210px; overflow: auto; scrollbar-width: thin; }
.media-item { display: flex; justify-content: space-between; align-items: center; padding: 9px 11px; background: #fff; border: 1px solid var(--border-soft); border-radius: 10px; font-size: var(--fs-sm); }

/* ---------- toast / loading ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(94px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%) translateY(10px); z-index: 99;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; opacity: 0; transition: 0.24s var(--ease);
  width: calc(100% - 48px); max-width: 400px;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast .t {
  background: rgba(21, 24, 27, 0.92); color: #fff; padding: 11px 18px; border-radius: 999px;
  font-size: var(--fs-md); line-height: 1.5; text-align: center; max-width: 100%;
  box-shadow: var(--shadow-l); backdrop-filter: blur(6px);
}
#toast .t.err { background: rgba(185, 28, 28, 0.95); }
#toast .t.ok { background: rgba(58, 125, 64, 0.96); }
.loading { padding: 60px 20px; text-align: center; color: var(--text-3); font-size: var(--fs-md); }
.spinner {
  width: 26px; height: 26px; border: 2.5px solid var(--brand-line); border-top-color: var(--brand);
  border-radius: 50%; margin: 0 auto 12px; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 登录：其他方式 / 微信 ---------- */
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--text-4); font-size: var(--fs-xs); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border-soft); }
.btn-wx { background: #07c160; border-color: #07c160; color: #fff; gap: 8px; }
.btn-wx:hover { background: #06ad56; }
.btn-wx:active { background: #059048; }

/* ---------- 手写签名 ---------- */
.sign-wrap {
  position: relative; width: 100%; height: 180px; margin-top: 10px;
  border: 1.5px dashed var(--brand-line); border-radius: var(--r-m); background: #fff; overflow: hidden;
}
.sign-wrap canvas { display: block; touch-action: none; }
.sign-tip {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-4); font-size: var(--fs-sm); pointer-events: none;
}
.sign-empty {
  width: 100%; height: 92px; border: 1.5px dashed var(--brand-line); border-radius: var(--r-m);
  background: var(--brand-soft); color: var(--text-3); font-size: var(--fs-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer;
}
.sign-done { display: flex; align-items: center; gap: 14px; }
.sign-thumb { height: 40px; max-width: 200px; border: 1px solid var(--border-soft); border-radius: 8px; background: #fff; padding: 3px 6px; }

/* ---------- 打印机 ---------- */
.dot-on { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(58, 125, 64, 0.15); flex: none; }
.skeleton { background: linear-gradient(90deg, #eef0f1 25%, #f7f8f8 37%, #eef0f1 63%); background-size: 400% 100%; animation: sk 1.2s ease infinite; border-radius: 10px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- 底部弹层 ---------- */
.sheet-mask {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(20, 28, 22, 0.38);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  animation: sheetMaskIn 0.24s ease;
}
@keyframes sheetMaskIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 61;
  width: 100%; max-width: 520px; padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: #fff; border-radius: 20px 20px 0 0;
  max-height: 82vh; overflow-y: auto; box-shadow: var(--shadow-l);
  animation: sheetIn 0.28s ease;
}
@keyframes sheetIn { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.sheet .grab { width: 36px; height: 4px; border-radius: 999px; background: rgba(30, 39, 33, 0.16); margin: 0 auto 12px; }
.sheet h3 { font-size: var(--fs-lg); font-weight: var(--fw-semibold); letter-spacing: -0.2px; margin-bottom: 14px; line-height: var(--lh-title); }

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

@media (min-width: 700px) {
  body { padding: 24px 0; }
  .shell { min-height: calc(100vh - 48px); border-radius: 28px; overflow: hidden; box-shadow: 0 24px 80px rgba(21, 24, 27, 0.2); }
  .tabbar { bottom: 24px; border-radius: 0 0 28px 28px; overflow: hidden; }
  .actionbar { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
  .view.no-tabs .actionbar { bottom: 24px; border-radius: 0 0 28px 28px; }
  #toast { bottom: 110px; }
}

/* ---------- AI 辅助录入 / 营养检测卡 ---------- */
.ai-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 14px; border: 1px dashed var(--brand-line); border-radius: 14px; background: var(--brand-soft); }
.ai-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--brand); background: #fff; color: var(--brand-deep); font-size: var(--fs-sm); font-weight: 600; }
.ai-btn:active { transform: scale(0.97); }
.ai-tip { font-size: var(--fs-xs); color: var(--text-3); }
.ai-panel { padding: 10px 12px; border-radius: 12px; background: var(--brand-soft); }
.nutrition-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.nutrition-cell { display: flex; flex-direction: column; align-items: center; padding: 6px 2px; background: #fff; border-radius: 10px; }
.nutrition-cell b { font-size: var(--fs-md); color: var(--brand-deep); }
.nutrition-cell span { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }

/* ---------- AI 智能助手（对话 / 语音播报 / 语音输入） ---------- */
.chat-msgs { display: flex; flex-direction: column; gap: 12px; padding: 2px 0 8px; }
.chat-msg { display: flex; gap: 9px; align-items: flex-start; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-ava { width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-deep); }
.chat-msg.user .chat-ava { background: #fff; color: var(--text-3); border: 1px solid var(--border-soft); }
.chat-bubble { max-width: calc(100% - 44px); padding: 10px 12px; border-radius: 14px 14px 14px 4px; background: #fff; border: 1px solid var(--border-soft); box-shadow: var(--shadow-s); font-size: var(--fs-md); line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.chat-msg.user .chat-bubble { background: var(--brand); border-color: transparent; color: #fff; border-radius: 14px 14px 4px 14px; }
.chat-tools { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.chat-tools button { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-deep); font-size: var(--fs-xs); font-weight: 600; }
.chat-tools button:active { transform: scale(0.97); }
.chat-quick { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 4px; }
.chat-quick .chip { flex: none; }
.chat-composer { display: flex; align-items: flex-end; gap: 8px; width: 100%; }
.chat-composer textarea { flex: 1; min-height: 44px; max-height: 88px; padding: 11px 12px; border: 1.5px solid var(--border); border-radius: 12px; background: #fff; font-size: var(--fs-md); line-height: 1.45; resize: none; }
.chat-composer textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(76, 154, 82, 0.12); }
.chat-mic { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--brand-line); background: var(--brand-soft); color: var(--brand-deep); }
.chat-mic.on { background: var(--red-soft); border-color: #f0c7c7; color: var(--red); }
.chat-send { height: 46px; flex: none; padding: 0 16px; border-radius: 12px; background: #e8f1e5; border: 1px solid rgba(76, 154, 82, 0.3); color: #2f6b38; font-weight: 700; font-size: var(--fs-base); }
.chat-send[disabled] { opacity: 0.45; pointer-events: none; }
.chat-foot { margin-top: 4px; text-align: center; font-size: var(--fs-2xs); color: var(--text-4); line-height: 1.7; }
.chat-typing { display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; }
.chat-typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-4); animation: chatDot 0.9s infinite ease-in-out; }
.chat-typing i:nth-child(2) { animation-delay: 0.15s; }
.chat-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatDot { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.ai-entry { display: flex; align-items: center; gap: 11px; padding: 13px 14px; border-radius: 16px; border: 1px solid var(--brand-line); background: linear-gradient(135deg, #f2f8ef, #ffffff); box-shadow: var(--shadow-s); }
.ai-entry .ico-box { width: 36px; height: 36px; border-radius: 11px; background: var(--brand-soft); color: var(--brand-deep); display: grid; place-items: center; flex: none; }

/* ---------- 打印（A4 / 证面） ---------- */
@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff !important; }
  .topbar, .tabbar, .actionbar, .chat-composer, .chat-quick, .toast, #toast, .chat-foot { display: none !important; }
  .shell { max-width: none; box-shadow: none; border-radius: 0; min-height: 0; }
  .view { padding-bottom: 0 !important; animation: none; }
  .content { padding: 0 !important; gap: 10px; }
  .content > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; }
  .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #999 !important; background: #fff !important; color: #111 !important; }
  .print-area .card, .print-area .card * { color: #111 !important; background-image: none !important; }
  .print-area .tag { border: 1px solid #666; color: #111 !important; }
  .print-area .mono { font-size: 15px; }
  a[href]::after { content: ""; }
}

/* 证面模板打印：打印时只输出模板层 */
body.tpl-printing #tplPrintOverlay { display: block !important; }
@media print {
  body.tpl-printing .content { display: none !important; }
  body.tpl-printing #tplPrintOverlay { position: static; padding: 0; }
}

/* 合格证打印模板默认样式（编辑器可整体替换） */
.cert-sheet { border: 2px solid #1a5c2a; border-radius: 8px; padding: 18px 20px; font-size: 13px; color: #111; }
.cert-head { text-align: center; border-bottom: 2px solid #1a5c2a; padding-bottom: 10px; margin-bottom: 12px; }
.cert-title { font-size: 22px; font-weight: 700; letter-spacing: 6px; color: #1a5c2a; }
.cert-no { font-size: 12px; color: #333; margin-top: 6px; font-family: monospace; }
.cert-table { width: 100%; border-collapse: collapse; }
.cert-table th, .cert-table td { border: 1px solid #999; padding: 7px 8px; text-align: left; font-size: 12.5px; }
.cert-table th { background: #eef5ee; width: 72px; font-weight: 600; }
.cert-declare { margin: 12px 0; padding: 9px 11px; background: #f4f8f4; border-left: 3px solid #1a5c2a; font-size: 12px; line-height: 1.7; }
.cert-foot { display: flex; justify-content: space-between; font-size: 11px; color: #444; font-family: monospace; }

/* 合格证蓝牙排版编辑器（可拖动） */
.lt-wrap { overflow-x: auto; padding: 6px 0; }
.lt-canvas { position: relative; width: 384px; min-height: 200px; background: #fff; border-radius: 6px; box-shadow: 0 0 0 1px var(--border) inset; touch-action: none; user-select: none; -webkit-user-select: none; }
.lt-canvas.lt-bordered::after { content: ''; position: absolute; inset: 4px; border: 2px solid #111; border-radius: 3px; pointer-events: none; }
.lt-item { position: absolute; left: 0; top: 0; color: #111; line-height: 1.15; white-space: nowrap; cursor: move; padding: 1px 2px; border-radius: 3px; border: 1px dashed transparent; }
.lt-item.sel { border-color: var(--brand); background: rgba(76, 154, 82, 0.1); }
.lt-dev { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--border-soft); border-radius: 8px; margin-bottom: 6px; }
