/* ===== 佰兴 ERP 设计系统 v3 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root{
  /* ===== 佰兴 ERP 设计系统 v5 · 单一真相源（第五轮） ===== */
  /* ① 品牌主色阶 · 钢青（10 档） */
  --c-brand-50:#eef3f8;  --c-brand-100:#e8eef4; --c-brand-200:#c5d6e6;
  --c-brand-300:#9bb8d2; --c-brand-400:#5b86ad; --c-brand-500:#2f6294;
  --c-brand-600:#1f4e79; /* 主色 · 图纸蓝 */    --c-brand-700:#173d5e;
  --c-brand-800:#123049; --c-brand-900:#0d2438;
  --c-brand:var(--c-brand-600);
  /* ② 中性色阶 */
  --c-n-0:#fffdf9;   --c-n-50:#faf7f1;  --c-n-100:#f7f4ee; --c-n-150:#efeadd;
  --c-n-200:#d8d2c4; --c-n-250:#ddd6c7; --c-n-300:#cfc7b6; --c-n-400:#b3a998;
  --c-n-500:#8b8377; --c-n-600:#7a7264; --c-n-700:#6b6459; --c-n-800:#3d3830;
  --c-n-900:#1c1a17; --c-n-950:#12110e;
  --c-ink:var(--c-n-900);      --c-ink-2:var(--c-n-700);    --c-ink-3:var(--c-n-500);
  --c-bg:var(--c-n-100);       --c-surface:var(--c-n-0);    --c-surface-2:var(--c-n-50);
  --c-line:var(--c-n-200);     --c-line-2:var(--c-n-150);    --c-line-3:var(--c-n-300);
  --c-thead:#f5f1e7;
  /* 第六轮 · 图纸账本（暖纸/纸面，旧 surface/bg 自动跟随） */
  --c-paper:var(--c-n-100); --c-paper-2:var(--c-n-0);
  /* ③ 侧栏碳底 */
  --c-side:#1f1c18; --c-side-raise:#2a2620; --c-side-text:#e8e2d5;
  --c-side-group:#9a9183; --c-side-active:var(--c-brand-400);
  /* ④ 强调色 · 锻橙 */
  --c-accent:#a63a2e; --c-accent-strong:#8f2f25; --c-accent-ink:#8a2f24; --c-accent-soft:#f4e4e0;
  /* ⑤ 语义状态色 */
  --c-success:#2f6b4f; --c-success-soft:#e8f1ec; --c-success-line:#aacdb9; --c-success-ink:#23603f;
  --c-warning:#8a5a1a; --c-warning-soft:#f7efe0; --c-warning-line:#e6cfa4; --c-warning-ink:#7a4d13;
  --c-danger:#a63a2e;  --c-danger-soft:#f6e6e3;  --c-danger-line:#e3bab4;  --c-danger-ink:#8f2f25;
  --c-info:#1f4e79;    --c-info-soft:#e8eef4;    --c-info-line:#bccfe1;    --c-info-ink:#173d5e;
  --c-pending:#5a5348; --c-pending-soft:#f0ece2; --c-pending-line:#d8d2c4; --c-pending-ink:#4a443b;
  --c-muted:#8b8377;   --c-muted-soft:#f4f1ea;   --c-muted-line:#ddd6c7;   --c-muted-ink:#6b6459;
  /* ⑥ 行状态 */
  --c-row-zebra:#faf7f1; --c-row-hover:#f0ece2; --c-row-selected:#efe9db;
  /* ⑦ 打印专用灰阶（物理隔离，不参与深色覆盖） */
  --c-print-ink:#1a1a1a; --c-print-ink-2:#444444;
  --c-print-line-heavy:#333333; --c-print-line:#555555; --c-print-line-soft:#999999;
  --c-print-zebra:#f2f5f7; --c-print-bg:#ffffff;
  /* ⑧ 字体栈（全本地，无外链） */
  --ff-sans:"Noto Sans SC","Microsoft YaHei UI","Microsoft YaHei","PingFang SC",system-ui,sans-serif;
  --ff-serif:"Noto Serif SC","Source Han Serif SC","Songti SC","STSong","SimSun",serif;
  --ff-num:"Bahnschrift","DIN Alternate","Segoe UI","Arial Narrow",sans-serif;
  --ff-mono:ui-monospace,"SF Mono","Cascadia Mono",Consolas,Menlo,monospace;
  /* ⑨ 字阶（--fs-* 复活为真相源，非删概念） */
  --fs-xs:11.5px; --fs-sm:12px; --fs-base:13px; --fs-body:13.5px; --fs-md:14px;
  --fs-lg:16px;   --fs-xl:19px; --fs-2xl:25px;  --fs-3xl:27px;
  --lh-tight:1.2; --lh-snug:1.35; --lh-base:1.55; --lh-relaxed:1.7; --lh-print:1.8;
  /* ⑩ 间距阶（4px 基准） */
  --sp-unit:4px;
  --sp-0:0; --sp-1:4px; --sp-2:8px; --sp-3:12px; --sp-4:16px; --sp-5:20px;
  --sp-6:24px; --sp-8:32px; --sp-10:40px; --sp-12:48px; --sp-16:64px;
  /* ⑪ 圆角（工业方角，旧名即真相源） */
  --r:2px; --r-sm:2px; --r-0:0; --r-lg:2px;
  /* ⑫ 阴影 */
  --sh-1:0 1px 2px rgba(16,22,29,.04);
  --sh-2:0 2px 8px rgba(16,22,29,.08);
  --sh-3:0 4px 16px rgba(16,22,29,.10);
  /* ⑬ 层级 */
  --z-th:2; --z-sticky:3; --z-pop:100; --z-drawer:200; --z-toast:300; --z-modal:400;
  /* ⑭ 尺寸 */
  --w-side:168px; --w-side-collapsed:66px; --h-top:58px;
  --w-drawer:1120px; --w-drawer-wide:1120px; --w-content-max:1760px;
  /* ⑮ 表格单元格 padding 三档 */
  --cell-pad:10px 12px; --cell-pad-compact:7px 10px; --cell-pad-print:5px 8px;
  /* ⑯ 第五轮新增定值（§7.1 #10 / §9.6） */
  --ct-label-w:76px; --sp-touch:44px; --fs-input-mobile:16px;
  --c-dirty-soft:var(--c-warning-soft); --c-dirty-ink:var(--c-warning-ink);
  /* ============================================================
     ⑰ 旧变量名兼容别名 —— 41 个旧名全量保留，只做 var() 映射，勿删
     ============================================================ */
  --brand:var(--c-brand-600);       --brand-ink:var(--c-brand-700);
  --brand-soft:var(--c-brand-100);  --brand-2:var(--c-brand-400);
  --ink:var(--c-ink);               --ink-2:var(--c-ink-2);   --ink-3:var(--c-ink-3);
  --line:var(--c-line);             --line-2:var(--c-line-2); --line-3:var(--c-line-3);
  --bg:var(--c-bg);                 --surface:var(--c-surface); --surface-2:var(--c-surface-2);
  --side:var(--c-side);
  --green:var(--c-success);         --green-soft:var(--c-success-soft);
  --amber:var(--c-warning);         --amber-soft:var(--c-warning-soft);
  --red:var(--c-danger);            --red-soft:var(--c-danger-soft);
  --ok:var(--c-success);            --warn:var(--c-warning);  --bad:var(--c-danger);
  --forge:var(--c-accent);          --num:var(--ff-num);      --muted:var(--c-muted);
  --sh:var(--sh-1);                 --sh-lg:var(--sh-3);
  --fs-12:var(--fs-sm); --fs-125:var(--fs-sm); --fs-13:var(--fs-base);
  --fs-14:var(--fs-md); --fs-16:var(--fs-lg);  --fs-20:var(--fs-xl); --fs-25:var(--fs-2xl);
  --gap-1:var(--sp-1); --gap-2:var(--sp-2); --gap-3:var(--sp-3);
  --gap-4:var(--sp-4); --gap-5:var(--sp-5);
  /* ★ 补齐 4 个「被引用却未定义」的静默回退变量 */
  --bg-soft:var(--c-surface-2); --blue:var(--c-info); --dim:var(--c-ink-3);
}
html, body { height: 100%; }
body {
  font-family: var(--ff-sans);
  background: var(--c-paper); color: var(--c-ink); font-size: 14px; line-height: 1.7;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
.hide { display: none !important; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }

/* ---------- 登录 ---------- */
.login-wrap {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--c-paper);
}
.login-card { width: 380px; background: var(--c-paper-2); border: 1px solid var(--c-ink); border-radius: var(--r); padding: 40px 36px 34px; box-shadow: none; }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-brand .mark { width: 34px; height: 34px; border-radius: var(--r); background: var(--brand); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px; }
.login-brand h1 { font-size: 22px; letter-spacing: .02em; font-family: var(--ff-serif); }
.login-brand h1 span { color: var(--brand); }
.login-sub { color: var(--c-ink-2); font-size: 12.5px; margin: 2px 0 26px; text-align: center; letter-spacing: .02em; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; padding: 11px; margin-top: 6px; height: 40px; }
.login-err { color: var(--red); font-size: 12.5px; text-align: center; height: 18px; margin-top: 8px; }
.login-foot { text-align: center; color: var(--c-ink-3); font-size: 11.5px; margin-top: 22px; }

/* ---------- 骨架 ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 168px; background: var(--side); color: var(--c-side-text); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px; }
.brand .mark { width: 30px; height: 30px; border-radius: var(--r); background: var(--c-accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.brand b { color: #fffdf9; font-size: 17px; font-weight: 600; letter-spacing: .02em; font-family: var(--ff-serif); }
.brand small { display: block; color: #9a9183; font-size: 10px; font-weight: 400; letter-spacing: .06em; }
.nav { flex: 1; overflow-y: auto; padding: 6px 0 14px; }
.nav::-webkit-scrollbar { width: 0; }
.nav-group { padding: 14px 18px 6px; font-size: 10.5px; letter-spacing: .12em; color: var(--c-side-group); }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; margin: 1px 0; padding: 9px 18px; border-radius: 0; color: var(--c-side-text); font-size: 13.5px; letter-spacing: .02em; cursor: pointer; opacity: .72; border-left: 2px solid transparent; transition: background .15s, color .15s, opacity .15s; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fffdf9; opacity: 1; }
.nav-item.active { background: transparent; color: #fffdf9; opacity: 1; border-left-color: var(--c-accent); border-left-width: 2px; font-weight: 500; }
.nav-item svg { display: none; }   /* 第六轮：去图标，只留文字（icon() 调用未删） */
.nav-item span { display: inline; }
.side-foot { padding: 12px 18px; border-top: 1px solid rgba(232,226,213,.1); color: var(--c-side-group); font-size: 11px; }

.main { flex: 1; margin-left: 168px; display: flex; flex-direction: column; min-width: 0; }
.top { height: 58px; background: var(--c-paper-2); border-bottom: 2px solid var(--c-ink); display: flex; align-items: center; gap: 16px; padding: 0 28px; position: sticky; top: 0; z-index: 20; }
.top h2 { font-family: var(--ff-serif); font-size: 18px; font-weight: 600; letter-spacing: .02em; }
.top .spacer { flex: 1; }
.top .search { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px; width: 230px; color: var(--ink-3); font-size: 12.5px; }
.top .search input { border: 0; background: none; outline: none; width: 100%; font-size: 12.5px; height: 22px; }
/* 窄屏下 flex 会把标题和账号挤到逐字换行（竖排）——三者都不许收缩 */
.top h2 { white-space: nowrap; flex-shrink: 0; }
.user-chip { flex-shrink: 0; white-space: nowrap; }
.top > .btn { flex-shrink: 0; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.user-chip .av { width: 24px; height: 24px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-size: 11px; font-weight: 600; }
.content { padding: 24px 28px; width: 100%; max-width: 1760px; margin: 0 auto; }   /* 第六轮：宽屏居中不铺满 */

/* ---------- 卡片 / KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-bottom: 22px;
  border-top: 2px solid var(--c-ink); border-bottom: 1px solid var(--c-line); padding: 16px 0; }
.kpi { background: transparent; border: 0; border-right: 1px solid var(--c-line); border-radius: 0; padding: 0 22px; box-shadow: none; }
.kpi:last-child { border-right: 0; }
.kpi .k-top { display: flex; align-items: center; justify-content: space-between; color: var(--c-ink-2); font-size: 11.5px; letter-spacing: .1em; font-weight: 500; }
.kpi .ic { width: 30px; height: 30px; border-radius: var(--r); display: grid; place-items: center; background: transparent; color: var(--c-ink-2); }
.kpi .ic.g { background: transparent; color: var(--green); }
.kpi .ic.a { background: transparent; color: var(--amber); }
.kpi .ic.r { background: transparent; color: var(--red); }
.kpi .v { font-family: var(--ff-num); font-size: 29px; font-weight: 600; margin-top: 5px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
.kpi .v small { font-size: 12px; font-weight: 400; color: var(--c-ink-3); margin-left: 4px; letter-spacing: 0; font-family: var(--ff-sans); }
.kpi .sub { font-size: 11.5px; color: var(--c-ink-3); margin-top: 3px; }

.card { background: transparent; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.card + .card { margin-top: 26px; border-top: 1px solid var(--c-line); padding-top: 26px; }
.card-h { display: flex; align-items: center; gap: 12px; padding: 0 0 9px; border-bottom: 2px solid var(--c-ink); flex-wrap: wrap; font-family: var(--ff-serif); }
.card-h h3 { font-size: 16px; font-weight: 600; letter-spacing: .03em; font-family: var(--ff-serif); }
.card-h .spacer { flex: 1; }
.card-b { padding: 0; }
.card-b.flush { padding: 0; }

/* ---------- 表格 ---------- */
.tbl-wrap { overflow: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
.tbl th { position: sticky; top: 0; z-index: 2; background: var(--c-paper); color: var(--c-ink-2); font-size: 11.5px; font-weight: 600; text-align: left; padding: 10px; white-space: nowrap; border-bottom: 2px solid var(--c-line); letter-spacing: .07em; }
.tbl td { padding: 0 10px; height: 38px; border-bottom: 1px solid var(--c-line-2); white-space: nowrap; font-size: 13.5px; }
.tbl tbody tr:hover td { background: #f0ece2; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .strong { font-weight: 600; }
.tbl .sub-line { color: var(--ink-3); font-size: 11.5px; }

/* ---------- 标签 / 按钮 ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r); font-size: 11.5px; line-height: 1.6; white-space: nowrap; }
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill-g { background: var(--green-soft); color: var(--green); }
.pill-a { background: var(--amber-soft); color: var(--amber); }
.pill-r { background: var(--red-soft); color: var(--red); }
.pill-b { background: var(--brand-soft); color: var(--brand); }
.pill-gray { background: #eef2f7; color: var(--ink-2); }
.pill-gray::before { display: none; }

.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--c-line); background: transparent; color: var(--ink); font-size: 13px; transition: background .15s, border-color .15s, color .15s; white-space: nowrap; }
.btn:hover { background: var(--c-surface-2); border-color: var(--c-line-3); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--sh-1); }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn-danger { color: var(--red); border-color: #f3cfcc; }
.btn-danger:hover { background: var(--red-soft); }
.btn:disabled { opacity: .6; cursor: not-allowed; pointer-events: none; }
.btn:disabled::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; margin-left: 6px; animation: bx-spin .7s linear infinite; }
@keyframes bx-spin { to { transform: rotate(360deg); } }
/* 第六轮：保存成功——按钮下 2px 墨线从左画满 600ms（不改 textContent） */
.btn.is-saved::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--c-ink); transform: scaleX(0); transform-origin: left;
  animation: save-ink .6s cubic-bezier(.22,.8,.3,1) forwards; }
@keyframes save-ink { to { transform: scaleX(1); } }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: 12px; color: var(--ink-2); }
.field > label b { color: var(--red); font-weight: 500; margin-left: 2px; }
input[type=text], input[type=number], input[type=date], input[type=password], input:not([type]), select, textarea {
  height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; width: 100%;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--c-brand-600); box-shadow: 0 0 0 2px rgba(31,78,121,.16); }
input:disabled { background: var(--c-surface-2); color: var(--c-ink-2); }
.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 14px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span4 { grid-column: span 4; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 2px; }
.seg button { border: 0; background: none; padding: 4px 12px; border-radius: var(--r-sm); font-size: 12.5px; color: var(--ink-2); }
.seg button.on { background: var(--surface); box-shadow: 0 1px 3px rgba(15,30,51,.1); color: var(--ink); font-weight: 500; }

/* ---------- 开单双栏 ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 392px; gap: 16px; align-items: start; }
/* 第六轮：grid 子项默认 min-width:auto 会被内部宽表撑开，强制允许收缩 */
.split > *, .kpi-grid > * { min-width: 0; }
.pick-list { max-height: 560px; overflow: auto; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.pick-row:hover { background: var(--brand-soft); }
.pick-row .card-no { font-family: var(--ff-mono); font-size: 11.5px; color: var(--brand); }
.pick-row .meta { flex: 1; min-width: 0; }
.pick-row .meta b { display: block; font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.pick-row .meta span { font-size: 11px; color: var(--ink-3); }
.totals { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.totals .t { display: flex; flex-direction: column; }
.totals .t span { font-size: 11.5px; color: var(--ink-2); }
.totals .t b { font-size: 15px; font-variant-numeric: tabular-nums; }
.totals .t.big b { font-size: 21px; color: var(--brand); }

/* ---------- 抽屉 ---------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(16,22,29,.42); z-index: 200; opacity: 0; transition: opacity .2s; }
.drawer-mask.on { opacity: 1; }
/* 第七轮：全站禁止右侧抽屉。所有编辑/详情统一为「居中大弹窗」，宽屏可用面积 ~1100px。
   保留 .drawer 类名与 drawer() 调用点，只换定位与动画，避免全站上百个调用点改动。 */
.drawer { position: fixed; top: 50%; left: 50%; right: auto; bottom: auto;
  width: min(1120px, 94vw); height: min(86vh, 940px);
  background: var(--c-paper-2); border: 1px solid var(--line);
  border-top: 3px solid var(--c-ink); border-radius: 8px; z-index: 201;
  display: flex; flex-direction: column;
  transform: translate(-50%, -48%) scale(.99); opacity: 0;
  box-shadow: 0 24px 64px rgba(16,22,29,.26);
  transition: transform .2s ease, opacity .2s ease; }
.drawer.on { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.drawer:not(.on) { transition: transform .16s ease, opacity .16s ease; }
.drawer-h { padding: 16px 24px; }
.drawer-b { padding: 20px 24px; }
.drawer .form-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
.drawer-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-h h3 { font-size: 15px; font-weight: 600; }
.drawer-h .spacer { flex: 1; }
.drawer-b { flex: 1; overflow: auto; padding: 20px 22px; }
.drawer-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface); }
.icon-btn { width: 30px; height: 30px; border-radius: var(--r); border: 0; background: transparent; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); }

/* ---------- PDF 预览浮层 ---------- */
.pdf-modal-mask { position: fixed; inset: 0; background: rgba(16,22,29,.35); z-index: 95; display: flex; align-items: center; justify-content: center; padding: 24px; }
.pdf-modal { width: min(880px, 96vw); max-height: 92vh; background: var(--surface); border-radius: var(--r); box-shadow: var(--sh-lg); display: flex; flex-direction: column; overflow: hidden; }
.pdf-modal-h { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.pdf-modal-h h3 { font-size: 14px; font-weight: 600; margin: 0; }
.pdf-modal-h .spacer { flex: 1; }
.pdf-modal-b { flex: 1; overflow: auto; background: #525659; padding: 14px; display: flex; justify-content: center; }
.pdf-modal-b iframe, .pdf-modal-b embed { width: 100%; height: 78vh; border: 0; background: #fff; border-radius: var(--r-sm); }
.pdf-modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface); }


/* ---------- 空态 / 加载 ---------- */
.empty { padding: 44px 20px; text-align: center; color: var(--ink-3); }
.empty .em-ic { width: 44px; height: 44px; border-radius: var(--r); background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 10px; color: var(--ink-3); }
.skel { height: 12px; border-radius: var(--r-sm); background: #ebe6da; animation: skel-in .2s ease both; animation-delay: 150ms; }
@keyframes skel-in { from { opacity: 0 } to { opacity: 1 } }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; top: 16px; transform: translate(-50%, -8px); max-width: min(92vw, 420px); white-space: normal; word-break: break-word; line-height: 1.6; background: var(--c-paper-2); color: var(--c-ink); border: 1px solid var(--c-line); border-left: 3px solid var(--c-ink); padding: 10px 18px; border-radius: var(--r); font-size: 13px; z-index: var(--z-toast); opacity: 0; transition: opacity .22s, transform .22s; box-shadow: 0 6px 20px -10px rgba(28,26,23,.3); pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-left-color: var(--c-success); }
.toast.err { border-left-color: var(--c-danger); }

/* ---------- 工具条 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.chip:hover { border-color: var(--c-line-3); color: var(--c-ink); }
.chip.on { background: var(--brand-soft); border-color: var(--c-brand-200); color: var(--brand); }
.toolbar input[type=text] { width: 220px; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  /* 第八轮：侧栏整体让位给左侧抽屉，不再压成 66px 图标条；底部由 .btab 常驻 */
  .side { display: none; }
  .main { margin-left: 0; }
  .content { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  /* 手机上页头放不下页内搜索：隐藏它，把位置让给标题和账号 */
  .top { gap: 10px; padding: 0 14px; }
  .top .search { display: none; }
  .user-chip span { max-width: 72px; overflow: hidden; text-overflow: ellipsis; }
  /* 两列 KPI 每列只有 ~140px，25px 的数字会把「¥324,700.05」顶出卡片 */
  .kpi { padding: 12px 13px; }
  .kpi .v { font-size: 19px; letter-spacing: -.2px; overflow-wrap: anywhere; }
  .kpi .sub { font-size: 11px; }
}

/* ═════════ 第八轮 · 移动端外壳（仅 ≤820 屏幕层；≥821 桌面零变化） ═════════ */
/* 默认隐藏：桌面永不出现。纸面 + 墨线 2px + 钢青 + 方角，禁止圆角卡片 App 风。 */
.btab, .nav-burger, .nav-drawer-mask, .nav-drawer, .act-bar, .quick-box, .dirty-hint { display: none; }
@media (max-width: 820px) {
  /* 为底部 Tab 留出安全区，末行内容不被遮住 */
  .content { padding-bottom: calc(56px + env(safe-area-inset-bottom) + 16px); }

  /* A · 底部固定 Tab：图标 21px + 文字 11.5px，整格可点，选中态顶部 2px 钢青指示条 */
  .btab {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--c-paper-2); border-top: 2px solid var(--c-ink); z-index: 40;
  }
  .btab button {
    position: relative; flex: 1 1 0; min-width: 0; min-height: 56px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 4px 0; border: 0; background: transparent; color: var(--c-ink-3);
    font-family: var(--ff-sans); cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .btab button svg { display: block; width: 21px; height: 21px; }
  .btab button span { display: block; font-size: 11.5px; line-height: 1.1; white-space: nowrap; }
  /* 选中态=印章红（与 .nav-item.active 的印章红竖线同源，不引入第二套激活色）；
     颜色非唯一载体：另有 font-weight:600 + 顶部 2px 指示条双重表达 */
  .btab button.active { color: var(--c-accent); font-weight: 600; }
  .btab button.active::before {
    content: ''; position: absolute; top: -2px; left: 22%; right: 22%;
    height: 2px; background: var(--c-accent);
  }

  /* B · 顶栏窄屏优先级：汉堡 → 返回 → 标题(省略号) → 头像；退出与搜索隐藏 */
  .nav-burger { display: inline-flex; flex: none; width: 44px; height: 44px; align-items: center; justify-content: center; }
  .top { height: 56px; gap: 8px; padding: 0 8px; }
  .top .nav-burger { order: 1; }
  .top #back-btn { order: 2; flex: none; padding: 0 8px; white-space: nowrap; }
  .top h2 { order: 3; flex: 1; min-width: 0; font-size: 16px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .top .spacer { display: none; }
  .top .user-chip { order: 4; flex: none; }
  .top .logout-btn { display: none; }

  /* B · 全菜单抽屉：独立于居中大弹窗 .drawer，碳底左滑入 */
  .nav-drawer-mask {
    display: block; position: fixed; inset: 0; z-index: 200;
    background: rgba(16,22,29,.42); opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .nav-drawer-mask.on { opacity: 1; pointer-events: auto; }
  .nav-drawer {
    display: flex; position: fixed; top: 0; left: 0; bottom: 0;
    width: min(86vw, 320px); max-width: 100%;
    background: var(--c-side); color: var(--c-side-text); z-index: 201;
    border-radius: 0;   /* 工业方角：不继承第七轮居中弹窗 .drawer 的 8px 圆角 */
    flex-direction: column; transform: translateX(-100%); transition: transform .2s ease;
  }
  .nav-drawer.open { transform: translateX(0); }
  .nav-drawer .brand { padding: 18px 16px 16px; border-bottom: 1px solid rgba(232,226,213,.1); }
  .nav-drawer .brand b, .nav-drawer .brand small { display: block; }
  .nav-drawer .nav { flex: 1; overflow-y: auto; padding: 6px 0 14px; }
  .nav-drawer .nav-group { display: block; padding: 14px 16px 6px; }
  /* 关键：覆盖桌面「只显文字」与 ≤820 全局「只显图标」两套隐藏规则，24 项文字全显 */
  .nav-drawer .nav-item {
    display: flex; align-items: center; min-height: 46px; padding: 9px 16px;
    gap: 10px; font-size: 13.5px; opacity: .72;
  }
  .nav-drawer .nav-item span { display: inline; }
  .nav-drawer .nav-item svg { display: block; flex: none; width: 18px; height: 18px; }
  .nav-drawer .nav-item.active {
    background: rgba(31,78,121,.24); color: #fffdf9; opacity: 1;
    border-left-color: var(--c-accent); font-weight: 600;
  }
  .nav-drawer-foot { padding: 12px 16px; border-top: 1px solid rgba(232,226,213,.1); }
  .nd-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
  .nd-av { width: 36px; height: 36px; border-radius: 50%; background: var(--c-side-raise);
    color: #fffdf9; display: grid; place-items: center; font-size: 14px; font-weight: 600; }
  .nd-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .nd-meta b { color: #fffdf9; font-size: 13px; font-weight: 600; }
  .nd-meta span { color: var(--c-side-group); font-size: 11.5px; }
  .nd-acts { display: flex; gap: 8px; }
  .nav-drawer-foot .btn { flex: 1; min-height: 44px; background: var(--c-side-raise);
    border-color: rgba(232,226,213,.2); color: #fffdf9; }

  /* C · 仪表盘常用操作磁贴（桌面 .quick-box 保持 display:none，零变化） */
  .quick-box { display: block; margin-bottom: 12px; }
  .quick-box .grp-title { margin: 0 0 8px; }
  .quick-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .quick-tiles button {
    min-height: 76px; display: flex; flex-direction: column; align-items: flex-start;
    justify-content: center; gap: 4px; padding: 12px; background: var(--c-paper-2);
    border: 1px solid var(--c-line); border-radius: var(--r); text-align: left;
    color: var(--c-ink); font-family: var(--ff-sans); cursor: pointer;
  }
  .quick-tiles button svg { width: 24px; height: 24px; color: var(--c-brand); }
  .quick-tiles .qt-main { font-size: 13px; font-weight: 600; line-height: 1.2; }
  .quick-tiles .qt-sub { font-size: 11.5px; color: var(--c-ink-3); line-height: 1.2; }

  /* D · 合同详情/打印预览屏幕层悬浮操作条（sticky 停在 Tab 之上） */
  .act-bar {
    display: flex; position: sticky; bottom: calc(56px + env(safe-area-inset-bottom) + 8px);
    height: 56px; gap: 8px; align-items: center;
    background: var(--c-paper-2); border-top: 2px solid var(--c-ink);
    z-index: 45; margin: 0 -16px; padding: 0 16px;
  }
  .act-bar .btn { min-height: 44px; white-space: nowrap; }
  .act-bar .spacer { flex: 1; }
  .act-bar .btn-stamp { color: var(--c-accent); border-color: var(--c-accent); background: transparent; }
  /* E · 手机无 hover：「请先保存」为常显警示文字（--c-warning-ink），不再只靠 title */
  .dirty-hint { display: inline; color: var(--c-warning-ink); font-size: 11.5px; white-space: nowrap; }
  /* F · 详情页顶部与底部悬浮条重复的三个动作（打印预览/盖章/保存PDF）在手机收起，
     统一走底部一键可达的悬浮条；桌面端不受影响（本规则仅在 ≤820 内） */
  .dp-acts .mob-hide-act { display: none !important; }
  /* G · 手机工作台不展示库存概览（KPI + 表格卡片），桌面端保留；
     单列 split 下最近订单卡片自动补位 */
  .hide-on-mobile { display: none !important; }
}
@media (max-width: 480px) {
  /* 头像收成 32px 圆形，姓名让位给标题；点击区域仍是整个 user-chip → openMyAccount() */
  .top h2 { font-size: 15px; }
  .top .user-chip { padding: 2px; border: 0; background: transparent; }
  .top .user-chip #user-name { display: none; }
  .top .user-chip .av { width: 32px; height: 32px; font-size: 12px; }
}
/* 禁用 ≠ 加载中：脏数据不可导出时显式去掉 .btn:disabled::after 的 spinner（桌面/手机都生效）。
   只有点击导出后真正进入「生成中…」才保留加载态。 */
.btn-no-spin:disabled::after { display: none; }
/* 悬浮条只在屏幕出现；打印版式与后端 PDF 零改动（唯一新增的 print 隐藏规则） */
@media print { .act-bar { display: none !important; } }

/* ===== 质感打磨层 ===== */
/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd8e5; border-radius: var(--r); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b6c3d6; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* 焦点可见（键盘可达） */
:focus-visible { outline: 2px solid var(--c-brand-400); outline-offset: 2px; border-radius: var(--r-sm); }
button:active { transform: translateY(.5px); }

/* 卡片层次（第六轮：去壳，无阴影/位移，文档不滑动） */
.kpi .v { letter-spacing: -.01em; }

/* 顶栏（第六轮：纸面 + 2px 墨线，见基础层） */

/* 表格更紧凑的呼吸感 */
.tbl td { padding: 10px 12px; }
.tbl tbody tr { transition: background .12s ease; }
.tbl th { letter-spacing: .2px; }

/* 分类筛选条 */
.cat-bar { display: flex; gap: 6px; padding: 10px 14px; overflow-x: auto; border-bottom: 1px solid var(--line-2); }
.cat-bar::-webkit-scrollbar { height: 0; }
.cat-bar .chip { flex: none; height: 26px; padding: 0 9px; font-size: 12px; }

/* 抽屉更顺滑 */
.drawer { will-change: transform; }
.drawer-mask { will-change: opacity; }

/* 空态更克制 */
.empty { color: var(--ink-3); font-size: 12.5px; }
.empty .em-ic { border: 1px dashed var(--c-line); background: transparent; }

/* 数字列对齐 */
.num, .mono { font-variant-numeric: tabular-nums; }

/* 表单聚焦更清晰（第六轮：2px 图纸蓝环） */
input:focus, select:focus, textarea:focus { border-color: var(--c-brand-600); box-shadow: 0 0 0 2px rgba(31,78,121,.16); }

/* 分段控件 */
.seg button { transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
.seg button:hover { color: var(--ink); }

/* 用户区 */
.user-chip { transition: border-color .15s ease; }
.user-chip:hover { border-color: var(--c-line-3); }

/* 导航粘性分组标题 */
.nav-group { position: sticky; top: 0; background: var(--side); z-index: 1; }

/* 抽屉底部按钮区 */
.drawer-f .btn-primary { min-width: 96px; }

/* 打印样式（合同/单据） */@media print {
  .side, .top, .drawer-f, .toolbar, .btn, .seg, .cat-bar { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  .card { background: #fff !important; box-shadow: none !important; border: 0 !important; }
  .drawer { position: static !important; width: 100% !important; height: auto !important; opacity: 1 !important;
    transform: none !important; box-shadow: none !important; border: 0 !important; top: auto !important; left: auto !important; }
  .drawer-mask { display: none !important; }
  body { background: #fff !important; color: #111 !important; }
}

/* 合同明细表：列宽唯一来源为 renderCItems 的 <colgroup>（第五轮删遗留百分比） */
#ct-items select { width: 100% !important; }
#ct-items input { width: 100% !important; }

/* 合同条款文本域 */
#ct-body { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
#ct-body:focus { background: #fff; }



/* v4 字阶/间距层已并入文件头唯一 :root（第五轮） */

/* 页面进入动效：轻、快、不抢焦点 */
.content > * { animation: pagein .12s ease both; }
@keyframes pagein { from { opacity: 0; } to { opacity: 1; } }   /* 第六轮：仅淡入，无位移 */
@media (prefers-reduced-motion: reduce) {
  .content > *, .skel, .btn.is-saved::after, .row-hl { animation: none !important; }
  .drawer, .drawer-mask, .toast, .tbl tbody tr, .btn, .chip, .seg button { transition: none !important; }
}

/* 顶栏标题区：主标题+面包屑副行 */
.top h2 { display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.top h2 .crumb { font-size: 11px; font-weight: 400; color: var(--ink-3); letter-spacing: .4px; }

/* KPI 数字强调（第六轮：去顶部色条，靠字号/字重/等宽体） */
.kpi .v.pos { color: var(--green); }
.kpi .v.neg { color: var(--red); }

/* 表格：宽表密度可切换 + 首列粘性 + 斑马纹（弱） */
.tbl.tbl-compact th { padding: 8px 10px; }
.tbl.tbl-compact td { padding: 0 10px; font-size: 13px; }
.tbl tbody tr:nth-child(even) td { background: transparent; }
.tbl tbody tr:hover td { background: #f0ece2; }
.tbl .sticky-col { position: sticky; left: 0; z-index: 1; background: var(--c-paper); box-shadow: 1px 0 0 var(--c-line-2); }
.tbl thead .sticky-col { z-index: 3; background: var(--c-paper); }
.tbl tbody tr:hover .sticky-col { background: #f0ece2; }
.tbl-wrap { border-radius: 0; }
.card-b.flush .tbl-wrap, .card > .tbl-wrap { max-height: 68vh; }

/* 表内输入控件：无边框幽灵态，聚焦才显形（数据网格专用） */
.tbl td input, .tbl td select {
  height: 28px; border-color: transparent; background: transparent; border-radius: var(--r-sm); padding: 0 6px;
}
.tbl td input:hover { border-color: var(--line); background: var(--surface); }
.tbl td input:focus { border-color: var(--c-brand-400); background: #fff; box-shadow: 0 0 0 3px rgba(99,149,164,.12); }

/* 按钮：去阴影（第六轮靠色彩/边框分层） */
.btn-primary:active { transform: translateY(1px); }

/* 状态点：更清晰的状态语言 */
.pill { font-weight: 500; letter-spacing: .2px; }
.pill-g, .pill-b { background-color: color-mix(in srgb, currentColor 9%, white); }

/* 抽屉：头部带上下文说明位 */
.drawer-h { padding: 16px 22px; background: linear-gradient(180deg, #fbfcff, #fff); }
.drawer-h h3 { display: flex; flex-direction: column; gap: 2px; }
.drawer-h h3 small { font-size: 11.5px; font-weight: 400; color: var(--ink-3); letter-spacing: .3px; }
.drawer-b h4.sec { font-size: 13px; font-weight: 600; margin: 18px 0 10px; padding-left: 9px; border-left: 3px solid var(--brand); line-height: 1.3; }
.drawer-b h4.sec:first-child { margin-top: 0; }

/* 空态：插画感 */
.empty .em-ic { width: 52px; height: 52px; font-size: 20px; border-radius: var(--r); color: #b9c6da; }

/* 侧栏：激活项由 border-left 印章红竖线表达（第六轮，去掉绝对定位伪元素） */

/* 登录页微调 */
/* 登录卡片：纸面 + 墨线（第六轮，见基础层） */

/* 打印隐藏列设置按钮等已在 print 层 */

/* ===== 可访问性/交互合规（web-design-guidelines 审查修复） ===== */
button, .chip, .seg button, .nav-item { touch-action: manipulation; }
body { -webkit-tap-highlight-color: rgba(0,0,0,0); }
.drawer-b, .pick-list, .tbl-wrap { overscroll-behavior: contain; }
@media (pointer: fine) { html { overscroll-behavior: none; } }
button.nav-item { width: calc(100% - 20px); border: 0; background: transparent; text-align: left; }
.toast { min-width: 120px; text-align: center; }

/* 分组标题（frontend-design：结构即信息） */
.grp-title { font-size: 12.5px; font-weight: 600; color: var(--ink-2); letter-spacing: .3px;
  margin: 4px 0 12px; padding-left: 9px; border-left: 3px solid var(--brand); line-height: 1.3; }
.grp-title + .form-grid { margin-bottom: 6px; }
.grp-title:not(:first-child) { margin-top: 16px; }

/* 校验错误就地高亮（ui-ux-pro-max：错误就近显示） */
.tbl td input.inp-err { border-color: var(--red) !important; background: var(--red-soft); }

/* ===== 第六轮 · 图纸账本：装饰已在 C1/C2 直接改写（无压制式 !important） ===== */

/* ===== 合同模板富文本编辑器 ===== */
.tpl-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.tpl-toolbar select { height: 28px; width: 84px; }
.tpl-toolbar .btn-sm { height: 28px; padding: 0 9px; }
.tpl-editor { min-height: 260px; max-height: 46vh; overflow: auto; border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 14px 16px; background: #fff; line-height: 1.9; font-size: 13.5px; outline: none; }
.tpl-editor:focus { border-color: var(--c-brand-600); }
.tpl-editor p { margin: 0 0 6px; }
.tpl-table { border-collapse: collapse; margin: 8px 0; width: 100%; }
.tpl-table td { border: 1px solid #4a4f55; padding: 5px 9px; min-width: 64px; }

/* v6 皮肤令牌已并入文件头唯一 :root（第五轮）；以下为本地字体栈收编 */
body, button, input, select, textarea { font-family: var(--ff-sans); }
.num, .mono { font-family: var(--num); font-weight: 600; letter-spacing: .02em; }
.kpi .v { font-family: var(--num); font-weight: 600; letter-spacing: -.01em; }
.kpi .v small, .kpi .sub { font-family: var(--ff-sans); font-weight: 400; }
.totals .t b { font-family: var(--num); font-weight: 700; }

/* 侧栏：暖褐底 + 印章红竖线（第六轮） */
.nav-item, .seg, .top .search, .user-chip, .chip, .btn, .field input, .field select, .drawer { border-radius: var(--r); }
.brand .mark, .login-brand .mark { border-radius: var(--r); }

/* 账本式横线表格（第六轮：去全细框，只留横线） */
.tbl th { border: 0; border-bottom: 2px solid var(--c-line); background: var(--c-paper); }
.tbl td { border: 0; border-bottom: 1px solid var(--c-line-2); }
.tbl thead .sticky-col { background: var(--c-paper); }

/* 大数字（第六轮：主数值墨色；hl 用盖章红点缀） */
.kpi .v { color: var(--c-ink); }
.kpi .v small, .kpi .sub { font-family: var(--ff-sans); font-weight: 400; }
.kpi.hl .v, .kpi .v.forge { color: var(--c-accent); }

/* ===== v7：明细列可拖拽调宽 + 宽屏全宽 ===== */
/* overflow:auto 会在窄表头里挤出滚动条，竖线正好压在列名上（「品名」看着像被劈开）。
   resize 只需要 overflow 不是 visible，用 hidden 即可；右侧留 14px 给拖拽手柄。 */
.tbl-resizable th { resize: horizontal; overflow: hidden; min-width: 56px;
  padding-right: 14px; text-overflow: ellipsis; }
.tbl-resizable td input, .tbl-resizable td select { min-width: 70px; }

/* ===== v7.1 紧凑表头（钢铁通式：表头压 2-3 行，明细区为主视觉） ===== */
.form-compact { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px 12px; align-items: center; }
.form-compact .field { display: flex; flex-direction: row; align-items: center; gap: 7px; min-width: 0; }
.form-compact .field > label { flex: 0 0 auto; margin: 0; font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.form-compact .field > input, .form-compact .field > select { flex: 1; min-width: 0; height: 30px; font-size: 12.5px; padding: 0 8px; }
.form-compact .field.span2 { grid-column: span 2; }
.form-compact .field.span3 { grid-column: span 3; }
.form-compact .field.span4 { grid-column: span 4; }
.form-compact .field.span6 { grid-column: span 6; }
.form-compact .seg { padding: 2px; }
.form-compact .seg button { padding: 3px 10px; }
/* 抽屉较窄：紧凑表头降为 4 列 */
.drawer-b .form-compact { grid-template-columns: repeat(4, 1fr); }
.drawer-b .form-compact .field.span6 { grid-column: span 4; }

/* ===== v11：合同全页表单 / 富文本 / 打印预览 ===== */
.combo-wrap { position: relative; display: flex; align-items: center; flex: 1; min-width: 0; }
.combo-wrap > svg { position: absolute; left: 9px; color: var(--ink-3); pointer-events: none; }
.combo-wrap > input { padding-left: 27px; }
.rt-bar { display: inline-flex; gap: 5px; align-items: center; flex-wrap: wrap; }
#ct-body:focus { border-color: #9dbcf5; box-shadow: 0 0 0 3px rgba(46,93,107,.12); }
#ct-body table.ct-table { border-collapse: collapse; width: 100%; margin: 8px 0; }
#ct-body table.ct-table td { border: 1px solid #444; padding: 5px 8px; min-width: 32px; }
#ct-body table.ct-table.noborder td { border-color: transparent; }
#ct-body p { margin: 4px 0; }

/* 打印预览：A4 竖版 */
.a4-page { width: 794px; min-height: 1123px; background: #fff; border: 1px solid var(--line);
  box-shadow: 0 3px 18px rgba(15,30,51,.12); padding: 48px; box-sizing: border-box;
  display: flex; flex-direction: column; }
.a4-inner { position: relative; font-size: 13px; line-height: 1.8; color: #111; word-break: normal; overflow-wrap: anywhere;
  flex: 1; display: flex; flex-direction: column; }
.pv-title { text-align: center; font-size: 21px; font-weight: 700; letter-spacing: 2px; margin: 4px 0 2px; }
.pv-no { text-align: right; font-size: 12px; color: #555; margin-bottom: 10px; }
.pv-parties { font-size: 12.5px; line-height: 1.9; margin-bottom: 10px; }
.pv-tbl { border-collapse: collapse; width: 100%; font-size: 11.5px; }
.pv-tbl th, .pv-tbl td { border: 1px solid #333; padding: 4px 5px; word-break: normal; overflow-wrap: anywhere; white-space: normal; }
.pv-tbl th { background: #f0f3f5; font-weight: 600; }
/* 大写金额这一排：主句靠左、定金贴右边缘（客户要求「定金别往前挤，跟这一排尾巴对齐」） */
.pv-upper { display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  font-size: 13.5px; font-weight: 600; margin: 8px 0; }
.pv-kvs { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 18px; font-size: 12.5px; margin-bottom: 10px; }
/* 合同要素：一行排三项，把纵向空间让给条款正文；「补充条款」单独占一整行 */
.pv-kvs3 { grid-template-columns: 1fr 1fr 1fr; gap: 4px 14px; border: 1px solid #333; padding: 6px 8px;
  align-items: start; }
/* 三列并排时每格文字长短差很多：标签不折行、值在标签右侧续写，格子之间用底边分隔，
   不会出现「运输及费用承担：…」被挤成两行、右边那格又顶到框线上 */
.pv-kvs3 .pv-kv { line-height: 1.6; display: block; overflow-wrap: anywhere; }
.pv-kvs3 .pv-kv b { white-space: nowrap; }
.pv-kvs3 .pv-kv b::after { content: "："; }
.pv-kvs3 .pv-kv b { margin-right: 0; }
.pv-kvs1 { grid-template-columns: 1fr; border: 1px solid #c8ccd2; border-top: 0; padding: 6px 8px; margin-top: -10px; background: #fcfcfa; border-radius: 0 0 3px 3px; }
/* 付款方式、运输及费用承担各自独占一行（三列挤在一起读不清）；
   期货的「全额付款日期 / 交货时间」两两并排，省一行高度 */
.pv-kvs-stack { grid-template-columns: 1fr; border: 1px solid #333; padding: 6px 8px; gap: 2px; margin-bottom: 0; }
.pv-kvs-stack .pv-kv { line-height: 1.8; }
.pv-kvs-stack .pv-kv b { margin-right: 0; }
.pv-kvs-stack .pv-kv b::after { content: "："; }
.pv-kvs-stack .pv-kv2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 18px; }
/* 一行两项：主项在左、尾部项（全额付款日期 / 交货时间）贴整行右边缘 */
.pv-kvs-stack .pv-kv-row { display: flex; align-items: baseline; gap: 18px; }
.pv-kvs-stack .pv-kv-row > .pv-kv { flex: 1 1 auto; min-width: 0; }
.pv-kvs-stack .pv-kv-tail { flex: 0 0 auto; margin-left: auto; text-align: right; white-space: nowrap; }
.pv-kvs-stack + .pv-kvs1 { margin-top: 0; }
/* 定金金额贴在「合同金额（大写）…（小写）」这一排的尾部 */
.pv-dep { font-weight: 700; white-space: nowrap; }
.pv-kvs1 .pv-kv { line-height: 1.6; }
.pv-kvs1 .pv-kv b::after { content: "：" }
.pv-kv b { font-weight: 600; color: #444; margin-right: 6px; }
.pv-body { font-size: 13px; line-height: 1.9; }
.pv-body table { border-collapse: collapse; width: 100%; font-size: 11.5px; margin: 6px 0; }
.pv-body td { border: 1px solid #444; padding: 4px 6px; }
.pv-body table.noborder td { border-color: transparent; }
.pv-sign { display: flex; justify-content: space-between; gap: 24px; margin-top: 34px; font-size: 12.5px; }
.pv-sign > div { flex: 1; line-height: 2; }
.pv-sub { font-size: 11.5px; color: #555; }
/* 电子章盖在「供方（甲方）」栏（左边那一栏），不是右边需方 */
/* 章要压在「供方（盖章）」那一行上（下沿留一点白），太高会盖住上面的税号/开户行 */
.pv-stamp { position: absolute; left: 40px; bottom: 6px; width: 150px; opacity: .92; pointer-events: none; }

/* 合同打印预览的「列设置」面板：按需增减打印列（按米销售时把长度/单位勾上）。
   面板挂在 body 上、fixed 定位：外层 .card 是 overflow:hidden，放里面会被裁掉，
   卡片链路上的 transform 还会把 fixed 的定位原点和层级一起带偏。 */
.colpick-wrap { position: relative; }
.colpick-host { position: fixed; left: 0; top: 0; width: 0; height: 0; z-index: 80; }
.colpick { display: none; position: fixed; width: 330px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--sh-lg); padding: 10px 12px; }
.colpick-host.on .colpick { display: block; }
@media print { .colpick-host { display: none !important; } }
.colpick-wrap.on .colpick { display: block; }
.colpick-h { font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.colpick-h .dim { font-weight: 400; display: block; margin-top: 2px; line-height: 1.5; }
.colpick-g { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.colpick-i { display: flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; }
.colpick-i input { margin: 0; }
.colpick-i em { font-style: normal; color: var(--ink-3); font-size: 11px; }
.colpick-i.is-lock { color: var(--ink-3); cursor: default; }
.colpick-f { margin-top: 8px; text-align: right; border-top: 1px solid var(--line-2); padding-top: 8px; }

@media print {
  body { background: #fff; }
  body * { visibility: hidden; }
  #print-host, #print-host * { visibility: visible; }
  #print-host { position: absolute; left: 0; top: 0; width: 100%; padding: 0 !important; display: block !important; }
  .a4-page { border: 0; box-shadow: none; margin: 0 auto; width: 210mm; min-height: auto; padding: 0 12mm; }
  @page { size: A4 portrait; margin: 10mm 0; }
}

/* 合同打印：双方完整信息块 */
.pv-parties2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; margin-bottom: 8px;
  border: 1px solid #555; padding: 10px 12px; }
.pv-party-t { font-weight: 700; font-size: 12.5px; margin-bottom: 3px; letter-spacing: 1px; }
.pv-l { font-size: 12px; line-height: 1.75; word-break: normal; overflow-wrap: anywhere; }
.pv-l b { color: #444; font-weight: 600; }
.pv-meta { font-size: 12px; margin: 6px 0 8px; color: #333; }

/* ===== H2：合同打印版式（明细突出 / 双专项行 / 一页铺排） ===== */
/* 明细表：10 列（序号/品名/产地/规格/材质/涂层颜色/数量/单位/单价/金额）挤在 A4 版心里，
   13px + 逐字 break-all 会把「TDC51D+Z」劈成两行、「宝钢黄石」折行。
   现在固定布局按 PRINT_COLS 的百分比走，字号压到 11.5px，短字段一律不换行，
   只有品名/涂层颜色/备注允许换行（这三个本来就可能有长内容）。 */
.pv-tbl-big { table-layout: fixed; }
.pv-tbl-big th, .pv-tbl-big td { padding: 5px 4px; font-size: 11.5px; white-space: nowrap;
  word-break: normal; overflow-wrap: normal; }
.pv-tbl-big td[data-k="name"], .pv-tbl-big td[data-k="color"], .pv-tbl-big td[data-k="remark"] {
  white-space: normal; word-break: break-word; }
/* 材质牌号（S350GD+AM150、TDC51D+AZ150 2/1M）比数字长得多：列宽按权重已经给足，
   万一遇到超长牌号允许在格内折行，绝不横向顶出边框——列宽固定，折行后各框仍然对齐。 */
.pv-tbl-big td[data-k="material"] { white-space: normal; word-break: break-word; line-height: 1.3; }
/* 金额/单价贴右边框看着像「出框」：留 7px 呼吸位，合计行同样处理 */
.pv-tbl-big td[data-k="amount"], .pv-tbl-big td[data-k="price_ton"], .pv-tbl-big td[data-k="tons"],
.pv-tbl-big tfoot td { padding-right: 7px; }
.pv-tbl-big tfoot td { font-size: 12px; }

/* 明细编辑器（销售/采购通用）：一行一张卡，字段多也不挤成一团 */
.oe-row { border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; margin-bottom: 10px;
  background: var(--surface); }
.oe-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12.5px; }
.oe-h b { font-size: 12.5px; }
.oe-g { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 12px; }
.oe-g label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--ink-3); }
.oe-g label.oe-f2 { grid-column: span 2; }
.oe-g input, .oe-g select { height: 28px; font-size: 12px; }
.oe-amt { text-align: right; font-size: 12.5px; margin-top: 6px; }
.oe-amt b { font-size: 14px; font-variant-numeric: tabular-nums; }
.chip-warn { background: rgba(214, 150, 30, .1); border: 1px solid rgba(214, 150, 30, .35);
  border-radius: var(--r); padding: 8px 10px; font-size: 12px; color: #8a5a00; line-height: 1.7; }

/* 电子章预览：棋盘格底，透明章的边缘才看得出来 */
.stamp-box { width: 190px; height: 190px; border: 1px solid var(--line); border-radius: var(--r);
  display: grid; place-items: center; overflow: hidden; flex: none;
  background-color: #fff;
  background-image: linear-gradient(45deg, #eef2f7 25%, transparent 25%, transparent 75%, #eef2f7 75%),
    linear-gradient(45deg, #eef2f7 25%, transparent 25%, transparent 75%, #eef2f7 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.stamp-box img { max-width: 92%; max-height: 92%; object-fit: contain; display: block; }

/* 合同抬头：简版图形标（不带公司名，名字交给标题与供需方栏）居左，标题在页面正中；
   用 grid 三列而不是 flex，右侧留一个等宽空列，标题才是「版心居中」而不是「剩余空间居中」 */
.pv-head2 { display: grid; grid-template-columns: 72px 1fr 72px; align-items: center; }
.pv-head2 img { width: 64px; height: auto; display: block; justify-self: start; }
.pv-title2 { grid-column: 2; text-align: center; font-size: 27px; font-weight: 800; letter-spacing: 3px;
  margin: 0; line-height: 1.28; color: #111; }
.pv-rule2 { border: 0; border-top: 2.4px solid #1c2026; border-bottom: .8px solid #1c2026; height: 3px;
  margin: 7px 0 5px; }
.pv-meta2 { display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; font-size: 13px;
  font-weight: 500; color: #1c2026; margin-bottom: 10px; }

/* 合同打印：供需方资料合并到底部，省下的版面全给明细 */
.pv-parties2-btm { margin-top: auto; padding-top: 22px; margin-bottom: 4px; }
.pv-parties2-btm + .pv-sign { margin-top: 10px; }
@media print {
  /* 打印时走流式排版，别让 flex 把内容撑到第二页 */
  .a4-page, .a4-inner { display: block; }
  .pv-parties2-btm { margin-top: 22px; padding-top: 0; }
}
.pv-sub2 { font-size: 10px; color: #666; line-height: 1.3; }
/* 合同新建页页头操作组 */
.ct-actions { display: inline-flex; align-items: center; gap: 8px; }
.pv-tbl-big tbody tr:nth-child(even) td { background: #f2f5f7; }
.pv-tbl-big td { font-weight: 500; }
.pv-tbl-big tfoot td { font-size: 13px; }
.pv-special { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px;
  border: 1px solid #555; padding: 8px 12px; margin: 8px 0 10px; }
.pv-sp { font-size: 12px; line-height: 1.8; word-break: normal; overflow-wrap: anywhere; }
.pv-sp b { font-weight: 700; color: #333; }

/* ===== v12：统一详情页（整页表单）+ 多条件查询条 + 分页条 ===== */
/* 详情页：粘性操作条，滚动时操作始终可达 */
.dp-head { position: sticky; top: 58px; z-index: 6; margin-bottom: 14px;
  background: var(--c-paper); padding: 10px 0; }   /* 第六轮：让开 58px 顶栏；去壳后补不透明底板防滚动透底 */
.dp-head .card-h { padding: 0 0 9px; }
.dp-head h3 { font-size: 15px; }
.dp-head .dp-sub { font-size: 12px; }
.dp-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dp-head .btn { height: 30px; padding: 0 11px; font-size: 12.5px; }
.dp-sec .card-h { padding: 0 0 9px; }
.dp-sec .dp-sub { font-size: 11.5px; }
.dp-sec + .dp-sec { margin-top: 14px; }

/* 只读信息格：字段名在上、值在下，2-3 行排完，长值自动换行不截断 */
.kv-grid { display: grid; gap: 10px 22px; }
.kv-grid.kv-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kv-grid.kv-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kv-wide { grid-column: 1 / -1; }
.kv-k { font-size: 11.5px; color: var(--ink-3); letter-spacing: .2px; }
.kv-v { font-size: 13px; color: var(--ink); word-break: break-word; overflow-wrap: anywhere; }
.kv-v a { color: var(--brand); }

/* 金额条 */
.money-strip { display: flex; flex-wrap: wrap; gap: 10px; }
.money-strip .ms { flex: 1 1 150px; min-width: 140px; border: 1px solid var(--line); border-radius: var(--r);
  padding: 9px 13px; background: var(--surface-2); display: flex; flex-direction: column; gap: 1px; }
.money-strip .ms span { font-size: 11.5px; color: var(--ink-2); }
.money-strip .ms b { font-family: var(--num); font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.money-strip .ms b.ok { color: var(--green); }
.money-strip .ms b.bad { color: var(--red); }
.money-strip .ms b.warn { color: var(--amber); }

/* 宽明细表：列多时横向滚动，不压扁列宽、不换行截断 */
.tbl-wide { min-width: 100%; }
.tbl-wide th, .tbl-wide td { white-space: nowrap; }
.dp-sec .tbl-wrap { max-height: none; }

/* 多条件查询条 */
.qbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 0 12px; }
.qbar .qb-lb { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.qbar input[type=date], .qbar .qb-date { width: 148px; flex: none; height: 30px; font-size: 12.5px; }
.qbar .qb-sel { width: 132px; flex: none; height: 30px; font-size: 12.5px; }
.qbar .qb-q { flex: 1 1 220px; min-width: 180px; max-width: 340px; height: 30px; font-size: 12.5px; }
.qbar .btn { height: 30px; }
/* 第八轮后续 · 查询条分组 wrapper：桌面不参与布局，渲染与旧版逐像素一致 */
.qbar .qb-row, .qbar .qb-field { display: contents; }
/* 工具栏里的日期不要撑满整行（历史布局 bug） */
.toolbar input[type=date] { width: 148px; flex: none; height: 30px; }
.toolbar .seg { flex: none; }

/* 分页条 */
.pg-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px;
  border-top: 1px solid var(--line-2); background: var(--surface); font-size: 12.5px; }
.pg-bar .spacer { flex: 1; }
.pg-bar .pg-size { width: 96px; height: 28px; font-size: 12.5px; }
.pg-btn { min-width: 30px; height: 28px; padding: 0 8px; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r-sm); font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pg-btn:hover:not(:disabled) { border-color: var(--c-line-3); color: var(--c-ink); background: var(--c-surface-2); }
.pg-btn.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pg-btn:disabled { opacity: .45; cursor: not-allowed; }
/* 服务端还有更多没取回时的提示（避免列表被静默截断却看不出来） */
.pg-cut { margin-left: 4px; padding: 2px 8px; border-radius: var(--r-sm); font-size: 11.5px;
  color: #8a4b12; background: #fdf2e6; border: 1px solid #f0d9bd; font-variant-numeric: tabular-nums; }

/* 合同只读条款 */
.ct-readonly { background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 18px 22px; font-size: 13px; line-height: 1.9; word-break: break-word; }
.ct-readonly table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.ct-readonly td { border: 1px solid #444; padding: 4px 6px; }

@media (max-width: 1180px) {
  .kv-grid.kv-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 详情页内空表：压缩留白，避免一屏被空态占满 */
.dp-sec .empty { padding: 20px 16px; }
.dp-sec .empty .em-ic { width: 36px; height: 36px; font-size: 14px; border-radius: var(--r); margin-bottom: 6px; }
@media print { .dp-head { position: static; } }

/* 卡片头里的下拉/日期不要撑满整行（打印预览的“打印列”选择器曾被挤到独立一行） */
.card-h select, .card-h input[type=date], .card-h input[type=text] { width: auto; max-width: 260px; height: 30px; font-size: 12.5px; }
.card-h .seg { flex: none; }

/* ===== v13：品牌 LOGO 接入（登录 / 侧栏 / 合同页眉） ===== */
.login-logo { width: 218px; height: auto; display: block; margin: 4px auto 14px; }
.login-sub { text-align: center; margin: 0 0 24px; letter-spacing: .3px; }
.login-brand, .login-brand .mark { display: none; }
.brand-logo { width: 34px; height: 34px; border-radius: var(--r); background: #fff; display: grid; place-items: center; flex: none; }
.brand-logo img { width: 28px; height: 28px; object-fit: contain; }
.brand .mark { display: none; }

/* 合同打印页眉：LOGO 左 / 编号·日期·地点右 / 分隔线 */
.pv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 2px; }

.pv-head-r { text-align: right; font-size: 11.5px; line-height: 1.85; color: #333; }
.pv-head-r b { font-weight: 600; color: #555; }
.pv-rule { border: 0; border-top: 1.1px solid #333; margin: 8px 0 4px; }
.pv-title { margin: 12px 0 2px; }
@media print { .pv-head img { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }

/* 从「按明细」点进订单详情时，定位并高亮来源那一行 */
.row-hl td { background: var(--brand-soft) !important; }
.row-hl { animation: row-flash .2s ease; }
@keyframes row-flash { from { background: #f0ece2; } to { background: transparent; } }
.row-hl td:first-child { box-shadow: inset 3px 0 0 var(--brand); }

/* 送货单识别结果：认不出的字段标红，别让人闭着眼保存 */
.dlv-cell-miss input { border-color: var(--red) !important; background: rgba(214, 69, 69, .06); }
.dlv-cell-miss { box-shadow: inset 0 -2px 0 var(--red); }
.tbl-compact input { border: 1px solid transparent; background: transparent; border-radius: var(--r-sm);
  padding: 3px 5px; font-size: 12px; color: inherit; height: 24px; }
.tbl-compact input:hover { border-color: var(--line); }
.tbl-compact input:focus { border-color: var(--brand); background: #fff; outline: none; }
.tbl-compact input:disabled { color: var(--muted, #8a94a6); }

/* 结算单：小指标块 + 可编辑金额格（D-34 规格成行 / M6 点保存才落盘） */
.kpi-mini { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 9px 12px; display: flex; flex-direction: column; gap: 3px; }
.kpi-mini span { font-size: 11.5px; color: var(--ink-3); }
.kpi-mini b { font-size: 15px; font-weight: 650; letter-spacing: -.2px;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tbl-compact input.stl-amt { border-color: var(--line); background: #fff; text-align: right; }
.tbl-compact input.stl-amt:focus { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }


/* ===== 第五轮 · 批次 A 收尾（A3/A4/A5/A6） ===== */
/* A6 打印等宽数字（不碰 .pv-tbl-big 607-617 的 word-break / 613 材质 break-word） */
.pv-tbl-big td, .pv-tbl-big th { font-variant-numeric: tabular-nums; }
.pv-tbl-big td[style*="text-align:right"], .pv-tbl-big th[style*="text-align:right"] { font-variant-numeric: tabular-nums; }
@media print { .no-print { display: none !important; } }

/* A3 组件规范：表格滚动槽位 + 首列 sticky 背景覆盖（斑马/悬停/选中/合计/打印） */
.tbl-wrap { scrollbar-gutter: stable; }
.tbl tbody tr:nth-child(even) .sticky-col { background: var(--c-row-zebra); }
.tbl tbody tr:hover .sticky-col, .tbl tbody tr.is-selected .sticky-col { background: var(--c-row-hover); }
.tbl tbody tr.row-hl .sticky-col { background: var(--brand-soft); }
.tbl tfoot .sticky-col, .tbl tbody tr:last-child .sticky-col { background: var(--c-surface-2); }
@media print { .tbl tbody tr:nth-child(even) .sticky-col { background: var(--c-print-zebra); } }
/* 数字列进位余量（999→1,000 不抖动） */
.tbl td.num, .tbl th.num { padding-left: 14px; font-variant-numeric: tabular-nums; }
/* toast 语义色条 + 状态三编码符号（中文文字仍由业务提供，不删字面量） */
.toast.ok { border-left: 3px solid var(--c-success); }
.toast.err { border-left: 3px solid var(--c-danger); }
.pill-g::before { content: "✓"; width: auto; height: auto; border-radius: 0; background: none; }
.pill-a::before { content: "△"; width: auto; height: auto; border-radius: 0; background: none; }
.pill-r::before { content: "✕"; width: auto; height: auto; border-radius: 0; background: none; }
.pill-b::before { content: "◐"; width: auto; height: auto; border-radius: 0; background: none; }
/* A3 第四轮新类纳入规范（圆角已全局归一，此处补焦点/密度/宽度） */
.colpick { width: min(330px, calc(100vw - 20px)); }
.oe-row, .stamp-box, .kpi-mini { border-color: var(--c-line); }
.dlv-cell-miss input { border-color: var(--c-danger) !important; background: var(--c-danger-soft); }
.tbl-compact input.stl-amt:focus { border-color: var(--c-brand-400); box-shadow: 0 0 0 2px rgba(99,149,164,.18); }
.pv-kvs-stack, .chip-warn { border-color: var(--c-line); }
/* A3 新增组件（供 B8 套用；仅样式，不改 DOM） */
.pill-type { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-sm); font-size: var(--fs-xs); }
.pill-type.spot { color: var(--c-info-ink); background: var(--c-info-soft); }
.pill-type.futures { color: var(--c-accent-ink); background: var(--c-accent-soft); }
.pill-type.spot::before { content: "●"; } .pill-type.futures::before { content: "◆"; }
.parse-check { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
.parse-check th { background: var(--c-row-selected); text-align: left; }
.parse-check td.miss { color: var(--c-danger-ink); border-left: 3px solid var(--c-danger); background: var(--c-danger-soft); }
.parse-check td.guess { background: var(--c-warning-soft); }
.alloc-row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; padding: var(--sp-1) 0; }
.pend-group { position: sticky; top: 0; z-index: var(--z-th); background: var(--c-surface-2); font-weight: 600; }
.stamp-meta { font-size: var(--fs-xs); color: var(--c-ink-2); }
.save-bar { display: flex; align-items: center; gap: var(--sp-2); position: sticky; bottom: 0;
  background: var(--c-surface); border-top: 1px solid var(--c-line); padding: var(--sp-2) var(--sp-4); z-index: var(--z-sticky); }
.is-readonly-tip { background: var(--c-dirty-soft); color: var(--c-dirty-ink); font-size: var(--fs-xs); padding: var(--sp-2) var(--sp-3); }
.is-readonly input, .is-readonly select { background: var(--c-surface-2); color: var(--c-ink-2); border-color: transparent; pointer-events: none; }
#ct-dirty, #dlv-dirty { color: var(--c-dirty-ink); background: var(--c-dirty-soft); }

/* A4 断点（首次落地，桌面零变化）——1024 宽表段 */
@media (min-width:1024px){
  #ct-tbl thead th { position: sticky; top: 0; z-index: var(--z-th); }
  #ct-tbl thead th:first-child, #ct-tbl tbody td:first-child {
    position: sticky; left: 0; z-index: var(--z-sticky); background: var(--c-surface); }
}
@media (min-width:641px) and (max-width:1023px){
  .tbl-wrap { overflow: auto; scrollbar-gutter: stable; }
  #ct-tbl thead th { position: sticky; top: 0; z-index: var(--z-th); }
  /* 本档规格「仅表头粘性」：取消基础 .tbl .sticky-col 的首列横向粘性，表头纵向 top 保留 */
  #ct-tbl tbody td.sticky-col { position: static; box-shadow: none; }
  #ct-tbl thead th.sticky-col { left: auto; box-shadow: none; }
  .drawer { width: 94vw; height: 92vh; }
}
@media (max-width:1024px){
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* A4+A5 ≤640：卡片化（Q1=C），关闭全部 sticky；thead 可访问隐藏（§9.6.1 不写 1px 盒子） */
@media (max-width:640px){
  .top .search { display: none; }
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .card + .card { margin-top: var(--sp-2); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }   /* 第六轮：390px 日期/电话不再被压窄 */
  .form-grid .span2, .form-grid .span4 { grid-column: auto; }   /* 单列下重置跨度，避免隐式第二列把字段压成 23px */
  /* 抬头表单 .form-compact 原本 6 列，窄屏会挤压/重叠（现货/期货 seg 被压成竖排） */
  .form-compact, .drawer-b .form-compact { grid-template-columns: minmax(0, 1fr); }
  .form-compact .field, .drawer-b .form-compact .field { flex-direction: column; align-items: stretch; gap: 4px; }
  .form-compact .field.span2, .form-compact .field.span3, .form-compact .field.span4, .form-compact .field.span6,
  .drawer-b .form-compact .field.span6 { grid-column: auto; }
  .form-compact .field > label { flex: none; white-space: normal; }
  .form-compact .field > input, .form-compact .field > select { flex: none; width: 100%; }
  .form-compact .seg, .drawer-b .form-compact .seg { flex-wrap: nowrap; align-self: flex-start; }
  .form-compact .seg button { white-space: nowrap; }
  .drawer { width: 98vw; height: 96vh; }
  .btn, .btn-sm, .chip, .pg-btn, .seg button, input, select, textarea { min-height: var(--sp-touch); font-size: var(--fs-input-mobile); }
  :focus-visible { outline: 2px solid var(--c-brand-400); outline-offset: 2px; }
  /* 查询条重排：搜索行置顶(输入+查询+重置)、日期行、下拉行，各占一行，整体整齐不再乱换行 */
  .qbar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 0 0 var(--sp-2); }
  .qbar .qb-row { display: grid; }
  .qbar .qb-searchrow { order: -1; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
  .qbar .qb-q { width: 100%; min-width: 0; max-width: none; flex: none; }
  .qbar .qb-go, .qbar .qb-reset { min-height: var(--sp-touch); padding: 0 12px; white-space: nowrap; }
  .qbar .qb-daterow { grid-template-columns: auto minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; }
  .qbar .qb-lb { font-size: 12px; }
  .qbar .qb-date, .qbar .qb-sel { width: 100%; min-width: 0; flex: none; }
  .qbar .qb-extrarow { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 6px; }
  .qbar .qb-field { display: flex; align-items: center; gap: 6px; min-width: 0; }
  .qbar .qb-field .qb-lb { flex: none; text-align: right; }
  .qbar .qb-field .qb-sel { flex: 1 1 auto; min-width: 0; }
  /* 卡片态：#ct-tbl 合同表 + .lines-card（报价/送货/结算明细），前缀限定避免误伤打印表 */
  .tbl-wrap { max-width: 100%; }
  #ct-tbl, .lines-card { display: block; width: 100%; table-layout: auto; }
  .lines-card { min-width: 0 !important; }   /* 覆盖送货单 table 内联 min-width:1180px */
  #ct-tbl tbody, .lines-card tbody { display: block; }
  #ct-tbl colgroup, .lines-card colgroup { display: none; }
  #ct-tbl thead { position: absolute; display: block; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; pointer-events: none; }
  #ct-tbl thead th { pointer-events: none; }
  #ct-tbl thead th, #ct-tbl tbody td, #ct-tbl tbody td.sticky-col { position: static; }
  /* 明细卡片两列网格：字段两两并排，标签在上、输入在下，一屏看到的行数翻倍 */
  #ct-tbl tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px var(--sp-2);
    align-items: start;
    border: 1px solid var(--c-line); border-radius: var(--r);
    background: var(--c-surface); margin-bottom: var(--sp-2); padding: var(--sp-2); }
  #ct-tbl tbody td { display: block; min-width: 0; height: auto !important; padding: 0; border: 0; overflow: visible; }
  #ct-tbl tbody td::before { content: attr(data-label); display: block; font-size: 11px; margin-bottom: 3px;
    color: var(--c-ink-3); font-weight: 500; white-space: nowrap; line-height: 1.2; text-align: left; }
  /* 序号行 + 行操作按钮跨满整行 */
  #ct-tbl tbody td[data-k="idx"], #ct-tbl tbody td:last-child { grid-column: 1 / -1; }
  #ct-tbl tbody td[data-k="idx"] { background: var(--c-surface-2); margin: calc(-1 * var(--sp-2)) calc(-1 * var(--sp-2)) 2px;
    padding: 4px var(--sp-2); font-weight: 600; color: var(--c-ink-2); border-bottom: 1px solid var(--c-line); }
  #ct-tbl tbody td[data-k="idx"] { display: flex; gap: 4px; align-items: center; }
  #ct-tbl tbody td[data-k="idx"]::before { content: "第 "; color: var(--c-ink-3); font-weight: 500; font-size: 12px; margin: 0; }
  #ct-tbl tbody td[data-k="idx"]::after { content: " 行"; color: var(--c-ink-3); font-weight: 500; font-size: 12px; }
  #ct-tbl tbody td:last-child { flex-direction: row; justify-content: flex-start; gap: 8px; padding-top: 4px;
    border-top: 1px dashed var(--c-line-2); margin-top: 2px; }
  #ct-tbl tbody td:last-child::before { content: none; }
  #ct-tbl tbody td input, #ct-tbl tbody td select { width: 100%; height: var(--sp-touch); font-size: var(--fs-input-mobile); }
  #ct-tbl tbody td.num input { text-align: right; }
  /* 金额列突出：放大、加粗、钢青 */
  #ct-tbl tbody td.num { text-align: right; }
  #ct-tbl tbody td[data-amt] { font-weight: 600; font-size: 15px; color: var(--c-brand); }
  #ct-tbl th { resize: none; }
  #ct-items td { overflow: visible; }
  /* 合计行是 tbody 末行，不是 tfoot（纯 CSS，不加 class） */
  /* 合计行抬到常驻 Tab 之上，避免被 56px 底栏盖住（act-bar 页不共存 #ct-tbl） */
  #ct-tbl tbody tr:last-child { position: sticky; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: var(--z-sticky);
    background: var(--c-surface-2); border-top: 2px solid var(--c-line);
    display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 4px; padding: var(--sp-2); }
  #ct-tbl tbody tr:last-child td::before { content: attr(data-label); font-size: var(--fs-xs); color: var(--c-ink-2); }
  #ct-tbl tbody tr:last-child td:last-child { display: none; }
  .icon-btn { width: var(--sp-touch); height: var(--sp-touch); }
  /* 送货单 / 报价单 / 结算单明细：table 带 .lines-card 标记，卡片化。
     不依赖 id 层级（id 在 tbody 上）、不依赖 :has()（结算单未保存/已审核/只读态无 .stl-amt 会漏命中）。 */
  .lines-card { border: 0; background: transparent; }
  .lines-card thead { position: absolute; display: block; width: 1px; height: 1px; padding: 0; margin: -1px; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; pointer-events: none; }
  .lines-card thead th { pointer-events: none; }
  .lines-card colgroup { display: none; }
  .lines-card tbody tr {
    display: block; border: 1px solid var(--c-line); border-radius: var(--r);
    background: var(--c-surface); margin-bottom: var(--sp-2); padding: var(--sp-2); }
  .lines-card tbody td {
    display: grid; grid-template-columns: var(--ct-label-w) minmax(0, 1fr); gap: var(--sp-2);
    align-items: center; border: 0; padding: var(--sp-1) var(--sp-2); }
  .lines-card tbody td::before {
    content: attr(data-label); font-size: var(--fs-sm); color: var(--c-ink-2); font-weight: 500; white-space: nowrap; }
  .lines-card tbody td input, .lines-card tbody td select {
    grid-column: 2; width: 100%; max-width: 100%; min-width: 0;
    height: var(--sp-touch); font-size: var(--fs-input-mobile); }
  .lines-card tbody td > button, .lines-card tbody td > .icon-btn { grid-column: 2; justify-self: start; }
  .lines-card tfoot { display: block; }
  .lines-card tfoot tr { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-2); }
  .lines-card tfoot th { border: 0; }
  /* 卡片态明细输入框可见边界：桌面靠 td 分隔线+透明输入框区分，卡片态 td 边框为 0 会「隐形」，
     这里给输入控件补可见边框+底色（对齐 .stl-amt 既有写法），仅 ≤640 生效，≥641 不动。 */
  #ct-tbl tbody td input:not(.stl-amt), #ct-tbl tbody td select, #ct-tbl tbody td textarea,
  .lines-card tbody td input:not(.stl-amt), .lines-card tbody td select, .lines-card tbody td textarea {
    border: 1px solid var(--c-line-3);
    background: var(--c-surface);
    border-radius: var(--r-sm);
  }
  /* 本组特异性高于全局 input:focus，需显式复述聚焦环，避免被上面的边框规则盖掉 */
  #ct-tbl tbody td input:not(.stl-amt):focus, #ct-tbl tbody td select:focus, #ct-tbl tbody td textarea:focus,
  .lines-card tbody td input:not(.stl-amt):focus, .lines-card tbody td select:focus, .lines-card tbody td textarea:focus {
    border-color: var(--c-brand-600);
    background: var(--c-surface);
    box-shadow: 0 0 0 2px rgba(31,78,121,.16);
  }
  /* 报价单 / 送货单明细（.lines-grid）：与合同明细同款两列网格，标签在上、输入在下，
     一屏能装下更多货。结算单仍走 .lines-card 原样，不受影响。 */
  .lines-grid tbody tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px var(--sp-2); border: 1px solid var(--c-line); border-radius: var(--r);
    background: var(--c-surface); margin-bottom: var(--sp-2); padding: var(--sp-2); }
  .lines-grid tbody td {
    display: block; padding: 0; border: 0; min-width: 0; height: auto !important; }
  .lines-grid tbody td::before {
    content: attr(data-label); display: block; font-size: 11px; margin-bottom: 3px;
    color: var(--c-ink-3); font-weight: 500; white-space: nowrap; text-align: left; }
  .lines-grid tbody td input, .lines-grid tbody td select {
    width: 100% !important; height: var(--sp-touch); }
  /* 序号当卡片头、操作按钮贴右下，两者跨满整行 */
  .lines-grid tbody td[data-label="序号"] {
    grid-column: 1 / -1; display: flex; gap: 6px; align-items: center;
    font-size: 12px; color: var(--c-ink-3); }
  .lines-grid tbody td[data-label="序号"]::before { display: none; }
  .lines-grid tbody td[data-label="操作"] {
    grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; padding-top: 2px; }
  .lines-grid tbody td[data-label="操作"]::before { display: none; }
  /* 材质（牌号 TDC51D+AZ100 长达 12 字符）跨满整行，否则一眼看不全最后几位 */
  .lines-grid tbody td[data-label="材质"] { grid-column: 1 / -1; }
  /* 卡片态明细输入框宽度统一（第六轮唯一允许新增的 !important：压过 app.js 行内 width:110/100/90…px 参差） */
  #ct-tbl tbody td input, #ct-tbl tbody td select,
  .lines-card tbody td input, .lines-card tbody td select { width: 100% !important; }
}
/* A5 ≤480：P2 白名单隐藏（必填 9 字段绝不可隐藏），带完整前缀 */
@media (max-width:480px){
  #ct-tbl tbody td[data-k="remark"],
  #ct-tbl tbody td[data-k="weight_lj"],
  #ct-tbl tbody td[data-k="location"],
  #ct-tbl tbody td[data-k="qty_pieces"] { display: none; }
  #ct-tbl tbody td { font-size: var(--fs-xs); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}
/* A5 ≤390：两列明细在极窄屏保持两列（标签已改在输入上方，不再有独立标签列） */
@media (max-width:390px){
  #ct-tbl tbody tr { gap: 6px; padding: 8px; }
  #ct-tbl tbody td::before { font-size: 10.5px; }
}

/* A6 打印末尾：强制浅色保护块（深色只预留 token，不落 [data-theme]、不写切换 JS） */
@media print {
  .a4-page, .a4-inner, .pv-tbl, .pv-tbl-big, .pv-body, .pv-parties2, .pv-sign { background: #fff !important; color: #111 !important; }
}

/* ═════════ 第六轮 W：全局输入框/下拉美化 · 表格竖向边框 · 侧栏品牌 ═════════ */

/* 全局输入框与下拉栏：纸面底、暖线、聚焦图纸蓝环 */
.field input, .field select, .field textarea,
.tbl td input, .tbl td select, .tbl td textarea,
.lines-card tbody td input, .lines-card tbody td select,
#ct-tbl tbody td input, #ct-tbl tbody td select, #ct-tbl tbody td textarea,
input:not([type]), select {
  border: 1px solid var(--c-line);
  background: var(--c-paper-2);
  border-radius: var(--r-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:hover, .field select:hover,
.tbl td input:hover, .tbl td select:hover { border-color: var(--c-ink-3); }
.field input:focus, .field select:focus, .field textarea:focus,
.tbl td input:focus, .tbl td select:focus,
#ct-tbl tbody td input:focus {
  border-color: var(--c-brand-600);
  box-shadow: 0 0 0 2px rgba(31, 78, 121, .12);
  outline: none;
}
.tbl td input:hover { border-color: var(--c-ink-3); }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b6459' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-position: right 8px center;
  background-repeat: no-repeat;
  padding-right: 24px;
}

/* 明细表格竖向边框线 */
.tbl td { border-right: 1px solid var(--c-line-2); }
.tbl th { border-right: 1px solid var(--c-line); }
table.tbl { border: 1px solid var(--c-line); }
.tbl .card-h { border-right: 0; }

/* 富文本工具栏美化 */
.rt-bar {
  display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap;
  background: var(--c-paper-2); border: 1px solid var(--c-line);
  border-radius: var(--r-sm); padding: 5px 8px; margin-bottom: 8px;
}
.rt-bar .btn { height: 27px; min-width: 27px; padding: 0 7px; font-size: 12px; border-radius: 2px; }
.rt-bar .rt-sel { height: 27px; padding: 0 4px; font-size: 12px; min-width: 64px; }
.rt-bar .rt-color { width: 27px; height: 27px; padding: 1px; border: 1px solid var(--c-line); border-radius: 2px; cursor: pointer; }

/* 侧栏品牌区：图标 + 中文 + 英文（168px 排版） */
.brand { padding: 15px 12px 13px; gap: 9px; border-bottom: 1px solid rgba(232,226,213,.14); margin-bottom: 4px; }
.brand-logo { width: 28px; height: 28px; }
.brand-logo img { width: 22px; height: 22px; }
.brand b { font-size: 13.5px; letter-spacing: .01em; white-space: nowrap; }
.brand small { font-size: 8px; letter-spacing: .09em; white-space: nowrap; }

/* ═══ 第六轮 W2：侧栏品牌区（图签式竖排居中）═══ */
.brand{flex-direction:column;align-items:center;gap:9px;
  padding:20px 12px 16px;
  border-bottom:1px solid rgba(232,226,213,.14);margin-bottom:4px}
.brand-logo{width:34px;height:34px;border-radius:0;
  background:#fffdf9;border:1px solid rgba(232,226,213,.22);
  display:grid;place-items:center;flex:none;padding:3px}
.brand-logo img{width:28px;height:28px;object-fit:contain}
.brand b{font-size:15.5px;font-weight:600;letter-spacing:.08em;
  color:#fffdf9;font-family:var(--ff-serif);white-space:nowrap}
.brand small{font-size:8.5px;font-weight:500;letter-spacing:.22em;
  padding-left:.22em;color:#9a9183;white-space:nowrap}
@media (max-width:1024px){
  .brand{padding:14px 0}
  .brand b,.brand small{display:none}
}
/* tbl-wrap 收缩兜底 */
.tbl-wrap{min-width:0;max-width:100%}
/* 模糊联想下拉（attachPartyFuzzy；客户/供应商输入框用） */
.fuzzy-drop{display:none;position:absolute;top:100%;left:0;right:0;z-index:80;margin-top:2px;
  background:var(--c-surface);border:1px solid var(--c-line);border-radius:var(--r);
  box-shadow:var(--sh-2);max-height:240px;overflow:auto}
.fuzzy-item{padding:7px 12px;font-size:var(--fs-base);cursor:pointer;color:var(--c-ink);
  overflow-wrap:anywhere;border-bottom:1px solid var(--c-line-2)}
.fuzzy-item:last-child{border-bottom:0}
.fuzzy-item:hover,.fuzzy-item.on{background:var(--c-row-hover)}
.fuzzy-item b{color:var(--c-brand-600);font-weight:600}
.fuzzy-empty{padding:8px 12px;font-size:var(--fs-sm);color:var(--c-muted-ink)}


/* ============ 第七轮 A：全局表格列宽 / 客户名截断 / 紧凑详情 / 行内编辑 ============ */
/* 列宽手柄：不用浏览器 th resize（table-cell 上时灵时不灵），用显式手柄 + 持久化 */
.tbl-resizable thead th { position: relative; padding-right: 16px; }
.col-grip { position: absolute; right: 0; top: 0; bottom: 0; width: 8px; cursor: col-resize;
  background: transparent; z-index: 2; }
.col-grip:hover, .col-grip.on { background: var(--brand, #2b6cb0); opacity: .45; }
.tbl-resizable { table-layout: auto; }
.tbl td.cust-cell { max-width: 152px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl td.cust-cell > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl td.cust-cell .sub-line { max-width: 100%; }

/* 详情页「订单信息 / 金额与开票 / 金额与入库」默认折叠，明细区成为首屏主体 */
.dp-sec.is-fold .card-b { display: none; }
.dp-sec.is-fold .card-h { padding-bottom: 4px; }
.fold-toggle { cursor: pointer; user-select: none; display: inline-flex; align-items: center;
  gap: 4px; font-size: 11.5px; color: var(--ink-3); border: 0; background: none; padding: 0 6px; }
.fold-toggle:hover { color: var(--brand, #2b6cb0); }
.compact-strip { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  padding: 6px 0 2px; font-size: 12.5px; }
.compact-strip .cs { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.compact-strip .cs span { color: var(--ink-3); }
.compact-strip .cs b { font-family: var(--num); font-size: 14px; }
.compact-strip .cs b.ok { color: var(--green); }
.compact-strip .cs b.bad { color: var(--red); }
.compact-strip .cs b.warn { color: var(--amber); }

/* 行内双击编辑：双击单元格变输入框，改动先留在内存，点「保存明细」才落盘 */
td.ie-cell { cursor: text; }
td.ie-cell:hover { box-shadow: inset 0 0 0 1px var(--line); }
input.ie-input, select.ie-input { width: 100%; min-width: 56px; box-sizing: border-box;
  font: inherit; font-size: 12px; padding: 3px 5px; border: 1px solid var(--brand, #2b6cb0);
  border-radius: 3px; background: #fff; color: var(--c-ink); }
tr.ie-dirty td { background: rgba(255,214,102,.13); }
.ie-bar { display: flex; align-items: center; gap: 10px; padding: 6px 0 10px; font-size: 12px; }
.ie-bar .dirty-mark { color: var(--red); font-weight: 600; }

/* 第七轮 D：收付款双区 / 流水页 */
.dual-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.pending-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 8px; }
.pending-tabs button { border: 1px solid var(--line); background: transparent; padding: 5px 11px;
  font-size: 12px; border-radius: 4px; cursor: pointer; color: var(--ink-2); }
.pending-tabs button.on { background: var(--c-ink); color: #fff; border-color: var(--c-ink); }
.pending-row { cursor: pointer; }
.pending-row:hover { background: var(--surface-2); }
.fin-flow-table td { white-space: nowrap; }
.link-no { color: var(--brand, #2b6cb0); text-decoration: underline; cursor: pointer; }

/* 合同明细「品名」格：输入框 + 商品库下拉按钮 */
.ci-name-wrap { display: flex; align-items: center; gap: 2px; min-width: 0; }
.ci-name-wrap input { flex: 1 1 auto; min-width: 0; width: auto !important; }
.ci-name-wrap .icon-btn { flex: 0 0 20px; width: 20px; padding: 0; font-size: 12px; line-height: 1; }
.cp-list .tbl-wrap { max-height: 58vh; overflow: auto; }

/* 详情页表头/金额压缩：展开后也是紧凑网格，不占首屏 */
.dp-sec .kv-grid { gap: 3px 12px; font-size: 12px; }
.dp-sec .kv { padding: 2px 0; min-height: 0; }
.dp-sec .kv-v { font-size: 12px; line-height: 1.5; }
.dp-sec.is-fold { margin-bottom: 8px; }
.dp-sec .card-h h3 { font-size: 13px; }
.dp-sec .tbl-wrap { max-height: none; }

/* 发票管理 / 流水页：紧凑到一屏能看见金额，列宽仍可拖 */
.inv-page .tbl th, .inv-page .tbl td { padding: 4px 7px; font-size: 12px; line-height: 1.45; }
.inv-page .card-h { padding-bottom: 8px; }
.inv-page .sub-line { font-size: 11px; }
.inv-page .tbl td { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
h4.sec { padding-left: 9px; border-left: 3px solid var(--brand, #2b6cb0); }

/* 收付款双区：上半录入卡片不要太高，下半明细表是主体 */
#dual-pending .tbl th, #dual-pending .tbl td { padding: 5px 8px; font-size: 12px; }
#dual-pending .tbl-wrap { max-height: 46vh; overflow: auto; }
#dual-pending .pending-row:hover td { background: var(--surface-2); }
