:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --violet: #7c3aed;
  --sidebar: #0f172a;
  --sidebar-ink: #cbd5e1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 布局 ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 228px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0f172a 0%, #111c33 100%);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: grid;
  place-items: center;
  font-size: 17px;
  flex-shrink: 0;
}

.brand-title { font-weight: 600; color: #f8fafc; font-size: 15px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.side-nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }

.side-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-ink);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.side-nav button:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav button.active { background: rgba(59, 130, 246, .18); color: #fff; box-shadow: inset 3px 0 0 #3b82f6; }
.side-nav .nav-icon { width: 18px; text-align: center; opacity: .9; }

.sidebar-footer {
  padding: 14px 18px;
  font-size: 11px;
  color: #64748b;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 { font-size: 17px; margin: 0; font-weight: 600; }
.topbar .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
}

.role-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: #f1f5f9; color: #475569; border: 1px solid var(--line);
}
.role-admin { background: #eef2ff; color: #4338ca; border-color: #e0e7ff; }
.role-operator { background: var(--green-soft); color: #15803d; border-color: #dcfce7; }
.role-viewer { background: #f8fafc; color: #64748b; }

.content { padding: 24px 28px 48px; }

.view { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; margin: 0 0 4px; font-weight: 650; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.card-head h3 { font-size: 15px; margin: 0; font-weight: 600; }
.card-body { padding: 16px 18px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }

.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 22px; font-weight: 650; margin-top: 4px; letter-spacing: .2px; }
.stat .hint { font-size: 11px; color: #9ca3af; margin-top: 2px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; max-height: calc(100vh - 330px); }
.table-wrap.short { max-height: none; }

table.grid { width: 100%; border-collapse: separate; border-spacing: 0; }

.grid th, .grid td {
  padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap;
  vertical-align: middle;
}
.grid thead th {
  position: sticky; top: 0; z-index: 2; background: #f9fafb; color: #475569;
  font-size: 12px; font-weight: 600; letter-spacing: .2px;
}
.grid tbody tr:hover { background: #fafcff; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid .num { font-variant-numeric: tabular-nums; }
.grid .muted { color: var(--muted); font-size: 12px; }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th .sort-arrow { margin-left: 4px; font-size: 10px; color: var(--accent); }

.actions { display: flex; gap: 6px; flex-wrap: nowrap; }

.btn-xs { padding: 4px 10px; font-size: 12px; border-radius: 7px; }

.empty { text-align: center; color: var(--muted); padding: 36px 12px; }
.empty .big { font-size: 28px; margin-bottom: 8px; opacity: .5; }

/* ---------- 徽章 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 2px 9px; border-radius: 999px; font-weight: 500;
}
.chip-new { background: var(--green-soft); color: #15803d; }
.chip-edit { background: var(--accent-soft); color: #1d4ed8; }
.chip-delete { background: var(--red-soft); color: #b91c1c; }
.chip-import { background: #f5f3ff; color: #6d28d9; }
.chip-correction { background: var(--amber-soft); color: #b45309; }

.delta-pos { color: var(--green); font-weight: 600; }
.delta-neg { color: var(--red); font-weight: 600; }
.delta-zero { color: var(--muted); }

/* ---------- 表单 ---------- */
.form-label { font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.required::after { content: " *"; color: var(--red); }

.form-control, .form-select {
  font-size: 14px; border-radius: 8px; border-color: #d1d5db;
}
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

.current-values {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
}
.current-values .cv-label { font-size: 11px; color: var(--muted); }
.current-values .cv-value { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }

.hint-text { font-size: 12px; color: var(--muted); }
.error-text { font-size: 12px; color: var(--red); min-height: 16px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar .form-control, .toolbar .form-select { width: auto; }

.search-box { position: relative; min-width: 260px; flex: 1; max-width: 380px; }
.search-box input { padding-left: 34px; }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9ca3af; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pager .pages { display: flex; gap: 6px; align-items: center; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero {
  background: radial-gradient(1200px 600px at 20% 10%, #1e3a8a 0%, #0f172a 55%, #0b1220 100%);
  color: #e2e8f0; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
}
.login-hero .logo-row { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 16px; }
.login-hero h2 { font-size: 34px; line-height: 1.25; margin: 0 0 16px; font-weight: 650; letter-spacing: -.5px; }
.login-hero p { color: #94a3b8; max-width: 420px; line-height: 1.7; font-size: 14px; }
.login-hero .hero-points { display: grid; gap: 12px; margin-top: 28px; }
.login-hero .hero-points div { display: flex; gap: 10px; align-items: flex-start; color: #cbd5e1; font-size: 13px; }
.login-hero .dot { width: 6px; height: 6px; border-radius: 50%; background: #60a5fa; margin-top: 7px; flex-shrink: 0; }
.login-card-wrap { display: grid; place-items: center; padding: 32px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 22px; margin: 0 0 6px; font-weight: 650; }
.login-card .sub { color: var(--muted); margin: 0 0 26px; font-size: 13px; }
.login-foot { margin-top: 20px; color: #9ca3af; font-size: 12px; text-align: center; }

/* ---------- 提示 ---------- */
.toast-stack { position: fixed; right: 20px; top: 20px; z-index: 1080; display: grid; gap: 10px; }
.toast-item {
  min-width: 260px; max-width: 380px; background: #111827; color: #f9fafb;
  border-radius: 10px; padding: 12px 14px; box-shadow: 0 10px 25px rgba(0, 0, 0, .18);
  font-size: 13px; animation: slide .2s ease; display: flex; gap: 10px; align-items: flex-start;
}
.toast-item.ok { background: #064e3b; }
.toast-item.err { background: #7f1d1d; }
.toast-item .x { margin-left: auto; cursor: pointer; opacity: .7; }
@keyframes slide { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

.skeleton { background: linear-gradient(90deg, #f1f5f9 25%, #e9eef5 37%, #f1f5f9 63%); background-size: 400% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; height: 14px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.modal-content { border: 0; border-radius: 14px; box-shadow: 0 20px 60px rgba(15, 23, 42, .25); }
.modal-header { border-bottom: 1px solid var(--line); padding: 16px 20px; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 18px 20px; }
.modal-footer { border-top: 1px solid var(--line); padding: 12px 20px; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

.note-box {
  background: var(--amber-soft); border: 1px solid #fde68a; color: #92400e;
  border-radius: 10px; padding: 10px 14px; font-size: 12.5px; line-height: 1.6;
}

/* ---------- 联想搜索 ---------- */
.suggest-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .14);
  max-height: 320px;
  overflow-y: auto;
  z-index: 40;
}

.suggest-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
}
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover, .suggest-item.active { background: var(--accent-soft); }
.suggest-item .phone { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; letter-spacing: .5px; }
.suggest-item .phone .lead { color: var(--accent); font-weight: 700; }
.suggest-item .meta { color: var(--muted); font-size: 12px; }
.suggest-item.create { color: var(--green); font-weight: 600; }
.suggest-empty { padding: 12px 14px; color: var(--muted); font-size: 12.5px; }

/* ---------- 办理：操作选择 ---------- */
.op-picker { display: flex; flex-wrap: wrap; gap: 8px; }

.op-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: #475569;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.op-chip:hover { border-color: #c7d2fe; background: #f8faff; }
.op-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
}
.op-chip[data-op="pearls-out"].active,
.op-chip[data-op="cards-out"].active,
.op-chip[data-op="points-out"].active { background: var(--red); border-color: var(--red); box-shadow: 0 2px 8px rgba(220, 38, 38, .22); }
.op-chip[data-op="cards-in"].active,
.op-chip[data-op="points-in"].active { background: var(--green); border-color: var(--green); box-shadow: 0 2px 8px rgba(22, 163, 74, .22); }

.op-preview {
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  border-radius: 10px;
  padding: 14px 16px;
  min-height: 62px;
  display: flex;
  align-items: center;
  font-size: 14px;
}
.op-preview .arrow { color: var(--muted); margin: 0 8px; }
.op-preview .from { color: var(--muted); }
.op-preview .to { font-weight: 700; font-size: 17px; }

/* ---------- 兑换购物车 ---------- */
.redeem-layout { display: grid; grid-template-columns: 1.45fr 1fr; gap: 20px; align-items: start; }

.cart-table-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.cart-table th { background: #f9fafb; }
.cart-table td { vertical-align: middle; }
.cart-item-name { font-weight: 600; }
.cart-thumb { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); margin-right: 10px; vertical-align: middle; background: #f1f5f9; }

.qty-control { display: inline-flex; align-items: center; gap: 4px; }
.qty-control input { width: 54px; text-align: center; }

.cart-total-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding: 14px 16px;
  background: var(--green-soft); border: 1px solid #bbf7d0; border-radius: 10px;
}
.cart-total-label { font-size: 12px; color: #15803d; }
.cart-total-value { font-size: 26px; font-weight: 700; color: #15803d; letter-spacing: -.5px; }

.parked-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all .15s;
}
.parked-card:hover { border-color: var(--accent); background: #f8faff; }
.parked-card .row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.parked-card .phone { font-family: ui-monospace, monospace; font-weight: 650; }
.parked-card .items { color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.6; }
.parked-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

/* ---------- 商品图片 ---------- */
.image-picker { display: flex; gap: 14px; align-items: flex-start; }
.image-preview {
  width: 96px; height: 96px; flex-shrink: 0;
  border: 1px dashed #cbd5e1; border-radius: 10px;
  background: #f8fafc;
  display: grid; place-items: center;
  overflow: hidden;
  text-align: center;
  font-size: 11px;
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-picker-actions { display: flex; flex-direction: column; gap: 6px; }

.product-thumb { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; border: 1px solid var(--line); background: #f1f5f9; }

@media (max-width: 1100px) {
  .redeem-layout { grid-template-columns: 1fr; }
}

/* ---------- 扫码兑换 ---------- */
.scan-preview {
  margin-top: 16px;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
  padding: 18px;
}

.product-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #bbf7d0;
  background: var(--green-soft);
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 10px;
}

.product-card .product-name { font-size: 17px; font-weight: 650; }
.product-card .product-cost { font-size: 22px; font-weight: 700; color: #15803d; }

.scan-member-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
}

.scan-member-card .phone { font-size: 16px; font-weight: 650; }

.stock-low { color: var(--red); font-weight: 650; }
.stock-ok { font-variant-numeric: tabular-nums; }

.history-result {
  margin-top: 14px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 260px;
  overflow: auto;
}

.help-list { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.8; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s ease; z-index: 30; }
  .sidebar.open { transform: none; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .current-values { grid-template-columns: repeat(2, 1fr); }
  .menu-toggle { display: inline-flex !important; }
}

.menu-toggle {
  display: none; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  width: 34px; height: 34px; align-items: center; justify-content: center; cursor: pointer;
}

/* ============================================================
   摄像头扫码
   ============================================================ */

.camera-stage {
  position: relative;
  background: #0b1220;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
}
.camera-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 取景框：提示店员把条码横向放在中间这条带子里 */
.camera-frame {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
}
.camera-frame span {
  display: block;
  width: 82%; height: 38%;
  border: 2px solid rgba(96, 165, 250, .9);
  border-radius: 10px;
  box-shadow: 0 0 0 100vmax rgba(2, 6, 23, .45);
  position: relative;
}
.camera-frame span::after {
  content: '';
  position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; background: rgba(248, 113, 113, .9);
}
.camera-status { margin-top: 10px; font-size: 13px; color: var(--muted); text-align: center; }
.camera-result {
  margin-top: 6px; text-align: center; font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600;
}

/* ============================================================
   手机端自适应
   ============================================================ */

/* 底部导航：小屏才出现，替代被收进抽屉的侧边栏 */
.mobile-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}
.mobile-nav button {
  border: 0; background: transparent; color: #64748b;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 10px;
  font-size: 11px; font-weight: 500; cursor: pointer;
}
.mobile-nav button span { font-size: 17px; line-height: 1.1; }
.mobile-nav button.active { color: var(--accent); background: var(--accent-soft); }
.mobile-nav button:active { transform: scale(.96); }

@media (max-width: 860px) {
  .mobile-nav { display: grid; }
  /* 给底部导航和安全区留出空间，最后一行内容不会被遮住 */
  .content { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .topbar { top: 0; }
  .topbar h1 { font-size: 16px; }
  .topbar .sub { display: none; }
  .user-chip .user-chip-name { display: none; }
  .page-head { margin-bottom: 14px; }
  .page-head h2 { font-size: 18px; }
  .stat-grid { gap: 10px; }
  .stat { padding: 12px; }
  .stat .value { font-size: 19px; }
  /* 输入框 16px 起：iOS Safari 低于 16px 会在聚焦时自动放大页面 */
  .form-control, .form-select { font-size: 16px; }
  .toolbar { gap: 6px; width: 100%; }
  /* 部分工具栏控件带内联 width:auto，移动端需要强制独占一行 */
  .toolbar .form-control, .toolbar .form-select { width: 100% !important; }
  .toolbar .btn { flex: 1 1 auto; }
  .card-head { padding: 12px 14px; gap: 8px; }
  .card-body { padding: 14px; }
  .search-box { min-width: 0; max-width: none; width: 100%; flex: 1 1 100%; }
  .table-wrap { max-height: none; }
  /* 弹窗铺满屏幕，避免手机上内容被键盘挤成一条缝 */
  .modal-dialog { margin: 0; min-height: 100vh; align-items: stretch; }
  .modal-dialog.modal-dialog-centered { align-items: flex-end; min-height: 0; }
  .modal-content { border-radius: 16px 16px 0 0; max-height: 92vh; overflow: auto; }
  .btn { min-height: 42px; }
  .btn-sm, .btn-xs { min-height: 34px; }
  .image-picker { flex-direction: column; align-items: center; }
  .image-preview { width: 132px; height: 132px; }
  .image-picker-actions { width: 100%; }
  .cart-table-wrap { max-height: none; }
  .redeem-layout { gap: 14px; }
  .cart-total-value { font-size: 22px; }
}

/* 超小屏：数据表格改成卡片式，一行一个会员，不再横向滚动找列 */
@media (max-width: 720px) {
  table.grid.card-mode { display: block; }
  table.grid.card-mode thead { display: none; }
  table.grid.card-mode tbody { display: block; }

  table.grid.card-mode tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    position: relative;
  }
  table.grid.card-mode tr:last-child { border-bottom: 0; }
  table.grid.card-mode tr:hover { background: transparent; }

  table.grid.card-mode td {
    display: flex; flex-direction: column; gap: 1px;
    padding: 0; border: 0; white-space: normal;
    font-size: 14px;
  }
  /* 用 data-label 把表头搬进单元格，让每个值都有自己的名字 */
  table.grid.card-mode td[data-label]::before {
    content: attr(data-label);
    font-size: 11px; color: var(--muted); font-weight: 500;
  }
  /* 手机号 / 商品名独占整行，作为这张卡片的标题 */
  table.grid.card-mode td.cell-primary {
    grid-column: 1 / -1;
    font-size: 17px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--line);
  }
  table.grid.card-mode td.cell-primary::before { display: none; }

  /* 商品卡片：图片+名称占满一行，名称那一列在卡片模式下已在标题里出现，隐藏避免重复 */
  table.grid.card-mode td.cell-title {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--line);
  }
  table.grid.card-mode td.cell-title::before { display: none; }
  table.grid.card-mode td.cell-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
  table.grid.card-mode td.empty { grid-column: 1 / -1; }
  table.grid.card-mode td.empty::before { display: none; }

  .cart-table.card-mode tr { grid-template-columns: 1fr auto; }
  .cart-table.card-mode td.cell-primary { border-bottom: 0; padding-bottom: 0; }
  .pager { flex-direction: column; align-items: stretch; gap: 8px; }
  .pager .pages { justify-content: center; }
  .pager .pages .btn { flex: 1; }
}

/* 竖屏手机：统计卡两列、操作按钮变宽，方便拇指点 */
@media (max-width: 480px) {
  .content { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat .hint { display: none; }
  .d-flex.gap-2 > .btn { flex: 1 1 auto; }
  .op-picker { gap: 6px; }
  .op-chip { padding: 8px 12px; font-size: 13px; }
  .camera-stage { aspect-ratio: 3 / 4; }
}

/* 横屏或大平板：恢复桌面式表格，避免卡片模式浪费宽度 */
@media (min-width: 721px) {
  table.grid.card-mode { display: table; }
}

/* ---------- 游乐卡券（V2.4） ---------- */
.play-form { max-width: 920px; }
.play-row { margin-bottom: 8px; }

.play-tiles {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 12px;
}

.play-tile {
  position: relative; display: flex; flex-direction: column; gap: 3px; cursor: pointer;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow); transition: border-color .15s ease, background .15s ease;
}
.play-tile:hover { border-color: var(--accent); }
.play-tile input { position: absolute; opacity: 0; pointer-events: none; }
.play-tile.is-checked { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(37, 99, 235, .12); }
.play-tile .tile-name { font-weight: 650; }
.play-tile .tile-meta { color: var(--muted); font-size: 12px; line-height: 1.5; }
.play-tile .tile-price { color: var(--accent); font-weight: 650; margin-top: 4px; }

@media (max-width: 640px) {
  .play-tiles { grid-template-columns: 1fr; }
}
