/* ══ CSS 重置 ════════════════════════════ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html, body {
  height: 100%;
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  -webkit-font-smoothing: antialiased;

  overflow-x: hidden;
}

/* ═══════════════════════════════════════════════════════
   泰国VAT发票系统 v3.0 · 全局样式 — 现代设计系统
═══════════════════════════════════════════════════════ */

/* ── 设计令牌 ─────────────────────────────────────── */
:root {
  /* 品牌色系 */
  --primary:       #4f6ef7;
  --primary-light: #6b85f9;
  --primary-dark:  #3a56d4;
  --primary-bg:    #eef1fe;
  --primary-ring:  rgba(79,110,247,.18);

  /* 语义色 */
  --success:       #22c55e;
  --success-bg:    #f0fdf4;
  --warning:       #f59e0b;
  --warning-bg:    #fffbeb;
  --danger:        #ef4444;
  --danger-bg:     #fef2f2;
  --info:          #3b82f6;
  --info-bg:       #eff6ff;

  /* 中性色 */
  --bg:            #f4f6fb;
  --card:          #ffffff;
  --border:        #e5e9f0;
  --border-light:  #f0f2f7;
  --text:          #1e293b;
  --text-secondary:#64748b;
  --text-muted:    #94a3b8;
  --hover-bg:      #f8f9fc;

  /* 侧边栏 */
  --sidebar-bg:    #0f172a;
  --sidebar-hover: rgba(255,255,255,.08);
  --sidebar-active:rgba(79,110,247,.2);

  /* 圆角 */
  --radius-sm: 6px;
  --radius:     10px;
  --radius-lg:  14px;
  --radius-xl:  18px;

  /* 阴影 */
  --shadow-xs:  0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:  0 1px 4px rgba(0,0,0,.06);
  --shadow:     0 2px 12px rgba(0,0,0,.07);
  --shadow-md:  0 4px 20px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 30px rgba(0,0,0,.1);

  /* 过渡 */
  --ease:        cubic-bezier(.4,0,.2,1);
  --duration:    .2s;
  --duration-slow:.35s;
}

/* Order management and compact system navigation */
.system-menu-toggle .nav-icon { transition: transform .2s ease; }
.system-menu-toggle.open .nav-icon { transform: rotate(45deg); }
.nav-item.admin-only,
.nav-item.system-subitem { padding-left: 36px !important; font-size: 13px; }
.order-page { width:100%; max-width:none; margin:0; padding:22px 24px 40px; }
.order-shell .topbar-inner { width:100%; max-width:1400px; margin:0 auto; }
.order-toolbar { display:flex; align-items:center; justify-content:space-between; gap:14px; margin-bottom:18px; }
.order-toolbar-actions { display:flex; align-items:center; justify-content:flex-end; gap:10px; flex:1; flex-wrap:wrap; }
.order-toolbar-actions > select { width:auto; min-width:150px; }
.order-search { width:min(420px,34vw); min-width:280px; }
.order-table-wrap { background:#fff; border:1px solid var(--border-light); border-radius:12px; overflow:auto; box-shadow:var(--shadow-xs); }
.order-table { width:100%; border-collapse:collapse; min-width:1180px; }
.order-table th { padding:11px 12px; color:var(--text-secondary); font-size:12px; text-align:left; background:#f8fafc; border-bottom:1px solid var(--border); white-space:nowrap; }
.order-table td { padding:12px; border-bottom:1px solid var(--border-light); vertical-align:top; }
.order-table tr:hover td { background:#fafbff; }
.status-pair { display:flex; gap:5px; flex-wrap:wrap; }
.status-chip { display:inline-flex; align-items:center; padding:3px 8px; border-radius:999px; font-size:11px; font-weight:700; white-space:nowrap; }
.status-chip.ok { color:#047857; background:#ecfdf5; }
.status-chip.wait { color:#92400e; background:#fffbeb; }
.status-chip.bad { color:#b91c1c; background:#fef2f2; }
.status-chip.info { color:#3730a3; background:#eef2ff; }
.status-chip.muted { color:#475569; background:#f1f5f9; }
.history-mark { color:#7c3aed; background:#f5f3ff; border:1px solid #ddd6fe; border-radius:5px; padding:2px 6px; font-size:10px; font-weight:700; }
.order-progress { width:112px; height:6px; border-radius:999px; background:#e2e8f0; overflow:hidden; margin-top:6px; }
.order-progress > span { display:block; height:100%; background:var(--primary); border-radius:inherit; }
.order-modal { position:fixed; inset:0; z-index:1200; background:rgba(15,23,42,.52); display:none; align-items:flex-start; justify-content:center; overflow:auto; padding:28px; }
.order-modal.show { display:flex; }
.order-dialog { width:min(1240px,96vw); background:#fff; border-radius:16px; box-shadow:var(--shadow-lg); overflow:hidden; }
.order-dialog-head { display:flex; align-items:center; justify-content:space-between; padding:18px 22px; color:#fff; background:linear-gradient(135deg,#3349ba,#4f6ef7); }
.order-dialog-body { padding:20px 22px 24px; }
.order-form-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.order-field label { display:block; color:var(--text-secondary); font-size:12px; margin-bottom:5px; font-weight:600; }
.order-field input,.order-field select,.order-field textarea { width:100%; border:1px solid var(--border); border-radius:7px; padding:9px 10px; font:inherit; color:var(--text); background:#fff; }
.order-field.span-2 { grid-column:span 2; }
.order-field.span-4 { grid-column:span 4; }
.order-dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:18px; }
/* 品目中心弹窗（2026-09-13 大哥：警示/确认弹窗一律在「订单品目」区域最中心打开） */
.oc-dialog-overlay { position:fixed; inset:0; z-index:1300; background:rgba(15,23,42,.52); }
.oc-dialog-card { position:fixed; z-index:1301; transform:translate(-50%,-50%); width:min(560px,92vw); max-height:74vh; overflow:auto; background:#fff; border-radius:16px; box-shadow:var(--shadow-lg); padding:22px 24px; transition:opacity .12s ease; }
.oc-dialog-msg { white-space:pre-line; font-size:14px; line-height:1.7; color:#1e293b; word-break:break-word; }
.oc-dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; }
.order-empty { padding:50px; text-align:center; color:var(--text-muted); }
.dashboard-alert-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; margin-bottom:18px; }
.dashboard-alert-card { background:#fff; border:1px solid var(--border-light); border-left:4px solid var(--primary); border-radius:10px; padding:15px 16px; }
.dashboard-alert-card.danger { border-left-color:var(--danger); }.dashboard-alert-card.warning { border-left-color:var(--warning); }.dashboard-alert-card.success { border-left-color:var(--success); }
@media(max-width:1000px){.order-toolbar{align-items:flex-start;flex-direction:column}.order-toolbar-actions{width:100%;justify-content:flex-start}.order-search{width:min(420px,100%)}.order-form-grid{grid-template-columns:repeat(2,1fr)}.order-field.span-4{grid-column:span 2}.order-summary-grid,.dashboard-alert-grid{grid-template-columns:repeat(2,1fr)}}
@media(min-width:769px) and (max-width:1024px){.order-shell .main-wrap{margin-left:56px}}
@media(max-width:768px){.order-shell .main-wrap{margin-left:0;width:100%;max-width:100%}}
@media(max-width:640px){.order-page{padding:14px}.order-toolbar{align-items:stretch;flex-direction:column}.order-search{min-width:0}.order-form-grid,.order-summary-grid,.dashboard-alert-grid{grid-template-columns:1fr}.order-field.span-2,.order-field.span-4{grid-column:span 1}}

/* Rich order UI: follows the approved blue dashboard, ledger and entry designs. */
.order-shell { background:#f4f6fb; }
.order-shell .topbar { flex:0 0 56px; }
.order-shell .topbar .logo-title { font-weight:500; }
/* 2026-09-13 大哥：顶部上移、左右扩宽、底部让位给表格（横向滚动条尽量下移） */
.order-shell .order-page { padding:8px 12px 8px; }
.om-heading-row,.od-heading,.oc-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:14px; }
.om-heading-row h1,.od-heading h1,.oc-heading h1 { margin:0; color:#1e293b; font-size:20px; font-weight:600; }
.om-heading-row p,.od-heading p,.oc-heading p { margin:3px 0 0; color:#64748b; font-size:12px; }

/* Customer order ledger */
.om-tabs { display:flex; align-items:center; gap:4px; margin-bottom:12px; padding:4px; border:1px solid #e5e9f0; border-radius:10px; background:#fff; box-shadow:0 1px 4px rgba(15,23,42,.04); overflow-x:auto; }
/* ── 单行工具条（2026-09-11 大哥要求：新增订单最左、页签居中、筛选+导出右对齐、行高压到最小）── */
.om-topbar { display:flex; align-items:center; gap:4px; flex-wrap:nowrap; overflow:hidden;
  margin-bottom:6px; padding:3px 8px 3px 6px; border:1px solid #e5e9f0; border-radius:9px;
  background:#fff; box-shadow:0 1px 4px rgba(15,23,42,.04); min-height:34px; }
.om-topbar .om-new-order { height:26px; padding:0 10px; font-size:11.5px; border-radius:6px; flex:0 0 auto; }
/* 视图下拉（2026-09-13 大哥：6 个页签占宽 ~500px → 压缩为下拉，省 ~350px；浅蓝轻强调以区别右侧筛选控件） */
.om-topbar .om-tab-select { height:26px; font-size:11.5px; padding:0 6px; border:1px solid #cdd8f0; border-radius:6px; background:#f8faff; color:#3350c9; font-weight:600; flex:0 0 auto; width:auto; min-width:118px; cursor:pointer; }
.om-topbar .om-tab-select:hover { border-color:#9db0e8; }
.om-topbar .om-tab-select:focus { outline:0; border-color:#4f6ef7; }
/* 待送货工作台入口（2026-09-16 大哥：从视图下拉移出 → 独立按钮置于「＋新增订单 / 视图下拉」右侧；样式与视图下拉同族，进工作台时高亮） */
.om-topbar .om-desk-btn { height:26px; padding:0 10px; font-size:11.5px; border-radius:6px; flex:0 0 auto;
  border:1px solid #cdd8f0; background:#f8faff; color:#3350c9; font-weight:600; cursor:pointer; box-shadow:none; }
.om-topbar .om-desk-btn:hover { border-color:#9db0e8; background:#eef3ff; }
.om-topbar .om-desk-btn:focus { outline:0; border-color:#4f6ef7; }
.om-topbar .om-desk-btn.active { background:linear-gradient(135deg,#4f6ef7 0%,#7d94ff 100%); border-color:#4f6ef7; color:#fff; box-shadow:0 2px 8px rgba(79,110,247,.22); }
.om-topbar-spacer { flex:1 1 auto; min-width:6px; }
.om-topbar .om-filterbar { display:flex; align-items:center; gap:5px; flex-wrap:nowrap; padding:0; border:0; background:none; flex:0 1 auto; min-width:0; }
.om-topbar .om-field { height:26px; font-size:11.5px; padding:0 7px; border-radius:5px; flex:0 1 104px; min-width:72px; width:auto; }
.om-topbar .om-field-search { flex:0 1 334px; width:334px; min-width:88px; }
.om-topbar .om-field-date { flex:0 1 116px; min-width:100px; }
.om-topbar .om-export { height:26px; padding:0 10px; font-size:11.5px; border-radius:6px; flex:0 0 auto; }
.om-ledger-page .om-panel { margin-top:0; }
.om-panel,.od-panel,.oc-panel { overflow:hidden; border:1px solid #edf0f5; border-radius:12px; background:#fff; box-shadow:0 1px 4px rgba(15,23,42,.055); }
.om-filterbar { display:grid; grid-template-columns:minmax(170px,1.3fr) repeat(4,minmax(105px,.58fr)) repeat(2,minmax(128px,.72fr)) auto; gap:8px; padding:13px 16px; border-bottom:1px solid #f0f2f7; background:linear-gradient(to bottom,#fafbfd,#f7f8fc); }
.order-page { padding-top:12px; }
.om-field { width:100%; min-width:0; height:35px; border:1px solid #d8dee9; border-radius:6px; padding:0 10px; outline:none; background:#fff; color:#1e293b; font-size:12px; }
.om-field:focus { border-color:#4f6ef7; box-shadow:0 0 0 3px rgba(79,110,247,.14); }
.om-table-wrap { overflow-x:auto; }
.om-table { width:100%; min-width:0; border-collapse:collapse; table-layout:fixed; font-size:11px; }
.om-table th { padding:10px 8px; border-bottom:1px solid #e5e9f0; background:#fafbfd; color:#64748b; text-align:left; font-weight:600; white-space:nowrap; }
.om-table td { padding:10px 8px; border-bottom:1px solid #f0f2f7; color:#334155; vertical-align:middle; overflow:hidden; }
.om-table tbody tr:hover td { background:#fafbff; }
.om-table>thead th:nth-child(1){width:58px}.om-table>thead th:nth-child(4){width:58px}.om-table>thead th:nth-child(5){width:84px}.om-table>thead th:nth-child(6){width:94px}.om-table>thead th:nth-child(7){width:80px}.om-table>thead th:nth-child(8){width:86px}.om-table>thead th:nth-child(9),.om-table>thead th:nth-child(10){width:94px}.om-table>thead th:nth-child(11){width:76px}.om-table>thead th:nth-child(12){width:110px}.om-table>thead th:nth-child(13){width:250px}
/* ── 台账视图（2026-09-11）：⚙️列设置 + 21 列品目级 + 操作列 ── */
/* 表格容器：纵向封顶 → 表头 sticky 常驻顶部、横向滚动条常驻容器底部（大哥 2026-09-11 需求） */
.om-table-wrap { overflow:auto; max-height:calc(100vh - 260px); }
.om-table-wrap::-webkit-scrollbar { height:14px; width:12px; }
.om-table-wrap::-webkit-scrollbar-track { background:#f1f5f9; border-radius:7px; }
.om-table-wrap::-webkit-scrollbar-thumb { background:#c7d2fe; border-radius:7px; border:3px solid #fff; }
.om-table-wrap::-webkit-scrollbar-thumb:hover { background:#818cf8; }
.om-ledger-table { min-width:0; }
/* 表头/行内容「高度对齐」（2026-09-12 大哥需求）：
   vertical-align:top → 所有表头标签首行同基线、同一行内各列内容首行同基线；
   原先 middle 会让 1 行表头（如 PO单号）在 2 行表头撑开的行里被居中，与同行其它表头/内容错开。 */
/* 2026-09-12 大哥反馈「表头字段列与列之间间距太大」：内边距 7px → 5px（列间距整体收紧） */
.om-ledger-table th { padding:5px 5px; vertical-align:top; position:relative; }
.om-ledger-table td { padding:5px 5px; vertical-align:top; }
/* ⚙️ 列表头按钮仍垂直居中 */
.om-ledger-table thead th.om-cols-gear-th { vertical-align:middle; }
.om-ledger-table th.om-2line { line-height:1.3; white-space:normal; }
.om-ledger-table th.om-2line em { display:block; font-style:normal; font-weight:500; color:#94a3b8; font-size:10px; }
/* 列宽拖动把手（右侧 7px 热区，col-resize）
   2026-10-14 修复（大哥反馈「订单管理标头没修复」连带排查）：
   原 right:-3px 使把手右侧约 3px 越界到相邻列领地，被后绘制的相邻 th 覆盖命中
   （elementFromPoint 实测：7px 里只有左缘约 4px 可点，中心点落到相邻 th）
   ⇒ 改 right:0 整体回收本列内，7px 全部可点。 */
.om-col-resizer { position:absolute; top:0; right:0; width:7px; height:100%; cursor:col-resize; z-index:8; }
.om-col-resizer::after { content:""; position:absolute; top:2px; bottom:2px; left:3px; width:1px; background:transparent; }
.om-col-resizer:hover::after { background:#818cf8; }
body.om-col-resizing { cursor:col-resize; user-select:none; }
body.om-col-resizing .om-ledger-table thead th[data-sortable]:hover { color:inherit; }
/* 表头常驻顶部：sticky + 不透明底色（否则行内容会透出来） */
.om-ledger-table thead th { position:sticky; top:0; z-index:4; background:#fafbfd; box-shadow:inset 0 -1px 0 #e5e9f0; }
.om-ledger-table thead th.om-cols-gear-th { z-index:6; }
/* 排序：点表头切换 升序/降序，指示器 ⇅ → ▲/▼ */
.om-ledger-table thead th[data-sortable] { cursor:pointer; user-select:none; }
.om-ledger-table thead th[data-sortable]:hover { color:#3454d1; }
.om-sort-ic { display:inline-block; margin-left:3px; font-style:normal; font-size:9px; color:#cbd5e1; vertical-align:1px; }
.om-sort-ic::after { content:"⇅"; }
.om-ledger-table thead th.om-sort-asc .om-sort-ic::after { content:"▲"; color:#3454d1; }
.om-ledger-table thead th.om-sort-desc .om-sort-ic::after { content:"▼"; color:#3454d1; }
.om-ledger-table thead th.om-2line.om-sort-asc .om-sort-ic::after,
.om-ledger-table thead th.om-2line.om-sort-desc .om-sort-ic::after { position:absolute; margin-left:2px; }
.om-ledger-table thead th.om-2line[data-sortable] { position:sticky; }
/* 列宽（2026-09-13 17:5x 大哥「合理规划 + 默认显示出 ⚙️→已收款金额」重排：2912 → 2058px）
   规划口径（实测校准）：① 每列宽 ≈ 表头文字 + 排序图标 12px + padding 10px（表头 nowrap 硬约束）；
   ② 数字列 = 文字宽 55 + 排序位 18 + 左 padding（76 可达）；③ 文本列（品名/料号/PO/客户）
   截断 + 悬停 title；④ 目标达成：隐藏 6 个成本/成交价列时，「⚙️→已收款金额」22 列 = 1418px，
   1600 屏仅需横向滚 12px 即全列可见（旧 2042px 需滚 634px）。 */
.om-ledger-table thead th:nth-child(1){width:40px}
.om-ledger-table thead th:nth-child(2){width:64px}   /* 客户名称（截断+悬停） */
.om-ledger-table thead th:nth-child(3){width:64px}   /* 订单年度 */
.om-ledger-table thead th:nth-child(4){width:52px}   /* 部门（包胶部徽标文字完整） */
.om-ledger-table thead th:nth-child(5){width:64px}   /* PO单号（截断+悬停） */
.om-ledger-table thead th:nth-child(6){width:64px}   /* 订货日期 */
.om-ledger-table thead th:nth-child(7){width:70px}   /* 料号（截断+悬停） */
.om-ledger-table thead th:nth-child(8){width:80px}   /* 品名（截断+悬停） */
.om-ledger-table thead th:nth-child(9){width:46px}   /* 规格（截断+悬停） */
.om-ledger-table thead th:nth-child(10){width:42px}  /* 单位 */
.om-ledger-table thead th:nth-child(11){width:58px}  /* 数量 */
.om-ledger-table thead th:nth-child(12),.om-ledger-table thead th:nth-child(13),
.om-ledger-table thead th:nth-child(14),.om-ledger-table thead th:nth-child(15),
.om-ledger-table thead th:nth-child(16),.om-ledger-table thead th:nth-child(17),
.om-ledger-table thead th:nth-child(18),.om-ledger-table thead th:nth-child(19){width:76px}
.om-ledger-table thead th:nth-child(20){width:64px}  /* 送货日期 */
.om-ledger-table thead th:nth-child(21){width:76px}  /* 已送/欠数 */
.om-ledger-table thead th:nth-child(22){width:72px}  /* 备料-库存 */
.om-ledger-table thead th:nth-child(23){width:76px}  /* 已开票数量（到货情况列 2026-09-13 移除） */
.om-ledger-table thead th:nth-child(24){width:76px}  /* 已开票金额 */
.om-ledger-table thead th:nth-child(25){width:68px}  /* 对账时间 */
.om-ledger-table thead th:nth-child(26){width:54px}  /* 关联单据 */
.om-ledger-table thead th:nth-child(27){width:84px}  /* 已收款金额 */
.om-ledger-table thead th:nth-child(28){width:58px}  /* 链路状态 */
.om-ledger-table thead th:nth-child(29){width:126px} /* 操作（3 按钮/行 ×2 行） */
.om-ledger-table td.om-num { text-align:right; padding-right:18px; font-variant-numeric:tabular-nums; white-space:nowrap; }
/* ── 链路列（2026-09-12 新增）：已开票/已收款/关联单据/链路状态 ── */
.om-inv-full { color:#2f7d32; font-weight:500; }
.om-inv-part { color:#b26a00; }
.om-docs { font-size:11px; color:var(--text-secondary,#5a5a5a); }
.om-chain { display:inline-block; padding:1px 7px; border-radius:9px; font-size:11px; line-height:17px;
            border:1px solid transparent; white-space:nowrap; }
.om-chain-none { background:#f1f1f1; color:#7a7a7a; border-color:#e0e0e0; }
.om-chain-ship { background:#e8f1fb; color:#1a5fa8; border-color:#cfe1f6; }
.om-chain-inv  { background:#fdf2e2; color:#a8630a; border-color:#f5dfc0; }
.om-chain-paid { background:#e7f4e8; color:#2f7d32; border-color:#cbe7cd; }
.om-chain-done { background:#f5f3ff; color:#7c3aed; border-color:#e4ddfa; }   /* 已完结（2026-09-15：原备料-库存「已完结」标识迁入链路状态列） */
/* ── 备料-库存=仓库实时库存（2026-09-15）：负库存标红（仓库页同口径允许负库存+预警）── */
.om-wh-neg { color:#dc2626; font-weight:500; }
/* ── 备料-库存「本单专属到货」优先显示（2026-09-15）：琥珀底徽标 ── */
.om-stock-own { display:inline-block; padding:0 5px; border-radius:4px; background:#fdf2e2;
                color:#a8630a; border:1px solid #f5dfc0; font-weight:500; }
/* ── 部门徽标（2026-09-12 新增）：包胶部订单一眼可辨 ── */
.om-dept { display:inline-block; padding:1px 7px; border-radius:9px; font-size:11px; line-height:17px;
           border:1px solid transparent; white-space:nowrap; }
.om-dept-bj    { background:#ece7fb; color:#5b3fa8; border-color:#dcd3f5; }
.om-dept-other { background:#eef2f7; color:#4a5b70; border-color:#dfe6ee; }
/* 数字列表头与数值同侧（右对齐）：修「表头靠左、数字靠右」的视觉错位（2026-09-12）
   实测：改前表头文字右边界比数值右边界偏左 23~36px → 改后 ≤3px（8 列精确 0.0）
   右侧留 18px 给排序图标：表头文字与数值同时内缩到同一右边界，两者才能严格对齐。 */
.om-ledger-table thead th.om-sortable-num { text-align:right; padding-right:18px; }
/* 排序图标绝对定位：
   ① 消除「两行表头」里 <i> 另起一行产生的多余空行（表头行高由 3 行降到 2 行）；
   ② 单行数字表头（数量/已送欠数）的文字得以贴齐右边界。 */
.om-ledger-table thead th.om-sortable-num .om-sort-ic { position:absolute; right:6px; top:6px; line-height:1; }
.om-ledger-table thead th.om-sortable-num .om-sort-ic::after { position:static; margin-left:0; }
/* 已送/欠数：欠数 > 0 显示琥珀色 */
.om-ship-sep { color:#cbd5e1; }
.om-ship-owed { color:#b45309; font-weight:600; }
/* ── 送货批次 / 到货记录 / 收款明细（2026-09-12 定版）：双击单元格 → 单元格内就地展开 ──
   大哥选择「格内直接看到」（不弹浮层）；列宽已调足（到货 110 / 收款 144 / 送货默认 96）
   容纳「日期 + 数值」单行；超长金额自然折行兜底（不裁剪）。 */
.om-batch-cell { display:flex; flex-direction:column; gap:2px; }
.om-batch-hint { align-self:flex-start; font-size:10.5px; color:#94a3b8; line-height:1.5; }
.om-batch-cell-warn .om-batch-hint { color:#b45309; }
/* 单批次「送货日期」行：日期后补已送数量（口径同「已送/欠数」列）2026-09-12 大哥口径 */
.om-ledger-table td[data-col="delivery_date"] .om-dd-qty { color:#0f766e; font-weight:600;
  margin-left:6px; font-variant-numeric:tabular-nums; }
/* 品目备注（2026-10-08 大哥定案 C）：delivery_info 里混入的非日期文本不再冒充「送货日期」，
   降级为备注灰字附显（与独立列 item_note 合并下发为 item_note_text）。 */
.om-ledger-table td[data-col="delivery_date"] .om-dd-note { display:block; margin-top:2px;
  font-size:10.5px; line-height:1.4; color:#94a3b8; word-break:break-all; }
.om-ledger-table td[data-col="delivery_date"],
.om-ledger-table td[data-col="arrival"],
.om-ledger-table td[data-col="paid_amount"] { user-select:none; -webkit-user-select:none; }
.om-cell-expand { margin-top:4px; padding-top:4px; border-top:1px dashed #cbd5e1;
  display:flex; flex-direction:column; gap:4px; }
.om-cell-expand .om-xb-line { display:block; font-size:11px; line-height:1.5; font-variant-numeric:tabular-nums; }
.om-cell-expand .om-xb-line em { font-style:normal; color:#64748b; }
.om-cell-expand .om-xb-line b { color:#0f766e; font-weight:600; margin-left:6px; }
.om-cell-expand .om-xb-foot { display:block; margin-top:4px; padding-top:4px; border-top:1px dashed #e2e8f0;
  font-size:10px; line-height:1.5; color:#94a3b8; }
.om-cell-expand .om-xb-empty { display:block; font-size:10.5px; line-height:1.5; color:#94a3b8; }
/* ── 售后/换货痕迹徽标（2026-09-24 大哥定案）──
   换货等类型按设计不写订单挂链 ⇒ 不进「已送/欠数」；此处只在送货日期列后提示「有该记录」，
   双击展开只看「日期 + 类型 + 数量」（前端不显示单号 / 原单号 / 技术措辞）。
   配色沿用订单台账浅色线条风。 */
.om-as-badge { display:inline-block; margin-left:6px; padding:0 5px; border-radius:7px;
  border:1px solid #f5c2c7; background:#fdf2f2; color:#b02a37; font-size:10px; line-height:15px;
  white-space:nowrap; vertical-align:middle; cursor:help; font-weight:600; }
.om-cell-expand .om-xb-line.om-as-line b { color:#b02a37; }
/* 退货（负数批次）行：负数红字（2026-09-29 大哥定案：退货留在批次列表、红字负数；
   含退货的行不再显示「合计」，下方售后区不再重复列同一笔） */
.om-cell-expand .om-xb-line.om-xb-ret b { color:#b02a37; }
/* ?view=<id> 定位高亮（保存订单后跳回列表时的目标行闪烁） */
@keyframes om-row-flash-kf { 0% { background:#fef08a; } 100% { background:transparent; } }
.om-ledger-row.om-row-flash > td { animation: om-row-flash-kf 2.5s ease-out 1; }
.om-ledger-table td.om-muted { color:#94a3b8; }
.om-ledger-table tr.om-ledger-row { cursor:default; }
.om-ledger-table .om-cell-ellipsis { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
/* 台账问题标识（只标识不修改）：⚠ + 悬停看原因 */
.om-issue { color:#d97706; font-weight:700; margin-right:3px; cursor:help; }
.om-issue-note { margin:2px 0 6px; padding:6px 9px; background:#fffbeb; border:1px solid #fde68a; border-radius:6px; color:#92400e; font-size:11.5px; line-height:1.5; }
.om-issue-src { margin:-2px 0 6px; color:#94a3b8; font-size:11px; }
/* 表头 ⚙️ 列设置（与送货管理/发票明细同款交互，class 前缀改 om- 以适配本页） */
.om-cols-gear-th { position:relative; z-index:6; padding:2px 2px !important; text-align:center; }
.om-cols-gear-btn {
  border:1px solid transparent; background:transparent; cursor:pointer;
  font-size:15px; line-height:1; padding:4px 6px; border-radius:5px;
}
.om-cols-gear-btn:hover { background:#eef2ff; border-color:#c7d2fe; }
/* 齿轮菜单：position:fixed —— 表格容器已 overflow:auto（会裁切 absolute 子元素），
   由 JS 按齿轮按钮位置设置 top/left（打开时定位、滚动/缩放时关闭） */
.om-cols-menu {
  position:fixed; top:0; left:0; margin-top:0; width:250px;
  max-height:72vh; overflow-y:auto; background:#fff;
  border:1px solid #dbe2ea; border-radius:8px;
  box-shadow:0 12px 30px rgba(15,23,42,.16); z-index:2000; padding:4px 0; text-align:left;
}
.om-cols-menu .cols-tt { font-size:11px; color:#64748b; font-weight:600; padding:6px 12px 4px; border-bottom:1px solid #f1f5f9; }
.om-cols-menu label { display:flex; align-items:center; gap:8px; padding:5px 12px; font-size:12.5px; color:#1e293b; cursor:pointer; white-space:nowrap; }
.om-cols-menu label:hover { background:#f8fafc; }
.om-cols-menu label input { accent-color:#1d4ed8; margin:0; flex-shrink:0; }
.om-cols-menu .cols-actions { display:flex; justify-content:space-between; gap:6px; padding:6px 8px; border-top:1px solid #f1f5f9; position:sticky; bottom:0; background:#fff; }
.om-cols-menu .cols-actions button { border:1px solid #dbe2ea; background:#fff; color:#334155; border-radius:6px; padding:3px 10px; font-size:11.5px; cursor:pointer; flex:1; }
.om-cols-menu .cols-actions button:hover { background:#f1f5f9; }
.om-table .om-po,.om-table td>div:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.om-source { display:inline-flex; align-items:center; gap:5px; color:#166534; white-space:nowrap; }
.om-source::before { content:""; width:6px; height:6px; border-radius:50%; background:#22c55e; }
.om-source.history { color:#64748b; }.om-source.history::before{background:#94a3b8}
.om-po { color:#3454d1; font-weight:600; }.om-subline{margin-top:3px;color:#94a3b8;font-size:10px}.om-money{font-variant-numeric:tabular-nums;white-space:nowrap}
.om-tag { display:inline-flex; align-items:center; padding:3px 7px; border-radius:5px; font-size:10px; white-space:nowrap; }
.om-tag.blue{background:#eef1fe;color:#3a56d4}.om-tag.green{background:#ecfdf3;color:#047857}.om-tag.amber{background:#fffbeb;color:#a16207}.om-tag.red{background:#fef2f2;color:#dc2626}.om-tag.gray{background:#f1f5f9;color:#64748b}.om-tag.purple{background:#f5f3ff;color:#7c3aed}
.om-progress { min-width:100px; }.om-progress-line{display:flex;justify-content:space-between;gap:7px;margin-bottom:4px;color:#475569;font-size:10px}.om-track{height:5px;border-radius:99px;background:#e5e9f0;overflow:hidden}.om-fill{height:100%;border-radius:inherit;background:#4f6ef7}
.om-action { display:inline-flex; align-items:center; justify-content:center; min-width:36px; height:26px; padding:0 6px; border:1px solid #d8dee9; border-radius:5px; background:#fff; color:#3a56d4; cursor:pointer; font-size:11px; font-weight:500; line-height:1; white-space:nowrap; }
.om-action:hover { border-color:#4f6ef7; color:#4f6ef7; }
.om-action-group { display:inline-flex; gap:4px; align-items:center; flex-wrap:wrap; }
tr.om-order-row { cursor:pointer; }
.om-status-overlay { position:fixed; inset:0; background:rgba(15,23,42,.35); z-index:1000; display:flex; align-items:center; justify-content:center; }
.om-status-dialog { background:#fff; border-radius:10px; padding:18px 18px 16px; width:220px; box-shadow:0 10px 40px rgba(0,0,0,.15); display:flex; flex-direction:column; gap:8px; }
.om-status-title { font-size:13px; font-weight:600; color:#0f172a; margin-bottom:2px; }
.om-status-dialog button { height:34px; border:1px solid #d8dee9; border-radius:6px; background:#fff; color:#334155; cursor:pointer; font-size:12px; }
.om-status-dialog button:hover { border-color:#4f6ef7; color:#4f6ef7; }
.om-status-dialog button.danger { color:#ef4444; border-color:#fecaca; }
.om-status-dialog button.danger:hover { border-color:#ef4444; }
.om-status-dialog button.ghost { color:#94a3b8; }
.om-status-dialog.om-arrival-dialog { width:auto; min-width:480px; max-width:640px; gap:10px; }
.om-arrival-fields { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.om-arrival-fields label { display:flex; flex-direction:column; gap:4px; font-size:11px; color:#475569; font-weight:500; }
.om-arrival-fields input { height:32px; padding:0 9px; border:1px solid #d8dee9; border-radius:6px; font-size:12px; color:#0f172a; }
.om-arrival-fields input:focus { outline:none; border-color:#4f6ef7; }
.om-arrival-table { width:100%; border-collapse:collapse; font-size:12px; }
.om-arrival-table th { text-align:left; padding:6px 8px; color:#64748b; font-weight:600; font-size:11px; border-bottom:1px solid #e5e9f0; background:#f8fafc; }
.om-arrival-table td { padding:6px 8px; border-bottom:1px solid #eef1f6; color:#1e293b; vertical-align:middle; }
.om-arrival-table input.arrival-qty { width:86px; height:28px; padding:0 7px; border:1px solid #d8dee9; border-radius:5px; font-size:12px; }
.om-arrival-table input.arrival-qty:focus { outline:none; border-color:#4f6ef7; }
.om-status-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:2px; }
tr.om-order-row:hover td { background:#f6f8ff; }
.om-action.danger { color:#ef4444; border-color:#fecaca; }
.om-action.muted { color:#94a3b8; cursor:default; font-weight:400; border-color:#e2e8f0; }
/* 2026-09-13 大哥：分页条压到最低行高（48px→22px 量级）；「跳至」加 nowrap 防空间不足时被压成竖排 */
.om-footer { display:flex; align-items:center; justify-content:space-between; gap:8px; min-height:22px; padding:1px 12px; color:#64748b; font-size:11px; }
.om-pages { display:flex; gap:3px; align-items:center; flex-wrap:wrap; }.om-page { min-width:20px; height:20px; padding:0 5px; border:1px solid #d8dee9; border-radius:4px; background:#fff; color:#64748b; cursor:pointer; font-size:10.5px; line-height:1; }.om-page.active{border-color:#4f6ef7;background:#4f6ef7;color:#fff}.om-page:disabled{opacity:.45;cursor:default}
.om-page-jump { display:inline-flex; align-items:center; gap:3px; margin-left:4px; color:#64748b; white-space:nowrap; flex-shrink:0; }
.om-page-jump .om-jump-label { white-space:nowrap; }
.om-page-jump input { width:42px; height:20px; padding:0 4px; border:1px solid #d8dee9; border-radius:4px; text-align:center; font-size:10.5px; }
.om-page-jump input:focus { outline:none; border-color:#4f6ef7; }

/* Order dashboard */
.od-rule,.oc-step { padding:7px 11px; border:1px solid #dce4ff; border-radius:6px; background:#f7f9ff; color:#3a56d4; font-size:11px; white-space:nowrap; }
.od-kpis { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-bottom:12px; }
.od-kpi { min-width:0; min-height:92px; padding:13px 14px; border:1px solid #edf0f5; border-radius:11px; background:#fff; box-shadow:0 1px 4px rgba(15,23,42,.055); color:#1e293b; cursor:pointer; text-align:left; transition:.18s ease; }
.od-kpi:hover,.od-kpi.active { transform:translateY(-1px); border-color:#b9c6ff; box-shadow:0 5px 14px rgba(79,110,247,.12); }
.od-kpi.finance { border-color:#e6e1f9; background:#faf8ff; }
.od-kpi.finance:hover,.od-kpi.finance.active { border-color:#a78bfa; box-shadow:0 5px 14px rgba(124,88,247,.12); }
.od-kpi-label { display:flex; justify-content:space-between; gap:6px; color:#64748b; font-size:11px; }.od-kpi-label i{width:7px;height:7px;border-radius:50%;background:#4f6ef7}.od-kpi-label i.danger{background:#ef4444}.od-kpi-label i.warning{background:#f59e0b}.od-kpi-label i.success{background:#22c55e}
.od-kpi strong { display:block; margin:7px 0 4px; font-size:22px; line-height:1; font-weight:600; }.od-kpi strong small{margin-left:4px;color:#64748b;font-size:10px;font-weight:400}.od-kpi>span:last-child{color:#94a3b8;font-size:10px}
.od-layout { display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:12px; align-items:start; }
.od-main-stack { display:grid; gap:12px; }
.od-delivery-bar { display:flex; height:44px; margin:14px; border-radius:8px; overflow:hidden; }
.od-dbar-seg { display:flex; align-items:center; justify-content:center; min-width:0; color:#fff; font-size:12px; font-weight:500; overflow:hidden; }
.od-dbar-seg span { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; padding:0 6px; }
.od-dbar-seg.done { background:#22c55e; }.od-dbar-seg.active { background:#f59e0b; }.od-dbar-seg.cancelled { background:#94a3b8; }
.od-panel-head { display:flex; align-items:center; justify-content:space-between; min-height:44px; padding:0 15px; border-bottom:1px solid #f0f2f7; background:linear-gradient(to bottom,#fff,#fafbfd); color:#1e293b; font-size:12px; }.od-panel-head a,.od-panel-head span{color:#3a56d4;font-size:10px;text-decoration:none}
.od-table-wrap { overflow-x:auto; }.od-table{width:100%;min-width:640px;border-collapse:collapse;table-layout:fixed;font-size:11px}.od-table th{padding:9px 9px;border-bottom:1px solid #e5e9f0;background:#fafbfd;color:#64748b;text-align:left;font-weight:600;white-space:nowrap}.od-table td{padding:11px 9px;border-bottom:1px solid #f0f2f7;vertical-align:middle}.od-table tbody tr:hover td{background:#fafbff}.od-table th:nth-child(1){width:200px}.od-table th:nth-child(2){width:90px}.od-table th:nth-child(3){width:150px}.od-table th:nth-child(4){width:80px}.od-table th:nth-child(5){width:90px}
.od-side-stack{display:grid;gap:12px}.od-stage-list{padding:8px 14px 12px}.od-stage-row{display:grid;grid-template-columns:72px 1fr 28px;align-items:center;gap:8px;padding:7px 0;color:#475569;font-size:11px}.od-stage-track{height:6px;border-radius:99px;background:#edf0f5;overflow:hidden}.od-stage-track span{display:block;height:100%;border-radius:inherit;background:#4f6ef7}.od-stage-row b{text-align:right;font-size:11px}
.od-risk-list{padding:6px 14px}.od-risk-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 0;border-bottom:1px solid #f0f2f7;font-size:11px}.od-risk-row:last-child{border:0}.od-risk-row b{display:block;color:#334155}.od-risk-row span{color:#94a3b8;font-size:10px}.od-risk-amount{color:#dc2626!important;font-size:12px!important;font-weight:600}.od-rank-amount{color:#6d28d9!important;font-size:12px!important;font-weight:600}.od-side-empty{padding:22px 4px;text-align:center;color:#94a3b8;font-size:11px}
.od-history-note{display:flex;justify-content:space-between;gap:10px;padding:12px 14px;border:1px solid #ddd6fe;border-radius:10px;background:#faf5ff;color:#6d28d9;font-size:11px}.od-history-note span{color:#8b5cf6}

/* Rich new-order page */
.oc-grid { display:grid; grid-template-columns:minmax(0,1.8fr) minmax(310px,.72fr); gap:12px; align-items:start; }.oc-stack{display:grid;gap:12px}.oc-panel-head{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:44px;padding:0 15px;border-bottom:1px solid #f0f2f7;background:linear-gradient(to bottom,#fafbfd,#f7f8fc);color:#1e293b;font-size:12px}.oc-panel-head>span{color:#94a3b8;font-size:10px}.oc-panel-head b,.oc-fields b{color:#ef4444}.oc-fields{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px 12px;padding:14px 15px 15px}.oc-fields label>span,.oc-label,.oc-rules label>span{display:block;margin-bottom:5px;color:#475569;font-size:11px}.oc-fields input,.oc-fields select,.oc-rules select{width:100%;min-width:0;height:35px;border:1px solid #d8dee9;border-radius:6px;padding:0 9px;background:#fff;color:#1e293b;font-size:12px}.oc-fields input:focus,.oc-fields select:focus,.oc-rules select:focus{outline:0;border-color:#4f6ef7;box-shadow:0 0 0 3px rgba(79,110,247,.14)}.oc-fields .span-2{grid-column:span 2}.oc-field-hint{display:block;margin-top:4px;color:#94a3b8;font-size:9px;line-height:1.35}
.oc-segments{display:flex;flex-wrap:wrap;gap:6px}.oc-segments label{position:relative}.oc-segments input{position:absolute;opacity:0;pointer-events:none}.oc-segments label>span{display:block;margin:0;padding:6px 9px;border:1px solid #d8dee9;border-radius:6px;background:#fff;color:#64748b;cursor:pointer;font-size:11px}.oc-segments input:checked+span{border-color:#4f6ef7;background:#eef1fe;color:#3a56d4;box-shadow:0 0 0 1px rgba(79,110,247,.1)}
.oc-link{border:0;background:transparent;color:#4f6ef7;cursor:pointer;font-size:11px}.oc-items-head{align-items:center;position:relative}
/* 「✨ AI翻译」按钮：与「英文开票品名／规格」标题同行、紧跟其后（2026-09-13 大哥：同行不换行，空间不够缩字号） */
.oc-translate-th{display:inline-block;margin-left:3px;vertical-align:middle;border:0;border-radius:4px;padding:1px 4px;background:#eef1fe;color:#3a56d4;cursor:pointer;font-size:8px;line-height:1.5;white-space:nowrap}.oc-translate-th:hover{background:#e0e7ff}.oc-translate-th:disabled{opacity:.6;cursor:wait}.oc-items-tools{display:flex;align-items:center;gap:5px;flex-wrap:nowrap}.oc-tool-btn{border:0;border-radius:6px;padding:3px 7px;background:#f1f5f9;color:#334155;cursor:pointer;font-size:10px;white-space:nowrap;transition:background .15s}.oc-tool-btn:hover{background:#e2e8f0}.oc-tool-btn strong{color:#4f6ef7}.oc-tool-link{color:#4f6ef7;text-decoration:none;font-size:10px;white-space:nowrap;padding:3px 4px}.oc-tool-link:hover{text-decoration:underline}.oc-items-wrap{overflow-x:auto}.oc-items{width:100%;min-width:0;border-collapse:collapse;table-layout:fixed;font-size:10px}.oc-items th{padding:8px 6px;border-bottom:1px solid #e5e9f0;background:#fafbfd;color:#64748b;text-align:left;font-weight:600;white-space:nowrap}.oc-items td{padding:7px 6px;border-bottom:1px solid #f0f2f7;vertical-align:top}.oc-items th:nth-child(1){width:28px}.oc-items th:nth-child(2){width:94px}.oc-items th:nth-child(3){width:170px}.oc-items th:nth-child(4){width:170px}.oc-items th:nth-child(5){width:170px;font-size:9px}.oc-items th:nth-child(6){width:54px}.oc-items th:nth-child(7){width:90px}.oc-items th:nth-child(8){width:95px}.oc-items th:nth-child(9){width:92px}.oc-items th:nth-child(10){width:92px}.oc-items th:nth-child(11){width:90px}.oc-items th:nth-child(12){width:88px}.oc-items th:nth-child(13){width:68px}.oc-items th:nth-child(14){width:68px}.oc-items th:nth-child(15){width:31px}
/* 品目表「删除」列：按钮居中、去左右 padding —— 27px 按钮塞进 30px 列会溢出撑出横向滚动（2026-09-12 修 3px 微滚） */
.oc-items td:last-child{padding-left:0;padding-right:0;text-align:center}
.oc-cell,.oc-cell-stack input,.oc-cell-select{width:100%;min-width:0;height:31px;border:1px solid #e1e6ef;border-radius:5px;padding:0 7px;background:#fff;color:#334155;font-size:10px}.oc-cell-stack{display:grid;gap:4px}.oc-delete{width:27px;height:29px;border:0;border-radius:5px;background:transparent;color:#94a3b8;cursor:pointer}.oc-delete:hover{background:#fef2f2;color:#dc2626}.oc-item-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px;background:#fafbfd;color:#64748b;font-size:11px}.oc-item-foot strong{color:#3a56d4;font-size:12px}.oc-cur-head{display:flex;flex-direction:row;gap:4px;align-items:center;white-space:nowrap}.oc-cur-toggle{display:flex;gap:2px}.oc-cur-toggle button{border:1px solid #d8dee9;border-radius:4px;background:#fff;color:#64748b;cursor:pointer;font-size:9px;line-height:1;padding:2px 4px;min-width:22px}.oc-cur-toggle button:hover{background:#f1f5f9}.oc-cur-toggle button.active{border-color:#4f6ef7;background:#eef1fe;color:#3a56d4;font-weight:700}.oc-items .item-number{font-size:9px;padding:0 5px}
/* 品目表长文本单元格：改用 textarea 自动增高（2026-09-21 大哥：客户料号/客户原文品名规格显示不全） */
.oc-items td textarea.oc-cell{padding:4px 7px;min-height:31px;height:auto}
.oc-side-body{padding:13px 15px 15px}.oc-drop{display:flex;align-items:center;gap:10px;min-height:76px;padding:11px;border:1px dashed #bfc9d9;border-radius:8px;background:#f8f9fc;color:#64748b;cursor:pointer}.oc-drop-icon{display:grid;place-items:center;width:42px;height:42px;border-radius:8px;background:#eef1fe;color:#4f6ef7;font-size:16px}.oc-drop b{display:block;color:#334155;font-size:11px}.oc-drop small{display:block;margin-top:3px;color:#94a3b8;font-size:10px}.oc-parse{width:100%;margin-top:9px}.oc-file-result{margin-top:8px;padding:8px 9px;border-radius:6px;background:#f1f5f9;color:#64748b;font-size:10px;overflow-wrap:anywhere}.oc-file-result.ready{background:#eef1fe;color:#3a56d4}.oc-file-result.warn{background:#fef3c7;color:#92400e}
.oc-rules{display:grid;gap:11px}.oc-fixed-check{display:flex;align-items:flex-start;gap:7px;color:#475569;font-size:10px}.oc-fixed-check input{margin-top:2px;accent-color:#4f6ef7}.oc-terms{margin-top:10px;padding:9px;border-radius:6px;background:#f8fafc;color:#64748b;font-size:11px}.oc-milestones{display:grid;gap:7px;margin-top:10px;padding-top:10px;border-top:1px solid #f0f2f7}.oc-milestone-row{display:grid;grid-template-columns:52px 1fr 94px 74px 26px;gap:6px;align-items:center}.oc-milestone-row input{width:100%;min-width:0;height:29px;border:1px solid #d8dee9;border-radius:5px;padding:0 6px;font-size:10px}.oc-milestone-amount{text-align:right;color:#64748b;font-size:10px}.oc-alert{margin-top:10px;padding:8px 9px;border:1px solid #fde7b0;border-radius:6px;background:#fffbeb;color:#92400e;font-size:10px}.oc-actions{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:12px;padding:12px 14px;border:1px solid #edf0f5;border-radius:12px;background:#fff;box-shadow:0 1px 4px rgba(15,23,42,.055);color:#64748b;font-size:11px}.oc-actions>div:last-child{display:flex;gap:7px}.oc-actions strong{color:#1e293b}.oc-paste-dialog{width:min(780px,94vw)}.oc-paste-text{width:100%;min-height:260px;border:1px solid #d8dee9;border-radius:7px;padding:10px;font:12px/1.6 Consolas,monospace;resize:vertical}
.order-detail-dialog{width:min(1320px,96vw)}.order-detail-title{font-size:18px;font-weight:700}.order-detail-sub{margin-top:2px;font-size:11px;opacity:.8}.order-dialog-close{border:0;background:none;color:#fff;font-size:26px;cursor:pointer}.order-detail-rules{display:flex;gap:8px;flex-wrap:wrap;margin:-4px 0 14px}.order-history-note{margin-top:12px;color:#64748b;font-size:11px}.order-detail-milestones{margin-top:14px;padding:12px;border:1px solid #e5e9f0;border-radius:8px;background:#fafbfd}.order-detail-milestones h3{margin:0 0 8px;font-size:12px}.order-detail-milestones-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.order-detail-milestone{padding:8px;border-radius:6px;background:#fff;color:#475569;font-size:11px}

.oc-client-search{position:relative}.oc-client-dropdown{position:absolute;z-index:40;top:calc(100% + 4px);left:0;right:0;max-height:280px;overflow:auto;border:1px solid #d8dee9;border-radius:8px;background:#fff;box-shadow:0 12px 28px rgba(15,23,42,.16)}.oc-client-dropdown[hidden]{display:none}.oc-client-dropdown button{display:block;width:100%;padding:9px 11px;border:0;border-bottom:1px solid #f0f2f7;background:#fff;text-align:left;cursor:pointer}.oc-client-dropdown button:last-child{border-bottom:0}.oc-client-dropdown button:hover,.oc-client-dropdown button:focus{outline:0;background:#f4f6ff}.oc-client-dropdown strong{display:block;color:#1e293b;font-size:11px;font-weight:600}.oc-client-dropdown small{display:block;margin-top:2px;color:#94a3b8;font-size:9px}.oc-client-empty{padding:14px;color:#94a3b8;font-size:10px;text-align:center}.oc-fields input.recognized{border-color:#7c9bff;background:#f7f9ff;box-shadow:0 0 0 2px rgba(79,110,247,.09)}
.oc-drop.dragging{border-color:#4f6ef7;background:#eef2ff;box-shadow:0 0 0 3px rgba(79,110,247,.12)}.oc-drop:focus{outline:0;border-color:#4f6ef7;box-shadow:0 0 0 3px rgba(79,110,247,.12)}.oc-recognition{margin-top:9px;padding:10px;border:1px solid #dce4ff;border-radius:8px;background:#f8faff}.oc-recognition[hidden]{display:none}.oc-recognition-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding-bottom:8px;border-bottom:1px solid #e6ebfa;color:#1e293b;font-size:11px}.oc-recognition-head span{padding:3px 6px;border-radius:999px;font-size:9px}.oc-recognition-head span.high{background:#dcfce7;color:#166534}.oc-recognition-head span.review{background:#fef3c7;color:#92400e}.oc-recognition dl{display:grid;gap:0;margin:7px 0 0}.oc-recognition dl>div{display:grid;grid-template-columns:70px 1fr;gap:7px;padding:4px 0;border-bottom:1px dashed #e8ecf5}.oc-recognition dt{color:#64748b;font-size:9px}.oc-recognition dd{margin:0;color:#1e293b;font-size:10px;overflow-wrap:anywhere}.oc-recognition-warnings{margin-top:8px;padding:8px;border:1px solid #fde7b0;border-radius:6px;background:#fffbeb;color:#92400e;font-size:9px;line-height:1.55}.oc-recognition-warnings ul{margin:4px 0 0;padding-left:16px}.oc-recognition-actions{display:flex;gap:12px;margin-top:8px}.oc-recognition-actions a{color:#4f6ef7;font-size:10px;text-decoration:none}.oc-cell-stack input.needs-review,.oc-cell-stack textarea.needs-review{border-color:#f59e0b;background:#fffbeb}.oc-cell-stack input.needs-review:focus,.oc-cell-stack textarea.needs-review:focus{outline:0;box-shadow:0 0 0 2px rgba(245,158,11,.14)}.oc-english-review{display:flex;align-items:center;justify-content:space-between;gap:5px;padding:3px 5px;border-radius:5px;background:#fff7d6;color:#92400e;font-size:8px}.oc-english-review[hidden]{display:none}.oc-confirm-english{border:0;border-radius:4px;padding:3px 6px;background:#f59e0b;color:#fff;font-size:8px;white-space:nowrap;cursor:pointer}.oc-translation-action{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:8px;padding-top:8px;border-top:1px dashed #f2d48a}.oc-translation-action div{display:grid;gap:2px}.oc-translation-action span{color:#a16207}.oc-translation-action button{border:0;border-radius:6px;padding:6px 9px;background:#4f6ef7;color:#fff;font-size:9px;font-weight:600;cursor:pointer;white-space:nowrap}.oc-translation-action button:disabled{opacity:.6;cursor:wait}.oc-translation-status{margin-top:6px;color:#475569;line-height:1.5}
/* 新增订单页——右侧面板高度压缩（PDF区/执行开票规则/收款条件） */
.oc-side-body{padding:9px 15px 11px}
.oc-drop{min-height:58px;padding:7px 10px;gap:9px;border-color:#a9b8d0}
.oc-drop-icon{width:36px;height:36px;border-radius:8px;font-size:15px}
.oc-drop b{font-size:11px}
.oc-drop small{margin-top:3px;font-size:9.5px}
.oc-rules{gap:6px}
.oc-rules select{height:30px}
.oc-rules label>span{margin-bottom:3px}
.oc-fixed-check{font-size:10px}
.oc-terms{margin-top:6px;padding:6px 9px}
.oc-milestones{margin-top:6px;padding-top:6px;gap:6px}
.oc-alert{margin-top:7px;padding:6px 8px}
/* 修复：.oc-milestones{display:grid} 会覆盖 HTML hidden 属性，导致「普通账期/分阶段收款」切换时分阶段区域不隐藏。加 [hidden] 显式声明，特异性高于 display:grid。 */
.oc-milestones[hidden]{display:none}
/* 修复右侧「4.收款条件」分阶段行：①百分比 input[type=number] 自带上下箭头遮挡数字→经 .oc-milestone-pct 容器包裹 + %后缀，隐藏 spinner 并在右侧显示 %；②日期放到阶段名称后面同一行(不要两行)：一行排 比例%|阶段名|日期|删除，金额放第二行独占。 */
.oc-milestone-row{
  display:grid;
  grid-template-columns:46px minmax(0,1fr) 92px 24px;
  grid-template-areas:"pct label due del" "amt amt amt amt";
  gap:4px 6px;
  align-items:center;
}
.oc-milestone-pct{grid-area:pct;position:relative;display:flex;align-items:center;min-width:0}
.oc-milestone-pct input[data-key="percent"]{flex:1 1 0;min-width:0;height:29px;text-align:center;-webkit-appearance:none;-moz-appearance:textfield;appearance:textfield;padding:0 16px 0 2px}
.oc-milestone-pct input[data-key="percent"]::-webkit-inner-spin-button,
.oc-milestone-pct input[data-key="percent"]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
/* 全局：数字输入框隐藏上下增减箭头（number spinner），避免遮挡内容、易误操作 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
input[type="number"]{-moz-appearance:textfield;appearance:textfield}
.oc-pct-sign{position:absolute;right:6px;top:50%;transform:translateY(-50%);color:#64748b;font-size:10px;pointer-events:none}
.oc-milestone-row input[data-key="label"]{grid-area:label;min-width:0}
.oc-milestone-row input[data-key="due_date"]{grid-area:due;min-width:0;-webkit-appearance:none;-moz-appearance:textfield;appearance:textfield;padding:0 2px;font-size:9.5px}
.oc-milestone-row .oc-milestone-amount{grid-area:amt;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#64748b;font-size:10px}
.oc-milestone-row .oc-delete{grid-area:del;width:24px;height:29px}
/* 新增订单页——页面整体紧凑：1基本信息压缩、右列收窄、品目表适应不横滚（不动菜单与布局模型） */
.oc-fields{padding:8px 12px 8px;row-gap:6px}
.oc-items{width:100%;min-width:1400px}
@media(min-width:1281px){
  .oc-page .oc-grid{grid-template-columns:minmax(0,1fr) 280px}
}
/* 2026-09-26 大哥确认：≤1280 时订单顶栏改两行 —— 左侧组（新增订单/视图下拉/待送货工作台）一行，
   筛选条独占第二行满宽。筛选条自身仍 flex-nowrap 单行排列（遵守「筛选控件不得换行/竖排」红线）。
   改前实测：1152 视口下「📥 导出Excel」越界 119px、订单日期(止)越界 22px 且被 .om-topbar{overflow:hidden} 静默裁掉。 */
@media(max-width:1280px){.od-kpis{grid-template-columns:repeat(3,1fr)}.oc-grid{grid-template-columns:1fr}.oc-right-stack{grid-template-columns:repeat(3,minmax(0,1fr))}.om-filterbar{grid-template-columns:repeat(4,minmax(120px,1fr))}.om-filterbar #order-search{grid-column:span 4}
.om-topbar{flex-wrap:wrap;row-gap:4px}
.om-topbar .om-filterbar{flex:1 1 100%}}
@media(max-width:1000px){.od-layout{grid-template-columns:1fr}.od-side-stack{grid-template-columns:repeat(2,minmax(0,1fr))}.od-history-note{grid-column:span 2}.oc-right-stack{grid-template-columns:1fr}.oc-fields{grid-template-columns:repeat(2,minmax(0,1fr))}.om-filterbar{grid-template-columns:1fr 1fr}.om-filterbar #order-search{grid-column:span 2}}
@media(max-width:640px){.om-heading-row,.od-heading,.oc-heading{flex-direction:column}.od-rule,.oc-step{white-space:normal}.od-kpis{grid-template-columns:repeat(2,1fr)}.od-side-stack{grid-template-columns:1fr}.od-history-note{grid-column:auto;flex-direction:column}.oc-fields{grid-template-columns:1fr}.oc-fields .span-2{grid-column:auto}.oc-actions{align-items:stretch;flex-direction:column}.oc-actions>div:last-child{width:100%}.oc-actions .btn{flex:1}.om-filterbar{grid-template-columns:1fr}.om-filterbar #order-search{grid-column:auto}.order-detail-milestones-grid{grid-template-columns:1fr 1fr}}

/* ── 旋转动画 ─────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }

/* ── 骨架屏动画 ─────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton-pulse {
  background: linear-gradient(90deg, #f0f2f7 25%, #e8eaf0 50%, #f0f2f7 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── 淡入动画 ─────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── 重置 & 基础 ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── 顶栏 ─────────────────────────────────────── */
.topbar {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  padding: 0 28px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,.05), 0 4px 20px rgba(0,0,0,.15);
}
.topbar-inner {
  max-width: 1400px;
  margin: auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon { font-size: 24px; }
.logo-title { font-size: 16px; font-weight: 700; letter-spacing: .3px; }
.logo-sub  { font-size: 11px; color: #7d8ba6; margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.badge-date, .badge-no {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-size: 12px;
  color: #94a3b8;
  backdrop-filter: blur(4px);
  transition: all var(--duration) var(--ease);
}
.badge-no {
  color: var(--primary-light);
  font-weight: 600;
  border-color: rgba(79,110,247,.15);
  background: rgba(79,110,247,.1);
}

/* ── 仅用于「开送货单 / 送货管理」页顶栏（独特类名，不影响其它页面）── */
.dn-sep {
  font-size: 12px;
  color: rgba(255,255,255,.25);
  margin: 0 2px;
  user-select: none;
}
.dn-lang-switcher {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  padding: 2px 3px;
  font-size: 11px;
}
.dn-lang-switcher .lang-btn {
  padding: 2px 6px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 4px;
  font-size: 11px;
  color: rgba(255,255,255,.75);
  transition: all var(--duration) var(--ease);
}
.dn-lang-switcher .lang-btn:hover { color: #fff; background: rgba(255,255,255,.08); }
.dn-lang-switcher .lang-btn.active {
  background: var(--primary) !important;
  color: #fff !important;
  font-weight: 600;
}

/* ── 布局 ─────────────────────────────────────── */
.layout {
  max-width: 1400px;
  margin: 20px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  animation: fadeIn var(--duration-slow) var(--ease);
}
@media(max-width:900px){ .layout{ grid-template-columns: 1fr; } }

/* ── 卡片 ─────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: box-shadow var(--duration) var(--ease);
}
/* Audit log: preserve complete audit evidence instead of truncating it. */
.audit-log-card { overflow: visible; }
.audit-log-table-wrap { overflow-x: auto; overflow-y: visible; }
.audit-log-table { width: 100%; min-width: 1120px; table-layout: fixed; }
.audit-log-table th,
.audit-log-table td { vertical-align: top; }
/* 表头允许换行：中文/英文/泰文表头长度差异极大，固定列宽 + nowrap 会把表头挤到相邻列（重叠）；换行确保永不重叠、永不裁字 */
/* ⚠️ 2026-10-06 修：vertical-align 必须与数据格一致（top）——表头长短不一（泰文常换 2 行）时，
   若表头 middle 居中，各列表头文字的起始线会高低不齐，与整列内容明显错位 */
/* ⚠️ 2026-10-06 修②：text-align 必须与数据格一致（left）——<th> 浏览器默认居中，会让表头文字浮在
   列中间（最宽的「操作内容」列实测偏 300px），且拖动列宽时表头跟着左右移动。改为左对齐后，
   表头文字与下方数据文字起始位置完全重合，且不随列宽变化而移动 */
.audit-log-table thead th { white-space: normal; overflow-wrap: anywhere; word-break: break-word; position: relative; vertical-align: top; text-align: left; }
/* 列宽拖拽手柄（范式 B：table-layout:fixed + colgroup，列宽权威在 <col>，写 th/td 宽度无效） */
.audit-log-table .col-resize-handle { position: absolute; right: 0; top: 0; width: 7px; height: 100%; cursor: col-resize; user-select: none; z-index: 3; }
.audit-log-table .col-resize-handle:hover,
.audit-log-table .col-resize-handle.active { background: var(--primary); opacity: .35; }
.audit-log-table .audit-operator-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audit-log-table .audit-time-cell,
.audit-log-table .audit-ip-cell { white-space: nowrap; font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.audit-log-table .audit-module-cell,
.audit-log-table .audit-action-cell { white-space: normal; overflow-wrap: anywhere; }
.audit-log-table .audit-detail-cell { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; line-height: 1.55; color: var(--text); }
.audit-col-operator { width: 130px; }
.audit-col-time { width: 150px; }
.audit-col-module { width: 110px; }
.audit-col-action { width: 142px; }
.audit-col-detail { width: auto; }
.audit-col-ip { width: 130px; }

/* ══ 🩺 实时请求监控 · 两张表（2026-10-10 大哥反馈「表头全挤在一起」）══════════
   根因：模板里写的是 <table class="table">，而全站 CSS 从未定义过 .table
        ⇒ 浏览器默认渲染：th/td padding=0、<th> 默认居中、无边框线、
          且 table-layout:auto 时宽度只按内容撑（实测仅 489px 挤在左侧 1390px 容器里）。
   修法：补一套与 .audit-log-table 同源的表格骨架（不改 .table 全局，避免波及他页）。 */
.reqmon-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.reqmon-table thead th {
  padding: 9px 14px; background: #fafbfd; color: #64748b; font-weight: 600;
  text-align: left; white-space: nowrap; border-bottom: 1px solid #e5e9f0;
}
/* 表头与数据格必须同对齐同基线（同 .audit-log-table 的教训：th 默认居中会让文字浮在列中间） */
.reqmon-table tbody td {
  padding: 9px 14px; border-bottom: 1px solid #f0f2f7;
  vertical-align: middle; color: #334155; text-align: left;
}
.reqmon-table tbody tr:hover td { background: #fafbff; }
.reqmon-table tbody tr:last-child td { border-bottom: none; }
/* 数字/时长列右对齐 + 等宽数字（多行数字对齐，读数更快） */
.reqmon-table th.reqmon-num, .reqmon-table td.reqmon-num {
  text-align: right; font-variant-numeric: tabular-nums;
}
/* 长文本列：单行显示 + 省略号（悬停 title 可看全文）；屏幕表格，不涉及打印红线 */
.reqmon-table td.reqmon-ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reqmon-table td.reqmon-nowrap { white-space: nowrap; }

/* 列宽分配（table-layout:fixed ⇒ 未指定的列平分剩余宽度） */
#reqmon-running-table th:nth-child(1) { width: 112px; }   /* 状态 */
#reqmon-running-table th:nth-child(3) { width: 110px; }   /* 操作人 */
#reqmon-running-table th:nth-child(4) { width: 104px; }   /* 耗时 */
#reqmon-running-table th:nth-child(6) { width: 136px; }   /* 来源IP */
#reqmon-running-table th:nth-child(7) { width: 96px; }    /* 操作 */
#reqmon-slow-table th:nth-child(1) { width: 136px; }      /* 结束时间 */
#reqmon-slow-table th:nth-child(3) { width: 110px; }      /* 操作人 */
#reqmon-slow-table th:nth-child(4) { width: 104px; }      /* 耗时 */
#reqmon-slow-table th:nth-child(5) { width: 92px; }       /* 结果 */
#reqmon-slow-table th:nth-child(6) { width: 84px; }       /* 写库 */
#reqmon-slow-table th:nth-child(7) { width: 112px; }      /* 是否被终止 */

.card:hover {
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600;
  font-size: 14px;
  background: linear-gradient(to bottom, #fafbfd, #f7f8fc);
}
.form-card  { padding: 0; }
.form-card form { padding: 6px 22px 56px; }
.form-card form > .section-title:first-of-type { margin-top: 0; }
/* 开票表单卡首屏留白：消除 header 与「基本信息」之间多余空白，仅作用于本卡首分区 */


/* ── 右侧列容器 ── */
.right-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: stretch;
}
.history-card {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.history-card::-webkit-scrollbar { width: 4px; }
.history-card::-webkit-scrollbar-track { background: transparent; }
.history-card::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* ── 草稿箱 ─────────────────────────────────── */
.draft-section {
  flex-shrink: 0;
}
.draft-section #draft-panel {
  padding: 4px 16px 10px;
  overflow-y: auto;
  max-height: 240px;
}
.draft-section #draft-panel::-webkit-scrollbar { width: 3px; }
.draft-section #draft-panel::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* ── 发票草稿箱折叠（默认收起，点标题展开/收起；与送货单 dn- 命名隔离）── */
.inv-draft-card .card-header { cursor: pointer; user-select: none; }
.inv-draft-card .card-header:hover #inv-draft-arrow { color: #334155; }
#inv-draft-arrow {
  display: inline-block; width: 12px; text-align: center;
  font-size: 11px; color: #94a3b8; flex-shrink: 0; line-height: 1;
  transition: color .15s;
}
.inv-draft-card.collapsed #inv-draft-body { display: none; }
.inv-draft-rule { font-size: 10px; color: #9ca3af; padding: 4px 16px 2px; line-height: 1.4; }

/* ── 表单元素 ─────────────────────────────────── */
.section-title {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  margin: 18px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ci-tabs { display:flex; gap:2px; padding:12px 20px 0; border-bottom:1px solid #e5e9f0; flex-wrap:wrap; background:#fafbfd; border-radius:12px 12px 0 0; }
.ci-tab { border:0; background:transparent; padding:10px 16px; cursor:pointer; font-size:13px; color:#64748b; border-bottom:2px solid transparent; white-space:nowrap; }
.ci-tab:hover { color:#334155; }
.ci-tab.active { color:#4f6ef7; border-bottom-color:#4f6ef7; font-weight:600; }
.ci-panel[hidden] { display:none; }
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.span2       { grid-column: span 2; }
.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .3px;
}
.req { color: var(--danger); }
input[type="text"], input[type="number"], input[type="date"], select {
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  width: 100%;
  transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease), background var(--duration) var(--ease);
}
input:hover { border-color: #c7cdd8; }
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
  background: #fff;
}
input::placeholder { color: var(--text-muted); }

/* ── 类型标签 ─────────────────────────────────── */
.type-tabs { display: flex; gap: 6px; }
.tab {
  border: 1px solid var(--border);
  background: var(--hover-bg);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-weight: 500;
}
.tab:hover { background: var(--primary-bg); border-color: var(--primary-light); color: var(--primary); }
.tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(79,110,247,.25);
}
.tab.active[data-type="cn"] {
  background: var(--danger);
  border-color: var(--danger);
  box-shadow: 0 2px 8px rgba(239,68,68,.25);
}
/* IN（商业请款单）标签：低调浅色（雾青灰）｜2026-10-02 大哥定案 */
.tab[data-type="in"] { color: #6B8A93; }
.tab:hover[data-type="in"] { background: #EFF5F6; border-color: #BCD2D8; color: #5B7C86; }
.tab.active[data-type="in"] {
  background: #E7F0F2;
  color: #4F7280;
  border-color: #A8C4CB;
  box-shadow: none;
}

/* ── 客户下拉 ─────────────────────────────────── */
.select-wrap { position: relative; }
.dropdown {
  position: absolute;
  z-index: 200;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 260px;
  overflow-y: auto;
  animation: fadeInUp .15s var(--ease);
}
.dropdown-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  line-height: 1.4;
  transition: background var(--duration) var(--ease);
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: var(--primary-bg); }
.dropdown-item .d-main { font-weight: 600; font-size: 13px; }
.dropdown-item .d-sub  { font-size: 11px; color: var(--text-secondary); }
.hidden { display: none !important; }

/* ══ 弹窗覆盖层（用于 sbModal / payModal / userModal / roleModal / restoreModal / edit-pay-modal） ══ */
/* 基础隐藏：不依赖 :has()，兼容 IE/旧Edge/系统自带浏览器 */
.modal {
  display: none !important;
}
/* 显示状态：不依赖 :has()，所有浏览器通用 */
/* 2026-10-01 大哥要求：弹窗出现时不得模糊/重度压暗背后数据（需核对背后数据）→ 去掉毛玻璃、遮罩减淡 */
.modal.show {
  display: flex !important;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.3);
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s var(--ease);
}
/* :has() 增强样式（现代浏览器补充） */
.modal:has(> .modal-content) {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.3);
  z-index: 1000;
  overflow-y: auto;
  padding: 20px;
}
.modal:has(> .modal-content).show {
  display: flex !important;
  align-items: center;
  justify-content: center;
  animation: fadeIn .15s var(--ease);
}
.modal:has(> .modal-content) .modal-content {
  background: #fff;
  border-radius: var(--radius-xl);
  max-width: 520px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  margin: auto;
  animation: fadeInUp .2s var(--ease);
  /* 弹窗不超屏：最大高度 90vh，内部滚动；标题/按钮 sticky 固定 */
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-light);
  background: #fafbfc;
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.modal-close {
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 4px;
  transition: color .15s;
  background: none;
  border: none;
}
.modal-close:hover { color: var(--text); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  background: #fafbfc;
  position: sticky;
  bottom: 0;
  z-index: 20;
  flex-shrink: 0;
}

/* ── 品目表 ───────────────────────────────────── */
.items-header, .item-row {
  display: grid;
  grid-template-columns: 36px 100px 100px 1fr 70px 60px 110px 100px 36px 30px;
  gap: 6px;
  align-items: center;
}
.item-row { align-items: start; }
.item-row .col-idx,
.item-row .f-qty,
.item-row .f-unit,
.item-row .f-price,
.item-row .col-amt,
.item-row .del-btn {
  align-self: center;
}
.item-row .col-idx {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
  user-select: none;
}
.items-header {
  padding: 8px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
  background: #fafbfd;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.item-row {
  padding: 7px 6px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--duration) var(--ease);
  animation: fadeIn .2s var(--ease);
}
.item-row:hover { background: #f8f9fd; }
.item-row input {
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 5px;
}
/* ── 品目行所有textarea自动增高 ── */
.item-row .f-po,
.item-row .f-code,
.item-row .f-desc {
  padding: 6px 8px;
  font-size: 13px;
  border-radius: 5px;
  line-height: 1.4;
  resize: none;
  overflow: hidden;
  min-height: 34px;
  max-height: 200px;
  field-sizing: content;
}
.item-row .col-amt {
  font-weight: 600;
  color: var(--primary);
  text-align: right;
  padding-right: 4px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* ── 导入 Excel 开票 · 送货行匹配角标（2026-10-07 方案 A · 第 10 列）────────
   唯一命中 ✓ 自动挂链 / 歧义「选」强制人工选 / 可开量不足 ! / 未命中 —
   角标是按钮，点击可查看与改选候选送货行；hidden 用 visibility 占位保持列对齐。 */
.item-row .match-badge,
.items-header .col-match { align-self: center; justify-self: center; }
.match-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration) var(--ease);
}
.match-badge.hidden { visibility: hidden; pointer-events: none; }
.match-badge.mb-ok    { border-color: #86efac; background: #f0fdf4; color: #15803d; }
.match-badge.mb-amb   { border-color: #fcd34d; background: #fffbeb; color: #b45309; }
.match-badge.mb-short { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; }
.match-badge.mb-none  { border-color: #e2e8f0; background: #f8fafc; color: #94a3b8; }
.match-badge:hover { filter: brightness(.95); }
.match-badge.mb-attn { box-shadow: 0 0 0 2px rgba(245, 158, 11, .28); }

/* 匹配结果条（品目表上方，单行不换行） */
.imatch-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: 0 0 8px;
  padding: 8px 12px;
  border: 1px solid #e6ebfa;
  border-radius: 8px;
  background: #f8faff;
  font-size: 12px;
  color: #475569;
}
.imatch-bar[hidden] { display: none; }
.imatch-bar .im-chip { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.imatch-bar .im-chip b { font-weight: 700; }
.imatch-bar .im-ok b   { color: #15803d; }
.imatch-bar .im-amb b  { color: #b45309; }
.imatch-bar .im-short b{ color: #b91c1c; }
.imatch-bar .im-none b { color: #64748b; }
.imatch-bar .im-go {
  margin-left: auto;
  padding: 4px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  background: #fff;
  color: #4f6ef7;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.imatch-bar .im-go:hover { background: #eef2ff; }

/* 候选送货行选择弹窗 */
.imatch-pick-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.imatch-pick-table th {
  padding: 7px 8px;
  border-bottom: 1px solid #e5e9f0;
  background: #fafbfd;
  color: #64748b;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.imatch-pick-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #f0f2f7;
  color: #1e293b;
  vertical-align: middle;
}
.imatch-pick-table tr.picked { background: #f0fdf4; }
.imatch-pick-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: all var(--duration) var(--ease);
  text-align: center;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.del-btn:hover {
  color: var(--danger);
  background: var(--danger-bg);
}
[class^="col-"] { min-width: 0; }

/* ── 长文本自动增高输入框（2026-09-21 大哥：编辑页长字段显示不全治理）──────
   痛点：长料号/长品名/长规格/长PO 在单行 input 里只能靠光标左右滚动，输入时看不出是否输错。
   做法：改 <textarea rows=1>，宽度内自动换行 + 高度随内容自适应，全文一次看全。
   配套：JS 拦截 Enter（禁换行）与多行粘贴（换行→空格），保证 .value 语义与 input 一致。 */
.auto-grow-input {
  field-sizing: content;
  resize: none;
  overflow: hidden;
  box-sizing: border-box;
  display: block;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-height: 32px;
  max-height: 180px;
}

/* ── 底部区域：备注 + 汇总 并排 ─────────────── */
.bottom-area {
  display: grid;
  grid-template-columns: 100px 100px 1fr 70px 60px 110px 100px 36px;
  gap: 6px;
  margin-top: 16px;
  align-items: stretch;
}
.bottom-notes {
  grid-column: 1 / 4;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.bottom-notes label { margin-bottom: 6px; display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.bottom-notes textarea { flex: 1; }
.summary-box-wrap {
  grid-column: 5 / 9;
  display: flex;
  align-items: stretch;
}

/* ── 金额汇总 ─────────────────────────────────── */
.summary-box {
  background: linear-gradient(135deg, #f8f9ff 0%, #f0f3ff 100%);
  border: 1px solid #dce4ff;
  border-radius: var(--radius);
  padding: 14px 18px;
  width: 100%;
  box-sizing: border-box;
}
.summary-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
  border-bottom: 1px solid rgba(220,228,255,.5);
}
.summary-row:last-child { border-bottom: none; }
.summary-label { margin-right: 12px; color: var(--text-secondary); white-space: nowrap; font-size: 12px; }
.summary-value {
  font-weight: 600;
  text-align: right;
  min-width: 136px;
  font-variant-numeric: tabular-nums;
}
.summary-row.grand {
  font-size: 18px;
  color: var(--primary);
  padding-top: 10px;
  margin-top: 4px;
  border-bottom: none;
}
.summary-row.grand .summary-label,
.summary-row.grand .summary-value { font-weight: 700; }
.red { color: var(--danger) !important; }

/* ── 上传区 ───────────────────────────────────── */
.multi-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2px;
  transition: all var(--duration) var(--ease);
  min-height: 28px;
}
.multi-upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-bg);
}
.upload-dropzone {
  padding: 3px 8px;
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
}
.upload-dropzone:hover,
.upload-dropzone.dragover {
  background: var(--primary-bg);
}
.dropzone-icon { font-size: 14px; margin-bottom: 0; }
.dropzone-text { font-size: 11px; color: var(--text-secondary); }
.dropzone-link { color: var(--primary); font-weight: 600; cursor: pointer; text-decoration: underline; }
.dropzone-hint { font-size: 9px; color: var(--text-muted); margin-top: 0; }

/* ── 附件文件列表 ─────────────────────────────── */
.attachment-list {
  padding: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.attachment-item {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-bg);
  border: 1px solid #dce4ff;
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11px;
  max-width: 240px;
  transition: all var(--duration) var(--ease);
}
.attachment-item:hover {
  background: #dbe5ff;
  border-color: var(--primary-light);
}
.att-icon { font-size: 14px; flex-shrink: 0; }
.att-name {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text);
}
.att-size { color: var(--text-muted); font-size: 10px; white-space: nowrap; }
.att-del {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer; font-size: 14px;
  padding: 0 2px; line-height: 1;
  transition: color var(--duration) var(--ease);
  flex-shrink: 0;
}
.att-del:hover { color: var(--danger); }

/* ── 保存草稿按钮 ─────────────────────────────── */
.btn-draft {
  background: var(--primary-bg);
  color: var(--primary);
  border: 1px solid #dce4ff;
}
.btn-draft:hover {
  background: #dbe5ff;
  border-color: var(--primary-light);
}
.draft-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background var(--duration) var(--ease);
}
.draft-item:last-child { border-bottom: none; }
.draft-item:hover { background: var(--hover-bg); }
.d-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.d-client {
  font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color var(--duration) var(--ease);
}
.d-client:hover { color: var(--primary); }
.d-meta { font-size: 10px; color: var(--text-muted); }
.d-actions { display: flex; gap: 3px; flex-shrink: 0; }
.d-load-btn {
  font-size: 10px; padding: 2px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid #dce4ff;
  background: var(--primary-bg);
  color: var(--primary);
  white-space: nowrap; flex: 1; text-align: center;
  transition: all var(--duration) var(--ease);
}
.d-load-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.d-del-btn {
  font-size: 10px; padding: 2px 5px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--hover-bg);
  color: var(--text-muted);
  transition: all var(--duration) var(--ease);
}
.d-del-btn:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

/* ── 按钮 ─────────────────────────────────────── */
.btn {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--duration) var(--ease);
}
.btn-ghost { background: var(--hover-bg); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); color: var(--text); }
.btn-preview { background: var(--info-bg); color: var(--info); border: 1px solid #93c5fd; }
.btn-preview:hover { background: #dbeafe; }
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all var(--duration) var(--ease);
}
.btn-sm.btn-add { background: var(--primary-bg); color: var(--primary); border-color: #dce4ff; }
.btn-sm.btn-add:hover { background: var(--primary); color: #fff; }
/* 选中分页页按钮 — 放在 .btn-sm 之后确保覆盖 */
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: #fff; box-shadow: 0 2px 8px rgba(79,110,247,.2); }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(79,110,247,.3); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(79,110,247,.2); }
.btn-primary:focus { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%); color: #fff; box-shadow: 0 2px 8px rgba(79,110,247,.2); outline: none; }
/* 非选中分页页按钮 */
.btn-sm.btn-secondary { background: var(--bg-card, #fff); color: var(--text-secondary, #666); border-color: var(--border, #d1d5db); }
.btn-sm.btn-secondary:hover { background: var(--hover-bg, #f3f4f6); }
.btn-sm.btn-secondary:focus { background: var(--bg-card, #fff); color: var(--text-secondary, #666); border-color: var(--border, #d1d5db); outline: none; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ── 历史列表 ─────────────────────────────────── */
#history-list { padding: 4px 0; }
.history-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background var(--duration) var(--ease);
  animation: fadeIn .2s var(--ease);
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--hover-bg); }
.history-item .h-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
  transition: all .15s var(--ease);
  padding: 2px 6px;
  border-radius: 4px;
  margin: -2px -6px;
}
.history-item .h-name:hover { background: var(--primary-bg); color: var(--primary); }
.history-item .h-meta { display: flex; gap: 8px; align-items: center; }
.history-item .h-date { font-size: 11px; color: var(--text-muted); }
.history-item .h-size { font-size: 11px; color: var(--text-muted); }
.history-item .h-actions { display: flex; gap: 6px; margin-top: 4px; }
.h-edit-btn {
  font-size: 11px; padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--success);
  background: var(--success-bg);
  color: var(--success);
  transition: all var(--duration) var(--ease);
}
.h-edit-btn:hover { background: var(--success); color: #fff; }
.h-dl-btn, .h-del-btn {
  font-size: 11px; padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--hover-bg);
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
}
.h-dl-btn:hover  { background: var(--primary-bg); color: var(--primary); border-color: var(--primary-light); }
.h-del-btn:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.h-void-btn {
  font-size: 11px; padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--warning);
  background: var(--warning-bg);
  color: var(--warning);
  transition: all var(--duration) var(--ease);
}
.h-void-btn:hover { background: var(--warning); color: #fff; }
.h-unvoid-btn {
  font-size: 11px; padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--info, #3b82f6);
  background: var(--info-bg, #eff6ff);
  color: var(--info, #3b82f6);
  transition: all var(--duration) var(--ease);
}
.h-unvoid-btn:hover { background: var(--info, #3b82f6); color: #fff; }
.empty-tip {
  text-align: center;
  padding: 30px;
  color: var(--text-muted);
  font-size: 13px;
}
.history-hint {
  padding: 5px 16px;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
}

.history-hint {
  padding: 5px 16px;
  font-size: 11px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

/* ── 排序按钮 ── */
.h-sort-btn {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}
.h-sort-btn:hover {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary-light);
}

/* ── 翻页 ── */
.h-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-light);
}
.h-page-btn {
  font-size: 13px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
  line-height: 1.6;
}
.h-page-btn:hover:not(.disabled) {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary-light);
}
.h-page-btn.disabled {
  opacity: .35;
  cursor: default;
}
.h-page-num {
  font-size: 11px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
  text-align: center;
}
.h-page-num:hover {
  background: var(--hover-bg);
  border-color: var(--border);
}
.h-page-num.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}
.h-page-ellipsis {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 2px;
}

/* ── 弹窗 ─────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.3);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  animation: fadeIn .15s var(--ease);
}
.modal {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.3);
  z-index: 1000;
  padding: 20px;
}
.modal-inner {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 32px 36px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fadeInUp .2s var(--ease);
  /* 弹窗不超屏：默认最大高度 90vh，内容过多内部滚动 */
  max-height: 90vh;
  overflow-x: hidden;
  overflow-y: auto;
}
/* 发票编辑弹窗可拉伸 */
#invoice-modal .modal-inner {
  position: relative;
  max-width: none;
  min-width: 420px;
  min-height: 300px;
}
#invoice-modal .resize-hint {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 22px;
  height: 22px;
  opacity: .45;
  cursor: nwse-resize;
  transition: opacity .2s;
  z-index: 2;
}
#invoice-modal .resize-hint:hover {
  opacity: .9;
}
.modal-icon { font-size: 48px; margin-bottom: 12px; }
.modal h2 { font-size: 20px; margin-bottom: 16px; }
.modal-body {
  background: #f8f9fc;
  border-radius: var(--radius);
  padding: 16px;
  text-align: left;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.modal-body strong { color: var(--text); }
.modal-actions { display: flex; gap: 12px; justify-content: center; }

/* ── 长弹窗右上角固定关闭按钮（sticky 吸附滚动容器右上角，不随内容滚走） ── */
.modal-close-sticky {
  position: sticky;
  top: -32px; /* 抵消 .modal-inner 的 padding-top:32px，吸顶时完全贴住弹窗右上角 */
  float: right;
  z-index: 30;
  margin: -10px -12px 0 12px;
  width: 32px;
  height: 32px;
  font-size: 22px;
  line-height: 1;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.modal-close-sticky:hover { color: var(--text, #0f172a); background: rgba(148,163,184,.18); }

/* ── Toast ─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  max-width: 420px;
  text-align: center;
  animation: fadeInUp .3s var(--ease);
  backdrop-filter: blur(8px);
}
.toast.error {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
}
.toast.success {
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 100%);
}

/* ── 额外字段 ─────────────────────────────────── */
.extra-field {
  background: #fffbf0;
  border: 1px solid #f6e05e;
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 8px;
}

/* ══ 侧边栏导航 ══════════════════════════════════ */
.sidebar {
  width: 168px;
  min-height: 100vh;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: #fff;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding-top: 0;
  box-shadow: 2px 0 20px rgba(0,0,0,.15);
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 18px 14px 14px 44px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  margin-bottom: 8px;
}

.sidebar .logo-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #e2e8f0 0%, #fff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-list { list-style: none; padding: 0 10px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: #94a3b8;
  transition: background-color var(--duration) var(--ease), color var(--duration) var(--ease);
  margin-bottom: 3px;
  position: relative;
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}
.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

/* ══ 管理功能分组样式 ══ */
.nav-divider {
  height: 1px;
  background: rgba(255,255,255,.1);
  margin: 8px 10px;
}
.nav-group-title {
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,.4);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 12px 12px 4px;
  margin-top: 4px;
}

/* ══ 主内容区偏移 ══ */
.main-wrap {
  margin-left: 168px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  box-sizing: border-box;
  position: relative;
  left: 0;
}
.main-wrap .topbar { position: sticky; top: 0; z-index: 100; }
.main-wrap .layout { max-width: none; margin: 0; padding: 20px; box-sizing: border-box; }
.page-section {
  display: none;
  width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  position: relative;
  left: 0;
}
.page-section.active { display: block; animation: fadeIn .3s var(--ease); }
.page-section.active.sec-fullpage { display: flex; flex-direction: column; height: calc(100vh - 60px); }

/* ══ 弹窗宽度扩展 ══ */
.modal-lg { max-width: 700px !important; }

/* ══ PDF解析状态提示 ══ */
.parse-status {
  background: var(--primary-bg);
  border: 1px solid #dce4ff;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 12px;
  color: var(--primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeInUp .2s var(--ease);
}
.items-title-row { justify-content: space-between; }
.items-actions { display: flex; gap: 6px; align-items: center; }
.btn-pdf-parse {
  background: #fff8e6; color: #b7791f; border-color: #f6c16e;
  font-weight: 600;
}
.btn-pdf-parse:hover { background: #f6c16e; color: #7b4f12; }

/* ══ 客户管理表格 ══ */
.cust-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cust-table th {
  background: #fafbfd;
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .3px;
  border-bottom: 2px solid var(--border);
}
.cust-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.cust-table tr:last-child td { border-bottom: none; }
.cust-table tr:hover td { background: var(--hover-bg); }

/* ══ 徽章计数 ══ */
.badge-count {
  display: inline-block;
  background: var(--primary-bg);
  color: var(--primary);
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

/* ══ 语义徽章 ══ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}
.badge-success {
  background: var(--success-bg);
  color: var(--success);
}
.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.badge-info {
  background: var(--info-bg);
  color: var(--info);
}
.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}
/* DN 类型专用徽章 — 蓝色 */
.badge-primary {
  background: #dbeafe;
  color: #2563eb;
}
/* Invoice type/status badges: compact solid colors matching the invoice list design. */
.badge-cn {
  background: #f59e0b;
  color: #ffffff;
}
.badge-dn {
  background: #6366f1;
  color: #ffffff;
}
/* 作废专用徽章 — 灰色+删除线 */
.badge-void {
  background: #f1f5f9;
  color: #94a3b8;
  text-decoration: line-through;
}
/* 作废行样式 — 统一使用CSS变量 */
.voided-row {
  background: var(--danger-bg) !important;
  position: relative;
}
.voided-row td:not(:last-child) {
  color: var(--text-muted) !important;
  text-decoration: line-through !important;
}
.voided-row td:not(:last-child) * {
  color: var(--text-muted) !important;
  text-decoration: line-through !important;
}
/* The final operation column remains readable and actionable. */
.voided-row td:last-child,
.voided-row td:last-child a {
  text-decoration: none !important;
}
.voided-row td:last-child a {
  color: var(--primary) !important;
}
/* 作废行左侧标识条 */
.voided-row td:first-child {
  position: relative;
}
.voided-row td:first-child::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--danger);
  border-radius: 2px;
}

/* ── 右侧历史列表「已作废」标识 ── */
.history-item .h-void-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: bold;
  line-height: normal;
  padding: 3px 8px;
  border-radius: 4px;
  background: #FFDBBB;
  color: #d97706;
  white-space: nowrap;
  vertical-align: middle;
}

/* ── 已作废历史项：文件名红色删除线 ── */
.history-item.is-voided .h-name {
  text-decoration: line-through;
  text-decoration-color: #dc2626;
  text-decoration-thickness: 1px;
}

/* ══ 统计页 ══ */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--border-light);
  text-align: center;
  transition: all var(--duration) var(--ease);
}
.stat-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.stat-card.accent {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  border-color: transparent;
}
.stat-card.highlight {
  background: var(--success-bg);
  border: 1px solid #86efac;
}
.stat-card.highlight .stat-lbl { font-size: 10px; font-weight: 600; opacity: 1; color: #065f46; }
.cust-table.compact th, .cust-table.compact td { padding: 3px 6px; font-size: 10px; }
.cust-table.compact thead th { font-size: 10px; padding: 3px 6px; }
.stat-val { font-size: 20px; font-weight: 700; margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.stat-lbl { font-size: 10px; color: inherit; opacity: .7; }
.stat-card.accent .stat-lbl { color: #c3deff; opacity: 1; }
.stats-row { display: flex; gap: 20px; }
.stats-row > .card { flex: 1; }
@media(max-width:768px) {
  .stats-cards { grid-template-columns: repeat(2, 1fr); }
}

/* ══ 表单grid ══ */
.form-grid-1 { grid-template-columns: 1fr; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }

/* ══ 响应式 ══ */
@media(max-width:768px) {
  .sidebar { width: 56px; }
  .sidebar .logo-title, .nav-item span:last-child { display: none; }
  .sidebar .nav-item.active::before { display: none; }
  .main-wrap { margin-left: 56px; width: auto; max-width: 100%;; overflow-x: hidden; }
  .stats-row { flex-direction: column; }
}

/* ══ 内联解析按钮 ══ */
.multi-upload-area { position: relative; }
.btn-parse-inline {
  background: #fff8e6; color: #b7791f; border-color: #f6c16e;
  font-weight: 600; white-space: nowrap;
}
.btn-parse-inline:hover { background: #f6c16e; }

/* ══ 解析结果表格 ══ */
#parse-items-table table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 8px; }
#parse-items-table th {
  background: var(--primary-bg);
  padding: 6px 10px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid #dce4ff;
  color: var(--primary);
}
#parse-items-table td { padding: 6px 10px; border-bottom: 1px solid var(--border-light); }
#parse-items-table tr:hover td { background: var(--hover-bg); }
#parse-items-table input { width: 100%; padding: 3px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }

/* ══ AI引擎下拉菜单 ══ */
.engine-drop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 500;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  font-size: 13px;
  animation: fadeInUp .15s var(--ease);
}
.engine-menu-item { border-bottom: 1px solid var(--border-light); }
.engine-menu-item:last-child { border-bottom: none; }
.em-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .15s var(--ease);
}
.em-row:hover { background: var(--primary-bg); }
.em-row.active { background: var(--primary-bg); }
.em-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ddd;
  flex-shrink: 0;
  transition: background .15s var(--ease);
}
.em-dot.active { background: var(--primary); }
.em-label { flex: 1; font-size: 12px; }
.em-type { font-size: 14px; opacity: .7; }

/* ══ 客户管理表格筛选 ══ */
.table-filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: #fafbfd;
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}
.table-filter-bar input {
  flex: 1; min-width: 160px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

/* ══ 全屏模式覆盖 ══ */
.fullscreen-mode {
  position: fixed !important;
  inset: 0 !important;
  z-index: 900 !important;
  background: var(--bg) !important;
  overflow: auto !important;
  padding: 20px 24px !important;
}
.fullscreen-mode .fullscreen-card {
  background: white !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-md) !important;
  min-height: calc(100vh - 80px) !important;
}
.fullscreen-mode .fullscreen-card table { font-size: 13px !important; }
.fullscreen-mode .fullscreen-card table th,
.fullscreen-mode .fullscreen-card table td { padding: 12px 16px !important; }

/* ══ 全屏工具栏按钮激活态 ══ */
#monthly-fs-btn.fs-active,
#client-fs-btn.fs-active {
  background: #fff8e6 !important;
  color: #b7791f !important;
  border-color: #f6c16e !important;
}

/* ══ 品目表头高亮列标记 ── */
.items-header .col-price,
.items-header .col-amt {
  color: var(--primary);
}

/* ══ 历史项金额标签 ── */
.invoice-code-cell {
  font-variant-numeric: tabular-nums;
}

/* 系统菜单：在 body 解析前由 i18n.js 恢复状态，避免首屏先显示再隐藏。 */
.nav-divider,
.nav-group-title,
#sidebar-nav .admin-only { display: none !important; }
#sidebar-nav[data-is-admin="0"] .system-menu-toggle { display: none !important; }
html.system-menu-open #sidebar-nav[data-is-admin="1"] .admin-only { display: flex !important; }

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══ 实用工具类（替代内联style）═══════════════════════════ */

/* 表单输入框统一样式 */
.form-input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color var(--duration) var(--ease);
}
.form-input:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-ring);
}

/* 金额显示框 */
.invoice-no-display {
  padding: 8px 10px;
  background: linear-gradient(135deg, #eef1fe, #dbe5ff);
  border: 1px solid #b8c8f7;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 800;
  color: #3a56d4;
  letter-spacing: .5px;
  text-align: center;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 选择框统一样式 */
.select-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-sizing: border-box;
}

/* 分支机构勾选区域 */
.branch-selector {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 8px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
}
.branch-selector > * {
  flex-shrink: 0;
}
.branch-selector .branch-number-input {
  flex-shrink: 1;
  flex-grow: 1;
  min-width: 80px;
  max-width: 200px;
}
.branch-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background .2s;
}
.branch-option:hover { background: #e2e8f0; }
.branch-box {
  width: 18px;
  height: 18px;
  border: 2px solid #953634;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  transition: all .2s;
}
.branch-box-checked { color: #953634; font-weight: bold; font-size: 14px; line-height: 1; }
.branch-number-input {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  min-width: 0;
  width: 180px;
}

/* CN专用区域 */
.cn-section {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 12px 16px;
}
.cn-input {
  border-color: #fb923c;
  background: #fffaf0;
  text-transform: uppercase;
}

/* WHT专用区域 */
.wht-section {
  background: #fef9c3;
  border: 1px solid #fde047;
  border-radius: 8px;
  padding: 12px 16px;
}
.wht-input {
  border-color: #fde047;
  background: #fefce8;
}

/* 弹窗编辑区 */
.modal-field {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
}
.modal-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.modal-label {
  font-size: 11px;
  color: #888;
  display: block;
  margin-bottom: 3px;
}
.modal-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-sizing: border-box;
}

/* 板块间距辅助 */
.section-gap { margin-top: 20px; }
.section-gap-sm { margin-top: 12px; }
.section-gap-xs { margin-top: 10px; }

/* 标签内联文本 */
.tag-sm {
  font-size: 11px;
  color: var(--text-muted);
}

/* 自适应宽度 */
.w-full { width: 100%; box-sizing: border-box; }

/* 列隐藏/显示（用于发票列表列切换） */
.col-extra { display: none; }
.col-extra.visible { display: table-cell; }

/* 占位菜单项（待开发，不可点击） */
.nav-placeholder { opacity: 0.5; cursor: default !important; }
.nav-placeholder:hover { background: transparent !important; }

/* ══ 发票明细表头（独立合成层，避免排序时闪动）══ */
.inv-list-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card, #fff);
}
.inv-list-header tr {
  height: 44px;
}

/* ══ 列宽拖拽手柄 ══ */
.col-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  z-index: 5;
}
.col-resize-handle:hover {
  background: var(--primary, #4f6ef7);
  opacity: 0.3;
}

/* 送货管理列表排序指示器 */
.del-list-header th.sort-asc::after { content: ' ▲'; font-size: 9px; color: var(--primary, #4f6ef7); }
.del-list-header th.sort-desc::after { content: ' ▼'; font-size: 9px; color: var(--primary, #4f6ef7); }

/* Unified pagination controls */
.unified-page-ellipsis { padding: 4px 5px; color: var(--text-muted, #64748b); line-height: 28px; }
.unified-page-jump { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted, #64748b); }
.unified-page-jump input { width: 58px; padding: 4px 6px; border: 1px solid var(--border, #dbe3ef); border-radius: 6px; text-align: center; background: var(--card, #fff); }
/* Invoice list actions: two equal columns prevent Chinese action labels from breaking mid-word. */
.invoice-actions-cell { width: 52px; min-width: 52px; padding: 2px 2px !important; text-align: center; vertical-align: middle; }
.invoice-action-grid { display: grid; grid-template-columns: repeat(2, max-content); gap: 1px 3px; align-items: center; justify-content: center; justify-items: center; }
.invoice-action-link { display: inline-flex; align-items: center; justify-content: center; min-width: 0; min-height: 14px; padding: 0; font-size: 10px; line-height: 14px; white-space: nowrap; text-decoration: none; border-radius: 3px; }
.invoice-action-link:hover { background: rgba(79, 110, 247, .08); }

.oc-template-inventory{margin-top:8px;border:1px solid #e2e8f0;border-radius:7px;background:#fff}.oc-template-inventory summary{padding:8px 9px;color:#475569;font-size:10px;font-weight:600;cursor:pointer;list-style-position:inside}.oc-template-inventory summary span{color:#64748b;font-weight:400}.oc-template-items{display:grid;max-height:240px;overflow:auto;border-top:1px solid #eef2f7}.oc-template-row{display:grid;grid-template-columns:54px 1fr auto;align-items:center;gap:7px;padding:7px 9px;border-bottom:1px dashed #edf1f6;font-size:9px}.oc-template-row:last-child{border-bottom:0}.oc-template-row strong{color:#1e293b}.oc-template-row span{color:#475569}.oc-template-row small{color:#64748b;white-space:nowrap}.oc-template-empty{padding:9px;color:#94a3b8;font-size:9px}

/* ── 订单附件（2026-09-12）：PO 单号点击弹层 + 新增页多附件 ───────────── */
.om-po-link{cursor:pointer}
.om-po-link:hover{text-decoration:underline;text-decoration-style:dotted}
.om-po-link.has-attach::after{content:'📎';margin-left:4px;font-size:10px;opacity:.85}
/* 待补正式订单（2026-09-13）：备件订单先登记、正式订单文件后补——PO 号前置 ⏳ + 附件弹层「标记已补」横幅 */
.om-po-pending::before{content:'⏳';margin-right:3px;font-size:10px}
/* 无 PO 订单（2026-09-14 大哥口径）：PO 列显示灰色「无PO」，不再显示内部订单号（防"冒充 PO"） */
.om-po-missing{color:#94a3b8;font-weight:500}
.om-attach-pending{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 11px;border:1px solid #fde68a;border-radius:9px;background:#fffbeb;color:#92400e;font-size:11.5px}
.om-attach-pending .om-action{flex:0 0 auto;white-space:nowrap}
/* 2026-10-05 布局改造（大哥：预览才是主体）——固定高度弹窗 + 左列表 / 右预览分栏；
   作用域限定 .om-attach-dialog / #om-attach-viewer，不影响订单详情等其它弹窗 */
.om-attach-dialog{width:min(1520px,96vw);height:min(calc(100vh - 56px),1180px);display:flex;flex-direction:column}
.om-attach-dialog .order-dialog-head{padding:8px 16px;flex:0 0 auto}
.om-attach-dialog .order-detail-title{font-size:15px}
.om-attach-dialog .order-dialog-close{font-size:22px;line-height:1}
.om-attach-headline{display:flex;align-items:baseline;gap:10px;flex:1;min-width:0;flex-wrap:wrap}
/* 文件列表：默认收起（预览吃满全宽），头部按钮展开/收起（大哥 2026-10-05 二轮） */
.om-attach-toggle{display:inline-flex;align-items:center;gap:4px;margin-right:10px;border:1px solid rgba(255,255,255,.5);border-radius:7px;padding:3px 10px;background:rgba(255,255,255,.14);color:#fff;font-size:12px;cursor:pointer;white-space:nowrap}
.om-attach-toggle:hover{background:rgba(255,255,255,.26)}
.om-attach-toggle.active{background:#fff;color:#3349ba;border-color:#fff}
.om-attach-dialog:not(.show-list) .om-attach-side{display:none}
.om-attach-sub{font-size:12px;opacity:.92;margin-top:0}
.om-attach-body{flex:1;min-height:0;display:flex;flex-direction:column;gap:10px;padding:12px 16px 16px;overflow:hidden}
.om-attach-main{flex:1;min-height:0;display:flex;gap:12px}
.om-attach-side{flex:0 0 clamp(300px,26vw,360px);min-width:0;min-height:0;display:flex;flex-direction:column}
#om-attach-viewer{flex:1;min-width:0;min-height:0;display:flex}
.om-attach-drop{display:flex;align-items:center;gap:10px;border:1.5px dashed #a9b8d0;border-radius:10px;padding:8px 12px;cursor:pointer;background:#f8fafc;color:#334155;flex:0 0 auto}
.om-attach-drop:hover,.om-attach-drop.dragover{border-color:#4f6ef7;background:#eef2ff}
.om-attach-drop .om-attach-ico{width:28px;height:28px;flex:0 0 28px}
.om-attach-drop strong{display:block;font-size:13px;color:#1e293b}
.om-attach-drop small{display:block;margin-top:2px;font-size:11px;color:#64748b}
.om-attach-list{flex:1;min-height:0;overflow-y:auto;display:flex;flex-direction:column;gap:6px;padding-right:2px}
.om-attach-item{display:flex;align-items:center;gap:8px;border:1px solid #e2e8f0;border-radius:9px;padding:7px 9px;background:#fff}
.om-attach-item.active{border-color:#4f6ef7;box-shadow:0 0 0 2px rgba(79,110,247,.12)}
.om-attach-ico{width:30px;height:30px;flex:0 0 30px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#fff;background:#64748b}
.om-attach-ico.pdf{background:#dc2626}
.om-attach-ico.excel{background:#16a34a}
.om-attach-ico.image{background:#7c3aed}
.om-attach-meta{flex:1;min-width:0}
.om-attach-meta b{display:block;font-size:12.5px;color:#1e293b;word-break:break-all}
.om-attach-meta span{display:block;margin-top:2px;font-size:11px;color:#64748b;word-break:break-all}
.om-attach-acts{display:flex;gap:6px;flex:0 0 auto;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.om-attach-btn{border:1px solid #d8dee9;background:#fff;color:#334155;border-radius:6px;padding:4px 8px;font-size:11px;cursor:pointer;white-space:nowrap}
.om-attach-btn:hover{border-color:#4f6ef7;color:#4f6ef7}
.om-attach-btn.danger{color:#ef4444;border-color:#fecaca}
.om-attach-btn.danger:hover{border-color:#ef4444}
.om-attach-btn[disabled]{opacity:.5;cursor:not-allowed}
.om-attach-empty{padding:18px;text-align:center;color:#94a3b8;font-size:12px;border:1px dashed #e2e8f0;border-radius:9px}
.om-attach-viewer{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden;background:#0f172a}
.om-attach-viewer iframe{flex:1;min-height:0;width:100%;border:0;display:block;background:#fff}
.om-attach-viewer img{width:100%;height:100%;flex:1;min-height:0;object-fit:contain;background:#fff}
.om-attach-viewer-bar{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:7px 11px;background:#1e293b;color:#e2e8f0;font-size:11.5px}
.om-attach-viewer-bar b{font-weight:600;word-break:break-all}
.om-attach-note{font-size:11.5px;color:#64748b}
.om-attach-errors{font-size:11.5px;color:#b45309;background:#fffbeb;border:1px solid #fde68a;border-radius:8px;padding:8px 10px}
@media (max-width:900px){.om-attach-main{flex-direction:column}.om-attach-side{flex:0 0 34%}}

/* 新增订单页 · 待上传附件清单 */
.oc-attach-list{display:flex;flex-direction:column;gap:6px;margin-top:8px}
.oc-attach-row{display:flex;align-items:center;gap:8px;border:1px solid #e2e8f0;border-radius:8px;padding:6px 8px;background:#fff}
.oc-attach-row b{flex:1;min-width:0;font-size:10.5px;color:#1e293b;word-break:break-all;font-weight:600}
.oc-attach-row small{font-size:9.5px;color:#64748b;white-space:nowrap}
.oc-attach-row .oc-attach-x{border:0;background:transparent;color:#ef4444;cursor:pointer;font-size:12px;line-height:1;padding:2px 4px}
.oc-attach-row .oc-attach-tag{font-size:9px;color:#fff;background:#64748b;border-radius:4px;padding:1px 5px}
.oc-attach-row .oc-attach-tag.saved{background:#16a34a}
.oc-attach-row .oc-attach-tag.recog{background:#2563eb}
.oc-attach-row .oc-attach-act{border:0;background:transparent;color:#2563eb;cursor:pointer;font-size:9.5px;padding:2px 4px;white-space:nowrap}
.oc-attach-row .oc-attach-act:hover{text-decoration:underline}
.oc-attach-row .oc-attach-act[disabled]{color:#94a3b8;cursor:default;text-decoration:none}
.oc-attach-row a{color:#2563eb;font-size:11px;text-decoration:none}
.oc-attach-hint{margin-top:6px;font-size:9.5px;color:#64748b;line-height:1.5}

/* ── 2026-09-21 大哥：品目表「验收要求 / 范围」下拉箭头压字 + 「品目交期」日历图标压日期 ──
   ① 下拉：隐藏原生箭头（原生约 17px 且绘在 padding 内、必压文字），改自绘 8px 细箭头，
      固定在距右 3px 处（占 3~11px），右侧内边距 12px → 箭头与文字区**结构性不重叠**；
   ② 日期：全局 `input[type="date"]{padding:9px 12px;font-size:13px}` 特异性 (0,1,1) 压过了
      行内 `.oc-cell` 的 (0,1,0)，导致日期框实为 13px 字号 + 12px 内边距、文本溢出 19.5px
      → 用 `.oc-items` 前缀提级到 (0,1,2) 覆盖：字号随行内、内边距收窄、日历图标缩到 10px。 */
.oc-cell-select{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0 12px 0 4px;background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M.6.6 4 4 7.4.6' fill='none' stroke='%2394a3b8' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 3px center;background-size:8px 5px;text-overflow:ellipsis}
.oc-items input[type="date"]{font-size:9.5px;padding:0 1px 0 5px;height:31px}
.oc-items input[type="date"]::-webkit-calendar-picker-indicator{width:10px;height:10px;margin:0 0 0 2px;padding:0;opacity:.55;cursor:pointer}
.oc-items input[type="date"]::-webkit-calendar-picker-indicator:hover{opacity:.9}
/* PO 印刷合计校验条（2026-09-22 B 方案）：表单合计与识别到的 PO 合计不一致时必须明示，不得静默 */
.oc-total-check{display:inline-flex;align-items:center;padding:3px 9px;border:1px solid #f0c36d;border-radius:6px;background:#fff8e6;color:#8a5b00;font-size:11px;font-weight:600;white-space:nowrap}
.oc-total-check[hidden]{display:none}
.oc-total-check.retotal-ok{border-color:#a7d7b5;background:#eefaf1;color:#1f7a45}

/* ── 回签弹窗滚动条：修复「右侧上下角被滚动条切成直角」（2026-09-29 大哥报障）──
   根因：Windows Chrome 默认滚动条 15px 贴右边缘、不随容器 border-radius 裁剪
   → 弹窗（12px 圆角）右侧上/下角呈直角（左侧正常）。
   实证修法（有头 Chrome 对照实验）：窄滚动条 + 透明轨道 + 内缩圆角滑块
   → 滚动条不再覆盖圆角区域，四角圆角恢复正常。 */
#signback-panel::-webkit-scrollbar,
#dn-signback-panel::-webkit-scrollbar { width: 10px; }
#signback-panel::-webkit-scrollbar-track,
#dn-signback-panel::-webkit-scrollbar-track { background: transparent; }
#signback-panel::-webkit-scrollbar-thumb,
#dn-signback-panel::-webkit-scrollbar-thumb {
  background: #cbd5e1; border-radius: 6px; border: 3px solid transparent; background-clip: content-box;
}
#signback-panel::-webkit-scrollbar-thumb:hover,
#dn-signback-panel::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

/* ══════════════════════════════════════════════════════════════════════════════
   全站「圆角容器右侧上下角被滚动条切成直角」根治（2026-10-07 大哥报障 · 全局收口）
   ──────────────────────────────────────────────────────────────────────────────
   机制：Windows Chrome 默认滚动条 15px，贴元素右边缘且【不随 border-radius 裁剪】
        ⇒ 任何「圆角容器自身滚动」处，右侧上/下角被滚动条通道填成直角
          （左侧两角永远正常、未滚动时也正常 ⇒ 症状"时有时无"）
   修法：滚动条改 10px + 轨道透明 + 滑块圆角内缩（background-clip:content-box）
        ⇒ 滚动条不再覆盖圆角区，四角保持圆角。与 09-29 #signback-panel 同一修法。
   三层覆盖（缺一即漏；新增页面请沿用 modal/dialog 命名，或用内联 border-radius）：
     ① 弹窗域：class/id 含 modal / dialog / overlay / popup / drawer / mdl 的容器
              【及其内部滚动区】（`… *` 那一条，保证弹窗内任意命名的滚动区都覆盖）
     ② 内联圆角容器：[style*="border-radius"]（页面里大量匿名 div 是这一形态）
     ③ 具名圆角滚动容器清单：实测枚举（2026-10-07 全站 28 页扫描）
   🔴 勿把 .om-table-wrap 加进来（订单页表格有专属 12px 蓝调滚动条，是既定设计）
   🔴 回归脚本：outputs/_scan_modal_corner_dyn_20261007.py（判据：sbW 15 → 10）
   ══════════════════════════════════════════════════════════════════════════════ */
:is(
  [class*="modal"], [id*="modal"], [class*="mdl"], [id*="mdl"],
  [class*="dialog"], [id*="dialog"], [class*="overlay"], [id*="overlay"],
  [class*="popup"], [id*="popup"], [class*="drawer"], [id*="drawer"],
  [style*="border-radius"],
  .om-cols-menu, .del-cols-menu, .oc-client-dropdown, .dropdown, .engine-drop,
  .order-table-wrap, .label-settings-panel,
  .um-table-wrap, .um-matrix-wrap, .wh-wrap, .emp-wrap,
  .att-grid-wrap, .att-toolbar, .pay-grid-wrap, .pay-toolbar, .err-box
)::-webkit-scrollbar,
:is(
  [class*="modal"], [id*="modal"], [class*="mdl"], [id*="mdl"],
  [class*="dialog"], [id*="dialog"], [class*="overlay"], [id*="overlay"],
  [class*="popup"], [id*="popup"], [class*="drawer"], [id*="drawer"],
  [style*="border-radius"],
  .om-cols-menu, .del-cols-menu, .oc-client-dropdown, .dropdown, .engine-drop,
  .order-table-wrap, .label-settings-panel,
  .um-table-wrap, .um-matrix-wrap, .wh-wrap, .emp-wrap,
  .att-grid-wrap, .att-toolbar, .pay-grid-wrap, .pay-toolbar, .err-box
) *::-webkit-scrollbar { width: 10px; height: 10px; }
:is(
  [class*="modal"], [id*="modal"], [class*="mdl"], [id*="mdl"],
  [class*="dialog"], [id*="dialog"], [class*="overlay"], [id*="overlay"],
  [class*="popup"], [id*="popup"], [class*="drawer"], [id*="drawer"],
  [style*="border-radius"],
  .om-cols-menu, .del-cols-menu, .oc-client-dropdown, .dropdown, .engine-drop,
  .order-table-wrap, .label-settings-panel,
  .um-table-wrap, .um-matrix-wrap, .wh-wrap, .emp-wrap,
  .att-grid-wrap, .att-toolbar, .pay-grid-wrap, .pay-toolbar, .err-box
)::-webkit-scrollbar-track,
:is(
  [class*="modal"], [id*="modal"], [class*="mdl"], [id*="mdl"],
  [class*="dialog"], [id*="dialog"], [class*="overlay"], [id*="overlay"],
  [class*="popup"], [id*="popup"], [class*="drawer"], [id*="drawer"],
  [style*="border-radius"],
  .om-cols-menu, .del-cols-menu, .oc-client-dropdown, .dropdown, .engine-drop,
  .order-table-wrap, .label-settings-panel,
  .um-table-wrap, .um-matrix-wrap, .wh-wrap, .emp-wrap,
  .att-grid-wrap, .att-toolbar, .pay-grid-wrap, .pay-toolbar, .err-box
) *::-webkit-scrollbar-track { background: transparent; }
:is(
  [class*="modal"], [id*="modal"], [class*="mdl"], [id*="mdl"],
  [class*="dialog"], [id*="dialog"], [class*="overlay"], [id*="overlay"],
  [class*="popup"], [id*="popup"], [class*="drawer"], [id*="drawer"],
  [style*="border-radius"],
  .om-cols-menu, .del-cols-menu, .oc-client-dropdown, .dropdown, .engine-drop,
  .order-table-wrap, .label-settings-panel,
  .um-table-wrap, .um-matrix-wrap, .wh-wrap, .emp-wrap,
  .att-grid-wrap, .att-toolbar, .pay-grid-wrap, .pay-toolbar, .err-box
)::-webkit-scrollbar-thumb,
:is(
  [class*="modal"], [id*="modal"], [class*="mdl"], [id*="mdl"],
  [class*="dialog"], [id*="dialog"], [class*="overlay"], [id*="overlay"],
  [class*="popup"], [id*="popup"], [class*="drawer"], [id*="drawer"],
  [style*="border-radius"],
  .om-cols-menu, .del-cols-menu, .oc-client-dropdown, .dropdown, .engine-drop,
  .order-table-wrap, .label-settings-panel,
  .um-table-wrap, .um-matrix-wrap, .wh-wrap, .emp-wrap,
  .att-grid-wrap, .att-toolbar, .pay-grid-wrap, .pay-toolbar, .err-box
) *::-webkit-scrollbar-thumb {
  background: #cbd5e1; border-radius: 6px; border: 3px solid transparent; background-clip: content-box;
}
:is(
  [class*="modal"], [id*="modal"], [class*="mdl"], [id*="mdl"],
  [class*="dialog"], [id*="dialog"], [class*="overlay"], [id*="overlay"],
  [class*="popup"], [id*="popup"], [class*="drawer"], [id*="drawer"],
  [style*="border-radius"],
  .om-cols-menu, .del-cols-menu, .oc-client-dropdown, .dropdown, .engine-drop,
  .order-table-wrap, .label-settings-panel,
  .um-table-wrap, .um-matrix-wrap, .wh-wrap, .emp-wrap,
  .att-grid-wrap, .att-toolbar, .pay-grid-wrap, .pay-toolbar, .err-box
)::-webkit-scrollbar-thumb:hover,
:is(
  [class*="modal"], [id*="modal"], [class*="mdl"], [id*="mdl"],
  [class*="dialog"], [id*="dialog"], [class*="overlay"], [id*="overlay"],
  [class*="popup"], [id*="popup"], [class*="drawer"], [id*="drawer"],
  [style*="border-radius"],
  .om-cols-menu, .del-cols-menu, .oc-client-dropdown, .dropdown, .engine-drop,
  .order-table-wrap, .label-settings-panel,
  .um-table-wrap, .um-matrix-wrap, .wh-wrap, .emp-wrap,
  .att-grid-wrap, .att-toolbar, .pay-grid-wrap, .pay-toolbar, .err-box
) *::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: content-box; }

/* ══ 「✓ 全部确认」一键确认全部待核对英文（2026-09-30 大哥：翻译后逐条点太慢）══
   双入口：#confirm-all-english（PDF 识别面板状态条内，随翻译结果注入）/
           #confirm-all-english-top（品目工具行常驻，动态显隐+计数） */
.oc-confirm-all { margin-left: 8px; border: 0; border-radius: 6px; padding: 4px 10px; background: #16a34a; color: #fff; font-size: 9px; font-weight: 600; cursor: pointer; white-space: nowrap; vertical-align: middle; }
.oc-confirm-all:hover { background: #15803d; }
.oc-confirm-all:disabled { opacity: .6; cursor: wait; }
#confirm-all-english-top { background: #e8f7ee; color: #166534; font-weight: 600; }
#confirm-all-english-top:hover { background: #d7f0df; }

/* ══ 订单附件带出（开票表单「从订单带出」按 PO 匹配；2026-10-02 大哥定案）══
   口径：品目行填了 PO 才匹配；无 PO / 占位「无PO」不带出；系统没有的才手动上传。
   结果默认勾选，保存时复制快照进发票附件（后端 sha256 防重）。 */
.order-attach-area {
  margin-top: 8px;
  border: 1px dashed #c7d2fe;
  border-radius: 8px;
  padding: 8px 12px;
  background: #f8faff;
}
.oa-head { display: flex; align-items: center; gap: 10px; }
.oa-title { font-size: 12px; font-weight: 600; color: #3450c9; white-space: nowrap; }
.oa-summary { flex: 1; font-size: 11px; color: #4f6ef7; }
.oa-summary b { color: #2a41b8; }
.oa-refresh-btn {
  border: 1px solid #dce4ff; background: #fff; color: #3350c9;
  border-radius: 6px; padding: 2px 10px; font-size: 11px; cursor: pointer;
  transition: all .15s; white-space: nowrap; flex: 0 0 auto;
}
.oa-refresh-btn:hover { border-color: #9db0e8; background: #f4f7ff; }
.oa-hint { font-size: 11px; color: var(--text-muted, #8a94a6); margin-top: 4px; }
.oa-list { margin-top: 4px; max-height: 180px; overflow-y: auto; }
.oa-order { margin-bottom: 6px; }
.oa-order-head { font-size: 11px; font-weight: 600; color: #4338ca; margin: 4px 0 2px; }
.oa-att { display: flex; align-items: center; gap: 6px; padding: 2px 4px; font-size: 11px; border-radius: 4px; cursor: pointer; }
.oa-att:hover { background: #eef2ff; }
.oa-att input[type=checkbox] { accent-color: #4f6ef7; cursor: pointer; margin: 0; flex-shrink: 0; }
.oa-ico { font-size: 13px; flex-shrink: 0; }
.oa-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text, #333); }
.oa-size { color: var(--text-muted, #8a94a6); font-size: 10px; white-space: nowrap; }
.oa-done { color: #2a9d5c; font-weight: 700; font-size: 11px; flex-shrink: 0; }
.oa-pv { text-decoration: none; font-size: 12px; opacity: .75; flex-shrink: 0; }
.oa-pv:hover { opacity: 1; }

/* ── 人工抄录单 · 单据印刷合计闸门（2026-10-17 大哥需求）── */
.oc-printed-total{display:flex;align-items:center;gap:12px;padding:9px 14px;background:#fff7ed;border-top:1px solid #fed7aa;font-size:12px;color:#9a3412}
.oc-printed-total[hidden]{display:none}
.oc-printed-total .oc-pt-label{flex:0 0 auto}
.oc-printed-total .oc-pt-label b{color:#b91c1c}
.oc-printed-total input{width:180px;height:30px;flex:0 0 auto;border:1px solid #fdba74;border-radius:5px;padding:0 8px;font-size:12px;background:#fff;color:#334155}
.oc-printed-total input:focus{outline:2px solid #fb923c;outline-offset:-1px}
.oc-printed-total .oc-pt-note{font-style:normal;color:#b45309;font-size:11.5px;min-width:0;white-space:normal;line-height:1.45}
.oc-printed-total .oc-pt-ok{color:#15803d;font-weight:600}
.oc-printed-total .oc-pt-bad{color:#b91c1c;font-weight:700}
