/* =============================================================
 * 销售中心 · 设计语言
 * 定位：中文内部业务后台。信息密度优先、高对比、表格清楚、主操作醒目。
 * 配色：中性石板灰底 + 单一主色（深蓝）；状态色仅用于表达状态，不作装饰。
 * ============================================================= */

:root {
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #F1F5F9;
  --line: #E2E8F0;
  --line-strong: #CBD5E1;
  --text: #0F172A;
  --text-2: #475569;
  --text-3: #94A3B8;

  --primary: #1D4ED8;
  --primary-hover: #1740AE;
  --primary-soft: #EEF3FF;
  --primary-line: #B7C8F5;

  --ok: #15803D;
  --ok-soft: #E7F6EC;
  --warn: #B45309;
  --warn-soft: #FDF3E4;
  --danger: #B42318;
  --danger-soft: #FDECEA;
  --info: #0E7490;
  --info-soft: #E4F3F6;
  --neutral: #475569;
  --neutral-soft: #EEF2F6;

  --r: 8px;
  --r-sm: 6px;
  --r-lg: 12px;
  --sh-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --sh-md: 0 4px 16px rgba(15, 23, 42, .10);
  --sh-lg: 0 12px 40px rgba(15, 23, 42, .18);

  --h-header: 56px;
  --w-side: 212px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; font-size: inherit; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt0 { margin-top: 0; } .mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-tight { display: flex; align-items: center; gap: 6px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }

/* ---------- 布局 ---------- */
.app { min-height: 100vh; }
.hdr {
  position: sticky; top: 0; z-index: 40;
  height: var(--h-header);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
}
.hdr .brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hdr .logo {
  width: 28px; height: 28px; border-radius: 7px; flex: none;
  background: var(--primary); display: grid; place-items: center; color: #fff;
}
.hdr .brand-text { min-width: 0; }
.hdr .brand-text b { font-size: 15px; display: block; line-height: 1.2; }
.hdr .brand-text span { font-size: 11px; color: var(--text-3); display: block; }
.hdr .spacer { flex: 1 1 auto; }
.demo-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--warn-soft); color: var(--warn);
  border: 1px solid #F3D9A4; border-radius: 999px;
  padding: 3px 10px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.role-switch { display: flex; align-items: center; gap: 8px; }
.role-switch select { min-width: 150px; }
.who { display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  border: 1px solid var(--primary-line);
}
.burger { display: none; }

.shell { display: flex; align-items: flex-start; }
.side {
  position: sticky; top: var(--h-header);
  width: var(--w-side); flex: none;
  height: calc(100vh - var(--h-header));
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 10px 8px 24px;
}
.side .nav-title { font-size: 11px; color: var(--text-3); padding: 8px 10px 4px; letter-spacing: .06em; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text-2); cursor: pointer; font-size: 13.5px;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; border-color: var(--primary-line); }
.nav-item .ic { flex: none; opacity: .9; }
.nav-item .badge-n {
  margin-left: auto; background: var(--danger); color: #fff;
  border-radius: 999px; font-size: 11px; padding: 0 6px; min-width: 18px; text-align: center; font-weight: 700;
}
.main { flex: 1 1 auto; min-width: 0; padding: 16px 20px 60px; max-width: 1400px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-sm);
}
.card + .card { margin-top: 12px; }
.card-hd {
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.card-hd h3 { font-size: 14.5px; }
.card-bd { padding: 14px; }
.card-bd.tight { padding: 10px 14px; }
.card-ft { padding: 10px 14px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r) var(--r); }
.page-hd { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-hd h2 { font-size: 19px; }
.page-hd .desc { color: var(--text-2); font-size: 13px; margin-top: 2px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  cursor: pointer; font-size: 13.5px; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--surface); border-color: #F0B4AE; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn-danger-solid:hover { background: #8E1B12; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 600; }
.btn-ok:hover { background: #116B33; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.disabled {
  background: var(--surface-3); border-color: var(--line); color: var(--text-3);
  cursor: not-allowed; opacity: 1;
}
.btn-primary[disabled] { background: #9DB4E8; border-color: #9DB4E8; color: #fff; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  width: 30px; height: 30px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--surface); display: inline-grid; place-items: center; cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-3); }

/* ---------- 状态标签 ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap; line-height: 1.5;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: currentColor; }
.t-ok { background: var(--ok-soft); color: var(--ok); border-color: #BFE3CC; }
.t-warn { background: var(--warn-soft); color: var(--warn); border-color: #F0D5A8; }
.t-danger { background: var(--danger-soft); color: var(--danger); border-color: #F4C4BE; }
.t-info { background: var(--info-soft); color: var(--info); border-color: #B4DCE4; }
.t-neutral { background: var(--neutral-soft); color: var(--neutral); border-color: var(--line); }
.t-primary { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 4px;
  background: var(--surface-3); color: var(--text-2); font-size: 11.5px; border: 1px solid var(--line);
}
.tag-line { background: transparent; border-color: var(--line-strong); }

/* ---------- 表格 ---------- */
.tbl-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--text-2); font-size: 12.5px;
  padding: 9px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.tbl tbody tr:hover { background: #FBFCFE; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl td.n, table.tbl th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tfoot td { padding: 10px; border-top: 2px solid var(--line-strong); font-weight: 600; }
.empty {
  padding: 34px 16px; text-align: center; color: var(--text-3); font-size: 13px;
  border: 1px dashed var(--line-strong); border-radius: var(--r); background: var(--surface-2);
}
.empty b { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 4px; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .lbl { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.lbl .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 34px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font-size: 13.5px; font-family: inherit;
  outline: none; transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12); }
.input[disabled], .select[disabled], .textarea[disabled] { background: var(--surface-3); color: var(--text-3); cursor: not-allowed; }
.input.err, .select.err, .textarea.err { border-color: var(--danger); background: #FFF9F8; }
.input.n { text-align: right; font-variant-numeric: tabular-nums; }
.select { appearance: none; padding-right: 26px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 6px center; }
.hint { font-size: 12px; color: var(--text-3); }
.err-text { font-size: 12px; color: var(--danger); display: flex; gap: 4px; align-items: flex-start; }
.warn-text { font-size: 12px; color: var(--warn); display: flex; gap: 4px; align-items: flex-start; }
.ok-text { font-size: 12px; color: var(--ok); }
.checkline { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; cursor: pointer; color: var(--text-2); font-size: 13px;
  border-right: 1px solid var(--line);
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.seg button[disabled] { color: var(--text-3); cursor: not-allowed; background: var(--surface-3); }

/* ---------- 明细行（建单小表单） ---------- */
.line-row {
  border: 1px solid var(--line); border-radius: var(--r); padding: 10px;
  background: var(--surface); margin-bottom: 8px;
}
.line-row.is-acc { background: #FBFCFE; border-style: dashed; }
.line-row.has-err { border-color: #F0B4AE; background: #FFF9F8; }
.line-grid { display: grid; grid-template-columns: minmax(180px, 2.4fr) 92px 120px 110px 30px; gap: 8px; align-items: start; }
.line-grid.acc { grid-template-columns: minmax(160px, 2.4fr) 92px 150px 110px 30px; }
.line-head {
  display: grid; gap: 8px; padding: 0 10px 6px; font-size: 12px; color: var(--text-3);
}
.line-head.main { grid-template-columns: minmax(180px, 2.4fr) 92px 120px 110px 30px; }
.line-head.acc { grid-template-columns: minmax(160px, 2.4fr) 92px 150px 110px 30px; }
.hist { font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

/* ---------- 提示条 ---------- */
.note {
  border: 1px solid var(--line); border-left: 3px solid var(--info);
  background: var(--info-soft); padding: 8px 12px; border-radius: var(--r-sm); font-size: 12.5px; color: #0B5A6E;
}
.note.warn { border-left-color: var(--warn); background: var(--warn-soft); color: #8A4308; }
.note.danger { border-left-color: var(--danger); background: var(--danger-soft); color: #8E1B12; }
.note.ok { border-left-color: var(--ok); background: var(--ok-soft); color: #105C2D; }
.note.neutral { border-left-color: var(--line-strong); background: var(--surface-2); color: var(--text-2); }
.note b { display: block; margin-bottom: 2px; }

/* ---------- 数据块 ---------- */
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; }
.stat {
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
  padding: 12px 14px; box-shadow: var(--sh-sm);
}
.stat .k { font-size: 12px; color: var(--text-2); }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .s { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.stat.accent { border-color: var(--primary-line); background: var(--primary-soft); }
.stat.accent .v { color: var(--primary); }
.stat.danger .v { color: var(--danger); }
.stat.warn .v { color: var(--warn); }

/* ---------- 进度条 ---------- */
.bar { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); }
.bar.ok > i { background: var(--ok); }
.bar.warn > i { background: var(--warn); }

/* ---------- 弹窗 / 抽屉 / Toast ---------- */
.mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 90; display: flex; }
.modal {
  margin: auto; background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-lg); width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden;
}
.modal.sm { width: min(520px, calc(100vw - 32px)); }
.modal.md { width: min(700px, calc(100vw - 32px)); }
.modal.lg { width: min(1080px, calc(100vw - 32px)); }
.modal-hd { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-hd h3 { font-size: 16px; }
.modal-bd { padding: 16px; overflow: auto; }
.modal-ft { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  background: var(--text); color: #fff; padding: 10px 14px; border-radius: var(--r-sm);
  box-shadow: var(--sh-md); font-size: 13px; max-width: 380px; display: flex; gap: 8px; align-items: flex-start;
}
.toast.ok { background: #106B33; }
.toast.err { background: #8E1B12; }
.toast.warn { background: #8A4308; }
.toast.info { background: #155E75; }

/* ---------- 合同预览 ---------- */
.paper-scroll { overflow-x: auto; padding-bottom: 6px; }
/* 缩放条只在手机出现（见移动端断点） */
.paper-bar { display: none; }
.paper {
  background: #fff; border: 1px solid var(--line-strong); border-radius: 4px;
  width: 100%; max-width: 820px; margin: 0 auto 14px; padding: 28px 30px;
  color: #111; font-size: 13px; line-height: 1.75; box-shadow: var(--sh-sm); position: relative;
}
.paper h4 { text-align: center; font-size: 17px; margin-bottom: 10px; letter-spacing: .08em; }
.paper .p-no { text-align: right; font-size: 12px; color: #555; margin-bottom: 6px; }
.paper table { width: 100%; border-collapse: collapse; font-size: 12px; }
.paper table th, .paper table td { border: 1px solid #333; padding: 5px 6px; }
.paper table th { background: #F2F4F7; font-weight: 600; }
.paper table td.n { text-align: right; font-variant-numeric: tabular-nums; }
.paper .clause { margin-top: 12px; font-size: 12px; }
.paper .clause ol { margin: 6px 0 0 18px; padding: 0; }
.paper .clause li { margin-bottom: 4px; }
.paper .sign { display: flex; justify-content: space-between; gap: 20px; margin-top: 22px; font-size: 12px; }
.paper .sign .box { flex: 1 1 0; border: 1px dashed #999; border-radius: 4px; padding: 10px; min-height: 96px; }
.paper .stamp {
  position: relative; display: inline-block; margin-top: 10px;
}
.stamp-mark {
  width: 116px; height: 116px; border: 2.5px solid #C0392B; border-radius: 50%;
  color: #C0392B; display: grid; place-items: center; text-align: center;
  font-size: 11px; line-height: 1.25; font-weight: 700; transform: rotate(-8deg);
  opacity: .85; letter-spacing: .04em; padding: 8px;
}
.stamp-mark.small { width: 92px; height: 92px; font-size: 10px; }
.sign-mark { font-family: "Kaiti SC", "STKaiti", serif; font-size: 22px; color: #1A3A7A; transform: rotate(-4deg); display: inline-block; }
.pending-watermark {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
}
.pending-watermark span {
  font-size: 40px; font-weight: 800; color: rgba(192, 57, 43, .13);
  transform: rotate(-24deg); letter-spacing: .12em; border: 4px solid rgba(192,57,43,.13); padding: 6px 18px; border-radius: 8px;
}
.paper.pending { border-color: #E6B7B1; }
.page-tag { font-size: 11.5px; color: var(--text-3); text-align: right; margin-bottom: 4px; }

/* ---------- 印章位置示意 ---------- */
.pos-preview {
  position: relative; width: 100%; aspect-ratio: 1 / 1.414; max-width: 380px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden;
}
.pos-preview .grid-bg { position: absolute; inset: 0; background-image: linear-gradient(var(--surface-3) 1px, transparent 1px), linear-gradient(90deg, var(--surface-3) 1px, transparent 1px); background-size: 10% 10%; }
.pos-preview .seal {
  position: absolute; transform: translate(-50%, -50%); width: 26%;
}
.pos-preview .doc-line { position: absolute; left: 12%; right: 12%; height: 6px; background: var(--surface-3); border-radius: 3px; }

/* ---------- 时间线 ---------- */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ''; position: absolute; left: 5px; top: 4px; bottom: 4px; width: 1px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 12px; font-size: 13px; }
.tl-item::before { content: ''; position: absolute; left: -17px; top: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); border: 2px solid var(--surface); }
.tl-item.on::before { background: var(--primary); }
.tl-item.ok::before { background: var(--ok); }
.tl-item.bad::before { background: var(--danger); }
.tl-item .t { color: var(--text-3); font-size: 12px; }

/* ---------- 筛选栏 ---------- */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--sh-sm);
}
.filters .field { min-width: 140px; }

/* ---------- 看板 ---------- */
.rank-row { display: grid; grid-template-columns: 20px 1fr 110px 74px 90px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.rank-row.head { color: var(--text-3); font-size: 12px; border-bottom: 1px solid var(--line-strong); }
.rank-row .idx { color: var(--text-3); font-size: 12px; }
.rank-row .amt { text-align: right; font-variant-numeric: tabular-nums; }
.rank-row .pct { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- 折叠块 / 摘要 / 间距 ---------- */
.fold { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); }
.fold > summary {
  cursor: pointer; padding: 8px 12px; font-size: 13px; color: var(--text-2);
  display: flex; align-items: center; gap: 6px; list-style: none;
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ''; margin-left: auto; width: 7px; height: 7px; border-right: 1.6px solid var(--text-3); border-bottom: 1.6px solid var(--text-3); transform: rotate(45deg); transition: transform .15s; flex: none; }
.fold[open] > summary::after { transform: rotate(-135deg); }
.fold[open] > summary { border-bottom: 1px solid var(--line); color: var(--text); font-weight: 600; }
.fold .fold-bd { padding: 10px 12px; background: var(--surface); border-radius: 0 0 var(--r-sm) var(--r-sm); }
.cust-summary { border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); padding: 8px 10px; }
.ml8 { margin-left: 8px; }
.mr8 { margin-right: 8px; }
.pill-short { display: none; }

/* ---------- 移动端 ---------- */
@media (max-width: 900px) {
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  /* 顶栏在 390 宽内不溢出：隐藏次要元素，保留标题 / 演示标识 / 角色选择 */
  .hdr { padding: 0 10px; gap: 8px; overflow: visible; }
  .hdr .brand { flex: 0 1 auto; min-width: 0; }
  .hdr .brand-text { min-width: 0; }
  .hdr .brand-text b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hdr .brand-text span { display: none; }
  .who { display: none; }
  .demo-pill .pill-full { display: none; }
  .demo-pill .pill-short { display: inline; }
  .role-switch { flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
  .role-switch .small { display: none; }
  .role-switch select { min-width: 0; width: 100%; max-width: 150px; }
  .burger {
    display: inline-grid; place-items: center; width: 34px; height: 34px;
    border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); cursor: pointer;
  }
  .demo-pill { font-size: 11px; padding: 2px 8px; }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 120;
    transform: translateX(-100%); transition: transform .18s ease; height: 100vh; padding-top: 12px;
    box-shadow: var(--sh-lg);
  }
  .side.open { transform: translateX(0); }
  .backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 110; }
  .main { padding: 12px 12px 80px; }
  .grid2, .grid3, .grid4 { grid-template-columns: 1fr; }
  .page-hd h2 { font-size: 17px; }
  .card-hd { padding: 10px 12px; }
  .card-bd { padding: 12px; }

  /* 表格转卡片，保证操作按钮不被挤走 */
  .tbl-wrap { overflow: visible; }
  table.tbl, table.tbl tbody, table.tbl tr, table.tbl td { display: block; width: 100%; }
  table.tbl thead { display: none; }
  table.tbl tr {
    border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 10px; background: var(--surface);
  }
  table.tbl td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
  table.tbl td::before {
    content: attr(data-label); color: var(--text-3); font-size: 12px; flex: 0 0 84px; text-align: left;
  }
  table.tbl td.n { text-align: left; }
  table.tbl td.cell-actions { flex-direction: column; align-items: stretch; }
  table.tbl td.cell-actions::before { flex: none; margin-bottom: 4px; }
  table.tbl td.cell-actions .btn { width: 100%; }
  table.tbl tfoot td { display: flex; justify-content: space-between; }
  table.tbl tfoot td::before { content: attr(data-label); color: var(--text-2); }

  /* 明细行转纵向排布 */
  .line-head { display: none; }
  .line-grid, .line-grid.acc { grid-template-columns: 1fr 1fr; }
  .line-grid .f-sku { grid-column: 1 / -1; }
  .line-grid .f-del { grid-column: 1 / -1; justify-self: end; }

  .kv { grid-template-columns: 84px 1fr; }
  .rank-row { grid-template-columns: 18px 1fr 92px 62px; }
  .rank-row .pct { display: none; }
  .filters .field { min-width: calc(50% - 5px); }
  .modal { width: calc(100vw - 20px); max-height: calc(100vh - 32px); }
  /* 合同保持原版式：容器横向滚动，不压成窄列逐字折行；缩放只影响合同纸本身 */
  .paper-bar {
    display: flex; justify-content: space-between; align-items: center;
    gap: 8px; flex-wrap: wrap; margin-bottom: 8px;
  }
  .paper-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .paper {
    padding: 18px 16px; font-size: calc(12px * var(--pz, 1));
    min-width: calc(660px * var(--pz, 1));
  }
  .paper h4 { font-size: calc(15px * var(--pz, 1)); }
  .paper table { font-size: calc(11.5px * var(--pz, 1)); }
  .paper .clause { font-size: calc(11.5px * var(--pz, 1)); }
  .btn-lg { height: 46px; font-size: 16px; }
  .stat .v { font-size: 19px; }
  #toasts { left: 12px; right: 12px; align-items: stretch; }
  .toast { max-width: none; }
}
@media (max-width: 430px) {
  /* 390 手机：顶栏三项（标题 / 演示 / 角色）必须同排且不横向溢出 */
  .hdr { padding: 0 8px; gap: 6px; }
  .hdr .brand { flex-shrink: 0; }
  .hdr .logo { width: 24px; height: 24px; border-radius: 6px; }
  .hdr .brand-text b { font-size: 12px; }
  .demo-pill { font-size: 11px; padding: 2px 7px; }
  .role-switch select { max-width: 118px; height: 30px; font-size: 12.5px; }
  .main { padding: 10px 10px 80px; }
}
@media (max-width: 390px) {
  .grid4 { grid-template-columns: 1fr; }
  .role-switch select { max-width: 104px; }
  .card-hd h3 { font-size: 14px; }
  .stat .v { font-size: 18px; }
}

/* ---------- V1.1 客户入口（手机小程序方向演示 + 电脑网页版） ---------- */
.cust-shell {
  max-width: 390px; margin: 0 auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.cust-shell.is-web { max-width: 880px; }
.phone-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.pb-dots { display: flex; gap: 4px; }
.pb-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-2, var(--line)); display: block; }
.pb-title { font-size: 12px; font-weight: 600; color: var(--text-2); flex: 1; }
.pb-side { display: flex; gap: 6px; }
.phone-hd {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.phone-bd { padding: 12px; max-height: 62vh; overflow-y: auto; }
.cust-shell.is-web .phone-bd { max-height: none; overflow: visible; }
.phone-ft { padding: 8px 12px 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.mini-item { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.mini-item:last-child { border-bottom: 0; }
.mi-name { font-size: 13px; font-weight: 600; }
.mi-meta { margin-top: 2px; }
.cust-grid { grid-template-columns: minmax(150px, 1.6fr) minmax(110px, 1fr) 92px minmax(120px, 1.2fr) 36px; }

/* ---------- 商品目录卡片（客户侧） ---------- */
.ct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.ct-card {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: start;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
}
.ct-img {
  width: 56px; height: 56px; border-radius: 8px; background: var(--surface-2);
  border: 1px dashed var(--line-2, var(--line)); display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-3); text-align: center; line-height: 1.2; padding: 2px; overflow: hidden;
}
.ct-main { min-width: 0; }
.ct-main .strong { font-size: 13px; }
.ct-buy { text-align: right; }
.ct-buy .lbl { display: block; margin-bottom: 4px; }
@media (max-width: 720px) {
  .ct-grid { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  .ct-card { grid-template-columns: 48px 1fr; }
  .ct-img { width: 48px; height: 48px; }
  .ct-buy { grid-column: 1 / -1; text-align: left; }
}
@media (max-width: 720px) {
  .cust-shell { max-width: none; border-radius: 0; border-left: 0; border-right: 0; }
  .cust-shell.is-web { max-width: none; }
  .phone-bd { max-height: none; overflow: visible; padding: 10px; }
  .pb-side { flex-wrap: wrap; }
  .cust-grid { grid-template-columns: 1fr 1fr; }
}

/* =========================================================
 * V1.5 客户选购端 / 送货单 / 本地配送
 * ========================================================= */

/* PC 客户身份片与二级页面包屑：默认隐藏（手机用外壳里的身份条），≥721px 才启用 */
.cust-who { display: none; }
.crumb { font-size: 12px; margin-top: 4px; }
.crumb a { font-weight: 600; }
/* 侧栏演示 / 使用说明：收成一处短入口，按需展开，不与主操作抢位置 */
.side-note { margin-top: 12px; padding: 8px 10px 0; border-top: 1px solid var(--line); }
.side-note > summary { cursor: pointer; list-style: none; font-size: 12px; color: var(--text-2); }
.side-note > summary::-webkit-details-marker { display: none; }
.side-note > summary::after { content: '›'; margin-left: 5px; color: var(--text-3); }
.side-note[open] > summary::after { content: '⌄'; }
.side-note-bd { padding: 6px 0 2px; font-size: 12px; color: var(--text-3); line-height: 1.7; }

/* ---------- 搜索与分类 ---------- */
.sp-search { display: flex; gap: 8px; align-items: center; }
.sp-search .input { flex: 1; min-width: 0; }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chipbtn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; line-height: 1.4;
}
.chipbtn:hover { border-color: var(--line-2, var(--line)); color: var(--text); }
.chipbtn.on { background: var(--brand, #2563eb); border-color: var(--brand, #2563eb); color: #fff; font-weight: 600; }

/* ---------- 商品图列表（电脑：搜索 + 横向分类 + 网格） ---------- */
.sp-mall { --sp-thumb: 120px; }
.sp-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-list { min-width: 0; }
.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.sp-card {
  display: flex; flex-direction: column; gap: 8px; padding: 10px;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--surface);
}
.sp-card:hover { border-color: var(--line-strong); }
.sp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
/* 统一图片区域：同一比例与底色，contain 不裁瓶身不变形；缺图是清晰占位，不把文字当图片地址。
   底色用白，与自有白底图一致，contain 后的两侧留白不会显出灰底画布条 */
.sp-img {
  width: 100%; height: 140px; object-fit: contain; background: #fff;
  border: 0; border-radius: 8px;
}
.sp-img.ph {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: #64748B; font-size: 12px; text-align: center; padding: 4px;
}
.sp-body { flex: 1; min-width: 0; }
.sp-name { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.sp-spec { font-size: 12px; margin-top: 2px; }
.sp-spec .sp-u { font-weight: 600; color: var(--text-2); }
/* 价格层级：单价最醒目，单位与来源轻量，不堆彩色标签和圆点 */
.sp-price-line { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sp-price { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.sp-unit { font-size: 12px; color: var(--text-3); }
.sp-price-none { font-size: 15px; font-weight: 700; color: var(--warn); }
.sp-src-tag { font-size: 11px; line-height: 1.5; padding: 1px 6px; border-radius: 4px;
  background: var(--surface-2); color: #64748B; border: 1px solid var(--line); white-space: nowrap;
}
.sp-src-tag.is-custom { color: var(--primary); border-color: var(--primary-line); background: var(--primary-soft); }
/* 辅助信息（规格 / 单位 / 价格来源 / 有效期）用石板灰 500，浅灰 #94A3B8 在图上可读性不足 */
.sp-unit, .sp-spec, .sp-src, .sp-cnt { color: #64748B; }
.sp-spec { font-size: 12px; margin-top: 2px; }
.sp-src { font-size: 11.5px; line-height: 1.45; margin-top: 2px; }
.sp-src.dim, .sp-src .dim { color: #64748B; }
/* 有效期 / 到期提醒：一行短提醒 + 按需展开，不占整行大框 */
.sp-fold { margin-top: 2px; }
.sp-fold > summary {
  list-style: none; cursor: pointer; font-size: 11.5px; line-height: 1.45; color: #64748B;
  display: inline-block; border-bottom: 1px dashed var(--line-strong);
}
.sp-fold > summary::-webkit-details-marker { display: none; }
.sp-fold > summary::after { content: '›'; margin-left: 4px; color: var(--text-3); font-size: 11px; }
.sp-fold[open] > summary::after { content: '⌄'; }
.sp-fold .sp-src { margin-top: 2px; }
/* 按钮统一在卡片底部对齐；短文案不留大段空白，行动区不再占半个卡片 */
.sp-buy { margin-top: auto; padding-top: 8px; gap: 8px; flex-wrap: wrap; align-items: center; }
/* 商品卡的「加入清单」：图标 + 短文本的小按钮，靠卡片右下，不是铺满整个卡片的蓝色块 */
.btn-add {
  display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding: 5px 11px;
  border: 1px solid var(--primary-line); border-radius: 6px; background: var(--primary-soft);
  color: var(--primary); font-size: 12.5px; font-weight: 500; cursor: pointer; line-height: 1.4;
}
.btn-add:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-add[disabled] {
  background: var(--surface-2); border-color: var(--line); color: var(--text-3); cursor: not-allowed;
}
.sp-joined {
  display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--ok);
  background: var(--ok-soft); border-radius: 4px; padding: 2px 8px;
}
.sp-cnt { margin-bottom: 6px; }
.sp-sec { margin-bottom: 8px; }

/* =========================================================
 * PC 客户布局（≥721px）
 * 目标：不再套手机预览框、不受 880px 窄宽限制、不显示窗口圆点 / 内层标题 /
 *      手机-电脑切换工具条；内容随屏幕铺开，商品网格随宽度增减列数。
 * 手机侧布局（≤430px 两栏 + 底部四入口）与本段互不干涉。
 * ========================================================= */
@media (min-width: 721px) {
  /* 只解除客户 PC 选购/客户端的 max-width 限制；内部管理页保留原 --main-max 不影响 */
  .main.cust-mode { max-width: none; padding: 18px 24px 40px; }
  /* 一组页面标题 + 右侧紧凑身份：身份不另占一行，也不重复客户名与邀请人 */
  .main.cust-mode > .page-hd {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
    margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
  }
  .main.cust-mode > .page-hd > .cust-who {
    display: inline-flex; align-items: center; gap: 8px; flex: none;
  }
  .crumb { font-size: 12px; margin-top: 4px; }
  .crumb a { font-weight: 600; }
  .cust-who .cw-av {
    display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary); font-size: 13px; font-weight: 700;
  }
  .cust-who .cw-txt { display: flex; flex-direction: column; line-height: 1.25; }
  .cust-who .cw-txt .small { font-size: 11px; }

  /* 外壳：不留手机框 / 圆点 / 内层标题 / 切换条，也不再限制 880px */
  .cust-shell, .cust-shell.is-web {
    max-width: none; border: 0; border-radius: 0; background: transparent;
  }
  .cust-shell .phone-bar { display: none; }
  .cust-shell .phone-hd { display: none; }
  .cust-shell .phone-bd { padding: 0; max-height: none; overflow: visible; }
  .cust-shell .sp-tabs { display: none; }         /* PC 用左侧一级导航，不重复底部四个 tab */
  .cust-shell .phone-ft {
    padding: 0; margin-top: 16px; border: 0; background: transparent; font-size: 12px;
  }
  /* 选购：横向分类一行，商品网格随宽度铺开 */
  .sp-mall { --sp-thumb: 160px; }
  .sp-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
  .sp-card { padding: 12px; }
  .cust-shell .sp-img { height: 148px; }
  /* 名称最多两行 + 价格行保底高度：同排卡片不会因长短文案出现大段空白 */
  .sp-name {
    font-size: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .sp-price-line { min-height: 30px; }
  .sp-price { font-size: 22px; }
  .sp-search .input { max-width: 420px; }
  /* 客户侧辅助说明统一用石板灰 500，浅灰 #94A3B8 在图上可读性不足 */
  .cust-shell .dim, .main.cust-mode .dim, .cust-who .small { color: #64748B; }
  /* 清单里的目录卡在 PC 上两列以上，不再是单列长条 */
  .ct-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .main.cust-mode .card { max-width: none; }
}
@media (min-width: 1400px) {
  .sp-grid { grid-template-columns: repeat(auto-fill, minmax(216px, 1fr)); }
}

/* ---------- 手机选购：左侧固定分类栏 + 右侧商品列表独立滚动 ---------- */
@media (max-width: 430px) {
  .sp-mall {
    --sp-thumb: clamp(62px, 19vw, 84px);
    /* 顶部搜索常驻：整块吸顶在顶栏之下，高度让出底部四个入口 */
    position: sticky; top: calc(var(--h-header) + 6px); z-index: 5;
    display: flex; flex-direction: column; min-height: 0;
    height: calc(100vh - var(--h-header) - 14px);
    height: calc(100dvh - var(--h-header) - 14px);
  }
  /* 客户选购屏：外壳正好一屏，两栏高度 = 视口 − 顶栏 − 客户摘要 − 说明 − 搜索 − 底部四入口，
     不再用「视口减顶栏」估算，短屏也不会把按钮压到导航下面 */
  .main.shop-fill { padding-bottom: 10px; }
  .cust-shell.shop-fill {
    display: flex; flex-direction: column; overflow: hidden;
    height: calc(100vh - var(--h-header) - 20px);
    height: calc(100dvh - var(--h-header) - 20px);
    min-height: 320px;
  }
  .cust-shell.shop-fill .phone-hd { flex: none; }
  .cust-shell.shop-fill .phone-bd {
    flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
    padding: 10px 10px 0; max-height: none; overflow: hidden;
  }
  .cust-shell.shop-fill .phone-bd > .sp-rule { flex: none; margin-bottom: 8px; }
  .cust-shell.shop-fill .sp-mall { position: static; top: auto; flex: 1 1 auto; min-height: 0; height: auto; }
  .cust-shell.shop-fill .phone-ft { display: none; }
  .cust-shell.shop-fill .sp-tabs { position: static; flex: none; box-shadow: none; }
  .sp-mall > .sp-search { flex: none; padding-bottom: 8px; }
  .sp-mall > .sp-search .input { height: 38px; }
  .sp-mall-bd {
    flex: 1 1 auto; min-height: 0; display: flex; align-items: stretch;
    border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface);
  }
  .sp-cats {
    flex: 0 0 74px; width: 74px;
    display: flex; flex-direction: column; flex-wrap: nowrap; gap: 0;
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    background: var(--surface-2); border-right: 1px solid var(--line); padding: 0 0 14px;
  }
  .sp-cats .chipbtn {
    flex: none; width: 100%; border: 0; border-radius: 0; background: none; box-shadow: none;
    padding: 11px 5px; font-size: 12px; line-height: 1.35; color: var(--text-2);
    text-align: center; position: relative; white-space: normal; overflow-wrap: anywhere;
  }
  .sp-cats .chipbtn.on { background: var(--surface); color: var(--primary); font-weight: 700; }
  .sp-cats .chipbtn.on::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px; border-radius: 0 4px 4px 0; background: var(--primary);
  }
  .sp-list {
    flex: 1 1 auto; min-width: 0;
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    padding: 8px 10px 14px;
  }
  /* 商品行：图 + 名称规格价 + 数量与加入，窄屏不被遮挡也不横向溢出 */
  .sp-grid { display: flex; flex-direction: column; gap: 0; }
  .sp-card {
    display: grid; grid-template-columns: var(--sp-thumb) minmax(0, 1fr); gap: 10px; align-items: start;
    border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none;
    padding: 10px 0; background: transparent;
  }
  .sp-card:first-child { border-top: 0; }
  .sp-card .sp-img { width: var(--sp-thumb); height: var(--sp-thumb); }
  .sp-card .sp-main { min-width: 0; gap: 4px; }
  .sp-card .sp-body { min-width: 0; }
  .sp-card .sp-name { font-size: 13.5px; }
  .sp-card .sp-price { font-size: 17px; }
  .sp-card .sp-price-line { margin-top: 3px; gap: 4px; }
  .sp-card .sp-buy { margin-top: 2px; gap: 8px; }
  .sp-card .sp-buy .btn-add { margin-left: 0; min-height: 30px; padding: 4px 10px; font-size: 12px; }
  /* 清单行同样收紧 */
  .ct-card { grid-template-columns: 52px 1fr 84px; }
  .ct-buy { text-align: right; }
  .ct-buy .input { width: 100%; }
  /* 客户入口切到「电脑网页版」时沿用电脑版排列：横向分类 + 网格，不做左栏 */
  .cust-shell.is-web .sp-mall { position: static; height: auto; }
  .cust-shell.is-web .sp-mall-bd { display: block; border: 0; overflow: visible; }
  .cust-shell.is-web .sp-cats {
    flex-direction: row; flex-wrap: wrap; gap: 6px; width: auto; flex: none;
    overflow: visible; background: none; border-right: 0; padding: 0;
  }
  .cust-shell.is-web .sp-cats .chipbtn {
    width: auto; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; text-align: center;
  }
  .cust-shell.is-web .sp-cats .chipbtn.on::before { display: none; }
  .cust-shell.is-web .sp-list { overflow: visible; padding: 0; }
  .cust-shell.is-web .sp-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .cust-shell.is-web .sp-card {
    display: flex; flex-direction: column; border: 1px solid var(--line);
    border-radius: var(--r); padding: 10px; background: var(--surface);
  }
}
/* ---------- 手机客户入口：去掉模拟外壳与重复标题，底部四入口常驻 ---------- */
@media (max-width: 430px) {
  .cust-shell .phone-bar { display: none; }
  .cust-shell .phone-ft { display: none; }
  .cust-shell .phone-hd { padding: 8px 12px; }
  .cust-shell .phone-hd .sub { display: none; }
  .cust-shell .phone-bd { padding: 10px 10px 72px; }
  .main.cust-mode > .page-hd { display: none; }
  .nav-item.cust-extra { display: none; }
  .cust-shell:not(.is-web) .sp-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    box-shadow: 0 -2px 10px rgba(15, 23, 42, .08); background: var(--surface);
  }
  .cust-shell:not(.is-web) .phone-bd { padding-bottom: 74px; }
  .sp-rule { font-size: 12px; line-height: 1.5; }
}
/* 选购屏的覆盖规则必须放在上面 fixed / 预留规则之后并提高优先级：
   否则同优先级的 position: fixed 与 padding-bottom: 74px 会赢，
   底导航浮在两栏之上，右栏滚动到底的按钮仍被盖住 */
@media (max-width: 430px) {
  .cust-shell.shop-fill .phone-bd.phone-bd { padding-bottom: 0; }
  .cust-shell.shop-fill .sp-tabs.sp-tabs,
  .cust-shell.shop-fill:not(.is-web) .sp-tabs.sp-tabs {
    position: static; left: auto; right: auto; bottom: auto; flex: none; box-shadow: none;
  }
  .cust-shell.shop-fill .sp-mall.sp-mall { position: static; top: auto; height: auto; }
}
.sp-rule {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2); font-size: 12.5px; color: var(--text-2);
}
.sp-rule summary { cursor: pointer; color: var(--text-2); font-size: 12.5px; list-style: none; }
.sp-rule summary::-webkit-details-marker { display: none; }
.sp-rule summary::after { content: '›'; margin-left: 6px; color: var(--text-3); }
.sp-rule[open] summary::after { content: '⌄'; }
.sp-more { margin-left: 6px; color: var(--primary); font-size: 12px; }

/* ---------- 手机版底部四个入口 ---------- */
.sp-tabs {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); background: var(--surface); position: relative;
}
.sp-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 7px 2px 5px; font-size: 11px; color: var(--text-3); text-decoration: none; position: relative;
}
.sp-tab.on { color: var(--brand, #2563eb); font-weight: 600; }
.sp-tab.on::before {
  content: ''; position: absolute; top: 0; left: 18%; right: 18%; height: 2px;
  background: var(--brand, #2563eb); border-radius: 2px;
}
.sp-dot {
  position: absolute; top: 3px; right: 16%; min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 999px; background: #dc2626; color: #fff; font-size: 10px; font-style: normal;
  display: flex; align-items: center; justify-content: center;
}
.cust-shell:not(.is-web) .phone-bd { padding-bottom: 4px; }

/* ---------- 我的入口链接 ---------- */
.me-link {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 2px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit;
}
.me-link:last-child { border-bottom: 0; }
.me-link:hover { background: var(--surface-2); }

/* ---------- V1.6 采购省事：买过的说明 / 清单金额汇总 ---------- */
.sp-bought { margin-top: 3px; line-height: 1.45; }
.cart-sum {
  margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--r); background: var(--surface-2);
}
.cs-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.cs-total { font-size: 20px; line-height: 1.2; }
.mini-list { display: grid; gap: 0; }
/* B67 来源提示：清单来自哪张原单、价格按现行报价重算 */
.cart-src {
  margin-top: 10px; padding: 6px 10px; border-left: 3px solid var(--line-strong);
  background: var(--surface-2); border-radius: var(--r-sm); line-height: 1.5;
}

/* ---------- 送货单预览 ---------- */
.dn-paper { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.dn-hd { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.dn-meta { display: grid; gap: 4px; font-size: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.dn-meta .dim { color: var(--text-3); margin-right: 4px; }
.dn-tbl { font-size: 12px; }
.dn-ft { display: grid; gap: 3px; padding-top: 8px; border-top: 1px solid var(--line); }

/* 内部核对与管理：沿用现有组件，正常内容与按需详情分层。 */
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
.quiet-fold { color:#64748b;font-size:13px; }
.quiet-fold summary { cursor:pointer;width:fit-content;padding:5px 0; }
.quiet-fold p { margin:8px 0;line-height:1.65; }
.quiet-fold[open] { color:var(--text); }
.settings-layout { display:grid;grid-template-columns:164px minmax(0,1fr);gap:24px;align-items:start; }
.settings-menu { display:flex;flex-direction:column;gap:4px;padding:6px;background:white;border:1px solid var(--line);border-radius:12px; }
.settings-menu a { padding:12px 14px;color:#475569;text-decoration:none;border-radius:8px; }
.settings-menu a.active { background:var(--primary-soft);color:var(--primary);font-weight:600; }
.settings-content { min-width:0; }
.setting-section > h3 { font-size:18px;margin:4px 0 8px; }
.setting-section > p { margin:0 0 20px; }
.setting-record { background:white;border:1px solid var(--line);border-radius:12px;margin-bottom:12px;overflow:hidden; }
.setting-record > summary { display:flex;align-items:center;justify-content:space-between;gap:20px;padding:20px;cursor:pointer; }
.setting-record > summary b { font-size:16px;font-weight:600; }
.setting-record .sub { display:block;margin-top:7px; }
.setting-record[open] > summary { border-bottom:1px solid var(--line); }
.setting-checks { display:flex;flex-wrap:wrap;gap:16px 22px; }
.manage-toolbar { display:flex;gap:10px;align-items:center; }
.manage-toolbar .input { flex:1;min-width:0; }
.manage-toolbar .select { width:156px; }
.manage-products { padding:0 20px; }
.manage-product { border-top:1px solid var(--line);padding:16px 0; }
.manage-product-main { display:flex;align-items:center;gap:18px; }
.manage-img { width:52px;height:60px;object-fit:contain;flex:none; }
.manage-img.placeholder { display:flex;align-items:center;justify-content:center;font-size:11px;text-align:center;color:#94a3b8;background:#f8fafc;border-radius:6px; }
.manage-product-name { flex:1;min-width:0; }
.manage-product-name .strong { font-size:15px; }
.manage-product-name .small { margin-top:5px; }
.manage-price { width:150px;flex:none;font-size:16px;text-align:right;margin-right:20px;font-variant-numeric:tabular-nums; }
.manage-product-main .checkline { width:102px;flex:none; }
.manage-edit { margin-left:70px;font-size:13px;color:#64748b; }
.manage-edit summary { width:fit-content;cursor:pointer;margin-top:8px; }
.manage-edit-body { display:grid;grid-template-columns:minmax(0,240px) minmax(0,1fr);gap:16px;margin-top:16px;background:#f8fafc;padding:16px;border-radius:8px; }
.manage-edit-body > .small { grid-column:1/-1; }
.rq-customer { padding:2px 0 14px; }
.rq-customer .strong { font-size:16px;margin-bottom:8px; }
.rq-customer .small { color:#64748b;line-height:1.5; }
.rq-meta { display:flex;gap:24px;align-items:flex-start;margin-bottom:16px; }
.rq-meta > details { min-width:0; }
.rq-meta > details[open] { flex:1; }
.rq-meta-body { padding:6px 0; }
.rq-exclusion { color:#475569;background:#f8fafc;border-radius:6px;padding:10px 12px;margin-bottom:14px; }
.rq-table { table-layout:fixed;width:100%; }
.rq-table th:first-child { width:23%; }
.rq-table th:nth-child(2) { width:36%; }
.rq-table th:nth-child(3) { width:10%; }
.rq-table th:nth-child(4) { width:18%; }
.rq-table th:last-child { width:13%; }
.rq-table td { vertical-align:top;padding-top:20px;padding-bottom:20px;overflow-wrap:anywhere; }
.rq-table .input,.rq-table .select { width:100%;min-width:0; }
.rq-table .strong { font-size:15px; }
.rq-table .small.dim { margin-top:5px; }
.rq-table .quiet-fold { margin-top:6px;font-size:12px; }
.rq-table .rq-options { display:grid;gap:10px;padding:8px 0; }
.rq-notice:not(:empty) { margin-top:8px;line-height:1.5; }
.rq-total { display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 4px 2px; }
.rq-total .strong { font-size:22px;margin-left:12px; }
.request-review .warn-text { color:#b45309; }
.setting-record .dim,.setting-section > p,.manage-products .dim,.request-review .dim { color:#64748b; }
@media(max-width:720px) {
  .settings-layout { grid-template-columns:minmax(0,1fr);gap:16px; }
  .settings-menu { flex-direction:row;flex-wrap:wrap;gap:0; }
  .settings-menu a { padding:10px 12px; }
  .setting-record > summary { padding:16px; }
  .manage-toolbar { flex-wrap:wrap; }
  .manage-toolbar .input { flex-basis:100%; }
  .manage-toolbar .select { flex:1; }
  .manage-products { padding:0 14px; }
  .manage-product-main { flex-wrap:wrap;gap:12px; }
  .manage-product-name { flex-basis:calc(100% - 70px); }
  .manage-price { margin-left:64px;margin-right:0;width:auto;flex:1;text-align:left; }
  .manage-edit { margin-left:0; }
  .manage-edit-body { grid-template-columns:minmax(0,1fr); }
  .rq-table,.rq-table tbody,.rq-table tr,.rq-table td { display:block;width:100%; }
  .rq-table thead { display:none; }
  .rq-table tr { padding:12px 0;border-bottom:1px solid var(--line); }
  .rq-table td { padding:8px 0;border:0; }
  .rq-table td:before { content:attr(data-label);display:block;float:none;font-size:12px;color:#64748b;margin-bottom:8px; }
  .rq-table td.n { text-align:left; }
  .rq-meta { flex-wrap:wrap;gap:8px 16px; }
  .rq-total { flex-wrap:wrap; }
}
