/* @critical:start */
:root {
  --bg: #f5f6fa;
  --panel: #ffffff;
  --ink: #171a24;
  --ink-2: #4b5164;
  --ink-3: #858b9c;
  --line: #e6e8f0;
  --brand: #5b5bd6;
  --brand-2: #7c6cf6;
  --brand-soft: #eef0ff;
  --danger: #e11d48;
  --success: #0f9d58;
  --warn: #d97706;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(23, 26, 36, .06);
  --shadow-lg: 0 18px 50px rgba(23, 26, 36, .12);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0 0 12px; line-height: 1.35; }
p { margin: 0 0 10px; }
small { font-size: 12px; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.page { padding: 20px 16px 80px; min-height: 60vh; }
.muted { color: var(--ink-3); }
.ink2 { color: var(--ink-2); }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
/* @critical:end */

/* @critical:start */
/* ---------- 顶部 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 18px; height: 60px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; color: #fff; font-size: 14px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 16px rgba(91, 91, 214, .3);
}
.site-nav { display: flex; gap: 4px; margin-left: 10px; }
.site-nav a { padding: 7px 12px; border-radius: 9px; color: var(--ink-2); font-weight: 500; }
.site-nav a:hover, .site-nav a.active { background: var(--brand-soft); color: var(--brand); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
/* @critical:end */

/* @critical:start */
/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--brand); color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .15s; font-family: inherit; white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--success); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { height: 48px; font-size: 16px; border-radius: 12px; font-weight: 600; }
.btn.block { width: 100%; }
.btn.link { background: none; color: var(--brand); padding: 0 4px; height: auto; }
/* @critical:end */

/* @critical:start */
/* ---------- 卡片 / 表单 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card.tight { padding: 14px; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title h3 { margin: 0; font-size: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 10px; padding: 9px 12px; font-size: 14px; font-family: inherit; outline: none;
  transition: .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91, 91, 214, .12); }
.textarea { min-height: 90px; resize: vertical; }
.input.sm { padding: 6px 9px; font-size: 13px; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
/* @critical:end */

/* @critical:start */
/* ---------- 徽标 / 提示 ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: #e7f7ee; color: var(--success); }
.badge.warn { background: #fff4e5; color: var(--warn); }
.badge.danger { background: #ffe9ee; color: var(--danger); }
.badge.info { background: var(--brand-soft); color: var(--brand); }
.badge.muted { background: #f1f2f7; color: var(--ink-3); }
.alert { padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 12px; border: 1px solid transparent; }
.alert-success { background: #e9f8f0; color: #0b7a45; border-color: #c9eeda; }
.alert-danger { background: #ffeef2; color: #b3123a; border-color: #ffd3de; }
.alert-warning { background: #fff7e8; color: #96620c; border-color: #ffe6bb; }
.alert-info { background: var(--brand-soft); color: #3f3fb2; border-color: #dcdefb; }

/* 登录 / 注册页的错误提醒（views/partials/flash_box.php + app.js）
   以前登录失败只 flash 一句就 redirect，blank 布局里没人输出 —— 用户看到的就是「刷新一下没反应」。 */
.flash-stack { margin-bottom: 14px; }
.flash-item { display: flex; align-items: flex-start; gap: 8px; line-height: 1.6; }
.flash-item .flash-ico { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%;
  color: #fff; font-size: 11px; font-weight: 700; font-style: normal; line-height: 16px; text-align: center; }
.flash-item .flash-txt { min-width: 0; word-break: break-word; }
.alert-danger .flash-ico { background: #dc2626; }
.alert-warning .flash-ico { background: #d97706; }
.alert-success .flash-ico { background: #0f9d58; }
.alert-info .flash-ico { background: var(--brand); }
/* 出错时卡片轻抖一下：视线本来在别处（或刚点完按钮）也能注意到 */
@keyframes card-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.auth-card.shake { animation: card-shake .45s ease; }
@media (prefers-reduced-motion: reduce) { .auth-card.shake { animation: none; } }
/* 大写锁定提示：默认不占位，开了才出现 */
.caps-hint { display: none; font-size: 12px; color: #96620c; margin-top: 4px; }
.caps-hint.on { display: block; }

/* @critical:end */

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--ink-3); font-weight: 600; background: #fafbff; white-space: nowrap; font-size: 12px; }
.table tr:last-child td { border-bottom: 0; }
.table td.actions { white-space: nowrap; }
.table .num { font-variant-numeric: tabular-nums; }

/* @critical:start */
/* ---------- 商城 ---------- */
.hero {
  border-radius: 18px; padding: 22px; margin-bottom: 20px; color: #fff;
  background: linear-gradient(120deg, #5b5bd6, #8b5cf6 55%, #ec4899);
  box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.hero h1 { font-size: 22px; margin-bottom: 6px; }
.hero p { color: rgba(255, 255, 255, .82); margin: 0; font-size: 13px; }
.hero .hero-actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn { background: rgba(255, 255, 255, .16); backdrop-filter: blur(4px); }
.hero .btn.light { background: #fff; color: var(--brand); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  padding: 7px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  color: var(--ink-2); font-size: 13px; white-space: nowrap;
}
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }

.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.product-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; transition: .18s; box-shadow: var(--shadow);
}
.product-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.product-cover {
  aspect-ratio: 16 / 10; background: linear-gradient(135deg, #eef0ff, #f7f3ff);
  display: grid; place-items: center; color: var(--brand); font-size: 22px; font-weight: 700;
}
.product-cover img { width: 100%; height: 100%; object-fit: cover; }
.product-cover { position: relative; }

/* 商品图角落的类型角标：红色「代充 / 直充 / 卡券」 */
.type-flag {
  position: absolute; top: 0; left: 0; z-index: 2;
  padding: 3px 9px; border-radius: 0 0 10px 0;
  background: rgba(220, 38, 38, .92); color: #fff;
  font-size: 12px; font-weight: 700; line-height: 1.3; letter-spacing: 1px;
}
.type-flag-1 { background: rgba(220, 38, 38, .92); }   /* 卡券 红 */
.type-flag-2 { background: rgba(234, 88, 12, .94); }   /* 代充 橙红 */
.type-flag-3 { background: rgba(13, 148, 136, .94); }  /* 直充 青 */
.type-flag-4 { background: rgba(79, 70, 229, .94); }   /* 大猿人充值 靛蓝 */
.type-flag-5, .type-flag-6, .type-flag-7, .type-flag-8 { background: rgba(100, 116, 139, .94); } /* 自定义类型 灰蓝 */

/* 品牌卡片 */
.section-head { margin: 4px 0 12px; }
.brand-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.brand-card {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 14px; box-shadow: var(--shadow); transition: .18s; display: flex; flex-direction: column; gap: 4px;
}
.brand-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.brand-card.recommended { border-color: var(--brand); }
.brand-icon {
  width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #eef0ff, #f7f3ff); color: var(--brand);
  font-size: 18px; font-weight: 700; margin-bottom: 6px;
  overflow: hidden;
  position: relative;
}
/* 品牌图标图片：先显示首字（本地排版，0 请求），app.js 在页面加载后把可视区的图换进来，
   src 就位并解码完才淡入，避免首屏为了几十个小图标去跨域拉图 */
.brand-icon img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: contain;
  background: #fff; border-radius: 10px; padding: 3px;
  opacity: 0; transition: opacity .2s;
}
.brand-icon img.is-loaded { opacity: 1; }
.brand-name { font-weight: 600; font-size: 14px; color: var(--ink-1, #1f2937); }
.brand-tag {
  position: absolute; top: 0; right: 0; background: var(--brand); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 0 var(--radius) 0 10px;
}
.brand-count { font-size: 12px; color: var(--ink-3); }
.brand-channels { display: flex; gap: 4px; flex-wrap: wrap; }
.brand-channels em {
  font-style: normal; font-size: 11px; color: var(--ink-2);
  background: #f4f5fb; border-radius: 4px; padding: 1px 6px;
}
.product-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-name { font-weight: 600; font-size: 14px; line-height: 1.4; min-height: 39px; }
.product-sub { font-size: 12px; color: var(--ink-3); }
.price { color: var(--danger); font-weight: 700; font-variant-numeric: tabular-nums; }
.price .unit { font-size: 12px; margin-right: 1px; }
.price .num-lg { font-size: 20px; }
.price-old { color: var(--ink-3); text-decoration: line-through; font-size: 12px; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 5px; background: #fff1f4; color: var(--danger); }
/* @critical:end */

.detail-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; align-items: start; }
.detail-cover {
  border-radius: var(--radius); overflow: hidden; background: linear-gradient(135deg, #eef0ff, #fdf2ff);
  aspect-ratio: 16 / 10; display: grid; place-items: center; font-size: 30px; font-weight: 700; color: var(--brand);
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.buybox { position: sticky; top: 80px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { width: 34px; height: 34px; border: 0; background: #fafbff; font-size: 16px; cursor: pointer; color: var(--ink-2); }
.qty input { width: 54px; height: 34px; border: 0; text-align: center; font-size: 14px; font-family: inherit; }
.checkline { display: flex; align-items: flex-start; gap: 8px; padding: 10px; background: #fafbff; border-radius: 10px; border: 1px solid var(--line); }
.checkline input { margin-top: 3px; }
.pay-options { display: flex; gap: 8px; flex-wrap: wrap; }
.pay-option {
  flex: 1; min-width: 120px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer;
  font-size: 13px; color: var(--ink-2); background: #fff;
}
.pay-option input { margin-right: 6px; }
.pay-option.checked { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
/* 本店没开通在线支付：选项留着（让顾客知道有这回事），但灰掉、点不了 */
.pay-option.is-off { opacity: .55; cursor: not-allowed; background: #fafafa; }
.pay-option.is-off input { cursor: not-allowed; }

.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; color: var(--ink-2); }
.summary-row.total { border-top: 1px dashed var(--line); margin-top: 6px; padding-top: 10px; font-size: 15px; color: var(--ink); font-weight: 600; }

/* ---------- 订单 / 支付 ---------- */
.order-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.order-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }
.cards-list { display: grid; gap: 8px; }
.card-item {
  background: #0f172a; color: #d1fae5; border-radius: 10px; padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; display: flex; justify-content: space-between; gap: 10px; align-items: center; word-break: break-all;
}
/* 一张卡多个内容（如 兑换码 + 兑换链接）：每个内容独占一行 */
.card-item-multi {
  display: grid; gap: 6px;
}
.card-item-multi > span {
  display: flex; justify-content: space-between; gap: 10px; align-items: center;
}
.card-item-multi .muted { flex-shrink: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--line); margin-left: 4px; font-size: 13px; }
.timeline li:last-child { border-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline .t { color: var(--ink-3); font-size: 12px; }

.pay-wrap { max-width: 520px; margin: 30px auto; }
.pay-amount { font-size: 34px; font-weight: 800; color: var(--danger); text-align: center; margin: 8px 0; }
.qr-box { display: grid; place-items: center; padding: 16px; background: #fff; border: 1px dashed var(--line); border-radius: 12px; }

/* ---------- 空状态 / 分页 ---------- */
.empty { text-align: center; padding: 44px 16px; color: var(--ink-3); }
.empty .emoji { font-size: 34px; margin-bottom: 8px; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 34px; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; color: var(--ink-2);
}
.pagination .active { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .disabled { opacity: .5; }

/* @critical:start */
/* ---------- 底部 ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 18px 0 26px; color: var(--ink-3); font-size: 12px; background: #fff; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: none;
  background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  backdrop-filter: blur(10px);
}
.tabbar a { flex: 1; text-align: center; font-size: 11px; color: var(--ink-3); display: grid; gap: 2px; justify-items: center; }
.tabbar a .ico { font-size: 17px; line-height: 1; }
.tabbar a.active { color: var(--brand); }
/* @critical:end */

/* ---------- 后台 ---------- */
.admin-body { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar {
  width: 216px; flex: 0 0 216px; background: #14172b; color: #cbd0e3; padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .logo { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 700; padding: 6px 8px 18px; }
.sidebar .logo .brand-mark { width: 28px; height: 28px; font-size: 13px; }
.side-group { font-size: 11px; color: #6b7290; padding: 14px 10px 6px; letter-spacing: .06em; }
.side-link { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 9px; font-size: 13.5px; color: #cbd0e3; }
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link.active { background: linear-gradient(90deg, rgba(91, 91, 214, .95), rgba(124, 108, 246, .75)); color: #fff; }
.sidebar .side-foot { margin-top: auto; font-size: 12px; color: #6b7290; padding: 12px 8px; }
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center;
  padding: 0 20px; gap: 12px; position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-weight: 600; font-size: 15px; }
.topbar .spacer { flex: 1; }
.content { padding: 20px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat .label { color: var(--ink-3); font-size: 12px; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .value.small { font-size: 18px; }
.stat .sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
/* 礼金卡页：兑换表单 + 我的卡列表（≤1024px 收成单列，避免手机上两栏挤压导致输入框太小） */
.gift-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; align-items: start; }
@media (max-width: 1024px) { .gift-grid { grid-template-columns: 1fr; } }
/* 大号输入框：手机端填卡号 / 卡密用（16px 起步，避免 iOS 聚焦自动放大；按键更舒服） */
.input.lg, .select.lg {
  font-size: 16px; padding: 13px 14px; border-radius: 12px; letter-spacing: .5px;
}
/* @critical:start */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 130px; }
/* @critical:end */
/* 礼金卡批量操作条：勾选后可分配 / 删除 */
.bulk-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; padding: 10px 12px; background: #fafbff; border: 1px solid var(--line); border-radius: 12px; }
.bulk-bar .bulk-count { font-size: 13px; color: var(--ink-2); }
.bulk-bar .bulk-count b { color: var(--brand); }
.bulk-bar .input.sm, .bulk-bar .select.sm { width: auto; min-width: 110px; }
/* 上游凭证图片 */
.voucher-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.voucher-grid a { display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #f7f8fc; }
.voucher-grid img { display: block; width: 160px; height: 160px; object-fit: cover; }
.voucher-grid .voucher-name { padding: 4px 8px; font-size: 11px; color: var(--ink-3); text-align: center; }

.bars { display: flex; align-items: flex-end; gap: 10px; height: 130px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; text-align: center; }
.bars .bar .fill { background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 6px 6px 0 0; min-height: 3px; }
.bars .bar .cap { font-size: 10px; color: var(--ink-3); }

/* @critical:start */
@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .brand-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .buybox { position: static; }
}

@media (max-width: 720px) {
  .site-nav { display: none; }
  .page { padding: 14px 12px 86px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .brand-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .product-body { padding: 10px; }
  .product-name { font-size: 13px; }
  .tabbar { display: flex; }
  .form-grid { grid-template-columns: 1fr; }
  .hero { padding: 18px; border-radius: 16px; }
  .hero h1 { font-size: 19px; }
  .sidebar { position: fixed; left: -230px; z-index: 60; transition: .2s; }
  .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
  .content { padding: 14px 12px 30px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat .value { font-size: 20px; }
  .table th, .table td { padding: 8px 9px; }
}
/* @critical:end */

/* ---------- 分类大类 / 批量操作 ---------- */
/* @critical:start */
.channel-tabs {
  display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 12px;
  scrollbar-width: none;
}
.channel-tabs::-webkit-scrollbar { display: none; }
.channel-tab {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 88px; padding: 10px 14px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-2);
  font-size: 13px; transition: .15s;
}
.channel-tab .ico { font-size: 18px; line-height: 1.2; }
.channel-tab em { font-style: normal; font-size: 11px; color: var(--ink-3); }
.channel-tab:hover { border-color: var(--brand); color: var(--brand); }
.channel-tab.active {
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  border-color: transparent; color: #fff; box-shadow: var(--shadow);
}
.channel-tab.active em { color: rgba(255, 255, 255, .8); }
/* @critical:end */

.bulk-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}

.channel-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.channel-icon {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 12px; background: var(--brand-soft); font-size: 18px;
}
.channel-head > form { flex: 1 1 480px; justify-content: flex-end; }
.channel-head > form { flex: 1 1 480px; justify-content: flex-end; }

/* ---------- 商品规则 / 说明 / 温馨提示 ---------- */
.meta-line {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.meta-label {
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.meta-section { padding: 12px 0 2px; }
.meta-section .meta-label { margin-bottom: 6px; }
.meta-text {
  font-size: 13px; color: var(--ink-2); line-height: 1.9;
  background: var(--bg); border-radius: 10px; padding: 10px 12px;
}
.notice-box {
  margin: 12px 0 2px; padding: 12px 14px; border-radius: 12px;
  background: var(--brand-soft); border: 1px solid transparent;
  font-size: 13px; color: var(--ink-2); line-height: 1.85;
}
.detail-text {
  padding: 4px 0 2px; font-size: 13px; color: var(--ink-2); line-height: 1.95;
  word-break: break-word; white-space: normal;
}
.notice-box strong {
  display: block; margin-bottom: 4px; font-size: 13px; color: var(--brand);
}
.notice-box.warn {
  background: #fff7ed; border-color: #fed7aa;
}
.notice-box.warn strong { color: var(--warn); }
/* 礼金卡余额充足、本单无需其他支付 */
.notice-box.ok {
  background: #f0fdf4; border-color: #bbf7d0;
}
.notice-box.ok strong { color: #16a34a; }

/* ---------- 可搜索下拉（分类筛选 / 移动到分类） ---------- */
.combo { position: relative; display: inline-block; vertical-align: middle; }
.combo .combo-native { display: none; }
.combo .combo-input { width: 200px; }
.filter-bar .combo .combo-input { width: 200px; }
.bulk-bar .combo-input { width: 210px; }
.combo-panel {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 100%;
  max-height: 300px; overflow-y: auto; padding: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg);
}
.combo-group {
  padding: 6px 8px 2px; font-size: 11px; color: var(--ink-3); font-weight: 600;
}
.combo-item {
  padding: 7px 10px; border-radius: 8px; font-size: 13px; color: var(--ink);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.combo-item.active { background: var(--brand-soft); color: var(--brand); }
.combo-item.selected { font-weight: 600; }
.combo-item.disabled { color: var(--ink-3); cursor: not-allowed; }
.combo-empty { padding: 10px; font-size: 13px; color: var(--ink-3); text-align: center; }

/* ---------- 两栏布局：子项不许撑破列宽（否则右侧栏会被表格挤出屏幕） ---------- */
.two-col > * { min-width: 0; }
/* 「我的」：左订单/流水，右资料/密码 */
.me-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
/* 系统设置：基础设置加宽，右侧（资金/密码/日志）收窄 */
.settings-grid { grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr); }

/* ---------- 客服浮标 ---------- */
.service-fab {
  position: fixed; right: 16px; bottom: 88px; z-index: 55;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 15px; border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(135deg, #5b5bd6, #8b5cf6); color: #fff;
  font-size: 13px; font-weight: 600; box-shadow: 0 10px 24px rgba(91, 91, 214, .32);
}
.service-fab .ico { font-size: 15px; line-height: 1; }
.service-fab:active { transform: scale(.97); }

/* ---------- 弹窗（客服 / 充值） ---------- */
.modal { position: fixed; inset: 0; z-index: 130; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(17, 17, 27, .52); }
.modal-card {
  position: relative; width: 100%; max-width: 360px; background: #fff;
  border-radius: 16px; box-shadow: 0 24px 60px rgba(17, 17, 27, .28); overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.modal-body { padding: 16px; max-height: 72vh; overflow: auto; }
.modal-qr {
  display: block; width: 220px; height: 220px; object-fit: contain;
  margin: 0 auto; background: #fff; border-radius: 10px;
}
.qr-carousel .modal-qr { display: none; border: 1px solid var(--line); padding: 6px; }
.qr-carousel .modal-qr.active { display: block; }
.contact-row {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  margin-top: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px;
}
.contact-row b { flex: 1; text-align: center; word-break: break-all; }

/* 推广链接一行（店铺码 / 商品推广码弹窗、分享页） */
.qr-link {
  font-family: ui-monospace, Menlo, monospace; font-size: 12px; line-height: 1.5;
  color: var(--ink-3); text-align: center; word-break: break-all;
}
.qr-fallback { padding: 10px; font-size: 12px; line-height: 1.6; color: var(--ink-3); text-align: center; }
.qr-fallback span { color: var(--ink-2); word-break: break-all; }

/* ---------- 代理「我的用户」：调整余额后回到列表 ---------- */
/* v73：充完 / 扣完值不跳走，回到原列表并把这一行标出来，
   代理连着调好几笔时能直接看到「刚才那笔 +/- 之后客户余额是多少」。 */
.table tr.row-hl td { background: #f4f6ff; }
.table tr.row-hl td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.delta { font-variant-numeric: tabular-nums; font-weight: 700; }
.delta.in { color: var(--success); }
.delta.out { color: var(--danger); }
.delta-line { color: var(--ink-2); }

@media (max-width: 1024px) {
  .me-grid, .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 721px) {
  .service-fab { bottom: 24px; }
}

/* ---------- 微信内置浏览器：降级重效果 + 老内核兜底 ---------- */
/* @critical:start */
/* 微信 X5 / 老 WKWebView 上，毛玻璃(backdrop-filter)、彩色大阴影、hover 位移
   都要额外开合成层，低端安卓机首帧和滚动会明显发涩。这些效果只是好看，
   去掉不影响可用性；边框和底色保留，视觉不至于散架。 */
html.wx .site-header,
html.wx .tabbar { backdrop-filter: none; -webkit-backdrop-filter: none; background: #fff; }
html.wx .hero .btn { backdrop-filter: none; -webkit-backdrop-filter: none; }
html.wx .card,
html.wx .panel,
html.wx .product-card,
html.wx .brand-card,
html.wx .hero { box-shadow: none; }
html.wx .product-card,
html.wx .brand-card,
html.wx .btn { transition: none; }
html.wx .product-card:hover,
html.wx .brand-card:hover { transform: none; box-shadow: none; }

/* 老内核（X5 / Chromium < 88）不认 aspect-ratio，商品图会塌成 0 高。
   用 padding-top 撑出 16:10，图绝对定位铺满。 */
@supports not (aspect-ratio: 16 / 10) {
  .product-cover { height: 0; padding-top: 62.5%; }
  .product-cover img { position: absolute; top: 0; left: 0; }
  .product-cover > span { position: absolute; top: 50%; left: 0; right: 0; text-align: center; transform: translateY(-50%); }
}
/* @critical:end */

/* ---------- v74：店铺设置「前端模板」选择卡片 ---------- */
.tpl-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl-card {
  display: block; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 12px 14px; cursor: pointer; transition: border-color .15s, box-shadow .15s;
  font-size: 12px; color: var(--ink-3, #6b7280);
}
.tpl-card input { position: absolute; opacity: 0; pointer-events: none; }
.tpl-card b { display: block; color: var(--ink); font-size: 14px; margin: 8px 0 4px; }
.tpl-card.on { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; background: color-mix(in srgb, var(--brand) 6%, #fff); }
.tpl-card:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.tpl-swatch { height: 46px; border-radius: 8px; display: flex; gap: 4px; padding: 8px; overflow: hidden; }
.tpl-swatch i { flex: 1; border-radius: 4px; }
.tpl-swatch-classic { background: #eef0ff; }
.tpl-swatch-classic i { background: #5b5bd6; opacity: .25; }
.tpl-swatch-classic i:first-child { opacity: 1; }
.tpl-swatch-shanchong { background: #1f4568; }
.tpl-swatch-shanchong i { background: #b96e1f; opacity: .4; }
.tpl-swatch-shanchong i:first-child { background: #e7eef5; opacity: 1; }
