:root {
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --text: #0F172A;
  --text-2: #475569;
  --muted: #64748B;
  --border: #E2E8F0;
  --primary: #2563EB;
  --primary-dark: #1D4ED8;
  --primary-soft: #EFF6FF;
  --success: #059669;
  --success-soft: #ECFDF5;
  --warning: #D97706;
  --danger: #E11D48;
  --shadow: 0 6px 20px -6px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body {
  max-width: 100%; overflow-x: hidden;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  line-height: 1.5; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
input, select, textarea { font-size: 16px; }

/* 顶栏 */
.m-header {
  position: sticky; top: 0; z-index: 40;
  height: 54px; padding: 0 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.m-brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.m-logo { width: 32px; height: 32px; flex-shrink: 0; }
.m-logo svg { width: 32px; height: 32px; display: block; }
.m-brand-text { display: flex; flex-direction: column; min-width: 0; }
.m-brand-name {
  font-size: 15px; font-weight: 800; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.02em;
}
.m-brand-sub { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--success); font-weight: 600; }
.m-dot-live { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.m-support-btn {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  background: var(--primary-soft); color: var(--primary); border: 1px solid #DBEAFE;
  border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.m-support-btn svg { width: 14px; height: 14px; }

/* 主内容区 */
.m-main { padding: 12px 14px calc(86px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
.m-view { display: none; }
.m-view.active { display: block; animation: mFade 0.2s ease; }
@keyframes mFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* 高奢渐变 Hero 卡片 */
.m-hero-card {
  position: relative; overflow: hidden;
  border-radius: 20px; padding: 18px 16px 16px; color: #fff;
  background: linear-gradient(140deg, #0F172A 0%, #1E3A8A 58%, #2563EB 100%);
  box-shadow: 0 14px 30px -10px rgba(37, 99, 235, 0.42);
  margin-bottom: 12px;
}
.m-hero-card::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 150px; height: 150px;
  border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.18), transparent 70%);
  pointer-events: none;
}
.m-hero-badge {
  display: inline-block; background: rgba(255, 255, 255, 0.16); backdrop-filter: blur(8px);
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; margin-bottom: 8px;
}
.m-hero-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; margin-bottom: 5px; }
.m-hero-sub { font-size: 12.5px; opacity: 0.88; line-height: 1.45; margin-bottom: 10px; }
.m-hero-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.m-hero-tags span {
  font-size: 11px; font-weight: 600; background: rgba(255,255,255,0.14);
  padding: 2px 8px; border-radius: 6px;
}
.m-search-bar {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.96); border-radius: 13px; padding: 4px 10px;
}
.m-search-bar svg { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.m-search-bar input {
  flex: 1; border: none; outline: none; background: transparent; color: var(--text);
  padding: 6px 0; font-size: 14.5px; min-width: 0;
}
.m-clear-btn {
  border: none; background: #E2E8F0; color: var(--text-2); border-radius: 7px;
  padding: 4px 8px; font-size: 11.5px; font-weight: 600;
}

.m-notice-bar, .m-sandbox-bar {
  display: flex; align-items: flex-start; gap: 8px; border-radius: 12px;
  padding: 9px 12px; font-size: 12px; margin-bottom: 10px;
}
.m-notice-bar { background: #fff; border: 1px solid #DBEAFE; color: var(--text-2); }
.m-notice-pill {
  flex-shrink: 0; background: var(--primary); color: #fff; font-weight: 700;
  font-size: 10.5px; padding: 1px 6px; border-radius: 5px; margin-top: 1px;
}
.m-sandbox-bar { background: #FFFBEB; border: 1px solid #FDE68A; color: #92400E; }
.m-sandbox-pill {
  flex-shrink: 0; background: #D97706; color: #fff; font-weight: 700;
  font-size: 10.5px; padding: 1px 6px; border-radius: 5px;
}

/* 横向分类滚动 */
.m-cat-scroll {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px;
  scrollbar-width: none; -ms-overflow-style: none;
}
.m-cat-scroll::-webkit-scrollbar { display: none; }
.m-cat-chip {
  flex-shrink: 0; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.m-cat-chip.active {
  background: var(--text); color: #fff; border-color: var(--text);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
}

.m-filter-row {
  display: flex; align-items: center; justify-content: space-between; margin: 4px 0 12px;
}
.m-chk-pill {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--border); padding: 5px 11px; border-radius: 9px; font-size: 12.5px; color: var(--text-2);
}
.m-sort-select {
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  padding: 5px 10px; font-size: 12.5px; color: var(--text); outline: none;
}

/* 横排拟物电子礼品卡商品卡片 */
.m-product-list { display: flex; flex-direction: column; gap: 12px; }
.m-prod-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 12px; display: flex; gap: 12px; box-shadow: var(--shadow); align-items: stretch;
}
.m-mini-card {
  width: 116px; min-height: 86px; border-radius: 13px; padding: 10px; color: #fff;
  display: flex; flex-direction: column; justify-content: space-between; flex-shrink: 0;
  position: relative; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 6px 14px -4px rgba(15, 23, 42, 0.25);
}
.m-mc-top { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.m-mc-tag {
  background: rgba(255,255,255,0.22); padding: 1px 6px; border-radius: 999px;
  font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.m-mc-hot { background: #FDE047; color: #713F12; font-size: 9.5px; font-weight: 800; padding: 1px 5px; border-radius: 4px; flex-shrink: 0; }
.m-mc-chip { width: 22px; height: 15px; border-radius: 3px; background: linear-gradient(135deg, #FDE68A, #D97706); opacity: 0.9; }
.m-mc-face { font-size: 20px; font-weight: 800; line-height: 1; text-align: right; }
.m-mc-face small { font-size: 12px; font-weight: 700; }

/* 8 套品牌主题 */
.theme-jd_crimson { background: linear-gradient(135deg, #E11D48 0%, #9F1239 100%); }
.theme-walmart_blue { background: linear-gradient(135deg, #0284C7 0%, #1E3A8A 100%); }
.theme-sams_emerald { background: linear-gradient(135deg, #059669 0%, #064E3B 100%); }
.theme-tmall_gold { background: linear-gradient(135deg, #EA580C 0%, #9A3412 100%); }
.theme-obsidian_gold { background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%); border: 1px solid rgba(251, 191, 36, 0.4); }
.theme-violet_royal { background: linear-gradient(135deg, #7C3AED 0%, #4C1D95 100%); }
.theme-sky_cyan { background: linear-gradient(135deg, #0EA5E9 0%, #0369A1 100%); }
.theme-forest_sage { background: linear-gradient(135deg, #15803D 0%, #14532D 100%); }

.m-prod-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: space-between; }
.m-prod-title { font-size: 14.5px; font-weight: 700; color: var(--text); line-height: 1.3; margin-bottom: 3px; }
.m-prod-sub {
  font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 6px;
}
.m-prod-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.m-price-num { font-size: 19px; font-weight: 800; color: var(--danger); line-height: 1.1; }
.m-price-num small { font-size: 12px; }
.m-price-orig { font-size: 11px; color: #94A3B8; text-decoration: line-through; margin-left: 4px; }
.m-stock-line { font-size: 11.5px; font-weight: 600; margin-top: 2px; }
.m-stock-ok { color: var(--success); }
.m-stock-low { color: var(--warning); }
.m-stock-out { color: var(--muted); }

.m-buy-btn {
  border: none; border-radius: 11px; padding: 9px 15px; font-size: 13px; font-weight: 700;
  background: linear-gradient(135deg, #2563EB, #1D4ED8); color: #fff; flex-shrink: 0; cursor: pointer;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.28);
}
.m-buy-btn:disabled { background: #CBD5E1; box-shadow: none; color: #64748B; cursor: not-allowed; }

/* 底部固定导航栏 */
.m-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.m-tab {
  border: none; background: transparent; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; padding: 4px 0;
  color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; border-radius: 10px;
}
.m-tab svg { width: 21px; height: 21px; }
.m-tab.active { color: var(--primary); }
.m-tab.active svg { stroke: var(--primary); }

/* 卡片与表单 */
.m-sec-head { margin-bottom: 14px; }
.m-sec-head h2 { font-size: 20px; font-weight: 800; }
.m-sec-head p { font-size: 12.5px; color: var(--muted); }

.m-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.m-card-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.m-seg-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: #F1F5F9; padding: 4px; border-radius: 11px; margin-bottom: 14px;
}
.m-seg-btn {
  border: none; background: transparent; padding: 8px 6px; border-radius: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--text-2); cursor: pointer;
}
.m-seg-btn.active { background: #fff; color: var(--primary); box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06); }

.m-field { margin-bottom: 12px; }
.m-field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.m-field input, .m-field select, .m-field textarea {
  width: 100%; border: 1.5px solid var(--border); border-radius: 11px;
  padding: 10px 12px; background: #fff; color: var(--text); outline: none;
}
.m-field input:focus, .m-field textarea:focus { border-color: var(--primary); }
.m-hint { font-weight: 400; color: var(--muted); font-size: 11.5px; }

.m-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 12px; padding: 11px 16px;
  font-size: 14px; font-weight: 700; cursor: pointer;
}
.m-btn-sm { padding: 7px 11px; font-size: 12.5px; border-radius: 9px; }
.m-btn-block { width: 100%; }
.m-btn-primary { background: linear-gradient(135deg, #2563EB, #1D4ED8); color: #fff; }
.m-btn-secondary { background: #F8FAFC; border-color: var(--border); color: var(--text); }
.m-btn-success { background: linear-gradient(135deg, #059669, #047857); color: #fff; }

/* 本机最近订单卡片 */
.m-recent-item {
  border: 1px solid var(--border); border-radius: 13px; padding: 12px;
  background: #F8FAFC; margin-bottom: 9px;
}
.m-recent-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.m-recent-btns { display: flex; gap: 8px; margin-top: 8px; }

.m-status-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.m-st-paid, .m-st-replaced, .m-st-approved_refund { background: var(--success-soft); color: var(--success); }
.m-st-pending, .m-st-pending_confirm { background: #FFFBEB; color: var(--warning); }
.m-st-expired, .m-st-rejected, .m-st-refunded { background: #FEF2F2; color: var(--danger); }

.m-verified-bar {
  background: var(--success-soft); border: 1px solid #A7F3D0; color: #065F46;
  padding: 10px 12px; border-radius: 10px; font-size: 12.5px;
}
.m-check-list { display: grid; gap: 8px; }
.m-check-item {
  display: flex; align-items: center; gap: 8px; padding: 9px 11px;
  background: #F8FAFC; border: 1px solid var(--border); border-radius: 10px; font-size: 13px;
}
.m-success-card {
  background: var(--success-soft); border: 1px solid #A7F3D0; color: #065F46;
  padding: 15px; border-radius: 14px; font-size: 13.5px;
}

/* 须知与 FAQ */
.m-support-val {
  background: #EFF6FF; color: var(--primary); font-weight: 700; padding: 12px;
  border-radius: 11px; text-align: center; margin-bottom: 10px; word-break: break-all;
}
.m-prose { white-space: pre-wrap; font-family: inherit; font-size: 13.5px; color: var(--text-2); line-height: 1.8; }
.m-faq-item { border-bottom: 1px solid var(--border); padding: 10px 0; }
.m-faq-item:last-child { border-bottom: none; }
.m-faq-q { font-weight: 700; font-size: 13.5px; margin-bottom: 4px; }
.m-faq-a { font-size: 12.5px; color: var(--text-2); }
.m-switch-desktop { text-align: center; margin: 12px 0 8px; }
.m-switch-desktop a { font-size: 12.5px; color: var(--muted); text-decoration: underline; }

/* 底部抽屉 Bottom Sheet */
.m-sheet-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 23, 42, 0.56); backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
}
.m-sheet-overlay.open { display: flex; }
.m-sheet {
  width: 100%; max-width: 640px; max-height: 90vh;
  background: #fff; border-radius: 24px 24px 0 0;
  display: flex; flex-direction: column; overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
  animation: sheetUp 0.22s ease;
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.m-sheet-handle { width: 40px; height: 4px; border-radius: 999px; background: #CBD5E1; margin: 10px auto 2px; flex-shrink: 0; }
.m-sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px 12px; border-bottom: 1px solid var(--border);
}
.m-sheet-head h3 { font-size: 16.5px; font-weight: 800; }
.m-sheet-close {
  border: none; background: #F1F5F9; width: 30px; height: 30px; border-radius: 50%;
  font-size: 18px; color: var(--text-2); cursor: pointer;
}
.m-sheet-body { padding: 16px 18px 22px; overflow-y: auto; }

/* 抽屉内购买控件与批量提卡 */
.m-qty-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.m-qty-stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; }
.m-qty-stepper button { width: 36px; height: 34px; border: none; background: #F1F5F9; font-size: 18px; font-weight: 700; }
.m-qty-stepper input { width: 46px; border: none; text-align: center; font-weight: 700; outline: none; }

.m-pay-list { display: grid; gap: 8px; margin-bottom: 12px; }
.m-pay-item {
  border: 1.5px solid var(--border); border-radius: 12px; padding: 10px 12px;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.m-pay-item.selected { border-color: var(--primary); background: var(--primary-soft); }
.m-pay-ico {
  width: 32px; height: 32px; border-radius: 9px; color: #fff; font-weight: 800;
  display: grid; place-items: center; flex-shrink: 0; font-size: 13px;
}
.m-pay-ico.alipay { background: #1677FF; }
.m-pay-ico.wechat { background: #07C160; }
.m-pay-ico.sandbox { background: #D97706; }

.m-fee-tag {
  background: #FFF7ED; color: #C2410C; border: 1px solid #FED7AA;
  font-size: 10.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; margin-left: 4px;
}
.m-auto-tag {
  background: #ECFDF5; color: #047857; border: 1px solid #A7F3D0;
  font-size: 10.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; margin-left: 4px;
}

.m-price-box {
  background: #F8FAFC; border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 14px;
}
.m-pb-row { display: flex; justify-content: space-between; padding: 2px 0; color: var(--text-2); }

.m-qr-box { text-align: center; padding: 14px; border: 1px solid var(--border); border-radius: 14px; margin: 10px 0; background: #fff; }
.m-qr-box img { max-width: 210px; max-height: 210px; }

.m-deliv-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.m-card-row {
  background: #F8FAFC; border: 1px solid var(--border); border-radius: 11px; padding: 10px 12px; margin-bottom: 8px;
}
.m-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; word-break: break-all; font-size: 13px; }
.m-raw-ta {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 9px;
  font-family: ui-monospace, monospace; font-size: 12px; background: #F8FAFC; margin-top: 8px;
}

.m-empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.m-empty-icon { font-size: 36px; margin-bottom: 8px; }

.m-toast-box {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 6px; width: max-content; max-width: 90vw;
}
.m-toast {
  background: #0F172A; color: #fff; padding: 9px 15px; border-radius: 10px; font-size: 13px; text-align: center;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.25);
}
.m-toast.ok { background: #065F46; }
.m-toast.err { background: #B91C1C; }
