/* =============================================================
   医药溯源查询系统 · 患者端（H5）
   宣纸底 + 墨色正文 + 朱砂点缀 + 细金线分隔
   移动优先（375px 起），桌面居中限宽 560px
   ============================================================= */

:root {
  /* 色板（借鉴旧模板令牌） */
  --paper: #f5efe3;
  --paper-2: #efe7d4;
  --paper-3: #e6dcc5;
  --card: #fdfaf3;
  --ink: #2b241c;
  --ink-soft: #4a3f33;
  --muted: #8a7f6d;
  --faint: #b3a894;
  --cinnabar: #b23a2e;
  --cinnabar-deep: #8f2c22;
  --cinnabar-wash: rgba(178, 58, 46, .08);
  --gold: #c9a86a;
  --gold-soft: #e6d5ab;
  --green: #3f5a4b;
  --green-wash: rgba(63, 90, 75, .10);
  --line: #d8ccb2;
  --line-soft: #e3d9c5;
  --ink-band: #241d16;
  --ink-band-2: #3a2d20;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 22px rgba(43, 36, 28, .10);
  --shadow-sm: 0 3px 10px rgba(43, 36, 28, .07);

  /* 字体：跨平台现代中英文字体栈 + 优雅衬线体回退 */
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Monaco, Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---------- 宣纸纹理层（纯 CSS，无外部图片） ---------- */
.bg-texture {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 10%, rgba(201, 168, 106, .10), transparent 42%),
    radial-gradient(circle at 88% 26%, rgba(178, 58, 46, .05), transparent 40%),
    linear-gradient(180deg, #f7f1e6 0%, #f1ead8 100%);
}
.bg-texture::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
}

main.wrap { padding-bottom: 28px; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* =============================================================
   品牌头部（照院方稿子的排版与配色：墨绿底 + 细网格 + 淡金环；居中印章在上，
   大号字距标题、字距拉开的描述、金色口号夹两条金线）
   ============================================================= */
.hero {
  position: relative;
  overflow: hidden;
  padding: 32px 0 38px;
  text-align: center;
  color: #f3efe6;
  background:
    radial-gradient(620px 320px at 22% -12%, rgba(201, 162, 39, .14), transparent 62%),
    radial-gradient(520px 340px at 88% 118%, rgba(43, 92, 74, .40), transparent 60%),
    linear-gradient(158deg, #14231d 0%, #0f1c17 46%, #0b1512 100%);
  border-bottom: 1px solid rgba(201, 162, 39, .26);
}
/* 细网格纹理：中间清楚、边上淡出 */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(243, 239, 230, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(243, 239, 230, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(520px 300px at 50% 24%, #000 20%, transparent 82%);
  mask-image: radial-gradient(520px 300px at 50% 24%, #000 20%, transparent 82%);
  pointer-events: none;
}
/* 右上的淡金环（稿子里那圈装饰线） */
.hero::after {
  content: "";
  position: absolute;
  right: -120px; top: 20px;
  width: 300px; height: 300px;
  border: 1px solid rgba(201, 162, 39, .16);
  border-radius: 50%;
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; }

/* 头 LOGO：居中放在标题上方。图片优先（site.brandLogo），图片缺失或坏了退回红底印章字 */
.hero-mark { display: flex; justify-content: center; margin-bottom: 16px; }
.hero-logo {
  width: 78px; height: 78px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .45));
}
.hero-logo[hidden], .hero-seal[hidden] { display: none; }
.seal {
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 8px;
  background: #a8352a;
  color: #fdf6ea;
  font-family: var(--font-serif);
  line-height: 1;
  text-align: center;
}
.hero-seal {
  width: 74px; height: 74px;
  border-radius: 9px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .20), 0 6px 24px rgba(168, 53, 42, .42);
  font-size: 32px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 33px;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: 7px;
  text-indent: 7px;
  color: #f6f1e6;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .45);
  overflow-wrap: anywhere;
}
/* 标题里那个「·」用金色点，跟稿子一致 */
.hero-title .sep { color: var(--gold); font-style: normal; }
.hero-sub {
  margin: 12px auto 0;
  font-size: 13px;
  letter-spacing: 5px;
  text-indent: 5px;
  color: #c3d1ca;
  overflow-wrap: anywhere;
}
.hero-slogan { display: flex; align-items: center; gap: 12px; margin: 22px auto 0; max-width: 430px; }
.hero-slogan .line { flex: 1; height: 1px; background: linear-gradient(90deg, rgba(201, 162, 39, 0), rgba(201, 162, 39, .72)); }
.hero-slogan .line.r { background: linear-gradient(90deg, rgba(201, 162, 39, .72), rgba(201, 162, 39, 0)); }
.hero-slogan .txt {
  flex: 0 0 auto;
  font-family: var(--font-serif);
  font-size: 14.5px;
  letter-spacing: 4px;
  text-indent: 4px;
  color: #d8b968;
}

/* =============================================================
   通用卡片 / 标题 / 按钮
   ============================================================= */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
}
.query-card { margin-top: -26px; position: relative; z-index: 2; }

.card-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.card-head h2 {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 1px;
}
.tick { width: 4px; height: 17px; border-radius: 2px; background: var(--cinnabar); flex: 0 0 auto; }
.tick.gold { background: var(--gold); }
.card-note { font-size: 13px; color: var(--muted); margin-bottom: 14px; }

.section-title {
  display: flex; align-items: center; gap: 9px;
  margin: 26px 0 4px;
}
.section-title h2 {
  font-family: var(--font-serif);
  font-size: 17px; font-weight: 600; letter-spacing: 1px;
}
.section-title .count {
  font-size: 12px; color: var(--muted);
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 1px 9px;
}
.section-tip { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }

.field { margin-bottom: 14px; }
.field-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-soft);
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.req-flag {
  font-size: 11px;
  color: var(--cinnabar);
  border: 1px solid rgba(178, 58, 46, .45);
  background: var(--cinnabar-wash);
  border-radius: 4px;
  padding: 0 6px;
  line-height: 1.5;
}
.req-flag.optional { color: var(--muted); border-color: var(--line); background: var(--paper-2); }

.input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  font-size: 17px;
  font-family: inherit;
  color: var(--ink);
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input-mono { font-family: var(--font-mono); letter-spacing: 1px; }
.input::placeholder { color: #a99f8b; font-family: var(--font-sans); letter-spacing: 0; }
.input:focus {
  outline: none;
  border-color: var(--gold);
  background: var(--card);
  box-shadow: 0 0 0 3px rgba(201, 168, 106, .20);
}
.input.invalid { border-color: var(--cinnabar); background: var(--cinnabar-wash); }

.field-error {
  font-size: 13px;
  color: var(--cinnabar-deep);
  background: var(--cinnabar-wash);
  border: 1px dashed rgba(178, 58, 46, .5);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 12px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 44px;
  padding: 0 20px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  letter-spacing: 1.5px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s, filter .2s, background .2s, box-shadow .2s, color .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary {
  background: linear-gradient(135deg, var(--cinnabar), var(--cinnabar-deep));
  color: #fff;
  box-shadow: 0 6px 16px rgba(178, 58, 46, .26);
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-primary:active { transform: none; }
.btn-primary:disabled { opacity: .6; cursor: wait; transform: none; filter: none; box-shadow: none; }
.btn-ghost {
  background: transparent;
  border-color: var(--gold);
  color: var(--cinnabar-deep);
}
.btn-ghost:hover { background: var(--gold-soft); }
.btn-quiet {
  background: var(--paper-2);
  border-color: var(--line);
  color: var(--ink-soft);
  font-weight: 400;
}
.btn-quiet:hover { background: var(--paper-3); }
.btn-block { width: 100%; height: 50px; margin-top: 4px; }
.btn-mini { height: 34px; padding: 0 13px; font-size: 13px; letter-spacing: .5px; }
.btn.is-busy .btn-text { opacity: .8; }

.btn:focus-visible,
.input:focus-visible,
a:focus-visible,
button:focus-visible,
.list-item:focus-visible,
.photo-thumb:focus-visible,
.med-qr:focus-visible {
  outline: 2px solid var(--cinnabar);
  outline-offset: 2px;
}

.form-foot { margin-top: 14px; font-size: 12.5px; color: var(--muted); text-align: center; }
.form-foot .cs-service { margin-left: 6px; vertical-align: middle; text-decoration: none; }
.link-wx { color: var(--cinnabar-deep); text-decoration: none; border-bottom: 1px dashed rgba(178, 58, 46, .6); }
.link-wx:hover { color: var(--cinnabar); }

/* 客服入口 = 微信客服链接（表单下「查询遇到问题？微信客服」、失败页上的按钮「微信客服」）：
   链接与入口文字都存在设置表（后台 PUT /api/settings 的 site.wxServiceUrl / site.wxServiceLabel），改完刷新即生效；
   .env 的 WX_SERVICE_URL / WX_SERVICE_LABEL 只是库里没填时的兜底默认值。链接留空 → 患者端不显示客服入口，
   表单下改显示「如需帮助请联系在线客服」，失败页只显示「重新查询」。客服是在线的，文案里不出现线下窗口。
   电话拨号（tel:）入口已按院方要求整体撤掉，不再出现。
   body.is-mobile-view 由 h5.js 判定手机/电脑（先看指针与悬停能力，再看 UA），现在只作识别用，不再控制显示。 */

/* ---------- 加载 ---------- */
.loading { text-align: center; padding: 26px 0 6px; color: var(--muted); font-size: 14px; }
.spinner {
  display: block;
  width: 30px; height: 30px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 3px solid var(--paper-3);
  border-top-color: var(--cinnabar);
  animation: spin .85s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================================
   结果区
   ============================================================= */
.result { display: block; }
.result > * { animation: fadeUp .45s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.detail-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 18px 0 12px;
  flex-wrap: wrap;
}
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px;
  color: var(--cinnabar-deep);
  background: none;
  border: none;
  border-bottom: 1px dashed rgba(178, 58, 46, .55);
  padding: 2px 0;
  cursor: pointer;
  font-family: inherit;
}
.back-link:hover { color: var(--cinnabar); }
.detail-src { font-size: 12px; color: var(--muted); }

/* ---------- 单据头 ---------- */
.order-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.order-head {
  background: linear-gradient(118deg, #2b2318, #423626);
  color: var(--paper);
  padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.order-id { font-family: var(--font-serif); font-size: 19px; letter-spacing: 1px; }
.order-id small {
  display: block;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .5px;
  color: rgba(245, 239, 227, .68);
  margin-top: 3px;
}
.badge {
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid rgba(201, 168, 106, .55);
  background: rgba(201, 168, 106, .16);
  color: var(--gold-soft);
}
.badge--doing { border-color: rgba(201, 168, 106, .6); background: rgba(201, 168, 106, .18); color: #e8d6ac; }
.badge--ready { border-color: rgba(230, 213, 171, .5); background: rgba(245, 239, 227, .14); color: #f0e7d3; }
.badge--done { border-color: rgba(126, 168, 141, .6); background: rgba(107, 145, 120, .22); color: #a9cfb7; }
.badge--pending { border-color: rgba(245, 239, 227, .35); background: rgba(245, 239, 227, .10); color: rgba(245, 239, 227, .78); }
.badge--void { border-color: rgba(178, 58, 46, .75); background: rgba(178, 58, 46, .22); color: #eaa79d; }

.order-info {
  padding: 6px 18px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.info-item { padding: 9px 0; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.info-item:nth-last-child(-n+2) { border-bottom: none; }
.info-item .k {
  display: block;
  font-size: 11.5px;
  letter-spacing: 1.5px;
  color: var(--muted);
}
.info-item .v {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.info-item.full { grid-column: 1 / -1; }
.mono { font-family: var(--font-mono); letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.dash { color: var(--faint); }

/* ---------- 横向流程条 ---------- */
.flowbar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 12px 12px;
  margin-top: 14px;
}
.flowbar-track {
  display: grid;
  grid-template-columns: repeat(var(--fb-count, 7), minmax(0, 1fr));
  align-items: start;
}
.fb-item { position: relative; text-align: center; padding-top: 14px; min-width: 0; }
.fb-item::before {
  content: "";
  position: absolute;
  top: 5px; left: 50%; right: -50%;
  height: 1px;
  background: var(--line);
}
.fb-item:last-child::before { display: none; }
.fb-dot {
  position: relative;
  width: 11px; height: 11px;
  margin: 0 auto;
  border-radius: 50%;
  background: var(--card);
  border: 1.5px solid var(--line);
}
.fb-name {
  display: block;
  margin-top: 7px;
  font-size: 11px;
  line-height: 1.35;
  color: var(--faint);
  letter-spacing: .5px;
}
.fb-item.is-done .fb-dot { background: var(--green); border-color: var(--green); }
.fb-item.is-done .fb-name { color: var(--green); }
.fb-item.is-done::before { background: var(--green); }
.fb-item.is-current .fb-dot {
  background: var(--cinnabar);
  border-color: var(--cinnabar);
  box-shadow: 0 0 0 4px rgba(178, 58, 46, .16);
  animation: pulse 1.9s ease-out infinite;
}
.fb-item.is-current .fb-name { color: var(--cinnabar); font-weight: 600; }
.fb-item.is-current::before { background: linear-gradient(90deg, var(--green), var(--cinnabar)); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(178, 58, 46, .30); }
  70% { box-shadow: 0 0 0 7px rgba(178, 58, 46, 0); }
  100% { box-shadow: 0 0 0 0 rgba(178, 58, 46, 0); }
}

/* ---------- 时间轴 ---------- */
.timeline {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 4px 0;
  overflow: hidden;
}
.step {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 13px;
  padding: 15px 16px;
  animation: stepIn .5s ease both;
}
@keyframes stepIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.step::before {
  content: "";
  position: absolute;
  left: 32px; top: 0; bottom: 0;
  width: 2px;
  background: var(--line-soft);
}
.step:first-child::before { top: 24px; }
.step:last-child::before { bottom: auto; height: 26px; }
.step.is-done::before,
.step.is-current::before { background: var(--green); }

.node {
  position: relative;
  z-index: 1;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper-2);
  border: 1.5px solid var(--line);
  color: var(--muted);
}
.node svg { width: 17px; height: 17px; }
.step.is-done .node {
  background: var(--green);
  border-color: var(--green);
  color: #f3f7f4;
}
.step.is-current .node {
  background: var(--card);
  border-color: var(--cinnabar);
  color: var(--cinnabar);
  box-shadow: 0 0 0 5px rgba(178, 58, 46, .12);
  animation: pulse 2s ease-out infinite;
}
.step.is-current .node .dot-core {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--cinnabar);
}
.step.is-pending .node { opacity: .8; border-style: dashed; }

.step-main { min-width: 0; }
.step-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-name {
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--ink);
}
.step-icon { color: var(--gold); flex: 0 0 auto; display: inline-flex; align-items: center; }
.step-icon svg { width: 15px; height: 15px; display: block; }
.step-time {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.step.is-current .step-time {
  background: var(--cinnabar);
  border-color: var(--cinnabar);
  color: #fff;
  letter-spacing: .5px;
}
.step.is-pending .step-name { color: var(--muted); }
.step.is-pending .step-time { background: transparent; border-color: transparent; color: var(--faint); }
.step-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.step-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 2px 8px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.chip .chip-k { color: var(--muted); margin-right: 4px; }
.chip--param { border-color: rgba(201, 168, 106, .55); background: rgba(201, 168, 106, .12); color: #6d5630; }
.tag-abnormal {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #fff;
  background: var(--cinnabar);
  border-radius: 5px;
  padding: 1px 8px;
}
.step.is-abnormal { background: var(--cinnabar-wash); }
.step-remark {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-soft);
  border-left: 2px solid var(--gold);
  padding-left: 9px;
  overflow-wrap: anywhere;
}

/* 环节照片 */
.photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo-thumb {
  width: 84px; height: 84px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper-2);
  cursor: zoom-in;
  box-shadow: var(--shadow-sm);
  transition: transform .18s, box-shadow .2s;
}
.photo-thumb:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(43, 36, 28, .14); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-broken {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--paper-2);
  text-align: center;
  padding: 4px;
}

/* =============================================================
   药品清单
   ============================================================= */
.med-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.med-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-soft);
  align-items: start;
}
.med-item:last-of-type { border-bottom: none; }
.med-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.med-idx {
  flex: 0 0 auto;
  min-width: 20px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.med-name {
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: .5px;
}
.med-amount {
  font-size: 13px;
  color: var(--cinnabar-deep);
  background: var(--cinnabar-wash);
  border-radius: 5px;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
.med-spec { font-size: 12px; color: var(--muted); }
.med-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 12px;
  margin-top: 6px;
}
.med-cell { font-size: 12.5px; color: var(--ink-soft); min-width: 0; overflow-wrap: anywhere; }
.med-cell .mk { color: var(--muted); margin-right: 4px; }
.med-qr {
  grid-column: 2;
  grid-row: 1 / span 2;
  width: 74px; height: 74px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: zoom-in;
  align-self: start;
  transition: box-shadow .2s, transform .18s;
}
.med-qr:hover { box-shadow: 0 5px 14px rgba(43, 36, 28, .14); transform: translateY(-1px); }
.med-qr img { width: 100%; height: 100%; display: block; object-fit: contain; }
.med-qr-slot { width: 74px; height: 74px; }
.med-line { font-size: 12.5px; color: var(--ink-soft); min-width: 0; overflow-wrap: anywhere; }
.med-line .mk { color: var(--muted); }
/* 溯源入口：只显示"药品溯源查看"，不把地址串甩给患者 */
.med-link {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--green);
  text-decoration: none;
  border-bottom: 1px dashed rgba(63, 90, 75, .5);
  align-self: baseline;
}
.med-link:hover { color: var(--cinnabar-deep); border-bottom-color: rgba(178, 58, 46, .5); }
/* 缺溯源地址时不在每味药下面硬凑内容（按要求患者端不显示批号/供应商），
   只在清单顶部给一句说明：紧跟 section-tip，贴紧上一行 */
.med-trace-note { margin-top: -6px; }

/* 冷备药兜底说明：早期中药饮片没有追溯码、命中白名单固定地址时显示。
   2026-11-10 起按院方要求做成红字（这条是要患者「去找客服」的，不该长得像普通说明） */
.med-fallback-note {
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(178, 58, 46, 0.34);
  border-left: 3px solid var(--cinnabar);
  border-radius: 6px;
  background: var(--cinnabar-wash);
  color: var(--cinnabar-deep);
  line-height: 1.55;
}
/* 这一味没有能点开的溯源入口：条目上写「需联系客服获取」（文字与链接都在后台改），同样用红字 */
.med-missing {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--cinnabar);
  text-decoration: none;
  border-bottom: 1px dashed rgba(178, 58, 46, .5);
  align-self: baseline;
}
.med-missing:hover { color: var(--cinnabar-deep); border-bottom-color: rgba(178, 58, 46, .8); }
.med-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 16px;
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}
.med-foot .seal-note {
  font-family: var(--font-serif);
  color: var(--cinnabar-deep);
  letter-spacing: 1px;
}

/* =============================================================
   溯源视频
   ============================================================= */
.video-list { display: flex; flex-direction: column; gap: 12px; }
/* 溯源视频那一栏的提示一律红字（2026-11-10 院方口径：和药品清单里那句法规说明同一套醒目度） */
.video-tip { color: var(--cinnabar-deep); }
/* 影像保留周期提示：文字由后台设置 site.videoRetentionNote 配（留空＝整行不渲染） */
.video-retention-note {
  margin-top: 6px;
  padding: 9px 12px;
  border: 1px solid rgba(178, 58, 46, 0.34);
  border-left: 3px solid var(--cinnabar);
  border-radius: 6px;
  background: var(--cinnabar-wash);
  color: var(--cinnabar-deep);
  line-height: 1.55;
}
.video-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 13px 15px 14px;
}
.video-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 600; letter-spacing: .5px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.video-stage {
  font-size: 11.5px; font-weight: 500;
  color: var(--green);
  background: var(--green-wash);
  border: 1px solid rgba(63, 90, 75, .3);
  border-radius: 5px;
  padding: 0 7px;
}
.video-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 280px;
  background: #171310;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
  object-fit: contain;
}
.video-note { font-size: 12.5px; color: var(--cinnabar-deep); margin-top: 8px; }
/* 录像还没生成好 / 暂时看不了：给患者一句说明，不放一个加载失败的播放器 */
.video-wait {
  background: var(--cinnabar-wash);
  border: 1px dashed rgba(178, 58, 46, .45);
  border-radius: 10px;
  padding: 14px 13px;
  font-size: 13px;
  color: var(--cinnabar-deep);
}
.video-ext {
  background: var(--cinnabar-wash);
  border: 1px dashed rgba(178, 58, 46, .45);
  border-radius: 10px;
  padding: 12px 13px;
  font-size: 13px;
  color: var(--cinnabar-deep);
}
.video-url {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
}
.video-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.video-actions .btn { text-decoration: none; }

/* =============================================================
   记录列表（多条命中）
   ============================================================= */
.list-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.list-tip {
  padding: 11px 16px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
}
.list-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 16px 15px;
  font-family: inherit;
  color: var(--ink);
  cursor: pointer;
  position: relative;
  transition: background .2s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--paper-2); }
.list-item::after {
  content: "查看流程 ›";
  position: absolute;
  right: 16px; bottom: 13px;
  font-size: 12px;
  color: var(--cinnabar-deep);
}
.li-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.li-no { font-family: var(--font-mono); font-size: 14px; letter-spacing: .5px; font-weight: 600; }.li-badge {
  font-size: 11.5px;
  padding: 1px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink-soft);
  letter-spacing: .5px;
}
.li-badge--doing { border-color: rgba(178, 58, 46, .4); background: var(--cinnabar-wash); color: var(--cinnabar-deep); }
.li-badge--ready { border-color: rgba(201, 168, 106, .6); background: rgba(201, 168, 106, .16); color: #7a6134; }
.li-badge--done { border-color: rgba(63, 90, 75, .35); background: var(--green-wash); color: var(--green); }
.li-badge--pending { color: var(--muted); }
.li-badge--void { border-color: rgba(178, 58, 46, .5); background: var(--cinnabar-wash); color: var(--cinnabar-deep); }
.li-name {
  display: block;
  margin-top: 6px;
  font-family: var(--font-serif);
  font-size: 15.5px;
  letter-spacing: .5px;
}
.li-rows { margin-top: 7px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; padding-right: 78px; }
.li-row { font-size: 12.5px; color: var(--ink-soft); min-width: 0; overflow-wrap: anywhere; }
.li-row .lk { color: var(--muted); margin-right: 4px; }
.li-row .mono { font-size: 12px; }
.list-item[aria-busy="true"] { cursor: wait; opacity: .7; }

/* =============================================================
   失败 / 作废
   ============================================================= */
.fail-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 20px 24px;
  text-align: center;
  margin-top: 18px;
}
.fail-icon {
  width: 62px; height: 62px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--cinnabar-wash);
  color: var(--cinnabar);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(178, 58, 46, .28);
}
.fail-icon svg { width: 30px; height: 30px; }
.fail-title {
  font-family: var(--font-serif);
  font-size: 21px; font-weight: 600; letter-spacing: 1px;
}
.fail-sub { font-size: 13.5px; color: var(--muted); margin-top: 7px; }
.fail-code {
  display: inline-block;
  margin-top: 12px;
  padding: 3px 11px;
  font-size: 11.5px;
  letter-spacing: 1px;
  color: var(--cinnabar-deep);
  background: var(--paper-2);
  border: 1px dashed var(--cinnabar);
  border-radius: 6px;
  font-family: var(--font-mono);
}
.fail-reasons {
  margin: 20px auto 0;
  max-width: 460px;
  text-align: left;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 14px 16px;
}
.fail-reasons h3 {
  font-family: var(--font-serif);
  font-size: 14.5px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
}
.fail-reasons h3::before { content: ""; width: 4px; height: 15px; background: var(--gold); border-radius: 2px; }
.fail-reasons li {
  list-style: none;
  position: relative;
  padding-left: 21px;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 7px;
  line-height: 1.6;
}
.fail-reasons li::before {
  content: "!";
  position: absolute;
  left: 2px; top: 3px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--cinnabar);
  color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.fail-hint { margin-top: 14px; font-size: 13px; color: var(--green); }
.fail-actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

.void-card {
  margin-top: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--cinnabar);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
  text-align: center;
}
.void-stamp {
  display: inline-block;
  font-family: var(--font-serif);
  font-size: 18px;
  letter-spacing: 4px;
  color: var(--cinnabar);
  border: 2px solid rgba(178, 58, 46, .6);
  border-radius: 8px;
  padding: 5px 16px;
  transform: rotate(-4deg);
  opacity: .9;
}
.void-sub { font-size: 13px; color: var(--muted); margin-top: 12px; }

/* =============================================================
   提示（「溯源查询须知」卡）/ 页脚
   「取药门店」卡已按院方口径撤掉；现在只有须知末条「超期后可在门店申请调取」提到门店
   ============================================================= */
.notice { margin-top: 24px; border-left: 3px solid var(--gold); }
.notice-list { list-style: none; margin-top: 6px; }
.notice-list li {
  position: relative;
  padding-left: 16px;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-top: 6px;
}
.notice-list li::before { content: "·"; position: absolute; left: 3px; color: var(--gold); font-weight: 700; }
/* 须知条目比较长（法规口径），行距松一点、段间留白大一点 */
.notice-list li { margin-top: 8px; line-height: 1.75; }

/* 须知最后一行：遇到问题找客服（后面跟着「点击联系客服」的链接，链接地址 = site.wxServiceUrl） */
.notice-contact {
  margin-top: 14px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.75;
}
.notice-contact[hidden] { display: none; }

.site-footer {
  margin: 26px 0 30px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 0 18px;
  line-height: 1.7;
}
.site-footer .rule {
  display: flex; align-items: center; gap: 8px;
  max-width: 320px; margin: 0 auto 10px;
}
.site-footer .rule i { flex: 1; height: 1px; background: rgba(201, 168, 106, .5); font-style: normal; }
.site-footer .rule span { color: var(--gold); font-size: 10px; letter-spacing: 3px; }

.noscript {
  margin-top: 20px;
  background: var(--cinnabar-wash);
  border: 1px dashed var(--cinnabar);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--cinnabar-deep);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(16px);
  max-width: calc(100vw - 32px);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease;
  z-index: 60;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .28);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.warn { background: var(--cinnabar-deep); }

/* ---------- 调剂单号：输入框 + 扫码按钮 ---------- */
.input-with-btn { display: flex; align-items: stretch; gap: 8px; }
.input-code { flex: 1 1 auto; min-width: 0; font-size: 15.5px; }
.btn-scan {
  flex: 0 0 auto;
  min-width: 96px;
  height: 50px;
  padding: 0 12px;
  font-size: 13.5px;
  letter-spacing: 1px;
  color: #fdfaf3;
  background: linear-gradient(135deg, var(--green), #2b3f34);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(63, 90, 75, .22);
}
.btn-scan svg { width: 19px; height: 19px; flex: 0 0 auto; }
.btn-scan:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn-scan:active { transform: none; }
.btn-scan:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
.field-tip { margin-top: 6px; font-size: 12px; color: var(--muted); letter-spacing: .3px; }

/* ---------- 扫码取景框（实时取景 / 拍照识别） ---------- */
.scanner {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(20, 16, 12, .95);
  color: var(--paper);
  display: flex; flex-direction: column;
  padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  animation: lbIn .22s ease both;
}
.scanner[hidden] { display: none; }
.scanner-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.scanner-title { font-family: var(--font-serif); font-size: 16px; font-weight: 600; letter-spacing: 2px; }
.scanner-close {
  height: 32px; padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(245, 239, 227, .35);
  background: rgba(245, 239, 227, .10);
  color: var(--paper);
  font-size: 13px;
  cursor: pointer;
}
.scanner-close:hover { background: rgba(245, 239, 227, .2); }
.scanner-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 210px;
  border-radius: 12px;
  overflow: hidden;
  background: #14100c;
}
.scanner-stage video,
.scanner-stage img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background: #14100c;
}
.scanner-stage video[hidden],
.scanner-stage img[hidden] { display: none; }
.scanner.mode-photo .scanner-stage {
  background: repeating-linear-gradient(135deg, #17130f, #17130f 12px, #1c1713 12px, #1c1713 24px);
}
.scanner-frame { position: absolute; left: 6%; right: 6%; top: 50%; height: 132px; transform: translateY(-50%); }
.scanner-frame i { position: absolute; width: 26px; height: 26px; border: 2px solid var(--gold); }
.scanner-frame i:nth-child(1) { left: 0; top: 0; border-right: none; border-bottom: none; }
.scanner-frame i:nth-child(2) { right: 0; top: 0; border-left: none; border-bottom: none; }
.scanner-frame i:nth-child(3) { left: 0; bottom: 0; border-right: none; border-top: none; }
.scanner-frame i:nth-child(4) { right: 0; bottom: 0; border-left: none; border-top: none; }
.scanner-hint {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  font-size: 13px; line-height: 1.5; text-align: center;
  color: rgba(245, 239, 227, .92);
  background: rgba(20, 16, 12, .62);
  border-radius: 8px;
  padding: 8px 11px;
}
.scanner-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0 6px; }
.scanner-bar .btn { height: 38px; }
.scanner-bar .btn-quiet {
  background: rgba(245, 239, 227, .10);
  border-color: rgba(245, 239, 227, .32);
  color: var(--paper);
}
.scanner-bar .btn-quiet:hover { background: rgba(245, 239, 227, .2); }
.scanner-bar .btn-ghost { color: var(--gold-soft); }
.scanner-tip { text-align: center; font-size: 12px; color: rgba(245, 239, 227, .62); }

/* 拍照识别的入口：不能用 display:none（那样 .click() 在部分浏览器里不弹选择框），挪出可视区即可 */
.file-slot {
  position: absolute; left: -9999px; top: 0;
  width: 1px; height: 1px; opacity: 0;
  pointer-events: none;
}

body.is-scanning { overflow: hidden; }

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(24, 19, 14, .88);
  display: flex; align-items: center; justify-content: center;
  padding: 22px;
  animation: lbIn .22s ease both;
}
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox[hidden] { display: none; }
.lightbox-fig { max-width: 100%; max-height: 100%; text-align: center; }
.lightbox-fig img {
  max-width: 100%;
  max-height: 74vh;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
}
.lightbox-fig figcaption {
  margin-top: 12px;
  font-size: 13px;
  color: rgba(245, 239, 227, .85);
  overflow-wrap: anywhere;
}
.lightbox-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(245, 239, 227, .35);
  background: rgba(245, 239, 227, .10);
  color: var(--paper);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(245, 239, 227, .2); }

/* =============================================================
   响应式
   ============================================================= */
@media (min-width: 480px) {
  .hero { padding: 40px 0 48px; }
  .hero-title { font-size: 39px; letter-spacing: 10px; text-indent: 10px; }
  .hero-logo { width: 88px; height: 88px; }
  .hero-seal { width: 82px; height: 82px; font-size: 36px; }
  .card { padding: 22px 22px; }
}

@media (max-width: 359px) {
  .fb-name { font-size: 10px; letter-spacing: 0; }
  .step { grid-template-columns: 30px minmax(0, 1fr); padding: 14px 13px; }
  .node { width: 30px; height: 30px; }
  .node svg { width: 15px; height: 15px; }
  .step::before { left: 28px; }
  /* 小屏下字距收一点，别让标题折得难看 */
  .hero-title { font-size: 26px; letter-spacing: 4px; text-indent: 4px; }
  .hero-sub { font-size: 12px; letter-spacing: 3px; text-indent: 3px; }
  .hero-slogan { gap: 8px; }
  .hero-slogan .txt { font-size: 12.5px; letter-spacing: 2px; text-indent: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after { animation: none !important; transition: none !important; }
}
