/* ============================================================
   苗医温通养护平台 · 移动端样式（患者端 / 店铺端共用）
   设计语言：苗药草本深绿 + 哑金 + 米白，承接原项目圆角卡片风格
   ============================================================ */
:root {
  --brand: #0e3b2e;
  --brand-2: #1c6b52;
  --brand-soft: #e8f1ec;
  --gold: #c9a227;
  --gold-soft: #f6efd8;
  --ink: #16221c;
  --text: #2a332c;
  --muted: #7b857d;
  --line: #e7e3d8;
  --bg: #f6f3ec;
  --card: #ffffff;
  --danger: #c0392b;
  --warn: #b8860b;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(14, 59, 46, 0.06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--brand-2); text-decoration: none; }
img { max-width: 100%; display: block; }

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: 78px;
  position: relative;
}

/* ---------- 顶部 ---------- */
.topbar {
  background: linear-gradient(135deg, var(--brand) 0%, #16453a 100%);
  color: #fff;
  padding: 18px 18px 20px;
}
.topbar.slim { padding: 14px 16px; }
.topbar-row { display: flex; align-items: center; gap: 10px; }
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; letter-spacing: 0.5px; }
.topbar .sub { font-size: 12px; color: rgba(255, 255, 255, 0.7); margin-top: 2px; }
.topbar .gold-line { width: 28px; height: 2px; background: var(--gold); border-radius: 2px; margin: 8px 0; }
.topbar .back { color: #fff; font-size: 20px; line-height: 1; padding-right: 4px; }

.navbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 14px;
  gap: 10px;
}
.navbar .title { font-size: 16px; font-weight: 600; }
.navbar a { color: #fff; }

/* ---------- 统一返回按钮（二级/三级页） ---------- */
.nav-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  height: 34px;
  padding: 0 13px 0 6px;
  margin-left: -2px;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff !important;
  font-size: 13.5px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.nav-back .arw {
  font-size: 19px;
  line-height: 1;
  margin: -2px 2px 0 0;
}
.nav-back:active { background: rgba(255, 255, 255, 0.34); }
.nav-back.right { margin-left: auto; margin-right: -2px; }
@media (hover: hover) { .nav-back:hover { background: rgba(255, 255, 255, 0.26); } }
/* 深色文字版（浅底页面用） */
.nav-back.dark { background: rgba(28, 107, 82, 0.1); color: var(--brand) !important; }

/* ---------- 卡片与版块 ---------- */
.wrap { padding: 14px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.card-title .more { font-size: 12px; color: var(--muted); font-weight: 400; }
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin: 18px 0 10px;
  padding-left: 10px;
  border-left: 3px solid var(--gold);
  line-height: 1.2;
}

/* ---------- 店铺头图 ---------- */
.store-hero {
  background: linear-gradient(150deg, #0e3b2e 0%, #1c6b52 100%);
  color: #fff;
  padding: 22px 18px 26px;
  position: relative;
  overflow: hidden;
}
.store-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(201, 162, 39, 0.12);
}
.store-hero h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: 0.5px; }
.store-hero .meta { font-size: 13px; color: rgba(255, 255, 255, 0.78); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  line-height: 1.7;
  vertical-align: middle;
}
.badge-gold { background: var(--gold-soft); color: #8a6d12; }
.badge-green { background: var(--brand-soft); color: var(--brand); }
.badge-red { background: #fdecea; color: var(--danger); }
.badge-gray { background: #eef0ee; color: #666; }
.badge-blue { background: #eaf2fb; color: #2b6cb0; }

/* ---------- 套餐 ---------- */
.pkg {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.pkg .thumb {
  width: 92px;
  height: 92px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--brand-soft);
  flex-shrink: 0;
}
.pkg .thumb-ph {
  width: 92px;
  height: 92px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e8f1ec, #d6e6dd);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.pkg .info { flex: 1; min-width: 0; }
.pkg .name { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.pkg .desc { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 6px; }
.pkg .price { color: var(--danger); font-weight: 700; font-size: 18px; }
.pkg .price small { font-size: 12px; font-weight: 400; }
.pkg .price .origin,
.pkg .origin { color: var(--muted); font-size: 12px; text-decoration: line-through; margin-left: 6px; font-weight: 400; }
.pkg .sales { font-size: 11px; color: var(--muted); margin-left: 8px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink); margin-bottom: 6px; font-weight: 500; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.input, .select, textarea.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus, .select:focus, textarea.input:focus { border-color: var(--brand-2); }
textarea.input { min-height: 84px; resize: vertical; }
.row2 { display: flex; gap: 10px; }
.row2 > * { flex: 1; }

.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}
.btn:active { opacity: 0.85; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-outline { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-ghost { background: #eef0ee; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { display: inline-block; width: auto; padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- 列表 ---------- */
.list { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #f2efe7;
}
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 14px; color: var(--ink); font-weight: 500; }
.list-item .li-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-item .li-right { text-align: right; font-size: 13px; }

.kv { display: flex; padding: 9px 0; border-bottom: 1px dashed #f0ece2; font-size: 14px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); width: 96px; flex-shrink: 0; }
.kv .v { color: var(--text); flex: 1; word-break: break-all; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 13px; }
.empty .ico { font-size: 34px; opacity: 0.35; display: block; margin-bottom: 8px; }

/* ---------- 状态条 ---------- */
.notice {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
  line-height: 1.6;
}
.notice-info { background: var(--brand-soft); color: var(--brand); }
.notice-warn { background: #fdf6e3; color: #8a6d12; border: 1px solid #f0e0b0; }
.notice-danger { background: #fdecea; color: var(--danger); }
.notice-ok { background: #eaf6ee; color: #1e7b45; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  height: 58px;
  background: #fff;
  border-top: 1px solid var(--line);
  display: flex;
  z-index: 40;
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
  gap: 1px;
}
.tabbar a .ico { font-size: 18px; line-height: 1; }
.tabbar a.on { color: var(--brand); font-weight: 600; }

/* ---------- 底部操作条 ---------- */
.actionbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 40;
}
.actionbar .sum { flex: 1; font-size: 13px; color: var(--muted); }
.actionbar .sum b { color: var(--danger); font-size: 19px; }
.actionbar .btn { width: auto; padding: 11px 26px; }

/* ---------- 二维码 ---------- */
.qrbox { text-align: center; padding: 8px 0 4px; }
.qrbox img {
  width: 200px;
  height: 200px;
  margin: 0 auto;
  border-radius: 10px;
  border: 6px solid #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
.qrbox .tip { font-size: 12px; color: var(--muted); margin-top: 10px; }
.qrbox .code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--brand); letter-spacing: 1px; }

/* ---------- 数据格 ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: #fff;
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat .n { font-size: 20px; font-weight: 700; color: var(--brand); line-height: 1.3; }
.stat .l { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---------- 步骤条 ---------- */
.steps { display: flex; margin: 4px 0 14px; }
.step { flex: 1; text-align: center; position: relative; font-size: 11px; color: var(--muted); }
.step::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 4px;
  border-radius: 50%;
  background: #e6e6e0;
  color: #fff;
  line-height: 22px;
  font-size: 12px;
}
.step.done::before { content: "✓"; background: var(--brand-2); }
.step.cur::before { content: "●"; background: var(--gold); }
.step.done, .step.cur { color: var(--ink); font-weight: 500; }

/* ---------- 页脚 ---------- */
.footer { text-align: center; font-size: 11px; color: #a8b0a9; padding: 22px 16px 30px; line-height: 1.8; }

/* ---------- 上传 ---------- */
.upload-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.upload-grid .thumb-item { position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.upload-grid .thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-grid label.add {
  width: 84px;
  height: 84px;
  border: 1px dashed #c8cfc9;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  background: #fbfaf6;
}
.upload-grid label.add span { font-size: 20px; line-height: 1; }

/* ---------- 提示条 ---------- */
.toast-bar {
  background: var(--brand-soft);
  color: var(--brand);
  padding: 9px 14px;
  font-size: 13px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.toast-bar.error { background: #fdecea; color: var(--danger); }

.pill-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.pill {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.pill.on { background: var(--brand); color: #fff; border-color: var(--brand); }

.checkout-line { display: flex; justify-content: space-between; font-size: 14px; padding: 8px 0; }
.checkout-line.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 12px; font-weight: 600; }
.checkout-line.total b { color: var(--danger); font-size: 18px; }

.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.tc { text-align: center; }
.f12 { font-size: 12px; }
.muted { color: var(--muted); }

/* ---------- 患者支付：方式切换 + 收款码 ---------- */
.paytabs {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.paytab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.paytab::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #cbd5ce;
  background: #fff;
}
.paytab.on {
  border-color: var(--brand);
  background: #edf6f1;
  color: var(--brand);
}
.paytab.on::before {
  border: 5px solid var(--brand);
}
.paytab:nth-child(2).on {
  border-color: #1677ff;
  background: #eef5ff;
  color: #1677ff;
}
.paytab:nth-child(2).on::before {
  border-color: #1677ff;
}

.qrpay { text-align: center; padding-top: 4px; }
.qrpay-img {
  width: 236px;
  height: 236px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
.qrpay-amount {
  margin-top: 12px;
  font-size: 26px;
  font-weight: 700;
  color: var(--danger);
  letter-spacing: 0.5px;
}
.qrpay-tip {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------- 购买支付弹层（套餐详情页） ---------- */
.paysheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 15, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  z-index: 90;
}
.paysheet-mask.on { opacity: 1; pointer-events: auto; }

.paysheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(8, 20, 15, 0.18);
  transform: translateY(103%);
  transition: transform 0.28s cubic-bezier(0.22, 0.8, 0.3, 1);
  z-index: 91;
  padding: 0 20px calc(20px + env(safe-area-inset-bottom));
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.paysheet.on { transform: translateY(0); }

.ps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 10px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}
.ps-title { font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: 0.5px; }
.ps-close {
  border: 0;
  background: #f1f0ea;
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.ps-close:active { opacity: 0.7; }

.ps-loading {
  padding: 46px 0 56px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}
.ps-spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  border: 2px solid var(--brand-soft);
  border-top-color: var(--brand-2);
  border-radius: 50%;
  animation: ps-rotate 0.8s linear infinite;
}
@keyframes ps-rotate { to { transform: rotate(360deg); } }

.ps-amount {
  text-align: center;
  font-size: 34px;
  font-weight: 700;
  color: var(--danger);
  letter-spacing: 0.5px;
  line-height: 1.2;
  padding: 2px 0 12px;
  font-variant-numeric: tabular-nums;
}
.ps-amount span { font-size: 20px; margin-right: 2px; font-weight: 600; }

.ps-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding-bottom: 12px;
}
.ps-tab {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}
.ps-tab.on {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.ps-qrwrap { text-align: center; }
.ps-qr {
  width: 232px;
  height: 232px;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px;
  box-shadow: 0 2px 14px rgba(14, 59, 46, 0.07);
}
.ps-qrline {
  margin-top: 8px;
  font-size: 11.5px;
  color: #a3aca5;
}

.ps-tip {
  margin-top: 14px;
  padding: 12px 14px;
  background: #f7f5ed;
  border-radius: 10px;
  font-size: 12.5px;
  color: #5a635c;
  line-height: 1.85;
  text-align: center;
}
.ps-tip b { color: var(--danger); font-weight: 700; }

.ps-status {
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.7;
  text-align: center;
  min-height: 4px;
}
.ps-status.wait { color: var(--brand-2); }
.ps-status.warn { color: var(--danger); }

.ps-later {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--muted);
  text-decoration: underline;
}

.ps-note {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.8;
  margin-bottom: 14px;
}
.ps-note-warn { background: #fff7e6; border: 1px solid #f0dcae; color: #8a5a00; }

.ps-ok { text-align: center; padding: 18px 0 26px; }
.ps-ok-ico {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 32px;
  line-height: 62px;
  box-shadow: 0 6px 20px rgba(14, 59, 46, 0.22);
}
.ps-ok-title { font-size: 19px; font-weight: 700; color: var(--brand); }
.ps-ok-amount {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 700;
  color: var(--danger);
  font-variant-numeric: tabular-nums;
}
.ps-ok-sub { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.ps-ok-hint { margin-top: 16px; font-size: 12px; color: #a3aca5; }
