/* ============================================================
   柏诗收银系统 · 设计系统 (mobile-first)
   ============================================================ */
:root {
  --brand: #ee6b2f;
  --brand-dark: #dc5a20;
  --brand-soft: #fff3ec;
  --accent: #11b3a3;
  --ink: #1f2733;
  --ink-2: #5b6675;
  --ink-3: #8a94a6;
  --line: #e7ebf2;
  --bg: #f4f6fb;
  --card: #ffffff;
  --ok: #1faa6a;
  --ok-soft: #e6f7ef;
  --warn: #e8a33d;
  --warn-soft: #fdf3e3;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 6px 24px rgba(31, 39, 51, 0.08);
  --shadow-sm: 0 2px 10px rgba(31, 39, 51, 0.06);
  --sidebar-w: 232px;
  --topbar-h: 60px;
  --bottomnav-h: 58px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

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

/* Sidebar (desktop) */
.sidebar {
  width: var(--sidebar-w);
  background: #0f1626;
  color: #c9d2e3;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 20px; font-weight: 700; color: #fff; font-size: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar .brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: grid; place-items: center; color: #fff; font-weight: 800;
}
.sidebar .nav { padding: 10px 10px; overflow-y: auto; flex: 1; }
.nav-group-title {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: #5d6b85; padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; color: #c9d2e3;
  cursor: pointer; user-select: none; margin-bottom: 2px; font-size: 14px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(238,107,47,.30); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .nav-text { flex: 1; }
.nav-item .nav-tag { font-size: 11px; background: rgba(255,255,255,.12); padding: 1px 7px; border-radius: 20px; }
.sidebar .side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,0.07); }

/* Main */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; position: sticky; top: 0; z-index: 20;
}
.topbar .tb-title { font-weight: 700; font-size: 16px; }
.topbar .tb-right { display: flex; align-items: center; gap: 12px; }
.topbar .user-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand); display: grid; place-items: center; font-weight: 700;
}
.content { padding: 18px; flex: 1; }
.content-scroll { max-width: 1180px; margin: 0 auto; }

/* Topbar children */
.topbar { gap: 10px; }
.tb-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.store-select { width: auto; max-width: 280px; padding: 6px 10px; text-overflow: ellipsis; }
.logout-btn { color: var(--ink-3); }
.logout-btn svg { width: 16px; height: 16px; }
.logout-btn:hover { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

/* Drawer user + logout */
.drawer-user { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.drawer-user .avatar { background: rgba(255,255,255,.14); color: #fff; }
.drawer-logout { margin-top: 12px; background: transparent; border-color: #334; color: #cdd; }
.drawer-logout:hover { background: rgba(255,255,255,.06); }

/* Bulk authorization grid */
.bulk-mods { display: grid; gap: 8px; margin-top: 4px; }
.bulk-mod { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfe; }
.bulk-mod .bm-name { flex: 1; font-weight: 600; font-size: 14px; }
.bm-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.bm-chk input { width: 16px; height: 16px; accent-color: var(--brand); }
/* 表头行：按「读/写/删/授」整列全选 */
.bulk-mod.bm-head { background: #eef2fb; border-style: dashed; padding: 8px 12px; }
.bulk-mod.bm-head .bm-name { font-weight: 500; font-size: 12.5px; color: var(--ink-2); }
.bulk-mod.bm-head .bm-chk { font-weight: 600; }

/* Key-value grid (小程序商城状态) */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; }
.kv { font-size: 14px; }
.kv .muted { display: block; margin-bottom: 5px; font-size: 12px; }

/* 两列卡片布局（报表/交接班） */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.stat-card .value { word-break: break-all; }

/* Bottom nav (mobile) */
.bottom-nav { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 9px 14px; border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #cdd6e6; box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { padding: 7px 9px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 16px; margin-bottom: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px;
}
.card-title { font-weight: 700; font-size: 15px; }

/* ---------- Page header ---------- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.page-header h2 { margin: 0; font-size: 19px; }
.page-header .sub { color: var(--ink-3); font-size: 13px; margin-top: 2px; }

/* ---------- Stats ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.stat-card .label { color: var(--ink-3); font-size: 13px; }
.stat-card .value { font-size: 26px; font-weight: 800; margin-top: 4px; }
.stat-card .delta { font-size: 12px; margin-top: 4px; color: var(--ink-3); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
table.tbl th {
  text-align: left; color: var(--ink-3); font-weight: 600; font-size: 12.5px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfe;
  white-space: nowrap;
}
table.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: #fafbff; }
.row-actions { display: flex; gap: 6px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: #eef1f6; color: var(--ink-2);
  /* 表格列被挤窄时，徽标文字不能折成两行（「已付款」被拆成「已付/款」） */
  white-space: nowrap; flex-shrink: 0;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: #b9791f; }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-info { background: var(--brand-soft); color: var(--brand); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ---------- 自助打印任务表 ---------- */
/* 文件名一多/一长就会把列撑爆或被折断成两行，统一单行省略 */
.pj-fn {
  max-width: 190px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-size: 12.5px;
}
.pj-spec { white-space: nowrap; font-size: 12px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--ink-2); }
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.form-textarea { resize: vertical; min-height: 70px; }
.form-hint { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.form-error { color: var(--danger); font-size: 12.5px; margin-top: 5px; }
.form-full { grid-column: 1 / -1; }

/* repeatable list (specs / flavors) */
.repeat-list { display: flex; flex-direction: column; gap: 8px; }
.repeat-row { display: flex; gap: 8px; align-items: center; }
.repeat-row .form-input { flex: 1; }
.repeat-add { margin-top: 6px; }

/* image upload */
.img-uploader {
  border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px;
  text-align: center; cursor: pointer; transition: all .15s; background: #fafbfe;
}
.img-uploader:hover { border-color: var(--brand); background: var(--brand-soft); }
.img-uploader .thumb { width: 88px; height: 88px; object-fit: cover; border-radius: 10px; margin: 0 auto 8px; }
.img-uploader .ph { width: 88px; height: 88px; border-radius: 10px; margin: 0 auto 8px;
  background: #eef1f6; display: grid; place-items: center; color: var(--ink-3); font-size: 26px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,22,38,.45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
  animation: fade .15s ease;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px;
  max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: pop .18s ease;
}
.modal.lg { max-width: 720px; }
.modal.xl { max-width: 1000px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close { border: none; background: #f1f3f8; width: 30px; height: 30px; border-radius: 8px; font-size: 16px; color: var(--ink-2); }
.modal-close:hover { background: #e6e9f1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-footer {
  padding: 14px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98) } to { opacity: 1; transform: none } }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #0f1626; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px;
  box-shadow: var(--shadow); animation: pop .18s ease; max-width: 90vw;
}
.toast.ok { background: #14532d; }
.toast.err { background: #7f1d1d; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: linear-gradient(135deg, #fff3ec 0%, #fff9ef 100%);
}
.login-card {
  background: #fff; border-radius: 20px; box-shadow: 0 20px 60px rgba(31,39,51,.12);
  width: 100%; max-width: 420px; padding: 30px 28px; overflow: hidden;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-brand .logo {
  width: 46px; height: 46px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px;
}
.login-brand .name { font-weight: 800; font-size: 20px; }
.login-sub { color: var(--ink-3); font-size: 13px; margin: 2px 0 20px; }
.login-card h3 { margin: 18px 0 12px; font-size: 15px; color: var(--ink-2); }
.demo-grid { display: grid; gap: 10px; }
.demo-btn {
  display: flex; align-items: center; gap: 12px; text-align: left;
  border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px;
  transition: all .15s; width: 100%;
}
.demo-btn:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.demo-btn .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex-shrink: 0; font-weight: 700; }
.demo-btn .t { font-weight: 700; }
.demo-btn .d { font-size: 12px; color: var(--ink-3); }
.ic-admin { background: linear-gradient(135deg,#ee6b2f,#ff9a6b); }
.ic-manager { background: linear-gradient(135deg,#11b3a3,#37d6c4); }
.ic-cashier { background: linear-gradient(135deg,#e8a33d,#f3c069); }
.login-foot { margin-top: 18px; text-align: center; color: var(--ink-3); font-size: 12px; }

/* ---------- Misc ---------- */
.empty { text-align: center; color: var(--ink-3); padding: 40px 10px; }
.empty .big { font-size: 40px; opacity: .4; }
.spinner {
  width: 26px; height: 26px; border: 3px solid var(--brand-soft); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg) } }
.muted { color: var(--ink-3); }
.right { text-align: right; }
.center { text-align: center; }
.flex { display: flex; } .between { justify-content: space-between; } .gap8 { gap: 8px; } .gap12 { gap: 12px; }
.wrap { flex-wrap: wrap; } .items-center { align-items: center; }
.tag-input-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { background: var(--brand-soft); color: var(--brand); border-radius: 20px; padding: 4px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.pill button { border: none; background: none; color: var(--brand); font-size: 14px; line-height: 1; }

/* QR box */
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #fafbfe; }

/* customer order page */
.order-page { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); }
.order-head { background: linear-gradient(135deg, var(--brand), var(--accent)); color: #fff; padding: 20px 18px; }
.cart-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #0f1626; color: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.cat-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 12px; background: #fff; border-bottom: 1px solid var(--line); }
.cat-tab { padding: 7px 14px; border-radius: 20px; background: #f1f3f8; font-size: 13px; white-space: nowrap; border: 1px solid transparent; }
.cat-tab.active { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); font-weight: 700; }
.prod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px; }
.prod-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.prod-card .pimg { height: 92px; background: #eef1f6; display: grid; place-items: center; color: var(--ink-3); font-size: 30px; }
.prod-card .pinfo { padding: 9px 10px; }
.prod-card .pname { font-weight: 600; font-size: 13.5px; }
.prod-card .pprice { color: var(--danger); font-weight: 800; margin-top: 2px; }
.prod-card .padd { float: right; width: 28px; height: 28px; border-radius: 50%; border: none; background: var(--brand); color: #fff; font-size: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .content { padding: 14px 12px 76px; }
  .topbar { padding: 0 10px; gap: 8px; }
  /* 手机端顶部：隐藏过宽标题与用户文字，只保留 菜单 + 门店选择 + 头像 + 退出，避免错位重叠 */
  .tb-title { display: none; }
  .tb-right { gap: 6px; flex: 1; justify-content: flex-end; }
  .store-select { max-width: 48vw; font-size: 13px; padding: 6px 8px; }
  .uc-text { display: none; }
  .logout-txt { display: none; }
  .logout-btn { padding: 7px 8px; }
  .form-grid { grid-template-columns: 1fr; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: #fff; border-top: 1px solid var(--line); height: var(--bottomnav-h);
    box-shadow: 0 -4px 16px rgba(0,0,0,.05);
  }
  .bottom-nav .bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; color: var(--ink-3); font-size: 11px; padding: 6px 2px;
  }
  .bottom-nav .bn-item.active { color: var(--brand); }
  .bottom-nav .bn-item svg { width: 21px; height: 21px; }
  .modal { max-width: 100%; border-radius: 16px 16px 0 0; align-self: flex-end; max-height: 92vh; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 901px) {
  .menu-toggle { display: none; }
}
.menu-toggle { border: none; background: transparent; font-size: 20px; color: var(--ink); }

/* ============================================================
 * v9 新增：店内码 / 库存批次区块 / 快速批量入库 / 扫码打印
 * ============================================================ */

/* 等宽字体（条码、取件码、链接） */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; letter-spacing: .2px; }

/* 商品编辑里的「库存 / 批次」区块 */
.stock-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fbfcff; }
.stock-box .sb-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stock-box .sb-h .mut { color: var(--ink-3); font-size: 12.5px; }
.stock-box .sb-b { font-size: 13px; color: var(--ink-2); margin: 8px 0 10px; line-height: 1.75; }
.stock-box .sb-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* 快速批量入库：一行一个商品 */
.bulk-tip { background: #f0f7ff; border: 1px solid #d6e6ff; border-radius: 10px; padding: 10px 12px; font-size: 13px; color: var(--ink-2); line-height: 1.7; }
.brow { display: grid; grid-template-columns: minmax(0, 1.5fr) 92px 152px 140px 34px; gap: 8px; align-items: center; margin-bottom: 6px; }
.brow .b-exp { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); margin: -2px 0 8px; }
.brow .b-del { height: 36px; padding: 0 10px; }
@media (max-width: 700px) {
  .brow { grid-template-columns: 1fr 1fr; align-items: end; }
  .brow .b-c1 { grid-column: 1 / -1; }
  .brow .b-del { height: 36px; }
}

/* 扫码打印面板 */
.print-scan { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 18px; }
.ps-qr { width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.ps-qr svg { width: 100%; height: auto; display: block; }
.ps-token { text-align: center; font-size: 13px; margin-top: 8px; color: var(--ink-2); }
.ps-token b { font-size: 17px; letter-spacing: 1.5px; color: var(--brand); }
.ps-sub { text-align: center; font-size: 12px; color: var(--ink-3); line-height: 1.7; margin-top: 4px; }
.ps-right { border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; min-height: 260px; min-width: 0; }
.ps-list { flex: 1; overflow: auto; max-height: 300px; }
.ps-file { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px dashed var(--line); }
.ps-file:last-child { border-bottom: none; }
.ps-f-main { min-width: 0; flex: 1; font-size: 13px; }
.ps-f-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-f-acts { display: flex; gap: 6px; flex-shrink: 0; }
.ps-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
@media (max-width: 700px) {
  .print-scan { grid-template-columns: 1fr; }
  .ps-qr { max-width: 220px; margin: 0 auto; }
}

/* 顶栏用户信息：窄桌面下不要把姓名挤成竖排 */
.topbar .user-chip { flex-shrink: 0; }
.topbar .tb-right { min-width: 0; }
.topbar .uc-text { white-space: nowrap; min-width: 0; }
.topbar .uc-text > div:first-child { max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1180px) {
  .topbar .store-select { max-width: 210px; }
}

/* ============================================================
   支付渠道 · 接入模式选择（直连 / 服务商 分页填写）
   ============================================================ */
.pm-list { display: grid; gap: 12px; }
.pm-card {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  background: var(--card); cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.pm-card:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.pm-card.on { border-color: var(--brand); background: var(--brand-soft); }
.pm-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pm-t { font-size: 15px; font-weight: 600; color: var(--ink); }
.pm-go { font-size: 12.5px; color: var(--brand); white-space: nowrap; }
.pm-d { font-size: 13px; color: var(--ink-3); line-height: 1.7; margin-top: 6px; }
.pm-n {
  font-size: 12.5px; color: var(--ink-3); margin-top: 10px; padding-top: 9px;
  border-top: 1px dashed var(--line);
}
.pm-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(127, 127, 127, .08);
  font-size: 13px; color: var(--ink-2);
}
.pm-head a { color: var(--brand); text-decoration: none; font-size: 12.5px; }
.pm-head a:hover { text-decoration: underline; }

/* ============================================================
   经营总览看板（7 日走势 / 收款构成 / 临期预警 / 库存预警）
   ============================================================ */
.db-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.db-2 > .card { margin-bottom: 0; }
@media (max-width: 900px) { .db-2 { grid-template-columns: 1fr; } }

.stat-card .delta.up { color: var(--danger); }
.stat-card .delta.down { color: var(--ok); }

.db-chart { display: flex; align-items: flex-end; gap: 10px; height: 156px; padding: 6px 2px 0; }
.db-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.db-col .bar {
  width: 100%; max-width: 40px; min-height: 4px; border-radius: 9px 9px 5px 5px;
  background: linear-gradient(180deg, #f6dfd2, #e8b49a); transition: .25s;
}
.db-col.on .bar { background: linear-gradient(180deg, #ffb27f, #ee6b2f); }
.db-col .bv { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.db-col .bl { font-size: 11.5px; color: var(--ink-3); }
.db-col.on .bl { color: var(--ink); font-weight: 600; }

.db-mix { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.db-mix .n { width: 62px; font-size: 13px; color: var(--ink-2); }
.db-mix .track { flex: 1; height: 9px; border-radius: 5px; background: #f1f3f8; overflow: hidden; }
.db-mix .track i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, #ffc59b, #ee6b2f); }
.db-mix .v { width: 112px; text-align: right; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.db-alert { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.db-alert .cell { border-radius: 12px; padding: 10px 12px; border: 1px solid; }
.db-alert .cell b { display: block; font-size: 22px; font-weight: 800; line-height: 1.25; }
.db-alert .cell span { font-size: 12px; }
.db-alert .c-exp { background: var(--danger-soft); border-color: #f8c9cb; color: #b02a2f; }
.db-alert .c-today { background: #fff3e8; border-color: #ffd9bd; color: #b8560f; }
.db-alert .c-soon { background: var(--warn-soft); border-color: #f5dfb8; color: #8c6417; }

.db-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.db-row:last-child { border-bottom: 0; }
.db-row .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-row .mut { color: var(--ink-3); font-size: 12px; }
.db-row .amt { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

.db-tag { font-size: 11.5px; border-radius: 8px; padding: 1px 7px; white-space: nowrap; background: #f2f4f8; color: var(--ink-2); }
.db-tag.exp { background: var(--danger-soft); color: #b02a2f; }
.db-tag.today { background: #fff3e8; color: #b8560f; }
.db-tag.soon { background: var(--warn-soft); color: #8c6417; }

.db-empty { color: var(--ink-3); font-size: 13px; padding: 14px 0; text-align: center; }
.db-link { color: var(--brand); font-size: 12.5px; cursor: pointer; }
.db-link:hover { text-decoration: underline; }

/* ============================================================
 * 商品列表：主图与标题上下分离（图片独立一列，不再和文字挤一行）
 * ============================================================ */
.prod-cell { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.prod-cell .pc-img {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 9px; object-fit: cover;
  background: #f4f6fa; border: 1px solid var(--line); display: block;
}
.prod-cell .pc-ph { display: grid; place-items: center; font-size: 18px; color: #b9c1d1; }
.prod-cell .pc-txt { min-width: 0; }
.prod-cell .pc-name {
  font-weight: 600; color: var(--ink); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.prod-cell .pc-meta { font-size: 11.6px; color: var(--ink-3); margin-top: 3px; line-height: 1.4; }
.prod-cell .pc-meta .sep { margin: 0 5px; color: #d5dae5; }

/* 待付款 / 已取消 状态标签 */
.badge-warn { background: #fff3e8; color: #b8560f; }
.badge-muted { background: #f1f3f8; color: #7b8497; }

/* 打印模板设计器容器 */
.tpl-frame { width: 100%; height: calc(100vh - 150px); min-height: 560px; border: 1px solid var(--line); border-radius: 12px; background: #f7f8fb; display: block; }

/* 收款方式管理 */
.pay-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.pay-item:last-child { border-bottom: 0; }
.pay-item .nm { flex: 1; min-width: 0; }
.pay-item .nm b { font-weight: 600; }
.pay-item .nm span { display: block; font-size: 11.6px; color: var(--ink-3); margin-top: 2px; }
.pay-item input[type=text] { max-width: 180px; }

/* ============================================================
   排版优化（2026-11-09）
   目标：统一间距体系，解决卡片过挤、表单与标签贴太近、
        表格行过矮、弹窗内容贴边、按钮与说明文字基线不齐。
   ============================================================ */
.card { padding: 20px; margin-bottom: 18px; }
.card > .card-title:first-child,
.card > .card-head:first-child { margin-top: 0; }
.card > .card-title { margin-bottom: 16px; }
.card .card-title + .muted,
.card .card-title + div { margin-top: 0; }

.page-header { margin-bottom: 20px; padding-bottom: 2px; }
.page-header h2 { font-size: 20px; letter-spacing: .2px; }
.page-header .sub { margin-top: 4px; }

.form-grid { gap: 16px 20px; }
.form-grid > .form-group { margin-bottom: 0; }
.form-group { margin-bottom: 16px; }
.form-label { margin-bottom: 8px; font-size: 13px; }
.form-hint { margin-top: 6px; line-height: 1.6; }

table.tbl th { padding: 12px 14px; }
table.tbl td { padding: 13px 14px; }
.table-wrap { border-radius: 10px; }

.stat-grid { gap: 16px; }
.stat-card { padding: 18px 18px 16px; }
.stat-card .value { margin-top: 6px; }

.modal-body { padding: 22px 24px; }
.modal-footer { padding: 14px 24px; gap: 10px; }

/* 统一后台：二级 Tab 与分页条 */
.unify-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.unify-tabs .btn { border-radius: 20px; padding: 7px 16px; }
.unify-pager {
  display: flex; gap: 12px; align-items: center; justify-content: flex-end;
  padding: 12px 4px 2px;
}
.unify-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 14px 18px;
}
.unify-toolbar .spacer { flex: 1; }
.unify-hint {
  padding: 14px 18px; margin-bottom: 16px; font-size: 13px; line-height: 1.75;
  color: var(--ink-2); background: #f7f9fd; border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.unify-kv { display: grid; grid-template-columns: 110px 1fr; gap: 12px 16px; font-size: 14px; }
.unify-kv .k { color: var(--ink-3); }
