:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #1f2937;
  --text-sub: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --red: #dc2626;   /* 涨/正 */
  --green: #16a34a; /* 跌/负 */
  --sidebar-w: 220px;
  /* v242：字号阶梯 + 交互色，统一引用，避免页面间 12/13/14 混用 */
  --fs-title: 20px;
  --fs-body: 14px;
  --fs-table: 13px;
  --row-hover: #f1f5f9;
  --row-hover-fixed: #e9f1fb;
  --head-bg: #f9fafb;
  --head-line: #d5dde7;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: var(--fs-body);
}
button { cursor: pointer; font-family: inherit; }
input, select, textarea {
  font-family: inherit; font-size: 14px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea { resize: vertical; min-height: 60px; }

/* 通用可搜索下拉（自动增强非 attachSearchableSelect 的 select） */
.select-search-wrapper { position: relative; display: inline-block; width: 100%; }
.select-search-input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: #fff; color: var(--text); font-size: 14px;
}
.select-search-input:focus { outline: none; border-color: var(--primary); }
.select-search-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  max-height: 260px; overflow-y: auto; background: var(--card, #fff);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
}
.select-search-item { padding: 8px 10px; cursor: pointer; font-size: 13px; line-height: 1.5; color: var(--text); border-bottom: 1px solid var(--border); }
.select-search-item:last-child { border-bottom: none; }
.select-search-item:hover { background: #f1f5f9; }
.select-search-empty { color: var(--text-sub); cursor: default; }
.select-search-empty:hover { background: none; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a, #2563eb); }
.login-card { background: #fff; padding: 40px; border-radius: 14px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.login-logo { font-size: 26px; font-weight: 700; text-align: center; }
.login-sub { text-align: center; color: var(--text-sub); margin: 6px 0 28px; }
.login-card label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--text-sub); }
.login-card input { width: 100%; }
.login-tip { text-align: center; color: var(--text-sub); font-size: 12px; margin-top: 16px; }
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; text-align: center; }

/* 布局 */
#app-view { display: flex; height: 100vh; }
/* 侧边栏：浅灰蓝（2026-10-18 从深灰 #1f2937 改浅色，用户反馈黑色压抑）。
   底色与右侧白底页面留一点层次，但整体仍属冷灰蓝，不抢主色。 */
.sidebar { width: var(--sidebar-w); background: #eef2f7; color: #0f172a; border-right: 1px solid #dbe3ee; display: flex; flex-direction: column; flex-shrink: 0; position: relative; }
/* 右边缘收起/展开手柄：骑跨在侧栏边框上，仅图标；侧栏收起后自动贴 60px 边缘 */
.side-edge-toggle { position: absolute; right: -13px; top: 50%; transform: translateY(-50%); width: 26px; height: 48px; padding: 0; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid #dbe3ee; border-left: none; border-radius: 0 8px 8px 0; color: #64748b; cursor: pointer; z-index: 60; box-shadow: 2px 0 6px rgba(15, 23, 42, .08); }
.side-edge-toggle:hover { color: var(--primary); background: #f1f5f9; }
.side-edge-toggle svg { width: 15px; height: 15px; }
.side-logo { padding: 20px 18px; font-size: 18px; font-weight: 700; color: #0f172a; border-bottom: 1px solid #dbe3ee; }
.side-logo span { display: block; font-size: 12px; font-weight: 400; color: #64748b; margin-top: 2px; }
.side-nav { flex: 1; overflow-y: auto; padding: 12px 8px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 8px; color: #334155; cursor: pointer; margin-bottom: 2px; transition: .15s; }
.nav-item:hover { background: #dfe7f2; color: #0f172a; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .ico { font-size: 16px; width: 20px; text-align: center; }
/* v242：侧边栏按业务分组，分组标题做弱化处理 */
.nav-group { margin-top: 14px; }
.nav-group:first-child { margin-top: 0; }
.nav-group-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: #94a3b8; padding: 6px 14px 4px; }
.side-footer { padding: 14px; border-top: 1px solid #dbe3ee; }
.user-info { font-size: 12px; color: #64748b; margin-bottom: 10px; word-break: break-all; }

.main { flex: 1; min-width: 0; overflow-y: auto; padding: 24px; }
#page-container { min-width: 0; }

/* 通用 */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: var(--fs-title); font-weight: 700; }
.page-actions { display: flex; gap: 10px; }
.card { background: var(--card); border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select { min-width: 140px; }
/* 工具栏里的日期区间（开始 ~ 结束）：两个日期框包在同一个白底容器里，看起来是一组 */
.toolbar .date-range {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 10px; min-height: 38px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
.toolbar .date-range input[type="date"] { min-width: 0; width: 136px; border: none; padding: 0; background: transparent; }
.toolbar .date-range input[type="date"]:focus { border-color: transparent; }
.toolbar .date-range .dr-sep { color: var(--text-sub); }

/* v242：按钮层级 —— 主按钮每页只保留一个（带轻投影），次级按钮 hover 范围更明显 */
.btn-primary { background: var(--primary); color: #fff; border: none; padding: 9px 16px; border-radius: 8px; font-weight: 500; box-shadow: 0 1px 2px rgba(37, 99, 235, .22); transition: background .15s, box-shadow .15s, transform .15s; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 2px 6px rgba(37, 99, 235, .28); }
.btn-ghost { background: transparent; color: var(--text-sub); border: 1px solid var(--border); padding: 9px 16px; border-radius: 8px; transition: background .15s, border-color .15s, color .15s; }
.btn-ghost:hover { background: #f1f5f9; border-color: #cbd5e1; color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; border: none; padding: 8px 14px; border-radius: 8px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 2px 6px; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
/* 已操作过的按钮（已转采购 / 已导出采购单）：绿色加粗，一眼区分，防止重复操作 */
.link-btn.done { color: var(--success); font-weight: 600; }
.link-btn.done::before { content: "✓ "; }

/* 表格 */
/* 表格：v242 收紧行高（列多的表更能一屏看全），hover 加深一档，方便横向追行 */
table { width: 100%; border-collapse: collapse; font-size: var(--fs-table); }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 7px 12px; transition: background .12s; }
th { background: var(--head-bg); color: var(--text-sub); font-weight: 600; position: sticky; top: 0; }
tbody tr:hover td { background: var(--row-hover); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ===== 列表表格：表头可拖拽调整列宽 =====
   首次拖动时把各列当前实际宽度固化成 <colgroup> 并切到 fixed 布局（外观不变），
   之后拖动只改目标列宽；双击手柄还原。宽度按「页面 + 表格序号」存 localStorage，刷新后仍生效。
   注意：手柄不能伸出 th 之外（相邻 th 是 sticky 会盖住它），所以贴右边内沿放；
   而溢出裁切只加在 td 上，否则会把 th 里的手柄一起裁掉。 */
.col-resizable { table-layout: fixed; }
.col-resizable td { overflow: hidden; text-overflow: ellipsis; }
.col-resizer { position: absolute; top: 0; right: 0; width: 10px; height: 100%; cursor: col-resize; user-select: none; z-index: 6; }
.col-resizer::before { content: ""; position: absolute; left: 4px; top: 20%; width: 2px; height: 60%; border-radius: 1px; background: transparent; transition: background .12s; }
.col-resizer:hover::before, .col-resizer.active::before { background: var(--primary); }
body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-select: none !important; }

/* ===== 列表分页（销售/采购/入库/出库/付款/退货/库存/物料 通用） =====
   放在表格卡片底部。行显隐由 app.js 的 applyPager() 统一控制（display 切换），
   筛选函数只负责写 row.dataset.match，不再直接改 display。 */
.pager { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px;
         border-top: 1px solid var(--border); font-size: 13px; color: var(--text-sub); }
.pager select { height: 30px; padding: 0 6px; font-size: 13px; }
.pager .pg-gap { flex: 1 1 auto; }
.pager .pg-btn { height: 30px; padding: 0 10px; font-size: 13px; color: var(--text); background: #fff;
                 border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.pager .pg-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager .pg-btn:disabled { opacity: .45; cursor: not-allowed; }
.pager .pg-nums { display: inline-flex; align-items: center; gap: 4px; }
.pager .pg-num { min-width: 30px; height: 30px; padding: 0 8px; font-size: 13px; color: var(--text); background: #fff;
                 border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.pager .pg-num:hover { border-color: var(--primary); color: var(--primary); }
.pager .pg-num.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager .pg-dots { padding: 0 2px; }
.pager .pg-jump { width: 58px; height: 30px; text-align: center; font-size: 13px; padding: 0 4px; }
.pager .pg-jump-wrap { display: inline-flex; align-items: center; gap: 4px; }
.pager b { color: var(--text); }

/* 销售订单：日期分隔行作为可点击折叠头（默认全部展开） */
tr.so-date-row { cursor: pointer; }
tr.so-date-row:hover { background: #eef2f7 !important; }
.so-fold-arrow { display: inline-block; width: 14px; color: var(--primary); font-weight: 700; }
/* v242：状态标签统一为「语义色 + 小圆点」，扫一眼就能分辨状态，不再各页面各一套色值 */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .65; flex: none; }
.tag-red { background: #fef2f2; color: #b91c1c; }
.tag-green { background: #f0fdf4; color: #15803d; }
.tag-yellow { background: #fffbeb; color: #b45309; }
.tag-gray { background: #f1f5f9; color: #64748b; }
.tag-blue { background: #eff6ff; color: #1d4ed8; }
.overdue { color: var(--red); font-weight: 600; }

/* 看板 */
.kpi-group-title { font-size: 13px; font-weight: 600; color: var(--text); margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.kpi-group-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--card); border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.kpi .kpi-label { font-size: 12px; color: var(--text-sub); margin-bottom: 8px; }
.kpi .kpi-value { font-size: 24px; font-weight: 700; }
.kpi .kpi-sub { font-size: 12px; color: var(--text-sub); margin-top: 4px; }

/* ===== v243：数据看板改版（待办最急单 / 异常提醒 / 本月经营 / 欠交 Top） ===== */
.page-header .dash-quick { margin-bottom: 0; }
/* 待办卡片：数字下方列出最急 3 单，方便直接判断先做哪张 */
.kpi-todo { display: flex; flex-direction: column; }
/* v254 待办感层级：有待办的卡左侧色条 + 计数点；无待办的卡降饱和 */
.kpi-todo.has-todo { position: relative; border-left: 3px solid var(--primary); }
.kpi-todo.has-todo.todo-warn { border-left-color: var(--warning); }
.kpi-todo.has-todo.todo-danger { border-left-color: var(--danger); }
.kpi-todo.no-todo { opacity: .75; }
.kpi-todo.no-todo .kpi-value { color: var(--text-sub); font-weight: 600; }
.kpi-todo.has-todo .kpi-value { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.kpi-todo.has-todo .kpi-value::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); flex: none; }
.kpi-todo.has-todo.todo-warn .kpi-value::after { background: var(--warning); }
.kpi-todo.has-todo.todo-danger .kpi-value::after { background: var(--danger); }
.ku-list { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 4px; }
.ku-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12px; }
.ku-main { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ku-meta { color: var(--text-sub); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ku-empty { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--text-sub); }
.dash-card { margin-bottom: 20px; }
/* 2026-11-13：异常提醒与快捷操作并排两张卡片（其余看板块不变） */
.dash-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; margin-bottom: 20px; }
.dash-split-left, .dash-split-right { min-width: 0; }
.dash-split > .dash-card { margin-bottom: 0; }
.dash-quick-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.dash-quick-list .btn-sm { width: 100%; }
@media (max-width: 900px) {
  .dash-split { grid-template-columns: 1fr; }
}
.dash-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.dash-card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.dash-note { font-size: 12px; color: var(--text-sub); }
.dash-empty { padding: 18px 0; text-align: center; color: var(--text-sub); font-size: 13px; }
/* 异常提醒：一行一类，点行跳到已筛选列表 */
.alert-body { display: flex; flex-direction: column; gap: 2px; }
.alert-row { display: grid; grid-template-columns: 8px 1fr 56px 1.4fr 56px; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 8px; cursor: pointer; transition: background .12s; }
.alert-row:hover { background: #f8fafc; }
.alert-row.danger:hover { background: #fef2f2; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); }
.alert-row.danger .alert-dot { background: var(--danger); }
.alert-label { font-size: 13px; color: var(--text); }
.alert-num { font-size: 15px; font-weight: 700; color: var(--text); text-align: right; font-variant-numeric: tabular-nums; }
.alert-row.danger .alert-num { color: var(--danger); }
.alert-meta { font-size: 12px; color: var(--text-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert-go { font-size: 12px; color: var(--primary); text-align: right; }
/* 本月经营 vs 上月 */
.biz-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.biz-item { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.biz-label { font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }
.biz-v { font-size: 20px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.biz-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--text-sub); margin-top: 6px; }
.biz-delta.up { color: var(--red); }
.biz-delta.down { color: var(--success); }
/* 迷你趋势线（纯 SVG） */
.spark-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.spark-box { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.spark-title { font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }
.spark { width: 100%; height: 44px; display: block; }
/* v254 全 0 占位：替代贴底直线，避免被误读成图表坏了 */
.spark-zero { height: 44px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--text-sub); border: 1px dashed var(--border); border-radius: 6px; background: #fafbfc; }
/* 欠交 Top：精确查询行 */
.dash-owe-search { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.dash-owe-search input { flex: 1 1 260px; min-width: 220px; max-width: 420px; }
/* 全部欠交弹窗筛选条 */
.owe-all-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.owe-all-bar select { width: auto; min-width: 150px; max-width: 300px; flex: 0 1 auto; }
.owe-all-bar input { width: auto; flex: 0 1 220px; min-width: 160px; }
/* 全部欠交弹窗（v263 用户反馈文字贴边）：.modal 全局无内边距，裸表格直接顶到边，单独补 */
/* owe-all 的 padding 已由「裸内容弹窗兜底」规则提供（.modal:not(:has(...))），此处不再单独定 */
.owe-all-modal .dash-card-head { position: sticky; top: 0; z-index: 3; background: #fff; padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.owe-all-modal thead th { top: 52px; } /* 表头吸顶避让吸顶标题，否则滚到中段列名会被标题盖住 */
/* 日历缩小让位：卡片放到底部，格子更紧凑 */
.calendar-card.compact .cal-toolbar { margin-bottom: 10px; }
.calendar-card.compact .cal-title { font-size: 15px; min-width: 96px; }
.calendar-card.compact .cal-dow span { font-size: 13px; padding: 4px 0; }
.calendar-card.compact .cal-cell { min-height: 56px; padding: 4px 5px; gap: 2px; }
.calendar-card.compact .cal-daynum { font-size: 13px; }
.calendar-card.compact .cal-panel { min-height: 280px; }
@media (max-width: 720px) {
  .spark-row { grid-template-columns: 1fr; }
  .alert-row { grid-template-columns: 8px 1fr 48px; }
  .alert-meta, .alert-go { display: none; }
}

/* 表单 */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-item label { display: block; font-size: 12px; color: var(--text-sub); margin-bottom: 5px; }
.form-item input, .form-item select, .form-item textarea { width: 100%; }

/* 只读详情（双击销售订单行弹出）：标签 + 值的两列网格 */
.detail-grid { display: grid; grid-template-columns: 190px 1fr; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.detail-item { display: contents; }
.detail-label { background: #f8fafc; padding: 9px 12px; font-size: 12px; color: var(--text-sub); }
.detail-value { background: #fff; padding: 9px 12px; font-size: 13px; color: var(--text); word-break: break-all; }

/* 转采购时的「历史进货价」内嵌选择器 */
.ph-box { margin-top: 10px; padding: 12px; border: 1px solid var(--warning); background: #fffbeb; border-radius: 8px; }
.ph-title { font-size: 13px; color: var(--text); margin-bottom: 8px; }
.ph-title b { color: var(--warning); }
.ph-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.ph-box table.mini th, .ph-box table.mini td { padding: 6px 8px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 100; overflow-y: auto; padding: 20px; }
.modal { background: #fff; border-radius: 12px; width: 720px; max-width: 100%; max-height: 90vh; overflow-y: auto; animation: modalIn .16s ease-out; display: flex; flex-direction: column; }
@keyframes modalIn { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-lg { width: 920px; }
/* 标准结构弹窗（header/body/footer 直子）：超高时 header/footer 常驻视口内、body 内部滚动，
   关闭按钮不会再滚出屏幕（原先整窗滚，标题栏的 × 和底部按钮都会被顶出去） */
.modal > .modal-header, .modal > .modal-footer { flex-shrink: 0; }
.modal > .modal-body { flex: 1; min-height: 0; overflow-y: auto; }
/* 裸内容弹窗兜底：没走 header/body 标准结构、内容直接贴着 .modal 的，自动补内边距。
   标准结构自带 padding，走不到这条（:has 浏览器支持与全站勾选高亮同一基线） */
.modal:not(:has(> .modal-header)):not(:has(> .modal-body)) { padding: 18px 22px 24px; }
/* 批量登记到货弹窗：加宽到近满屏、加高到近满屏，避免 11 列横向滚动 + 看不全行 */
/* 2026-10-30：弹窗整体加高到约 3 倍（min-height 72vh，原约 1/4 屏）。
   宽度分状态：刚打开（只有搜索框）为 60vw；选中采购单后加 .is-wide 撑到约 80vw
   （11 列明细表需要宽度，否则要横向拖动）。 */
.modal-batch { width: min(1440px, 60vw); max-height: 96vh; min-height: 72vh; }
.modal-batch.is-wide { width: min(1920px, 80vw); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 17px; }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--text-sub); line-height: 1; }

/* 操作留痕：详情弹窗右上角「历史」+ 右侧浮层抽屉（销售订单 / 采购订单） */
.modal-head-tools { display: flex; align-items: center; gap: 10px; }
.hist-btn {
  font-size: 13px; line-height: 1.6; color: var(--primary);
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 999px;
  padding: 2px 12px; cursor: pointer; white-space: nowrap;
}
.hist-btn:hover { background: #dbeafe; }
.audit-layer { position: fixed; inset: 0; z-index: 150; }
.audit-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .30); }
.audit-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 380px; max-width: 100%;
  background: var(--card); display: flex; flex-direction: column;
  box-shadow: -10px 0 30px rgba(15, 42, 96, .16);
  animation: auditSlide .22s ease;
}
@keyframes auditSlide { from { transform: translateX(24px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }
.audit-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.audit-head h4 { font-size: 16px; color: var(--text); }
.audit-sub { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.audit-close { background: none; border: none; font-size: 22px; color: var(--text-sub); line-height: 1; cursor: pointer; }
.audit-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.audit-empty { font-size: 13px; color: var(--text-sub); line-height: 1.9; padding: 24px 0; text-align: center; }
.audit-item { position: relative; padding: 0 0 18px 16px; }
.audit-item::before { content: ""; position: absolute; left: 3px; top: 14px; bottom: 0; width: 1px; background: var(--border); }
.audit-item:last-child { padding-bottom: 4px; }
.audit-item:last-child::before { display: none; }
.audit-dot { position: absolute; left: 0; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: #c3cdd9; }
.audit-dot.is-add { background: var(--success); }
.audit-dot.is-del { background: var(--danger); }
.audit-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.audit-time { font-size: 12px; color: var(--text-sub); font-variant-numeric: tabular-nums; }
.audit-user { font-size: 12px; color: var(--text); font-weight: 600; }
.audit-tag { font-size: 11px; color: var(--text-sub); border: 1px solid var(--border); border-radius: 999px; padding: 0 7px; line-height: 1.7; }
.audit-diff { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 13px; line-height: 1.7; }
.audit-fld { color: var(--text-sub); }
.audit-old { color: var(--text-sub); text-decoration: line-through; word-break: break-all; }
.audit-arrow { color: var(--text-sub); }
.audit-new { color: var(--primary); font-weight: 600; word-break: break-all; }
.audit-note { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
@media (max-width: 760px) {
  .audit-drawer { top: auto; left: 0; width: 100%; height: 76%; border-radius: 14px 14px 0 0; animation: auditUp .22s ease; }
  @keyframes auditUp { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
}

/* 付款：按到货入库付款（可多笔合并） / 采购单预付 */
.pay-mode-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.pay-mode-btn { padding: 8px 16px; border: 1px solid var(--border); background: #fff; border-radius: 8px; font-size: 13px; color: var(--text-sub); cursor: pointer; }
.pay-mode-btn.is-active { border-color: var(--primary); color: var(--primary); background: #eff6ff; font-weight: 600; }
.pay-arr-filter { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.pay-arr-filter input[type=text], .pay-arr-filter input:not([type]) { flex: 1 1 240px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; }
/* 提高优先级盖掉 .form-item label 的 display:block / margin-bottom */
.form-item label.pay-arr-only { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; margin-bottom: 0; font-size: 13px; color: var(--text-sub); white-space: nowrap; }
/* 盖掉 .form-item input 的 width:100%，否则复选框会被拉宽 */
.form-item .pay-arr-only input[type="checkbox"] { width: 14px; height: 14px; margin: 0; flex: 0 0 auto; cursor: pointer; }
.form-item .pay-arr-filter input:not([type]), .form-item .pay-arr-filter input[type=text] { min-width: 0; }
.pay-arr-box { border: 1px solid var(--border); border-radius: 8px; max-height: 320px; overflow: auto; background: #fff; }
.pay-arr-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.pay-arr-tbl th, .pay-arr-tbl td { padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.pay-arr-tbl thead th { position: sticky; top: 0; background: #f8fafc; z-index: 1; text-align: left; font-weight: 600; }
.pay-arr-tbl th.num, .pay-arr-tbl td.num { text-align: right; }
.pay-arr-group td { background: #f1f5f9; font-weight: 600; color: #334155; }
.pay-arr-amt { width: 104px; padding: 5px 6px; border: 1px solid var(--border); border-radius: 5px; text-align: right; font-size: 12.5px; }
.pay-arr-amt:disabled { background: #f8fafc; color: #94a3b8; }
.pay-arr-more { padding: 8px; text-align: center; }
.pay-sum-bar { display: flex; gap: 18px; flex-wrap: wrap; padding: 10px 12px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.pay-sum-bar b { font-weight: 700; color: #0f172a; font-variant-numeric: tabular-nums; }
.pay-detail-title { margin: 14px 0 8px; font-weight: 700; font-size: 13px; }
.detail-extra { margin-top: 4px; }


.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 12px 20px; border-radius: 8px; z-index: 200; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* 空状态：给占位文字配一个中性的「空盒子」图形，比单独一行灰字更像有意的空态 */
.empty { text-align: center; color: var(--text-sub); padding: 44px 0; }
.empty::before {
  content: ""; display: block; width: 34px; height: 26px; margin: 0 auto 10px;
  border: 2px solid #cbd5e1; border-radius: 4px;
  background: linear-gradient(#f8fafc, #eef2f7);
}
.loading { text-align: center; color: var(--text-sub); padding: 40px 0; }

/* ===== v244：统一线性图标 / 侧栏收起 / 空状态分场景 / 骨架块 ===== */
/* 图标用 currentColor，选中态、按钮 hover 自动跟随文字颜色，零外部依赖 */
.ui-ico { display: inline-block; flex: none; vertical-align: -3px; }
.nav-item .ico { display: inline-flex; align-items: center; justify-content: center; width: 20px; }
.nav-item .ico .ui-ico { width: 16px; height: 16px; }
.side-btn { display: flex; align-items: center; justify-content: center; gap: 8px; }
.side-btn-ico { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; flex: none; }

/* 侧栏收起：只留图标，状态由 app.js 存 localStorage；不挤压出浮层，表格不抖 */
body.side-collapsed { --sidebar-w: 60px; }   /* 悬浮批量条 / 固定元素用 calc(var(--sidebar-w)) 定位，收起时必须跟着变，否则左侧留空约 160px */
body.side-collapsed .sidebar { width: 60px; }
body.side-collapsed .side-logo { font-size: 0; text-align: center; padding: 16px 8px; }
body.side-collapsed .side-logo span { display: none; }
body.side-collapsed .side-logo::after { content: "鸿"; font-size: 18px; font-weight: 700; color: var(--primary); }
body.side-collapsed .nav-group { margin-top: 8px; }
body.side-collapsed .nav-group-title { display: none; }
body.side-collapsed .nav-item { justify-content: center; padding: 11px 0; gap: 0; }
body.side-collapsed .nav-item > span:not(.ico) { display: none; }
body.side-collapsed .nav-item .ico { width: 20px; }
body.side-collapsed .side-footer { padding: 10px 8px; }
body.side-collapsed .side-footer .user-info { display: none; }
body.side-collapsed .side-btn { gap: 0; padding: 9px 0; }
body.side-collapsed .side-btn-text { display: none; }

/* 空状态：分场景 + 引导动作；.empty::before 的空盒子让位给带图形的富结构 */
.empty.empty-rich { padding: 30px 16px; }
.empty.empty-rich::before { display: none; }
.es-wrap { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.es-ico { width: 40px; height: 40px; color: #cbd5e1; }
.es-ico.err { color: #f87171; }
.es-title { font-size: 14px; font-weight: 600; color: var(--text); }
.es-title.err { color: var(--danger); }
.es-desc { font-size: 12px; color: var(--text-sub); line-height: 1.7; max-width: 560px; }
.es-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.es-detail { font-size: 11px; color: var(--text-sub); background: #f6f7f9; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; margin-top: 6px; max-width: 560px; word-break: break-word; }

/* 骨架块：复用列表的 .sk-bar，给看板 / 日历 / 搜索结果用 */
.sk-block { padding: 6px 2px; }
.sk-block .sk-bar { margin: 0 0 10px; }
.sk-block .sk-bar:last-child { margin-bottom: 0; }
.sk-block.sk-compact { padding: 2px 0; }
.sk-block.sk-compact .sk-bar { height: 8px; margin-bottom: 7px; }

/* 供应商选择下拉提示 */
.supplier-pick { background: #fffbeb; border: 1px solid #fde68a; padding: 12px; border-radius: 8px; margin-bottom: 14px; }
.supplier-pick b { color: var(--warning); }

/* 预览表格 */
.preview-note { background: #eff6ff; border: 1px solid #bfdbfe; padding: 12px; border-radius: 8px; margin-bottom: 14px; color: #1e40af; font-size: 13px; }

/* 物料档案：阶梯价维护区 */
.tier-section { border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; background: #fafbfc; }
.tier-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tier-head b { font-size: 14px; }
.tier-hint { flex: 1; min-width: 200px; font-size: 12px; color: var(--text-sub); }
.tier-list { display: flex; flex-direction: column; gap: 8px; }
.tier-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: center; }
.tier-row input { width: 100%; }
.tier-row .link-btn.danger { white-space: nowrap; }

/* 批量转采购 · 单价编辑确认页 */
.price-edit { width: 84px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; text-align: right; background: #fffef0; font-size: 13px; font-variant-numeric: tabular-nums; box-sizing: border-box; }
.price-edit:focus { outline: 2px solid var(--primary); background: #fffde7; box-shadow: 0 0 0 2px rgba(22,119,255,.18); }
.tier-badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 8px; background: #eef7ff; color: #2563eb; border: 1px solid #bcdcff; margin-left: 6px; vertical-align: middle; }
.grp-title { font-size: 15px; font-weight: 600; margin: 18px 0 8px; }
.grp-amt { color: #2563eb; font-weight: 600; font-size: 13px; margin-left: 8px; }
.bpe-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.bpe-tbl th, .bpe-tbl td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
.bpe-tbl thead th { background: #f7f9fc; color: var(--text-sub); font-weight: 600; }
.bpe-grand { color: #1f2a44; }

.batch-sum { padding: 4px 10px; background: #eef4ff; border: 1px solid #dbe7ff; border-radius: 6px; color: #1f2a44; font-size: 13px; }
.batch-sum b { color: #2563eb; font-weight: 600; }

/* 销售/采购订单批量栏：橙底，两行（标签行与操作同高 + 数值行对齐列上方） */
#so-batch-bar, #po-batch-bar {
  position: relative;
  background: #fff7ed;
  border: 1px solid #ffedd5;
  color: var(--text);
  padding: 10px 16px 6px 16px;
  min-height: 0;
}
/* 工具栏强制一排：搜索/状态/日期/清空/导出 不换行；按钮文字也不换行 */
.sales-toolbar, .purchase-toolbar, .payment-toolbar, .inventory-toolbar { flex-wrap: nowrap; }
.sales-toolbar input#sales-search,
.purchase-toolbar input#purchase-search { flex: 4 1 360px; min-width: 240px; }
.payment-toolbar input#pay-search,
.inventory-toolbar input#inv-search { flex: 4 1 360px; min-width: 240px; }
/* v111：进货入库/销售出货/退货/物料/供应商页的搜索框与上面同款加长 ——
   这些页的 placeholder 列了五六个可搜字段，框太窄会被截断，用户看不出能搜什么。
   v281：入库/出货两页加了「排序方式」下拉，控件变多，允许换行（原来 nowrap 会把搜索框挤到 240px 以下）。 */
.si-toolbar, .so-toolbar { flex-wrap: wrap; row-gap: 10px; }
.ret-toolbar, .mat-toolbar, .sup-toolbar { flex-wrap: nowrap; }
.si-toolbar input, .so-toolbar input, .ret-toolbar input,
.mat-toolbar input, .sup-toolbar input { flex: 4 1 360px; min-width: 240px; }
.sales-toolbar .sel-wrap,
.purchase-toolbar .sel-wrap,
.payment-toolbar .sel-wrap,
.inventory-toolbar .sel-wrap,
.si-toolbar .sel-wrap,
.so-toolbar .sel-wrap,
.ret-toolbar .sel-wrap {
  position: relative; flex: 0 0 auto; display: inline-flex; align-items: center;
}
.sales-toolbar .sel-wrap::after,
.purchase-toolbar .sel-wrap::after,
.payment-toolbar .sel-wrap::after,
.inventory-toolbar .sel-wrap::after,
.si-toolbar .sel-wrap::after,
.so-toolbar .sel-wrap::after,
.ret-toolbar .sel-wrap::after {
  content: ""; position: absolute; right: 11px; top: 50%;
  width: 8px; height: 8px; margin-top: -5px;
  border-right: 2px solid #64748b; border-bottom: 2px solid #64748b;
  transform: rotate(45deg); pointer-events: none;
}
.sales-toolbar select,
.purchase-toolbar select,
.payment-toolbar select,
.inventory-toolbar select,
.si-toolbar select,
.so-toolbar select,
.ret-toolbar select {
  flex: 0 0 auto; min-width: 110px; width: 110px;
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: 28px;
}
.toolbar .btn-primary,
.toolbar .btn-ghost { white-space: nowrap; }
/* v282：「只看待填写」开关。平时与普通 ghost 按钮一致，筛上时用琥珀色描边把状态显出来
   （不靠文字变长提示，避免工具栏在窄屏抖动）。 */
.si-toolbar .pend-filter,
.so-toolbar .pend-filter { flex: 0 0 auto; padding: 9px 14px; }
.si-toolbar .pend-filter.on,
.so-toolbar .pend-filter.on {
  background: #fffbeb; border-color: #f59e0b; color: #b45309; font-weight: 600;
}
/* 表格倒序下出货页的口径说明（少了退货/罚款单据，得让人知道为什么） */
.sort-note {
  flex: 0 0 auto; font-size: 12px; line-height: 1;
  padding: 6px 9px; border-radius: 6px;
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  white-space: nowrap;
}
#so-batch-bar .so-batch-actions,
#po-batch-bar .po-batch-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 34px; }
#so-batch-bar .so-batch-label,
#po-batch-bar .so-batch-label {
  position: absolute;
  top: 16px;                 /* 与「取消勾选」按钮同高 */
  text-align: right;
  color: var(--text-sub);
  font-size: 12px;
  white-space: nowrap;       /* 含税金额合计 强制一行 */
  pointer-events: none;
}
#so-batch-bar .so-batch-values,
#po-batch-bar .so-batch-values { position: relative; height: 30px; margin-top: 4px; }
#so-batch-bar .so-batch-total,
#po-batch-bar .so-batch-total {
  position: absolute;
  top: 0;
  text-align: right;
  white-space: nowrap;
  color: var(--primary);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  pointer-events: none;
}
#so-batch-bar .so-batch-total b,
#po-batch-bar .so-batch-total b { color: var(--primary); font-weight: 600; }

/* PDF 导入左右对照视图：两栏放大铺满、各自独立滚动 */
.pdf-compare { display: flex; gap: 14px; align-items: stretch; }
.pdf-compare-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.pdf-compare-head { flex: 0 0 auto; padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--text); background: var(--bg-sub, #f8fafc); border-bottom: 1px solid var(--border); }
.pdf-side-view { flex: 1 1 auto; overflow: auto; padding: 10px; background: #f8fafc; max-height: 68vh; }
.pdf-side-table { flex: 1 1 auto; overflow: auto; max-height: 68vh; }
.pdf-import-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pdf-import-table th { position: sticky; top: 0; background: #f8fafc; z-index: 1; }
.pdf-import-table th, .pdf-import-table td { padding: 8px 7px; border-bottom: 1px solid var(--border); text-align: left; white-space: normal; }
.pdf-import-table td input { width: 100%; min-width: 120px; box-sizing: border-box; }
/* 左栏 PDF 原文收窄、右栏解析结果加宽：配合弹窗 98vw，整表（含单价全位小数）不用横向拖动就能看全 */
.pdf-compare-pdf { flex: 0 0 32%; min-width: 260px; }
.pdf-import-table td.pdf-spec-cell input { min-width: 200px; }
.pdf-import-table td input[type="number"] { min-width: 110px; }
.pdf-import-table td:last-child { white-space: nowrap; }
.pdf-import-table td.pdf-date-cell { white-space: nowrap; }
.pdf-import-table td.num { white-space: nowrap; }

/* 打印预览样式（PDF 导入预览订单 / 采购单预览） */
.po-print { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 28px 32px; box-shadow: 0 2px 12px rgba(0,0,0,.06); max-width: 960px; margin: 0 auto; }
.po-print th, .po-print td { word-break: break-word; }

/* 小号幽灵按钮 */
.btn-sm { font-size: 12px; padding: 3px 10px; border-radius: 6px; }

/* ===== 采购订单打印版（对齐旧工具「采购订单_专业版」模板版式，导出 PDF 用） =====
   页面设置与旧工具模板一致：A4 横向（模板 pageSetup orientation="landscape" scale="80"） */
.po-paper { width: 297mm; min-height: 210mm; margin: 0 auto; padding: 8mm 9mm; background: #fff; color: #000; font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", sans-serif; font-size: 10pt; box-sizing: border-box; }
.po-paper .po-title { text-align: center; font-size: 15pt; font-weight: 700; margin-bottom: 6px; }
.po-paper .po-meta { display: flex; justify-content: space-between; font-size: 10pt; margin-bottom: 4px; }
.po-paper .po-sec { font-weight: 700; margin: 6px 0 2px; }
/* 打印表格边框稳健化（v124）：弃用 border-collapse。
   collapse 模式下共享边由浏览器仲裁绘制，Chromium 打印时有已知缺陷：
   表格外沿上边、表头(th)竖线段会被画成发丝线甚至整段丢失（本次红线/绿线问题）。
   改为 separate + 每格自绘 右/下 边框 + 首列左框 + 表头行上框：
   每段线只由唯一元素负责，无仲裁；2px(≈1.5pt) 宽度保证任何小数像素对齐下
   都完整覆盖 ≥1 设备像素，任何查看器/缩放下都是实线。 */
.po-paper table.po-tbl { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
/* 关键：必须显式 white-space:normal 覆盖全局 `th, td { white-space: nowrap }`，
   否则长规格文字不换行、直接溢出被裁（就是"显示不全"的原因） */
/* 边框 1.5px（≈1.1pt）：1px 发丝线在 PDF 里落在半像素位置时会渲染得忽粗忽细、甚至淡到看不见
   （实测同一张表竖线 0.24~0.59mm 不等）。1.5px 保证任何对齐下都 ≥1 整设备像素，粗细均匀；
   物理打印机上也不易丢细线。屏幕预览同样生效（96dpi 下 1.5px 与 1px 观感几乎无差）。 */
.po-paper table.po-tbl th, .po-paper table.po-tbl td { border: 0; border-right: 2px solid #000; border-bottom: 2px solid #000; padding: 2px 3px; font-size: 8.5pt; text-align: center; vertical-align: middle; white-space: normal; word-break: break-word; overflow-wrap: anywhere; line-height: 1.3; }
.po-paper table.po-tbl th { font-weight: 700; }
/* 仅首列补左边框、仅表头行补上边框：与每格的 右/下 边框拼出完整且唯一的网格线，避免双边重叠变粗 */
.po-paper table.po-tbl th:first-child, .po-paper table.po-tbl td:first-child { border-left: 2px solid #000; }
.po-paper table.po-tbl thead th { border-top: 2px solid #000; }
.po-paper table.po-tbl tr.po-total td { font-weight: 700; height: 30px; }
/* 表头「含税/未税单价」下拉（仅预览可编辑态；打印态是纯文字）：融入表头、不破坏 2px 边框版式 */
.po-paper table.po-tbl th select.po-price-sel {
  width: 100%; border: none; background: transparent; color: #000;
  font: inherit; font-weight: 700; text-align: center; padding: 0; cursor: pointer;
}
/* 采购单预览可编辑单元格：浅色底 + 悬停/聚焦高亮，提示可直接双击修改 */
.po-paper table.po-tbl td.po-editable { cursor: text; background: #fffef0; transition: background .12s, box-shadow .12s; }
.po-paper table.po-tbl td.po-editable:hover { background: #fff9c4; }
.po-paper table.po-tbl td.po-editable:focus { outline: 2px solid var(--primary); background: #fffde7; box-shadow: 0 0 0 2px rgba(22,119,255,.18); }
.po-paper table.po-tbl td.po-num-edit { text-align: center; }
.po-paper .po-cn { font-weight: 700; font-size: 10pt; padding: 5px 2px; }
.po-paper .po-clause { font-size: 8.5pt; line-height: 1.45; }
.po-paper .po-clause .po-clause-title { font-weight: 700; }
.po-paper .po-clause .po-clause-body { margin-bottom: 1px; }
/* 附加行（运费等）：预览里淡淡区分，金额计入合计；打印版（editable=false）不渲染删除按钮 */
.po-paper table.po-tbl tr.po-extra-row td { background: #f8fafc; }
.po-paper .po-cn .po-freight-cn { font-weight: 400; }
.po-paper .po-del-extra {
  background: none; border: none; color: #c0c4cc; cursor: pointer; font-size: 13px; line-height: 1;
  padding: 2px 4px; border-radius: 4px;
}
.po-paper .po-del-extra:hover { color: #dc2626; background: #fde8e8; }
/* 采购订单列表里的「运费」标签：标明该行是附加费用行，不是物料 */
.po-freight-tag {
  display: inline-block; font-size: 11px; font-weight: 600; color: #92400e;
  background: #fef3c7; border: 1px solid #fde68a; border-radius: 4px; padding: 0 4px; margin-left: 4px;
}
.po-paper .po-sign { display: flex; justify-content: space-between; margin-top: 12px; font-size: 9.5pt; line-height: 1.8; position: relative; break-inside: avoid; page-break-inside: avoid; }
.po-paper .po-sign-col { width: 48%; break-inside: avoid; page-break-inside: avoid; }
.po-paper .po-sign-col.right { text-align: left; position: relative; break-inside: avoid; page-break-inside: avoid; }
.po-paper .po-stamp { position: absolute; width: 36mm; height: 36mm; opacity: .92; left: 32mm; top: 0; }
/* 分页保护：明细行、合计、大写金额、条款标题/正文、签章区不被拦腰截断 */
.po-paper table.po-tbl tr { page-break-inside: avoid; break-inside: avoid; }
.po-paper table.po-tbl thead { display: table-header-group; }
.po-paper .po-cn, .po-paper .po-clause-title { page-break-after: avoid; break-after: avoid; }
.po-paper .po-clause-body { page-break-inside: avoid; break-inside: avoid; }
/* 打印根：屏幕上隐藏，仅打印时显示 */
#po-print-root { display: none; }
@media print {
  body > *:not(#po-print-root):not(#delivery-print-root) { display: none !important; }
  #po-print-root { display: block !important; }
  #delivery-print-root { display: block !important; }
  /* 留白全部烤进 .po-paper 自身（padding 10mm 12mm），@page margin=0。
     原因：浏览器打印对话框「边距=无/最小值」会覆盖 CSS @page margin，曾导致导出 PDF
     零边距、内容顶满纸边、表格右边框被裁掉。留白进纸张后，无论对话框怎么选都有稳定边距。 */
  @page { size: A4 landscape; margin: 0; }
  .po-paper { width: auto; min-height: auto; padding: 10mm 12mm; margin: 0; box-shadow: none; font-size: 9pt; }
  .po-paper .po-sign { margin-top: 10px; }
}

/* ===== 送货单打印版（2026-11-03，A4 纵向，标准分页，每页带章） =====
   与采购单（横向单页）不同：送货单是「一单一份、明细多则分页」，采用 A4 纵向标准分页，
   签章区 break-inside:avoid 保证不被拦腰截断；超一页时每页底部都有签章区（用 CSS 分页，
   表格 thead 每页重复，签章区随内容自然落到各页底部）。 */
#delivery-print-root { display: none; }
.dl-paper { width: 210mm; min-height: 290mm; margin: 0 auto; padding: 10mm 12mm; background: #fff; color: #000; font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", sans-serif; font-size: 10pt; box-sizing: border-box; }
/* 边框稳健化（2026-11-03，对齐采购单 v124 的做法，见上方 .po-tbl 注释）：
   弃用 border-collapse —— collapse 模式下共享边由浏览器仲裁绘制，1px 发丝线落到半像素
   位置时会渲染得忽粗忽细（用户实测「表头右侧和下方那两段明显更细」）。
   改为 separate + 每格只自绘「右/下」边框、首列补左框、表头行补上框：每段线只由唯一
   一个元素负责，无仲裁、无双线。
   ⚠ 线宽只能取整数 px：Chromium 会把 1.5px 这类小数边框宽度取整回 1px（实测导出的 PDF
   里矩形仍是 1.00），所以「细且稳」只有 1px，要稳定一致只能用 2px（=1.5pt）。 */
.dl-paper .dl-head { text-align: center; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 8px; }
.dl-paper .dl-company { font-size: 15pt; font-weight: 700; letter-spacing: 2px; }
.dl-paper .dl-title { font-size: 19pt; font-weight: 700; letter-spacing: 2px; margin: 5px 0; }
.dl-paper .dl-addr { font-size: 9pt; color: #333; }
.dl-paper .dl-meta { display: flex; justify-content: space-between; font-size: 10pt; margin: 8px 0 6px; }
.dl-paper .dl-meta b { font-size: 10.5pt; }
.dl-paper table.dl-cust { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; margin-bottom: 8px; }
.dl-paper table.dl-cust td { border: 0; border-right: 2px solid #000; border-bottom: 2px solid #000; padding: 4px 6px; font-size: 9.5pt; vertical-align: middle; white-space: normal; word-break: break-word; line-height: 1.35; }
.dl-paper table.dl-cust tr:first-child td { border-top: 2px solid #000; }
.dl-paper table.dl-cust tr td:first-child { border-left: 2px solid #000; }
.dl-paper table.dl-cust td.dl-cust-lbl { background: #f9f9f9; font-weight: 700; text-align: center; }
.dl-paper table.dl-tbl { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.dl-paper table.dl-tbl th, .dl-paper table.dl-tbl td { border: 0; border-right: 2px solid #000; border-bottom: 2px solid #000; padding: 4px 3px; font-size: 9pt; text-align: center; vertical-align: middle; white-space: normal; word-break: break-word; overflow-wrap: anywhere; line-height: 1.3; }
.dl-paper table.dl-tbl thead th { border-top: 2px solid #000; }
.dl-paper table.dl-tbl tr > *:first-child { border-left: 2px solid #000; }
.dl-paper table.dl-tbl th { font-weight: 700; background: #f9f9f9; }
.dl-paper table.dl-tbl td.num { text-align: center; }
.dl-paper table.dl-tbl tr.dl-total td { font-weight: 700; background: #f7f7f7; }
.dl-paper .dl-note { font-size: 9pt; color: #333; margin: 8px 2px 0; line-height: 1.6; }
/* 签章区：仅最后一页渲染；发货方/收货方两栏结构完全对称（标签+值三行），字体一致；
   出货专用章参照采购章的做法，绝对定位压发货方「经办人」行（用户 2026-11-05 要求：
   章中心对准经办人，不再对准公司名） */
.dl-paper .dl-sign { display: flex; justify-content: space-between; align-items: flex-start; position: relative; margin-top: 12px; padding-bottom: 4mm; }
.dl-paper .dl-sign-col { break-inside: avoid; page-break-inside: avoid; position: relative; }
.dl-paper .dl-sign-col.dl-sign-supplier { width: 50%; text-align: left; position: relative; }
.dl-paper .dl-sign-col.dl-sign-receiver { width: 44%; text-align: left; }
.dl-paper .dl-sup-row { font-size: 10pt; line-height: 2.0; }
.dl-paper .dl-sup-lbl { display: inline-block; width: 5em; font-weight: 700; }
.dl-paper .dl-sup-name { font-weight: 700; }
.dl-paper .dl-sup-val { white-space: nowrap; }
/* 出货专用章：36mm，透明度 85%（用户 2026-11-04 确认；采购章仍为 92%）。
   尾页：中心对准发货方「经办人」行（line-height 2.0 × 10pt = 7.06mm/行，第二行中心 = 10.58mm，
   故 top = 10.58 - 18 = -7.4mm）；非尾页：盖在右下角空白区（页码上方），不挡任何文字 */
.dl-paper .dl-stamp { position: absolute; width: 36mm; height: 36mm; opacity: .85; left: 24mm; top: -7.4mm; z-index: 5; }
.dl-paper .dl-stamp-page { left: auto; top: auto; right: 14mm; bottom: 28mm; }
/* 每页底部页码：第 X 页 / 共 Y 页 */
.dl-paper .dl-page-num { position: absolute; left: 0; right: 0; bottom: 5mm; text-align: center; font-size: 9pt; color: #000; }
.dl-paper table.dl-tbl tr { page-break-inside: avoid; break-inside: avoid; }
.dl-paper table.dl-tbl thead { display: table-header-group; }
.dl-paper .dl-sign { break-inside: avoid; page-break-inside: avoid; }
/* 每个「页块」独立成页：除最后一块外，块末强制分页（每块都带签章区 → 每页都有章）。
   内容与签章区之间固定留 4 行明细的空白（实测单行明细约 7mm → 28mm，2026-11-03 用户要求
   "签章区和内容区之间按 4 行留白"），不再把签章区一路顶到纸张底部。 */
.dl-paper .dl-page { page-break-after: always; break-after: page; position: relative; min-height: 269mm; display: flex; flex-direction: column; }
.dl-paper .dl-page:last-child { page-break-after: auto; break-after: auto; }
.dl-paper .dl-page .dl-sign { margin-top: 28mm; }
.dl-paper .dl-page .dl-head-cont { border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 8px; }
.dl-paper .dl-page .dl-title-cont { font-size: 15pt; font-weight: 700; letter-spacing: 2px; margin: 4px 0; }
/* 打印态：留白烤进纸张；@page 尺寸由 JS 打印前动态注入（A4 纵向），打印后移除 */
@media print {
  #delivery-print-root { display: block !important; }
  /* ⚠ 纸面自己不再留 padding：留白只由 .dl-page 的 padding 提供。
     原来 .dl-paper(padding 10mm) 套 .dl-page(高 296mm + padding 10mm) = 316mm > A4 297mm，
     打印必然溢出成 2 页（单行内容也被劈成两页、第二页几乎空白，2026-11-03 用户报的问题）。 */
  .dl-paper { width: auto; min-height: auto; margin: 0; padding: 0; box-shadow: none; }
  /* 打印态每个 .dl-page 各自占一页（靠 page-break-after 分页），高度固定 296mm（A4 297mm 留 1mm
     防舍入溢出产生空白页），让绝对定位的页码（bottom:5mm）真正落在纸张末端。 */
  .dl-paper .dl-page { padding: 10mm 12mm; box-sizing: border-box; height: 296mm; }
}

/* Excel 导入预览 */
.sec-title { font-size: 13px; font-weight: 600; color: var(--text); margin: 16px 0 8px; padding-left: 8px; border-left: 3px solid var(--primary); }
.tbl-scroll { overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.tbl-scroll table.mini { font-size: 12px; }
.tbl-scroll table.mini th, .tbl-scroll table.mini td { padding: 6px 10px; white-space: nowrap; }

/* 可搜索下拉（登记到货/出货的关联订单）：输入框 + 浮层过滤列表，底层 select 隐藏保留 */
.search-wrap { position: relative; }
.search-wrap > input { width: 100%; }
.search-list { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  background: var(--card, #fff); border: 1px solid var(--border); border-radius: 8px;
  max-height: 560px; overflow-y: auto; box-shadow: 0 8px 24px rgba(15, 23, 42, .14); }
.search-list .search-item { padding: 8px 10px; cursor: pointer; font-size: 13px; line-height: 1.5;
  color: var(--text); border-bottom: 1px solid var(--border); }
.search-list .search-item:last-child { border-bottom: none; }
.search-list .search-item:hover { background: #f1f5f9; }
.search-list .search-empty { color: var(--text-sub, #94a3b8); cursor: default; }
.search-list .search-empty:hover { background: none; }

/* 批量登记到货弹窗：候选列表改为文档流内显示，避免被弹窗 overflow 裁切到只剩几行。
   不设 min-height → 命中少时自动变矮；max-height 上限=近满屏 → 命中多时撑满弹窗并内部滚动 */
.batch-search .search-list { position: static; margin-top: 6px; box-shadow: 0 4px 14px rgba(15, 23, 42, .10); max-height: calc(96vh - 220px); }

/* ===== 数据备份与恢复 ===== */
.backup-meta {
  display: flex; gap: 28px; flex-wrap: wrap; margin-top: 12px;
  padding: 12px 14px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
}
.backup-meta-item { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.backup-meta-item .lbl { color: var(--text-sub); }
.backup-meta-item .val { color: var(--text); }
.backup-status { margin-top: 12px; font-size: 13px; min-height: 20px; line-height: 1.6; }
.backup-warn {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  padding: 12px; border-radius: 8px; font-size: 13px; line-height: 1.7;
}
/* 月底强制备份遮罩：层级要压过普通弹窗(100)和 toast(200)，
   且没有关闭按钮、点遮罩空白处也不关闭 —— 只能靠「导出备份并进入系统」退出 */
.modal-mask.forced-mask { z-index: 300; background: rgba(15, 23, 42, .58); }
.forced-mask .forced-modal { width: 640px; }

/* ===== 对账中心 ===== */
.recon-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.recon-tab { padding: 8px 16px; border: 1px solid var(--border); background: #fff; color: var(--text-sub); border-radius: 6px; font-size: 13px; }
.recon-tab:hover { border-color: var(--primary); color: var(--primary); }
.recon-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.recon-summary {
  display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 16px;
  padding: 12px 14px; background: #f8fafc; border: 1px solid var(--border); border-radius: 8px;
}
.recon-summary > div { display: flex; flex-direction: column; gap: 4px; }
.recon-summary span { color: var(--text-sub); font-size: 12px; }
.recon-summary b { font-size: 15px; }
.recon-group { margin-bottom: 18px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.recon-group:last-child { margin-bottom: 0; }
.recon-group-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; background: #f1f5f9; border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
.recon-group-head:hover { background: #e2e8f0; }
.recon-toggle { display: inline-block; width: 14px; font-size: 11px; color: var(--text-sub); }
.recon-group-body { padding: 0; }
.recon-group-name { font-weight: 700; font-size: 14px; }
.recon-group-sub { font-size: 12px; color: var(--text-sub); }
/* 组头上的「导出此供应商/客户」按钮：小号、不抢视觉，别跟着组头的展开/收起触发 */
.recon-export-one {
  font-size: 12px; padding: 3px 10px; margin-left: auto; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer;
}
.recon-export-one:hover { border-color: var(--primary); color: var(--primary); }
.recon-group table { font-size: 12px; }
.recon-group table th, .recon-group table td { padding: 7px 10px; }
tr.recon-subtotal td { background: #f8fafc; border-top: 2px solid var(--border); }

/* 列表「导出 Excel」弹窗 */
.export-meta { margin-top: 16px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; padding: 12px 14px; }
.export-meta-row { display: flex; gap: 12px; line-height: 1.7; font-size: 13px; }
.export-meta-row + .export-meta-row { margin-top: 8px; }
.export-label { flex: 0 0 92px; color: var(--text-sub); }
.export-meta b { color: var(--primary); font-weight: 600; }
.export-cols { color: var(--text); }
.export-note { color: var(--text-sub); font-size: 13px; padding: 6px 0; }

/* ===== 只读模块：统一隐藏写操作入口 =====
   权限为「只读」的模块，route() 会给 body 加 .readonly，
   这里把页面上的新增按钮、行内的编辑/删除/转采购等按钮一并藏掉。
   导出 Excel（btn-ghost）保留 —— 导出属于查看行为，只读也应允许。 */
body.readonly .page-actions { display: none !important; }
body.readonly .link-btn { display: none !important; }

/* ===== 用户与权限（超级管理员） ===== */
.perm-note { color: var(--text-sub); font-size: 12px; line-height: 1.7; margin-bottom: 10px; }
.perm-tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.perm-tbl th, .perm-tbl td { border: 1px solid var(--border); padding: 6px 8px; text-align: center; white-space: normal; }
.perm-tbl th:first-child, .perm-tbl td:first-child { text-align: left; }
.perm-tbl th:nth-child(n+2) { width: 72px; }
.perm-pay { text-align: left !important; }
.perm-pay label { margin-right: 14px; cursor: pointer; }
.perm-sub { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); color: var(--text-sub); font-size: 12px; }
.perm-sub label { margin-right: 16px; cursor: pointer; }

/* ===== 批量转采购 · 可搜索供应商下拉 ===== */
.bp-pick-wrap { position: relative; width: 100%; }
.bp-pick-btn {
  width: 100%; text-align: left; background: #fff; border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 28px 7px 10px; font-size: 13px; color: var(--text-sub);
  position: relative; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bp-pick-btn.selected { color: var(--text); }
.bp-pick-btn::after {
  content: "▾"; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-sub); font-size: 12px; pointer-events: none;
}

/* ===== 列表「筛选中」提示条（v232） ===== */
/* 筛选条件过去只存在内存里，用户看不出列表被筛过；遇到 0 条会误以为数据丢了。
   现在在工具栏最前面显示「筛选中：xxx ×」，点 × 直接清空筛选。 */
.filter-hint {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 8px 5px 10px; border: 1px solid #fcd34d; border-radius: 999px;
  background: #fffbeb; color: #92400e; font-size: 12px; line-height: 1.4;
  max-width: 100%;
}
.filter-hint .fh-x {
  display: inline-block; width: 16px; height: 16px; line-height: 15px; text-align: center;
  border-radius: 50%; color: #92400e; cursor: pointer; font-weight: 700; text-decoration: none;
}
.filter-hint .fh-x:hover { background: #fde68a; }
.bp-pick-panel {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); overflow: hidden;
}
.bp-pick-search {
  width: 100%; border: none; border-bottom: 1px solid var(--border); border-radius: 0;
  padding: 9px 10px; font-size: 13px;
}
.bp-pick-search:focus { outline: none; border-bottom-color: var(--primary); }
.bp-pick-list { list-style: none; margin: 0; padding: 4px; max-height: 240px; overflow-y: auto; }
.bp-pick-list li {
  padding: 8px 10px; border-radius: 6px; font-size: 13px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bp-pick-list li:hover { background: #f3f4f6; }
.bp-pick-list li[data-active="1"] { background: #eff6ff; color: var(--primary-hover); font-weight: 600; }
.bp-pick-list li.ph { color: var(--text-sub); cursor: default; }
.bp-pick-list li.empty-li { color: var(--text-sub); cursor: default; text-align: center; padding: 14px; }
.bp-need-hint { font-size: 12px; color: var(--warning); margin-top: 6px; line-height: 1.5; }
.bp-need-hint .bp-goto { font-size: 12px; padding: 0 2px; }

/* ===== 销售订单列表·供应商名称列（取数优先级：物料档案 → 本单值 → 采购单） ===== */
td.so-sup { white-space: nowrap; }
.so-sup-pick { max-width: 180px; font-size: 12px; padding: 2px 4px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); }
.so-sup-pick:focus { outline: none; border-color: var(--primary); }
.so-sup-link { margin-left: 6px; font-size: 12px; }
.so-sup-mark { margin-left: 5px; font-size: 10px; line-height: 1; color: #64748b; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 4px; padding: 2px 4px; white-space: nowrap; }
.so-sup-empty { color: var(--text-sub); }

/* ===== 物料档案「供应商」列：当前供应商名 + 小字管理入口 ===== */
.mat-sup-manage { margin-left: 6px; font-size: 11px; color: var(--text-sub); cursor: pointer; white-space: nowrap; }
.mat-sup-manage:hover { color: var(--primary); text-decoration: underline; }
.mat-sup-none { color: var(--text-sub); }

/* ===== 核对「已转采购」弹窗 ===== */
.audit-stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.audit-item {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 4px; background: #fff;
}
.audit-item b { font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.audit-item span { font-size: 12px; color: var(--text-sub); }
.audit-item.ok { border-color: #bbf7d0; background: #f0fdf4; }
.audit-item.ok b { color: #15803d; }
.audit-item.warn { border-color: #fde68a; background: #fffbeb; }
.audit-item.warn b { color: #b45309; }
.audit-item.mute b { color: var(--text-sub); }
.audit-notes { margin: 0 0 12px; padding-left: 20px; font-size: 13px; color: var(--text); line-height: 1.8; }
.audit-notes b { font-variant-numeric: tabular-nums; }
.audit-detail { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: #fafafa; }
.audit-detail > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--primary-hover); }
.audit-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.audit-table th, .audit-table td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: left; white-space: nowrap; }
.audit-table th { background: #f1f5f9; position: sticky; top: 0; z-index: 1; font-weight: 600; }
.audit-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.audit-progress { margin-right: auto; font-size: 12px; color: var(--text-sub); align-self: center; }

/* ===== 供应商档案附件（营业执照 / 开票信息） ===== */
.sup-files { border: 1px solid var(--border); border-radius: 8px; background: #fbfcfe; padding: 4px 10px; }
.sup-files-empty { padding: 10px 0; font-size: 12px; color: var(--text-sub); }
.sup-file-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.sup-file-row:last-child { border-bottom: none; }
.sup-file-thumb { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); background: #fff; }
.sup-file-ico { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 6px; display: flex; align-items: center; justify-content: center; background: #eef2f7; color: #64748b; font-size: 10px; font-weight: 600; letter-spacing: .02em; }
.sup-file-main { flex: 1 1 auto; min-width: 0; }
.sup-file-name { display: block; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sup-file-meta { font-size: 12px; color: var(--text-sub); }
.sup-file-bar { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.sup-file-note { font-size: 12px; color: var(--text-sub); }
.sup-doc { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 12px; margin-right: 4px; background: #f1f5f9; color: #64748b; white-space: nowrap; }
.sup-doc.ok { background: #e7f6ec; color: #15803d; }

/* 附件预览浮层：核对识别结果时放原件大图 */
.sup-file-name.pv { cursor: zoom-in; }
.sup-file-name.pv:hover { color: var(--primary); text-decoration: underline; }
.sup-file-thumb { cursor: zoom-in; }
.sup-pv { position: fixed; z-index: 400; display: flex; flex-direction: column; background: #0f172a; border: 1px solid #334155; border-radius: 10px; box-shadow: 0 18px 48px rgba(0,0,0,.42); overflow: hidden; }
.sup-pv-bar { display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 10px; background: #0f172a; color: #e2e8f0; font-size: 12.5px; flex: 0 0 auto; cursor: move; user-select: none; border-bottom: 1px solid #1e293b; }
.sup-pv-grip { flex: 0 0 auto; color: #64748b; font-size: 12px; letter-spacing: 1px; }
.sup-pv-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e2e8f0; }
.sup-pv-tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.sup-pv-tools .link-btn { color: #c7d2fe; background: none; border: none; padding: 0; cursor: pointer; font-size: 12px; }
.sup-pv-tools .link-btn:hover { color: #fff; text-decoration: underline; }
.sup-pv-close { background: #1e293b; color: #e2e8f0; border: 1px solid #334155; border-radius: 6px; padding: 3px 9px; font-size: 12px; cursor: pointer; }
.sup-pv-close:hover { background: #334155; }
.sup-pv-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 8px; text-align: center; touch-action: none; cursor: grab; user-select: none; }
.sup-pv-body.dragging { cursor: grabbing; }
.sup-pv-img { display: block; height: auto; margin: 0 auto; background: #fff; border-radius: 3px; cursor: zoom-in; -webkit-user-drag: none; user-select: none; }
.sup-pv-page { display: block; height: auto; margin: 0 auto 8px; background: #fff; border-radius: 3px; }
.sup-pv-btn { width: 22px; height: 20px; padding: 0; border-radius: 5px; border: 1px solid #334155; background: #1e293b; color: #e2e8f0; cursor: pointer; font-size: 13px; line-height: 1; }
.sup-pv-btn:hover { background: #334155; }
.sup-pv-scale { min-width: 54px; text-align: center; color: #cbd5e1; font-size: 11.5px; }
.sup-pv-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.sup-pv-tip { color: #cbd5e1; font-size: 12.5px; padding: 24px 12px; }
.sup-pv-resize { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; }
.sup-pv-resize::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 7px; height: 7px; border-right: 2px solid #64748b; border-bottom: 2px solid #64748b; }

/* 列表加载失败的说明行：错误本身一行，下面一行小字告诉用户该怎么办 */
.list-err { padding: 18px 12px !important; }
.list-err-tip { margin-top: 6px; font-size: 12px; color: var(--text-sub); }

/* 上传后自动识别：提示条 + 自动填入的字段轻微高亮，方便一眼确认「这是机器填的」 */
.sup-ocr-hint {
  grid-column: 1 / -1;
  margin: 2px 0 2px;
  padding: 9px 12px;
  border-radius: 8px;
  background: #f0f7ff;
  border: 1px solid #cfe3ff;
  font-size: 12.5px;
  line-height: 1.75;
  color: #1f4e79;
  word-break: break-all;
}
.sup-ocr-hint b { font-weight: 600; color: #0f3f6b; }
.sup-ocr-hint .link-btn { margin-left: 4px; }
.sup-ocr-busy { color: #2563eb; }
.sup-ocr-busy::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  margin-right: 6px;
  border: 2px solid #bfdbfe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: ocrSpin .8s linear infinite;
  vertical-align: -1px;
}
@keyframes ocrSpin { to { transform: rotate(360deg); } }
input.ocr-filled { animation: ocrFlash 2.6s ease-out; border-color: #4ade80 !important; }
@keyframes ocrFlash {
  0% { background: #dcfce7; box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
  55% { background: #f2fdf5; box-shadow: 0 0 0 3px rgba(34,197,94,.10); }
  100% { background: #fff; box-shadow: none; }
}

/* ============ 数据看板：日历 + 共享记事/待办 ============ */
.calendar-card { padding: 16px; }
.cal-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-title { font-size: 16px; font-weight: 700; min-width: 110px; text-align: center; }
.cal-today { margin-left: 4px; }
.cal-legend { margin-left: auto; font-size: 12px; color: var(--text-sub, #6b7280); display: flex; align-items: center; gap: 6px; }
.cal-legend .cal-badge { margin: 0; }
/* 销/采 显隐开关：隐藏时只留「● 有记事」图例，徽标数字不显示 */
.calendar-card.hide-due .cal-legend-due { display: none; }
#cal-toggle-due.cal-off { opacity: .55; text-decoration: line-through; }
/* 看板顶部快捷入口（与标题同一行、右对齐） */
.dash-quick { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dash-quick-tip { font-size: 12px; color: var(--text-sub, #6b7280); }
.dash-quick-tip a { color: var(--primary, #2563eb); text-decoration: underline; }
/* 按钮里的邮箱大师图标（assets/mailmaster.png，从本机 exe 提取的 256×256 原图标） */
.dash-quick-below { margin-top: 16px; }
/* 按钮加大：更好点、图标也更清楚 */
.dash-quick .btn-ghost {
  padding: 11px 20px; font-size: 15px; font-weight: 600; border-radius: 8px;
  border: 1px solid var(--border, #e5e7eb); background: #fff;
}
.dash-quick .btn-ghost:hover { background: #f3f6ff; border-color: var(--primary, #2563eb); color: var(--primary, #2563eb); }
.dash-mail-btn { display: inline-flex; align-items: center; }
.dash-mail-btn img { width: 20px; height: 20px; margin-right: 8px; display: block; }
.dash-web-btn { display: inline-flex; align-items: center; }
.dash-web-ico { font-size: 18px; margin-right: 7px; }
.cal-body { display: flex; gap: 18px; align-items: flex-start; }
.cal-grid { flex: 3 1 0; min-width: 0; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.cal-dow span { text-align: center; font-size: 15px; font-weight: 600; color: var(--text-sub, #6b7280); padding: 6px 0; }
.cal-cells { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-cell {
  min-height: 78px; padding: 5px 6px; border: 1px solid #e5e7eb; border-radius: 6px;
  background: #fff; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  transition: background .12s, box-shadow .12s;
}
/* 周六/周日 与工作日做颜色区分（浅蓝底 + 红色日期数字），且不影响选中/今天态 */
.cal-cell.cal-weekend { background: #f3f6ff; }
.cal-cell.cal-weekend .cal-daynum { color: #ef4444; }
.cal-cell:hover { background: #f7faff; box-shadow: 0 0 0 1px var(--primary, #2563eb) inset; }
.cal-cell.other { background: #fafafa; color: #b6bcc6; }
.cal-cell.today { border-color: var(--primary, #2563eb); }
.cal-cell.sel { background: #eef4ff; box-shadow: 0 0 0 2px var(--primary, #2563eb) inset; }
.cal-daynum { font-size: 15px; font-weight: 600; }
.cal-cell.other .cal-daynum { font-weight: 400; }
.cal-badges { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.cal-badge {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 18px;
  padding: 0 4px; border-radius: 4px; font-size: 11px; font-weight: 600; line-height: 1;
}
.cal-badge.cal-so { background: #dbeafe; color: #1d4ed8; }
.cal-badge.cal-po { background: #ccfbf1; color: #0f766e; }
.cal-dot { color: #d97706; font-size: 10px; }
.cal-panel {
  flex: 2 1 0; min-width: 0; min-height: 360px; padding: 12px;
  border: 1px solid #e5e7eb; border-radius: 8px; background: #fff;
}
.cal-panel-empty { color: var(--text-sub, #6b7280); font-size: 13px; text-align: center; margin-top: 60px; }
/* 常驻事项（面板上半块）：不绑日期、始终显示；限高滚动，不挤掉下面的当日记事 */
.cal-pinned { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px dashed #d7dbe3; }
.cal-pinned-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-pinned-title { font-size: 14px; font-weight: 700; }
.cal-pinned-sub { font-size: 11px; color: var(--text-sub, #6b7280); }
.cal-pinned-toggle {
  margin-left: auto; background: none; border: none; color: var(--primary, #2563eb);
  font-size: 12px; cursor: pointer; padding: 2px 4px; border-radius: 4px;
}
.cal-pinned-toggle:hover { background: #eef4ff; }
.cal-pinned .cal-notes { max-height: 190px; overflow-y: auto; }
.cal-panel-head { margin-bottom: 10px; }
.cal-panel-date { font-size: 15px; font-weight: 700; }
.cal-panel-due { font-size: 12px; color: var(--text-sub, #6b7280); margin-top: 4px; display: flex; align-items: center; gap: 6px; }
.cal-add { display: flex; gap: 6px; margin: 10px 0; }
.cal-input { flex: 1; padding: 7px 9px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 13px; }
.cal-notes { display: flex; flex-direction: column; gap: 8px; }
.cal-loading, .cal-empty { color: var(--text-sub, #6b7280); font-size: 13px; text-align: center; padding: 20px 0; }
.note-item { display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; }
.note-item.done { background: #f7f7f8; }
.note-item.done .note-content { text-decoration: line-through; color: #9aa0a6; }
.note-check { margin-top: 3px; width: 16px; height: 16px; cursor: pointer; flex: 0 0 auto; }
.note-body { flex: 1; min-width: 0; }
.note-content { font-size: 13.5px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.note-meta { font-size: 11px; color: var(--text-sub, #6b7280); margin-top: 3px; }
.note-del { background: none; border: none; color: #c0c4cc; cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 4px; border-radius: 4px; flex: 0 0 auto; }
.note-del:hover { color: var(--danger, #dc2626); background: #fde8e8; }
@media (max-width: 760px) {
  .cal-body { flex-direction: column; }
  .cal-grid { width: 100%; flex-basis: auto; }
  .cal-panel { width: 100%; flex-basis: auto; min-width: 0; max-width: none; }
}

/* ===== 按采购单号批量登记到货 ===== */
.batch-search { position: relative; margin-bottom: 14px; }
.batch-search input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.batch-search input:focus { outline: none; border-color: var(--primary); }
.batch-empty, .batch-loading { color: var(--text-sub); padding: 18px; text-align: center; border: 1px dashed var(--border); border-radius: 8px; }
.batch-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 14px; flex-wrap: wrap; gap: 8px; }
.batch-shared {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-bottom: 14px;
  background: #f8fafc; padding: 12px; border-radius: 8px; border: 1px solid var(--border);
}
.batch-shared .full { grid-column: 1 / -1; }
.batch-shared .form-item { display: flex; flex-direction: column; gap: 4px; }
.batch-shared label { font-size: 12px; color: var(--text-sub); }
.batch-shared input, .batch-shared select { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.batch-table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* 表格区独立滚动：填满弹窗高度、共享字段（日期/税率等）保持可见，多行时只滚表格 */
.batch-table-wrap { overflow: auto; max-height: calc(96vh - 340px); margin-top: 4px; }
.batch-table th, .batch-table td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; white-space: nowrap; }
.batch-table th { background: #f1f5f9; font-weight: 600; }
.batch-table .num { text-align: right; }
.batch-table .cell-input { width: 92px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; text-align: right; font-size: 13px; }
.batch-table .cell-input:focus { outline: none; border-color: var(--primary); }
.batch-table tr.batch-done { background: #f0fdf4; }
.batch-table tr.batch-done:hover { background: #ecfdf3; }
.tag-done { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #dcfce7; color: #15803d; font-size: 12px; font-weight: 600; }
/* 批量登记出货（v144）：已交齐的行用浅灰底表示（仍可填，退货补发用），与入库「已收齐」绿底区分。
   注意顺序：本行必须写在 batch-over / batch-hit 之前，同优先级下让后者覆盖底色。 */
.batch-table tr.bs-done > td { background: #f8fafc; color: #64748b; }
.batch-table tr.bs-done .cell-input { color: var(--text); }
.batch-table tr.batch-over td { background: #fff7ed; }
/* 搜索料号/物料后，命中的明细行用琥珀黄高亮，便于在长单里快速定位 */
.batch-table tr.batch-hit > td { background: #fff3bf; }
.batch-table tr.batch-hit:hover > td { background: #ffe9a8; }
.batch-foot-note { margin-top: 10px; font-size: 12px; color: var(--text-sub); line-height: 1.6; }

/* ===== 「待填写」日期（2026-11-02）=====
   供应商直发客户的单子，登记的那一刻还不知道实际进出日期，等货到了才知道。
   原生 <input type="date"> 塞不进中文，所以在右边配一个勾选框：勾上 → 清空并禁用日期框，
   库里存文本「待填写」；取消 → 日期框恢复可用并补今天的日期。
   列表里「待填写」的行整行淡黄底 + 日期列一个小标签，扫一眼就能挑出还没补真实日期的。 */
.date-pending { display: flex; align-items: center; gap: 8px; }
.date-pending > input[type="date"] { flex: 1 1 auto; min-width: 0; }
.date-pending > input[type="date"]:disabled { background: #f3f4f6; color: #9ca3af; cursor: not-allowed; }
/* 提高优先级盖掉 .form-item label 的 display:block / margin-bottom */
.form-item .date-pending label.pending-chk {
  display: inline-flex; align-items: center; gap: 4px; margin-bottom: 0;
  white-space: nowrap; font-size: 12px; color: var(--text-sub);
  cursor: pointer; user-select: none;
}
.form-item .date-pending label.pending-chk input[type="checkbox"] { width: 14px; height: 14px; margin: 0; cursor: pointer; }
.form-item .date-pending label.pending-chk:has(input:checked) { color: var(--warning); font-weight: 600; }
.pending-tag {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  background: #fef3c7; color: #b45309; border: 1px solid #fcd34d;
  font-size: 12px; line-height: 1.6; white-space: nowrap;
}
/* 注意：与第 112 行的 tr:hover td 同优先级，靠写在后面生效；hover 用更深一档，仍能看出鼠标在哪行 */
tr.row-pending > td { background: #fffbeb; }
tr.row-pending:hover > td { background: #fef3c7; }
/* 退货 / 罚款行（2026-11-05 用户要求「红色突出显示」）：浅红底 + 左侧红条 + 日期列小标签 + 负值红字 */
tr.row-return > td { background: #fff1f2; }
tr.row-return:hover > td { background: #ffe4e6; }
tr.row-return > td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.ret-tagline { margin-top: 2px; }
.neg-num { color: var(--danger); font-weight: 600; }
/* 日期区间筛选旁的提醒：本次筛选不含「待填写」（那类行没有具体日期，落不进任何区间） */
.dr-pending-note {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 10px;
  background: #fff7ed; color: #b45309; border: 1px solid #fed7aa;
  font-size: 12px; white-space: nowrap; cursor: help;
}

/* ===== 候选订单列表（2026-11-02）=====
   批量到货/出货弹窗的搜索框右侧加了「显示全部历史」开关，所以输入框与开关要排一行；
   候选行里除了「未交/已收齐」还要显示客户交期，过期的标红。 */
.batch-search-row { display: flex; align-items: center; gap: 10px; }
.batch-search-row > input { flex: 1 1 auto; min-width: 0; }
.batch-search .hist-toggle {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  font-size: 12.5px; color: var(--text-sub); cursor: pointer; user-select: none;
}
/* 盖掉 .batch-search input 的 width:100%，否则勾选框被拉成一个宽条 */
.batch-search .hist-toggle input[type="checkbox"] { width: 14px; height: 14px; margin: 0; cursor: pointer; flex: 0 0 auto; }
.batch-search .hist-toggle:hover { color: var(--text); }

/* 候选行里的「客户交期」：常规灰字，过期红字（红=要优先发/催） */
.due-txt { font-size: 12.5px; color: var(--text-sub); font-variant-numeric: tabular-nums; }
.due-txt.due-late { color: var(--danger); font-weight: 600; }

/* 已交齐 / 已收齐的候选：整行灰掉但仍可点（补发、补收货场景） */
.search-list .search-item.is-closed { opacity: .62; }
.search-list .search-item.is-closed:hover { opacity: .8; }

/* 候选行里的「料号 + 物料名」（2026-11-02 用户需求：料号放物料名前面，方便按料号查找区分）
   料号做成小胶囊：等宽数字、浅底、加深字，和后面的物料名一眼分开；
   同一张单多行时用「 / 」串联，超过 3 对只显示前 3 对 + 「等 N 个料号」。 */
.po-items { display: inline; }
/* 一对「料号 + 物料名」不许在中间断开，行宽不够只在「对与对之间」换行 */
.po-item {
  display: inline-block; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}
.po-sep { color: #cbd5e1; font-style: normal; margin: 0 3px 0 5px; }
.cpn-txt {
  display: inline-block; padding: 0 5px; border-radius: 4px;
  background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe;
  font-size: 12px; line-height: 17px; letter-spacing: .2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  vertical-align: 1px;
}
.mname-txt { color: var(--text); }
/* 「N 项 · 欠货 X」不许被拆成两行（之前会断在「2 项 ·」和「欠货 2,600」中间） */
.po-tag { white-space: nowrap; }
.cpn-more { color: var(--text-sub); font-size: 12px; white-space: nowrap; }

/* ===== 进货入库：勾选后的批量条（2026-11-02 用户需求：批量添加支付日期）=====
   形态对齐销售/采购页的批量栏：一条浅底提示带，左边「已勾选 N 行」，
   中间日期输入 + 蓝色主按钮，右边「取消勾选」。 */
#si-batch-bar .si-batch-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 34px; }
#si-batch-bar .si-batch-set { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#si-batch-bar .si-batch-lbl { font-size: 13px; white-space: nowrap; }
/* 日期框旁边的固定说明（鼠标悬停在日期框上还会显示同样的 title 提示） */
#si-batch-bar .si-batch-note { font-size: 12px; color: var(--text-sub); white-space: nowrap; }
#si-batch-bar input[type="date"] {
  /* 130px：批量条现在有「进货日期 / 支付日期」两个日期框，152px 时会挤成三行；130px 刚好两个一行 */
  width: 130px; padding: 6px 8px; font-size: 13px; color: var(--text);
  border: 1px solid #bfdbfe; border-radius: 6px; background: #fff;
}
#si-batch-bar input[type="date"]:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, .15); }
/* 列表首列的勾选框：别让它把行高撑起来 */
#si-tbody .si-check, #si-check-all { width: 15px; height: 15px; margin: 0; cursor: pointer; vertical-align: middle; }
/* 勾选行浅蓝底，和出货页一致；特异性高于 tr.row-pending，待填写行被勾时优先显示选中态。
   ⚠ 销售订单页与销售出货页共用 `id="so-tbody"` 和 `.so-check`（历史命名，两者不同时渲染），
     所以这一条同时覆盖销售订单页 —— 改这里等于同时改两页。 */
#si-tbody tr:has(.si-check:checked) > td,
#so-tbody tr:has(.so-check:checked) > td,
#po-tbody tr:has(.po-check:checked) > td { background: #dbeafe; }

/* ===== 批量条里的「数量合计 / 含税金额合计」=====
   入库、出货两个批量条共用（采购/销售订单页的合计是对齐到列上的绝对定位，另一套，别混用）。
   两侧细竖线把「合计」和「要填的字段」分开，视觉上先看总数再填值。 */
.so-sum { display: inline-flex; align-items: baseline; gap: 16px; padding: 0 14px; border-left: 1px solid #cbd5e1; border-right: 1px solid #cbd5e1; }
.so-sum-item { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.so-sum-item > i { font-style: normal; font-size: 12px; color: var(--text-sub); }
.so-sum-val { font-size: 15px; font-weight: 700; color: #2563eb; font-variant-numeric: tabular-nums; }

/* ===== 销售出货：勾选后的批量条（2026-11-02 用户需求）=====
   5 个字段比入库多，窄屏要能换行；每个「标签 + 输入」自成一个不被拆开的小组。
   按钮组用 margin-left:auto 靠右：同一行时贴右边，换行时落在下一行右侧，
   不会像普通 flex 项那样掉到第二行最左边、看起来像散架。 */
#so-batch-bar .so-batch-actions { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; min-height: 34px; }
#so-batch-bar .so-batch-count { white-space: nowrap; }
/* 「留空的项 = 不改」这条说明已改成各输入框的 placeholder「不改」，腾出位置给合计 */
/* 2026-11-12：按钮组紧跟内容，不再 margin-left:auto 推到容器最右制造空白 */
#so-batch-bar .so-batch-btns { margin-left: 0; display: inline-flex; align-items: center; gap: 8px; }
#so-batch-bar .so-batch-set { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#so-batch-bar .so-batch-lbl { font-size: 13px; white-space: nowrap; color: var(--text); }
#so-batch-bar input[type="text"],
#so-batch-bar input[type="number"],
#so-batch-bar input[type="date"] {
  padding: 6px 8px; font-size: 13px; color: var(--text);
  border: 1px solid #bfdbfe; border-radius: 6px; background: #fff;
}
#so-batch-bar input[type="text"] { width: 132px; }
#so-batch-bar input[type="number"] { width: 92px; }
#so-batch-bar input[type="date"] { width: 140px; }
#so-batch-bar input[type="text"]:focus,
#so-batch-bar input[type="number"]:focus,
#so-batch-bar input[type="date"]:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59, 130, 246, .15); }
#so-batch-bar input:disabled { background: #f1f5f9; color: var(--text-sub); }
/* 「本月」按钮贴着对账账期输入框，小一号 */
#so-batch-bar .so-batch-set .btn-sm { padding: 4px 8px; font-size: 12px; }
/* 单价不可批量改的原因：单独一行、琥珀色，别跟输入挤在一起 */
#so-batch-bar .so-batch-hint { margin-top: 6px; font-size: 12px; color: #b45309; }
#so-tbody .so-check, #so-check-all { width: 15px; height: 15px; margin: 0; cursor: pointer; vertical-align: middle; }
/* 勾选行浅蓝底（规则统一放在上方 `.si-check` 那组，销售/出货/采购共用一处，别在这重复定义） */

/* ============ 备份页：系统 vs Excel 核对（2026-11-02） ============ */
.cmp-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; padding-bottom: 8px; border-bottom: 1px solid #e2e8f0; }
.cmp-tag { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: #f1f5f9; color: #475569; white-space: nowrap; }
.cmp-tag.ok { background: #dcfce7; color: #15803d; }
.cmp-tag.warn { background: #fef3c7; color: #b45309; }
.cmp-src { font-size: 12px; color: var(--text-sub); margin-left: auto; }
.cmp-block { margin: 12px 0; }
.cmp-h { font-size: 13px; font-weight: 700; color: #334155; margin-bottom: 6px; }
.cmp-h.warn { color: #b45309; }
.cmp-more { font-weight: 400; color: var(--text-sub); font-size: 12px; margin-left: 8px; }
.cmp-empty { font-size: 13px; color: var(--text-sub); padding: 2px 0 8px; }
.cmp-scroll { max-height: 260px; overflow: auto; border: 1px solid #e2e8f0; border-radius: 8px; }
.cmp-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.cmp-tbl th { position: sticky; top: 0; background: #f8fafc; text-align: left; padding: 6px 10px; font-weight: 600; color: #475569; border-bottom: 1px solid #e2e8f0; z-index: 1; }
.cmp-tbl td { padding: 6px 10px; border-bottom: 1px solid #f1f5f9; }
.cmp-tbl tr:last-child td { border-bottom: none; }
.cmp-tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* 核对结果表：固定列宽，避免「数量」列被拉成一整片空白（2026-11-02 v162） */
.cmp-tbl { table-layout: fixed; }
.cmp-tbl th:nth-child(1), .cmp-tbl td:nth-child(1) { width: 132px; }
.cmp-tbl th:nth-child(2), .cmp-tbl td:nth-child(2) { width: 66px; }
.cmp-tbl th:nth-child(3), .cmp-tbl td:nth-child(3) { width: 132px; }
.cmp-tbl th:nth-child(4), .cmp-tbl td:nth-child(4) { width: 112px; }
.cmp-tbl th:nth-child(5), .cmp-tbl td:nth-child(5) { width: 232px; }
.cmp-tbl td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== 手机端布局（2026-11-04）=====
   桌面端 220px 侧栏 + 表格最小内容宽度会把整个页面撑出屏幕。
   ≤760px 时侧栏改为顶部横向导航，主区域独立纵向滚动；宽表格仍在各自容器里横向滚动，
   不压缩列、不让 body 横向溢出。打印规则不受影响。 */
@media screen and (max-width: 760px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  body { font-size: 14px; }
  input, select, textarea, .select-search-input { font-size: 16px; } /* 避免 iOS 聚焦输入框自动放大 */
  button, .btn-primary, .btn-ghost, .btn-danger { min-height: 38px; }

  .login-wrap { min-height: 100dvh; padding: 12px; }
  .login-card { width: 100%; max-width: 360px; padding: 26px 22px; }

  #app-view { height: 100dvh; min-height: 0; flex-direction: column; }
  .sidebar {
    width: 100%; flex: 0 0 auto; border-right: 0; border-bottom: 1px solid #dbe3ee;
  }
  .side-logo { padding: 10px 12px 8px; font-size: 16px; }
  .side-logo span { display: inline; margin-left: 8px; font-size: 11px; }
  .side-nav {
    display: flex; gap: 6px; padding: 0 8px 8px; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; scrollbar-width: thin;
  }
  .nav-item {
    flex: 0 0 auto; gap: 6px; margin: 0; padding: 8px 11px;
    white-space: nowrap; font-size: 13px;
  }
  .nav-item .ico { width: auto; font-size: 14px; }
  .side-footer {
    display: flex; align-items: center; gap: 8px; padding: 7px 10px;
    border-top: 1px solid #dbe3ee;
  }
  .side-footer .user-info { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-footer #reset-colw-btn { display: none; }
  .side-footer #logout-btn { width: auto; flex: 0 0 auto; min-height: 32px; padding: 5px 12px; }

  .main { flex: 1 1 auto; min-width: 0; min-height: 0; width: 100%; padding: 12px; overflow-x: hidden; }
  .page-header { align-items: flex-start; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
  .page-title { font-size: 18px; }
  .page-actions { flex-wrap: wrap; gap: 8px; max-width: 100%; }
  .card { min-width: 0; padding: 12px; border-radius: 8px; }
  .toolbar { gap: 8px; }
  .sales-toolbar, .purchase-toolbar, .payment-toolbar, .inventory-toolbar,
  .si-toolbar, .so-toolbar, .ret-toolbar, .mat-toolbar, .sup-toolbar { flex-wrap: wrap; }
  .toolbar > input { flex: 1 1 100%; width: 100%; }
  .toolbar input, .toolbar select { min-width: 0; max-width: 100%; }
  .toolbar .date-range { flex: 1 1 100%; max-width: 100%; justify-content: space-between; }
  .toolbar .date-range input[type="date"] { flex: 1 1 0; width: auto; min-width: 0; }
  .purchase-toolbar input#purchase-search,
  .inventory-toolbar input#inv-search,
  .mat-toolbar input,
  .sup-toolbar input { min-width: 0; flex-basis: 100%; }

  .form-grid, .batch-shared { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: minmax(92px, 34%) minmax(0, 1fr); }
  .modal-mask { padding: 8px; }
  .modal { width: 100% !important; max-width: 100%; max-height: calc(100dvh - 16px); padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; }
  .kpi .kpi-value { font-size: 20px; }
  .pdf-compare { flex-direction: column; }
  .pdf-compare-pdf { min-width: 0; width: 100%; }
  .pager { gap: 6px; }
  .pager .pg-jump-wrap { display: none; }
  .so-sum { padding: 0; border: 0; flex-wrap: wrap; gap: 6px 12px; }
  #si-batch-bar .si-batch-set, #so-batch-bar .so-batch-set { flex-wrap: nowrap; }
  #si-batch-bar input[type="date"] { width: 132px; }
  #so-batch-bar .so-batch-btns { margin-left: 0; flex-wrap: wrap; }
}

/* ===== 页面列表表头居中（v235）=====
   之前 th 跟随全局左对齐，数字列又是右对齐（.num），表头看起来没落在内容上方。
   这里把页面内（.card 里的表格）的表头文字统一居中，单元格内容保持原对齐不变。
   列宽由 th 的宽度决定，与 text-align 无关 —— 表头拖拽调列宽、恢复上次列宽都不受影响。 */
.card table th,
.card table th.num { text-align: center; }
/* 权限表首列是模块名，保持左对齐更易读 */
.card .perm-tbl th:first-child { text-align: left; }

/* ===== v237：列表表格吸顶 + 首列固定 + 批量条悬浮 =====
   说明：表头 sticky 必须有一个「会垂直滚动」的祖先才生效。之前表格外层只有
   overflow-x:auto，垂直方向不滚动，所以 th 的 sticky 等于失效；这里让外层自己
   成为滚动容器（只在高出屏幕时才出现滚动条），表头与左侧列就能固定住。 */
.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 250px);
}
.table-scroll table thead th {
  position: sticky; top: 0; z-index: 6; background: var(--head-bg);
  /* 吸顶后给表头一条实线 + 轻投影，滚动时和正文分层，不再糊在一起 */
  box-shadow: inset 0 -1px 0 var(--head-line), 0 6px 10px -10px rgba(15, 23, 42, .35);
}
/* 勾选列固定 34px，第二列（单号 / 日期）紧贴其后 */
.table-scroll table.sticky-cols th:first-child,
.table-scroll table.sticky-cols td:first-child {
  position: sticky; left: 0; z-index: 3;
  width: 34px; min-width: 34px; max-width: 34px;
  padding-left: 6px; padding-right: 6px; text-align: center;
  background: #fff;
}
.table-scroll table.sticky-cols th:first-child { z-index: 8; background: var(--head-bg); }
.table-scroll table.sticky-cols th:nth-child(2),
.table-scroll table.sticky-cols td:nth-child(2) {
  position: sticky; left: 34px; z-index: 3; background: #fff;
  /* 固定列右侧投影：横向滚动时把固定区和滚动内容分开 */
  box-shadow: 8px 0 8px -8px rgba(15, 23, 42, .22);
}
.table-scroll table.sticky-cols th:nth-child(2) { z-index: 8; background: var(--head-bg); }
/* 固定列要盖住横向滚过来的内容，所以必须有不透明底色；hover 时跟着变 */
.table-scroll table.sticky-cols tbody tr:hover td:nth-child(1),
.table-scroll table.sticky-cols tbody tr:hover td:nth-child(2) { background: var(--row-hover-fixed); }

/* 批量操作条：悬浮在窗口底部，出现 / 消失都不再挤压表格 */
[id$="-batch-bar"] {
  position: fixed; left: calc(var(--sidebar-w) + 20px); right: 20px; bottom: 16px;
  z-index: 40; margin: 0; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18);
}
@media (max-width: 860px) {
  [id$="-batch-bar"] { left: 12px; right: 12px; }
}

/* 骨架屏：列表请求期间的占位灰条 */
.sk-row td { height: 40px; }
.sk-bar {
  display: block; height: 10px; width: 72%; margin: 0 auto; border-radius: 4px;
  background: linear-gradient(90deg, #eef2f7 25%, #e3e9f1 37%, #eef2f7 63%);
  background-size: 400% 100%; animation: sk-shine 1.2s ease-in-out infinite;
}
.sk-row td:nth-child(3n) .sk-bar { width: 56%; }
.sk-row td:nth-child(4n) .sk-bar { width: 84%; }
@keyframes sk-shine {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* 行尾「⋯」菜单：危险操作收在这里，位置由 JS 用 fixed 计算，避免被表格滚动容器裁掉 */
.row-menu { position: relative; display: inline-block; }
.row-menu-btn { font-weight: 700; padding: 2px 6px; letter-spacing: 1px; }
.row-menu-pop {
  display: none; position: absolute; right: 0; top: 100%; z-index: 50;
  min-width: 116px; padding: 4px; text-align: left;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
}
.row-menu-item {
  display: block; width: 100%; padding: 7px 10px; border: none; background: none;
  border-radius: 6px; text-align: left; white-space: nowrap; font-size: 13px; color: var(--text);
}
.row-menu-item:hover { background: #f1f5f9; }
.row-menu-item.danger { color: var(--danger); }
.row-menu-item.danger:hover { background: #fef2f2; }

/* ===== v240：批量操作条改为悬浮胶囊 / 悬浮面板 =====
   之前 ID 规则里的 position:relative 优先级更高，悬浮规则没生效，勾选后仍把表格往下推；
   这里用「ID + 类」选择器压过去，并顺手把销售/采购的两行式合计改成单行内联。 */
#so-batch-bar.batch-pill,
#po-batch-bar.batch-pill {
  position: fixed; left: 50%; right: auto; bottom: 20px; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 32px);
  z-index: 40; display: none; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 0; padding: 8px 12px 8px 16px;
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .16); font-size: 13px;
}
.batch-pill .batch-count b { color: var(--primary); }
.batch-pill .batch-sum { color: #64748b; white-space: nowrap; }
.batch-pill .batch-sum span { color: #0f172a; font-variant-numeric: tabular-nums; }
.batch-pill .batch-btns { display: inline-flex; gap: 6px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* 入库 / 出货页的批量条带日期、价格输入，做成能换行的悬浮面板 */
#si-batch-bar.batch-panel,
#so-batch-bar.batch-panel {
  position: fixed; left: 50%; right: auto; bottom: 16px; transform: translateX(-50%);
  /* 2026-11-12：批量条不再拉到接近整屏宽；内容多则自动换行，避免右侧一大片空白（用户截图反馈） */
  width: max-content; max-width: min(1100px, calc(100vw - 24px)); max-height: 60vh; overflow: auto;
  z-index: 40; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0; padding: 10px 14px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .18); font-size: 13px;
}
/* v241：批量条拖动 —— 整条可按住拖动，左侧 ⠿ 是手柄，单击复位到默认位置
   v242：出现时淡入（transform 由停靠逻辑接管，这里只做透明度，避免和 left/top 打架） */
.batch-pill, .batch-panel { cursor: grab; animation: batchIn .16s ease-out; }
@keyframes batchIn { from { opacity: 0; } to { opacity: 1; } }
.batch-pill.batch-dragging, .batch-panel.batch-dragging { cursor: grabbing; user-select: none; }
.batch-grip {
  color: #cbd5e1; font-size: 15px; line-height: 1; letter-spacing: 1px;
  cursor: grab; user-select: none; padding: 0 2px; flex: none;
}
.batch-grip:hover { color: #64748b; }

@media (max-width: 720px) {
  #so-batch-bar.batch-pill, #po-batch-bar.batch-pill { border-radius: 12px; bottom: 12px; }
  #si-batch-bar.batch-panel, #so-batch-bar.batch-panel { width: calc(100vw - 24px); border-radius: 12px; }
}

@media screen and (max-width: 380px) {
  .main { padding: 8px; }
  .card { padding: 10px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .nav-item { padding: 8px 9px; }
}

/* ===== v248: 看板全局搜索卡 ===== */
.dash-search-card { padding: 14px 20px; margin-bottom: 20px; }
.dash-search-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dash-search-bar input { flex: 1 1 280px; min-width: 220px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.dash-search-result { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow: auto; }
.ds-group { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.ds-ghead { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.ds-gmeta { font-weight: 400; color: var(--text-sub); font-size: 12px; }
.ds-row { display: flex; align-items: baseline; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.ds-row:hover { background: #f8fafc; }
.ds-main { color: var(--primary); font-weight: 600; white-space: nowrap; }
.ds-meta { color: var(--text-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.ds-empty { padding: 6px 8px; color: var(--text-sub); font-size: 12px; }
/* v254 搜索结果：分组头左色条 + 关键词 <mark> 高亮，拉开扫描层级 */
.ds-ghead { border-left: 3px solid var(--primary); padding-left: 8px; }
.ds-main mark, .ds-meta mark { background: #fef08a; color: inherit; padding: 0 1px; border-radius: 2px; }

/* ===== 备案号（工信部要求：网站底部展示，且为可点击链接指向 beian.miit.gov.cn）=====
   固定贴底居中、12px 弱化，不抢内容；容器不接收点击（pointer-events:none）避免挡住下方内容，
   只有链接本身可点。移动端抬高 4px 避开 iPhone 底部安全区。 */
.icp-footer {
  position: fixed;
  left: 0; right: 0; bottom: 8px;
  text-align: center;
  font-size: 12px;
  line-height: 1;
  color: #94a3b8;
  pointer-events: none;
  z-index: 60;
}
.icp-footer a { color: #94a3b8; text-decoration: none; pointer-events: auto; }
.icp-footer a:hover { color: var(--primary); text-decoration: underline; }
@supports (padding: env(safe-area-inset-bottom)) {
  .icp-footer { bottom: calc(8px + env(safe-area-inset-bottom)); }
}
