:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #16a34a;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
}

.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-view {
  position: fixed; inset: 0; z-index: 100;
  background: linear-gradient(160deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: var(--card); border-radius: 16px; padding: 32px 28px;
  width: 100%; max-width: 360px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-logo { font-size: 44px; }
.login-logo-img { width: 200px; max-width: 80%; display: block; margin: 0 auto 6px; border-radius: 8px; }
.brand-logo { height: 20px; vertical-align: middle; margin-right: 8px; border-radius: 3px; }
.login-card h1 { font-size: 20px; margin: 8px 0 4px; }
.login-tip { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.login-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 16px; }
.icp-footer { margin-top: 14px; font-size: 12px; text-align: center; }
.icp-footer a { color: var(--muted, #999); text-decoration: none; }
.icp-footer a:hover { color: var(--primary, #1a6ce0); text-decoration: underline; }

/* ---------- 布局 ---------- */
.app { width: 100%; max-width: none; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: #1e3a8a; color: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.whoami { font-size: 13px; opacity: .85; }
.topbar .btn.ghost { border-color: rgba(255,255,255,.4); color: #fff; }

.login-input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; margin-bottom: 10px; outline: none; }
.login-input:focus { border-color: var(--primary); }

.user-table { margin-top: 14px; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: 12px; word-break: break-all; }

/* ---------- v3 新增 ---------- */
.stat-row { grid-template-columns: repeat(4, 1fr); }
.btn.big { padding: 14px 18px; font-size: 16px; }
.inline-row { display: flex; gap: 8px; align-items: stretch; }
.inline-row .grow { flex: 1; }
.scan-btn { white-space: nowrap; flex: 0 0 auto; }

.lowstock-banner {
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  border-radius: 10px; padding: 12px 14px; font-size: 13px; line-height: 1.8;
  margin-bottom: 12px;
}
.tag.tag-transfer { background: #dbeafe; color: #1d4ed8; }
.thumb { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; cursor: pointer; margin-right: 4px; border: 1px solid var(--line); vertical-align: middle; }

#scan-video-wrap { background: #111; border-radius: 10px; overflow: hidden; min-height: 180px; display: flex; align-items: center; justify-content: center; }
#scan-video { width: 100%; max-height: 240px; object-fit: cover; }
.scan-card { max-width: 400px; }

.img-viewer { max-width: 92vw; max-height: 90vh; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.img-viewer img { max-width: 92vw; max-height: 76vh; border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.4); transition: transform .15s ease; }
/* 大图弹窗操作按钮：实色加大加阴影，白图下方也醒目 */
.img-viewer .btn { padding: 10px 24px; font-size: 15px; font-weight: 600; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.45); }
#img-rot-l, #img-rot-r { background: var(--primary); color: #fff; border: 0; }
#img-close { background: #fff; color: #334155; border: 1px solid #cbd5e1; }

.pending-card .pending-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13px; }
.pending-card .pending-src { color: var(--muted); font-size: 12px; }
.pending-card { margin-bottom: 10px; }

/* ---------- 拍照识别 / 多行入库 ---------- */.ai-preview { max-width: 100%; max-height: 260px; border-radius: 10px; border: 1px solid var(--line); margin-bottom: 10px; }
.ai-row {
  display: grid;
  grid-template-columns: 0.85fr 1.15fr 0.42fr 0.38fr 0.6fr 0.75fr 32px;
  grid-template-areas:
    "cat sub mat mat mat mat del"
    "name name spec spec code code del"
    "unit qty price price amt amt del";
  gap: 6px; margin-bottom: 8px; align-items: center;
}
.ai-row .ai-cat { grid-area: cat; background: #f8fafc; }
.ai-row .ai-sub { grid-area: sub; background: #f8fafc; }
.ai-row .ai-mat { grid-area: mat; }
.ai-row .ai-code { grid-area: code; }
.ai-row .ai-name { grid-area: name; }
.ai-row .ai-spec { grid-area: spec; }
.ai-row .ai-qty { grid-area: qty; }
.ai-row .ai-unit { grid-area: unit; }
.ai-row .ai-price { grid-area: price; }
.ai-row .ai-amt { grid-area: amt; background: #f8fafc; color: #475569; }
.ai-row .row-del { grid-area: del; align-self: stretch; height: auto; }
/* AI 匹配锁定行：已自动填写的大类/小类下拉灰底显示，一眼看出是自动带出不可改 */
.ai-row select:disabled { background: #f1f5f9; color: #64748b; }
/* 入库多行 no-new 模式：无编码/规格/删行按钮；桌面端单行横排 + 行号；名称可整行手输 */
.ai-row .row-no { grid-area: no; text-align: center; color: #94a3b8; font-size: 13px; font-weight: 600; align-self: center; min-width: 18px; }
.ai-row.no-new {
  grid-template-columns: 26px 0.72fr 0.72fr 1fr 1.08fr 0.32fr 0.42fr 0.48fr 0.48fr 26px;
  grid-template-areas: "no cat sub mat name unit qty price amt del";
  gap: 5px;
}
.ai-row.no-new .ai-code { display: none; }
.ml-row {
  display: grid; grid-template-columns: 2fr 1fr 1fr 32px;
  gap: 6px; margin-bottom: 8px; align-items: center;
}
/* 设计单物料行：设备名称/设备数量/生产工厂/图号(编码)/零件名称/型号规格/材质/数量/单位/备注/插入/删除（2026-11-25 严格对齐生产料单列序） */
.bom-row { grid-template-columns: 0.9fr 0.5fr 0.7fr 0.9fr 1.2fr 1fr 0.6fr 0.5fr 0.5fr 0.9fr 30px 30px; }
/* 行间插入按钮：绿色 + 号，点击在该行下方插入空行（自动带上该行设备名称/设备数量/生产工厂）（2026-11-25） */
.bom-row .row-ins {
  border: 0; background: #dcfce7; color: #15803d; border-radius: 8px;
  height: 36px; cursor: pointer; font-size: 15px; font-weight: 600; padding: 0;
}
.bom-row .row-ins:active { background: #bbf7d0; }
/* bom/se 行按 DOM 顺序自动流动，删除按钮跟在备注后（.ai-row 基础的 grid-template-areas 会把 row-del 固定在第 7 列，需解除）（2026-11-25） */
.bom-row, .se-row { grid-template-areas: none; grid-auto-flow: column; grid-auto-rows: auto; }
.bom-row .row-del, .se-row .row-del { grid-area: auto; }
/* BOM 导入按钮：桌面端自然宽度紧凑排在「加一行物料」右侧，禁止 block 拉满整行把页面撑出横向滚动（2026-11-25） */
#bom-import, #bom-wecom { flex: 0 0 auto; padding: 0 18px; }
/* 设备标准件库编辑行（无设备列） */
.se-row { grid-template-columns: 1.2fr 0.8fr 1fr 0.6fr 0.5fr 0.5fr 0.9fr 32px; }
.ai-row .input, .ml-row .input { padding: 8px 8px; font-size: 14px; }
.ol-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.pick-chip {
  border: 1px solid #2563eb; background: #eff6ff; color: #1d4ed8;
  border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.pick-chip:active { background: #dbeafe; }
.cat-filter { max-width: 460px; margin-bottom: 10px; }
/* 库存明细筛选一行横排：仓库/大类/小类/货架号/名称/规格/编码（2026-11-25） */
.stock-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.stock-filters .input { width: auto; flex: 1 1 130px; min-width: 0; }
.stock-filters select.input { flex: 0 1 auto; min-width: 120px; }
@media (max-width: 640px) {
  .stock-filters select.input, .stock-filters .input { flex: 1 1 calc(50% - 8px); }
}
.note-btn {
  border: 0; background: #eef2ff; color: #3730a3; border-radius: 6px;
  padding: 3px 7px; cursor: pointer; font-size: 13px; margin-right: 4px; vertical-align: middle;
}
.note-btn:active { background: #e0e7ff; }
.st-history-card .pending-src { margin-left: 8px; font-size: 12px; color: var(--muted); }
.po-paste-zone {
  border: 2px dashed #93c5fd; background: #eff6ff; border-radius: 10px;
  padding: 16px; text-align: center; color: #1d4ed8; cursor: pointer;
  margin-bottom: 10px; font-size: 14px; outline: none;
}
.po-paste-zone:focus, .po-paste-zone.paste-hot { border-color: #2563eb; background: #dbeafe; }
.po-card { border-left: 4px solid #2563eb; }
.po-card.closed { border-left-color: #9ca3af; opacity: .75; }
.po-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 8px; font-size: 14px; }
.ai-row .row-del, .ml-row .row-del {
  border: 0; background: #fee2e2; color: var(--danger); border-radius: 8px;
  height: 36px; cursor: pointer; font-size: 15px;
}
.match-tag { font-size: 11px; padding: 1px 6px; border-radius: 999px; }
.match-tag.yes { background: #dcfce7; color: var(--ok); }
.match-tag.no { background: #fef3c7; color: var(--warn); }

/* 出库单（打印） */
.note-card {
  background: var(--card); border-radius: 12px; padding: 18px; width: 100%; max-width: 780px;
  max-height: 88vh; display: flex; flex-direction: column;
}
.note-scroll { overflow: auto; }
.note-doc { background: #fff; border: 1px solid #e5e7eb; padding: 24px 28px; color: #111; font-size: 14px; }
.note-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid #111; padding-bottom: 8px; }
.note-title { font-size: 22px; font-weight: 700; letter-spacing: 4px; }
.note-brand { font-size: 13px; color: #555; }
.note-no { margin: 8px 0 4px; font-size: 13px; color: #444; }
.note-meta { width: 100%; margin-bottom: 10px; font-size: 13px; border-collapse: collapse; }
.note-meta td { padding: 3px 12px 3px 0; white-space: nowrap; }
.note-items { width: 100%; border-collapse: collapse; }
.note-items th, .note-items td { border: 1px solid #cbd5e1; padding: 6px 8px; font-size: 13px; }
.note-items th { background: #f1f5f9; font-weight: 600; }
.note-items .num { text-align: right; }
.note-total { margin-top: 10px; font-weight: 700; text-align: right; font-size: 14px; }
.note-remark { margin-top: 6px; font-size: 13px; color: #333; }
.note-sign { margin-top: 16px; font-size: 12px; color: #555; }
.note-signline { margin-top: 18px; font-size: 13px; color: #222; }

@media print {
  #app, #login-view, #toast, #confirm-mask, #scan-mask, #img-mask { display: none !important; }
  #note-mask { position: static !important; display: block !important; background: #fff !important; padding: 0 !important; }
  #note-mask .note-card { box-shadow: none; max-width: none; max-height: none; padding: 0; border-radius: 0; background: #fff; }
  #note-mask .note-scroll { overflow: visible; }
  #note-mask .btn-row { display: none !important; }
  .note-doc { border: 0; }
}

@media (max-width: 640px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .content { padding-bottom: 76px; }
  /* 手机端顶栏标题不换行，给右侧刷新/退出按钮留位 */
  .topbar-title { white-space: nowrap; font-size: 15px; }
  .brand-logo { width: 20px; height: 20px; }
  .whoami { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* 移动端底部大按钮导航 */
  .tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: #fff; border-top: 1px solid var(--line); border-bottom: 0;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    gap: 2px;
  }
  .tab { flex: 1; padding: 10px 2px; font-size: 12px; text-align: center; border-radius: 8px; border-bottom: 0; }
  .tab.active { background: #eff6ff; }
  .thumb { width: 44px; height: 44px; }
  .img-cell-add { width: 44px; height: 44px; font-size: 16px; }
}

.tabs {
  display: flex; gap: 4px; padding: 8px 12px 0;
  background: var(--card); border-bottom: 1px solid var(--line);
  overflow-x: auto; position: sticky; top: 0; z-index: 10;
}
.tab {
  border: 0; background: transparent; padding: 10px 14px; font-size: 14px;
  color: var(--muted); cursor: pointer; border-radius: 8px 8px 0 0; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.content { padding: 16px 16px 40px; flex: 1; }
.page { display: none; }
.page.active { display: block; }

.section-title { font-size: 15px; margin: 20px 0 10px; color: var(--text); }

/* ---------- 卡片 / 表单 ---------- */
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 8px;
}
.card-title { font-size: 15px; margin-bottom: 12px; }
.form-grid {
  display: grid; grid-template-columns: 130px 1fr; gap: 10px 12px; align-items: center;
  margin-bottom: 14px;
}
.form-grid label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
/* 双列紧凑表单（报价单 2026-11-25）：一行两对 label/控件 */
.form-grid-2 { grid-template-columns: 110px 1fr 110px 1fr; }
/* 名片/照片粘贴框：点击后 Ctrl+V 粘贴剪贴板截图（报价单名片、客户档案名片/照片通用） */
#q-card-paste, #cu-card-paste, #cu-img-paste {
  border: 1.5px dashed #94a3b8; border-radius: 8px; padding: 7px 12px; font-size: 13px;
  color: #64748b; cursor: pointer; outline: none; white-space: nowrap;
}
#q-card-paste:focus, #cu-card-paste:focus, #cu-img-paste:focus { border-color: #2563eb; color: #2563eb; background: #eff6ff; }
@media (max-width: 900px) {
  .form-grid-2 { grid-template-columns: 110px 1fr; }
}
@media (max-width: 640px) {
  .form-grid-2 { grid-template-columns: 1fr; }
  .form-grid-2 label { margin-top: 6px; }
}
/* 字段网格：label 在上、控件在下，多字段并排压缩表头高度（快速入库 2 行布局） */
.fld-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 10px; margin-bottom: 14px; }
.fld-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.fld-grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
/* 库存总表：列多易超宽，压缩内边距字号，长文本列允许换行，保证窄窗口下全部列可见 */
#stock-table th, #stock-table td { padding: 8px 5px; font-size: 13px; }
#stock-table th { padding-top: 6px; padding-bottom: 6px; }
#stock-table .row-ops .edit-btn, #stock-table .row-ops .del-btn { padding: 2px 2px; font-size: 12px; margin: 0; }
#stock-table td:nth-child(1), #stock-table td:nth-child(2), #stock-table td:nth-child(3),
#stock-table td:nth-child(4), #stock-table td:nth-child(5) { white-space: normal; }
.fld-grid.cols-7 { grid-template-columns: 0.8fr 0.85fr 1.2fr 0.8fr 0.8fr 0.9fr 1fr; }
.fld-grid .fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fld-grid .fld label { font-size: 13px; color: var(--muted); }
.fld-grid .fld .input { width: 100%; }
.fld-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) {
  /* 手机端压缩表头（含 cols-5/6/7）改为一行横排 + 向右滑动，与操作记录表格滑动方向一致 */
  .fld-grid, .fld-grid.cols-5, .fld-grid.cols-6, .fld-grid.cols-7 {
    display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
    gap: 6px; padding-bottom: 4px;
  }
  /* 字段窄一点排密些；控件内边距/字号与明细行一致，保证行高对齐 */
  .fld-grid .fld { flex: 0 0 112px; min-width: 0; }
  /* 日期字段：显示的是两位年份覆盖层，可以更窄更矮（与明细行输入框同高） */
  .fld-grid .fld:has(input[type="date"]) { flex-basis: 94px; }
  /* 手机端日期框更窄更矮（覆盖层全局样式见上方通用块） */
  .date-cov-wrap input[type="date"] { padding: 4px 5px; font-size: 13px; height: 33px; -webkit-appearance: none; appearance: none; }
  .date-cov-wrap input[type="date"]::-webkit-calendar-picker-indicator { margin-left: 0; }
  .date-cover {
    position: absolute; left: 7px; top: 50%; transform: translateY(-50%);
    font-size: 14px; color: var(--text); pointer-events: none; white-space: nowrap;
  }
  .fld-grid .fld .input { padding: 8px 8px; font-size: 14px; height: auto; }
  /* 日期框放在通用 .input 规则之后：压住 height:auto，与明细行输入框同高（36px） */
  .fld-grid .fld .date-cov-wrap input[type="date"] { padding: 4px 5px; height: 33px; }
  .fld-grid .fld .date-cover { font-size: 13px; left: 6px; }
  .fld-grid .fld label { font-size: 12px; }
}
/* 自定义字段容器不占网格格子：空时无占位，有内容时子元素直接作为网格项排布 */
#cu-custom-fields { display: contents; }
.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; background: #fff; color: var(--text); outline: none;
}
.input:focus { border-color: var(--primary); }
.link-btn {
  border: 0; background: none; color: var(--primary); font-size: 12px; cursor: pointer; padding: 0;
}
.hint { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }

.btn {
  border: 0; border-radius: 8px; padding: 11px 18px; font-size: 15px; cursor: pointer;
  background: #e5e7eb; color: var(--text); font-weight: 500;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:active { background: var(--primary-dark); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---------- 表格 ---------- */
.table-wrap {
  background: var(--card); border-radius: var(--radius); overflow-x: auto;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
/* 日期短显示（全端）：输入框文字透明化 + 覆盖层显示两位年份（26-11-22），真实值不变 */
.date-cov-wrap { position: relative; display: block; width: 100%; }
.date-cov-wrap input[type="date"] { color: transparent; min-height: 0; }
.date-cover {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; color: var(--text); pointer-events: none; white-space: nowrap;
}
/* 最近出入库/调拨记录表：每个字段放不下都自动换行（手机端保持换行） */
#in-table, #out-table, #tf-table { min-width: 0; }
#in-table th, #in-table td, #out-table th, #out-table td, #tf-table th, #tf-table td {
  white-space: normal; word-break: break-word; vertical-align: middle;
}
/* 电脑端改回单行显示：放不下的文字用省略号隐藏，悬停可见全文（2026-11-24） */
@media (min-width: 641px) {
  #in-table, #out-table, #tf-table { table-layout: fixed; }
  #in-table th, #in-table td, #out-table th, #out-table td, #tf-table th, #tf-table td {
    white-space: nowrap; word-break: normal; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
  }
  /* 凭证列与删除操作列给足固定宽度、不裁切内容 */
  #in-table th:nth-child(12), #out-table th:nth-child(14), #tf-table th:nth-child(9) { width: 180px; }
  #in-table th:last-child, #out-table th:last-child, #tf-table th:last-child { width: 72px; overflow: visible; }
  #in-table td:nth-child(12), #out-table td:nth-child(14), #tf-table td:nth-child(9),
  #in-table td:last-child, #out-table td:last-child, #tf-table td:last-child { overflow: visible; }
  /* 默认列宽（可拖拽覆盖）：入库表（2026-11-24 列序：日期/采购单号/分类/物料/型号/编码/数量/单价/供应商/经办/库位；凭证列收窄省出的 3% 补给物料/型号/编码） */
  #in-table th:nth-child(1) { width: 6.5%; }
  #in-table th:nth-child(2) { width: 8.5%; }
  #in-table th:nth-child(3) { width: 9%; }
  #in-table th:nth-child(4) { width: 9%; }
  #in-table th:nth-child(5) { width: 8.5%; }
  #in-table th:nth-child(6) { width: 9%; }
  #in-table th:nth-child(7) { width: 5%; }
  #in-table th:nth-child(8) { width: 5%; }
  #in-table th:nth-child(9) { width: 8.5%; }
  #in-table th:nth-child(10) { width: 5.5%; }
  #in-table th:nth-child(11) { width: 6%; }
  /* 默认列宽：出库表（多 类型/项目 两列；采购单号在日期后；省出的 3% 补给物料/型号/编码） */
  #out-table th:nth-child(1) { width: 5.5%; }
  #out-table th:nth-child(2) { width: 6.5%; }
  #out-table th:nth-child(3) { width: 4.5%; }
  #out-table th:nth-child(4) { width: 5.5%; }
  #out-table th:nth-child(5) { width: 8.5%; }
  #out-table th:nth-child(6) { width: 8.5%; }
  #out-table th:nth-child(7) { width: 7.5%; }
  #out-table th:nth-child(8) { width: 6%; }
  #out-table th:nth-child(9) { width: 4.5%; }
  #out-table th:nth-child(10) { width: 4.5%; }
  #out-table th:nth-child(11) { width: 9%; }
  #out-table th:nth-child(12) { width: 5%; }
  #out-table th:nth-child(13) { width: 5.5%; }
  /* 默认列宽：调拨表 */
  #tf-table th:nth-child(1) { width: 7%; }
  #tf-table th:nth-child(2) { width: 9%; }
  #tf-table th:nth-child(3) { width: 10%; }
  #tf-table th:nth-child(4) { width: 6%; }
  #tf-table th:nth-child(5) { width: 9%; }
  #tf-table th:nth-child(6) { width: 9%; }
  #tf-table th:nth-child(7) { width: 6%; }
  #tf-table th:nth-child(8) { width: 12%; }
  /* 凭证列与删除列也用百分比（合计恒 ≤100%，任何窗口宽度都不产生横向滚动）；in/out 操作按钮并入凭证列后放宽到 14%（容纳 缩略图+➕+📎+✏️/删除 单行，2026-11-24） */
  #in-table th:nth-child(12), #out-table th:nth-child(14) { width: 14%; }
  #tf-table th:nth-child(9) { width: 11%; }
  /* tf 操作列仍独立成列；in/out 的 last-child 已是凭证合并列（宽度由上面 13% 规则决定，勿再设 5%） */
  #tf-table th:last-child { width: 5%; overflow: visible; }
  #in-table td:nth-child(12), #out-table td:nth-child(14), #tf-table td:nth-child(9),
  #in-table td:last-child, #out-table td:last-child, #tf-table td:last-child { overflow: visible; }
  /* 凭证列/操作列：内容列内布局，禁止向右溢出撑出横向滚动（table[id] td:has(.img-cell-add) 的 nowrap+min-width:140 会被这里覆盖） */
  #in-table td:nth-child(12), #out-table td:nth-child(14), #tf-table td:nth-child(9),
  #in-table td:last-child, #out-table td:last-child, #tf-table td:last-child {
    white-space: normal !important; min-width: 0 !important;
  }
  /* 凭证列按钮与缩略图紧凑化：缩略图24 + 三个24px按钮 + 间距 ≈ 99px，950px 视口（列宽≈104px）单行放下 */
  #in-table td:nth-child(12) .thumb, #out-table td:nth-child(14) .thumb, #tf-table td:nth-child(9) .thumb { width: 24px; height: 24px; }
  #in-table td:nth-child(12) .img-cell-add, #out-table td:nth-child(14) .img-cell-add, #tf-table td:nth-child(9) .img-cell-add,
  #in-table td:nth-child(12) .img-cell-paste, #out-table td:nth-child(14) .img-cell-paste, #tf-table td:nth-child(9) .img-cell-paste {
    width: 24px; height: 24px; font-size: 12px; margin-right: 1px;
  }
  #in-table td:nth-child(12) .img-cell-wrap, #out-table td:nth-child(14) .img-cell-wrap, #tf-table td:nth-child(9) .img-cell-wrap { margin-right: 1px; }
  /* 操作列：两按钮紧凑纵向叠放（每枚宽 ≤32px、高约 20px），行高基本不变且不溢出 */
  #tf-table td:last-child .note-btn, #tf-table td:last-child .del-btn {
    display: block; margin: 1px auto; padding: 1px 5px; font-size: 12px; line-height: 16px; white-space: nowrap; text-align: center;
  }
  /* 操作列收窄内边距 + 删除按钮小一号：950px 视口（列内容宽 34px）也不溢出 */
  #tf-table td:last-child { padding-left: 2px; padding-right: 2px; }
  #in-table td:last-child .del-btn, #out-table td:last-child .del-btn, #tf-table td:last-child .del-btn { font-size: 11px; }
  /* in/out 凭证列已并入 ✏️/删除 按钮（rec-action）：td 保持 table-cell，内部 .cell-flex 均匀分布使按钮等距（2026-11-24） */
  #in-table td:nth-child(12), #out-table td:nth-child(14) { padding-left: 3px; padding-right: 3px; }
  #in-table td:nth-child(12) .cell-flex, #out-table td:nth-child(14) .cell-flex, #q-table td:nth-child(12) .cell-flex {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px;
  }
  /* 电脑端禁止这三张表横向滚动（列宽百分比已保证不溢出） */
  .table-wrap:has(> #in-table), .table-wrap:has(> #out-table), .table-wrap:has(> #tf-table) { overflow-x: hidden; }
}
/* 编辑/删除按钮组（并入凭证列，全端生效）：纵向叠放跟随凭证按钮之后 */
.rec-action { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; }

/* ---------- PO 号分组选择面板（2026-11-24）：大类=项目编号，小类=采购单号 ---------- */
#po-pick-panel {
  position: fixed; z-index: 3000; max-height: 46vh; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .18); padding: 4px;
}
#po-pick-panel.hidden { display: none; }
.po-pick-group {
  position: sticky; top: 0; z-index: 1;
  font-size: 12px; font-weight: 600; color: #475569;
  background: #f1f5f9; padding: 5px 10px; margin-top: 3px;
  border-radius: 6px;
}
.po-pick-item { padding: 6px 10px; cursor: pointer; border-radius: 6px; display: flex; flex-direction: column; gap: 1px; }
.po-pick-item:hover { background: #eff6ff; }
.po-pick-item b { font-size: 13px; color: var(--text); font-weight: 600; }
.po-pick-item span { font-size: 12px; color: #64748b; }
.po-pick-empty { padding: 12px; color: #94a3b8; font-size: 13px; text-align: center; }
/* 手机端（2026-11-24）：出入库/调拨记录表单行显示，整行横排向右滑动；点单元格弹出完整内容 */
@media (max-width: 640px) {
  #in-table th, #in-table td, #out-table th, #out-table td, #tf-table th, #tf-table td {
    white-space: nowrap; word-break: normal;
  }
}
.fulltext-bubble {
  position: fixed; z-index: 9999; max-width: 82vw;
  background: #1e293b; color: #fff; font-size: 13px; line-height: 1.6;
  padding: 8px 12px; border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.28);
  pointer-events: none; white-space: normal; word-break: break-word;
}
/* 复制凭证选择列表（2026-11-24） */
.imgcopy-item { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 6px; }
.imgcopy-item:hover { background: #f1f5f9; }
.imgcopy-item img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex: 0 0 auto; }
.imgcopy-item .imgcopy-info { min-width: 0; flex: 1; }
.imgcopy-item .imgcopy-title { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imgcopy-item .imgcopy-sub { font-size: 12px; color: #64748b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 数据表允许每个字段换行显示（2026-11-23）：流水/月度报表/库存查询/盘点/PO卡片/请购卡片/采购计划 */
#q-table th, #q-table td, #r-table th, #r-table td, #stock-table th, #stock-table td,
#st-table th, #st-table td, #po-list table th, #po-list table td,
#rq-list table th, #rq-list table td, #plan-result table th, #plan-result table td {
  white-space: normal; word-break: break-word; vertical-align: middle;
}
/* 加工任务表：表头冻结（往下拉表头始终可见） */
.table-wrap.sticky-head { max-height: calc(100vh - 265px); overflow: auto; }
.table-wrap.sticky-head table thead th {
  position: sticky; top: 0; z-index: 2;
  box-shadow: inset 0 -1px 0 var(--line);
}
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 13px; background: #f9fafb; }
/* 可排序表头 */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--primary); }
th.sortable.sorted { color: var(--primary); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: 0; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.tag.ok { background: #dcfce7; color: var(--ok); }
.tag.warn { background: #fef3c7; color: var(--warn); }
.tag.type-in { background: #dcfce7; color: var(--ok); }
.tag.type-out { background: #fee2e2; color: var(--danger); }
.tag.tag-info { background: #dbeafe; color: #1d4ed8; }

.del-btn { border: 0; background: none; color: var(--danger); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.edit-btn { border: 0; background: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 2px 4px; }

.empty { color: var(--muted); text-align: center; padding: 24px 0; font-size: 14px; }

/* ---------- 汇总卡片 ---------- */
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 4px; }
.stat-card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); text-align: center;
}
.stat-card .num { font-size: 24px; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.stat-card .label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card.warn .num { color: var(--warn); }

/* ---------- 提示 / 确认 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%);
  background: rgba(31,41,55,.92); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; z-index: 200; max-width: 86vw; text-align: center;
}
.toast.error { background: rgba(220,38,38,.95); }
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 150;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.confirm-card {
  background: var(--card); border-radius: 12px; padding: 20px; max-width: 340px; width: 100%;
}
.confirm-card p { margin-bottom: 16px; font-size: 14px; line-height: 1.6; }

.tips { padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 2; }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; gap: 4px; }
  .form-grid label { margin-top: 6px; }
  .stat-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat-card .num { font-size: 20px; }
  .tab { padding: 10px 10px; font-size: 13px; }
  .content { padding: 12px 12px 40px; }
}

/* 用户仓库权限复选框 */
.wh-checks { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; padding: 6px 0; }
.wh-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; }
.wh-item input { accent-color: var(--primary, #2563eb); }

/* 盘点表：单元格内嵌扁平输入框（像直接在表格里填数） */
#st-table { min-width: 760px; }
#st-table th { background: #f7f8fa; color: #6b7280; font-weight: 500; padding: 11px 14px; }
#st-table td { padding: 10px 14px; }
#st-table td.st-cell { padding: 0; }
#st-table .st-actual {
  display: block; width: 100%; box-sizing: border-box;
  border: 0; border-radius: 0; background: transparent;
  padding: 11px 14px; font-size: 15px; font-family: inherit;
  text-align: right; font-variant-numeric: tabular-nums;
  color: var(--text); outline: none;
  -moz-appearance: textfield; appearance: textfield;
}
#st-table .st-actual::-webkit-outer-spin-button,
#st-table .st-actual::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#st-table .st-actual::placeholder { color: #c3c8d1; font-size: 13px; }
#st-table .st-actual:hover { background: #f8fafc; }
#st-table .st-actual:focus { background: #eff6ff; box-shadow: inset 0 0 0 2px var(--primary); }
#st-table .st-diff { font-weight: 600; }
#st-table tbody tr:hover { background: #fbfcfe; }

/* ---------- 左侧菜单布局 ---------- */
.layout { display: flex; align-items: stretch; min-height: calc(100vh - 53px); }
.sidebar {
  width: 172px; flex-shrink: 0; background: var(--card);
  border-right: 1px solid var(--line);
  padding: 10px 8px; display: flex; flex-direction: column; gap: 4px;
  /* 左侧菜单跟随视口：右侧列表滚动时菜单固定在屏幕内 */
  position: sticky; top: var(--topbar-h, 54px); align-self: flex-start;
  max-height: calc(100vh - var(--topbar-h, 54px)); overflow-y: auto;
}
.snav {
  border: 0; background: none; text-align: left; padding: 13px 14px;
  font-size: 15px; border-radius: 10px; cursor: pointer; color: var(--text);
  white-space: nowrap;
}
.snav:hover { background: #f0f3f8; }
.snav.active { background: #e8effd; color: var(--primary); font-weight: 600; }
.content { flex: 1; min-width: 0; padding: 16px 18px 60px; }
/* 大屏满屏时内容区留足边距 */
@media (min-width: 1400px) {
  .content { padding: 20px 28px 60px; }
}
.subtabs {
  display: flex; gap: 6px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 6px; margin-bottom: 14px; overflow-x: auto;
  position: sticky; top: var(--topbar-h, 54px); z-index: 20;
}
.subtab {
  flex: 1; border: 0; background: none; padding: 11px 16px;
  font-size: 14px; border-radius: 8px; cursor: pointer;
  color: var(--muted); white-space: nowrap; font-weight: 500;
}
.subtab:hover { background: #f0f3f8; }
.subtab.active { background: var(--primary); color: #fff; font-weight: 600; }

@media (max-width: 640px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; flex-direction: row; flex-wrap: wrap;
    border-right: 0; border-bottom: 1px solid var(--line); padding: 6px;
    position: static; max-height: none; align-self: auto;
  }
  /* 手机端主导航上下 2 行（每行 4 个），不再左右滑动 */
  .snav { padding: 9px 4px; font-size: 13px; flex: 1 1 calc(25% - 6px); min-width: 0; text-align: center; border-radius: 8px; white-space: normal; }
  .content { padding: 12px 12px 40px; }
  .subtab { padding: 9px 12px; font-size: 13px; }
  .table-wrap.sticky-head { max-height: calc(100vh - 300px); }
}

/* 销售角色：只显示客户管理/签约项目/仓库管理（仓库组内仅库存总表） */
.is-sales .snav { display: none; }
.is-sales .snav[data-page="crm"],
.is-sales .snav[data-group="wh"] { display: block; }

/* 采购人员：隐藏待确认；仓库管理组内仅库存总表（无入库/出库/调拨/盘点/流水查询/报表） */
.is-purchase .snav[data-page="pending"] { display: none; }

/* 单价列仅管理员可见（入库/出库记录表，采购金额不让仓库人员看到） */
body:not(.is-admin) .price-col { display: none; }

/* 设计人员：只显示设计单 + 仓库管理（组内仅库存总表） */
.is-design .snav { display: none; }
.is-design .snav[data-page="design"],
.is-design .snav[data-group="wh"] { display: block; }

/* 销售：库存总表 + 签约项目 */
.is-sales .snav[data-page="projects"] { display: block; }

/* 无 CRM 权限的角色隐藏客户管理菜单 */
body.is-nocrm .snav[data-page="crm"] { display: none; }

/* 生产管理人员/生产文员：显示仓库管理（组内仅库存总表）+ 生产管理组 */
.is-prod .snav { display: none; }
.is-prod .snav[data-group="wh"],
.is-prod .snav[data-group="prod"] { display: block; }

/* 只读角色（生产管理人员）隐藏工时登记表单，统计仍可见 */
body.is-readonly [data-workhour-form] { display: none; }

/* ===== CRM 页签与组件 ===== */
.crm-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
  position: sticky; top: var(--topbar-h, 54px); z-index: 18;
  background: var(--bg);
  padding: 8px 0 10px; margin-top: -8px;
  box-shadow: 0 6px 10px -8px rgba(15, 23, 42, .18);
}
.crm-tab { border: 1px solid var(--border, #d6dee9); background: #fff; color: var(--text, #1e293b); padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.crm-tab:hover { color: var(--primary, #2563eb); border-color: var(--primary, #2563eb); }
.crm-tab.active { background: var(--primary, #2563eb); color: #fff; border-color: var(--primary, #2563eb); font-weight: 600; }
.crm-sec { display: none; }
@media (max-width: 768px) {
  .crm-tabs { position: static; box-shadow: none; margin-top: 0; padding: 0; }
  /* 手机端 CRM 页签固定上下 2 栏（每行 4 个） */
  .crm-tab { flex: 1 1 calc(25% - 6px); min-width: 0; padding: 9px 4px; text-align: center; font-size: 13px; white-space: normal; }
}
.crm-sec.active { display: block; }
.crm-filter-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.kpi-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px; padding: 12px 14px; }
.kpi-card .kpi-label { font-size: 12px; color: #64748b; }
.kpi-card .kpi-value { font-size: 20px; font-weight: 700; color: #1e293b; margin-top: 4px; }
.kpi-card .kpi-value small { font-size: 12px; font-weight: 400; color: #64748b; }
.kpi-card .kpi-sub { font-size: 11px; color: #94a3b8; margin-top: 2px; }
.funnel-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.funnel-label { width: 88px; text-align: right; font-size: 13px; color: #334155; flex: none; }
.funnel-bar-wrap { flex: 1; background: #f1f5f9; border-radius: 6px; overflow: hidden; height: 26px; }
.funnel-bar { height: 100%; background: linear-gradient(90deg, #2563eb, #60a5fa); border-radius: 6px; min-width: 2px; display: flex; align-items: center; padding: 0 8px; }
.funnel-bar-text { font-size: 12px; color: #fff; white-space: nowrap; }
.funnel-nums { width: 150px; flex: none; font-size: 12px; color: #64748b; }
.tag-row { display: flex; gap: 4px; flex-wrap: wrap; }
.tag-chip { background: #eff6ff; color: #1d4ed8; border-radius: 10px; padding: 1px 8px; font-size: 11px; white-space: nowrap; }
.tag-chip.warn { background: #fef2f2; color: #b91c1c; }
.pool-pub { background: #f0fdf4; color: #15803d; border-radius: 10px; padding: 1px 8px; font-size: 11px; }
.pool-priv { background: #eff6ff; color: #1d4ed8; border-radius: 10px; padding: 1px 8px; font-size: 11px; }
.stage-sel { font-size: 12px; padding: 2px 4px; }

/* 报价单合计栏 */
.q-sum-bar { display: flex; gap: 22px; align-items: baseline; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; padding: 8px 12px; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 13px; color: #334155; }
.q-sum-bar b { font-size: 15px; }

/* ===== 批量选择产品弹窗 ===== */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-mask.hidden { display: none; }
.modal-panel { background: #fff; border-radius: 12px; width: min(1180px, 96vw); height: min(780px, 92vh); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 70px rgba(15, 23, 42, .35); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #e5e7eb; background: #f8fafc; }
.modal-x { margin-left: auto; border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: #64748b; padding: 0 4px; }
.modal-x:hover { color: #b91c1c; }
.modal-body { flex: 1; display: flex; min-height: 0; }
.pick-tree { width: 208px; flex: none; border-right: 1px solid #e5e7eb; overflow-y: auto; padding: 8px 6px; font-size: 13px; background: #fcfdff; }
.pick-tree .tree-item { padding: 5px 8px; border-radius: 6px; cursor: pointer; color: #475569; }
.pick-tree .tree-item:hover { background: #eff6ff; }
.pick-tree .tree-item.active { background: #dbeafe; color: #1d4ed8; font-weight: 600; }
.pick-tree .tree-cat { font-weight: 600; color: #334155; margin-top: 4px; }
.pick-tree .tree-sub { padding-left: 22px; font-size: 12.5px; }
.pick-tree .tree-count { color: #94a3b8; font-weight: 400; font-size: 11.5px; margin-left: 4px; }
.pick-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pick-toolbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #e5e7eb; }
.pick-table-wrap { flex: 1; overflow: auto; }
#q-pick-table { font-size: 12.5px; }
#q-pick-table th { position: sticky; top: 0; background: #f1f5f9; z-index: 1; white-space: nowrap; font-size: 12px; }
#q-pick-table td { vertical-align: middle; padding: 4px 6px; }
#q-pick-table input[type="number"] { width: 62px; padding: 3px 4px; font-size: 12.5px; }
#q-pick-table tr.picked { background: #f0f9ff; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid #e5e7eb; background: #f8fafc; }

/* 报价单客户：自绘下拉建议面板 */
.cust-ac{position:relative}
.cust-ac::after{content:'▾';position:absolute;right:10px;top:50%;transform:translateY(-50%);color:#94a3b8;pointer-events:none;font-size:12px}
.cust-ac .input{padding-right:26px}
.cust-ac-drop{position:absolute;top:calc(100% + 3px);left:0;right:0;z-index:70;background:#fff;border:1px solid #cbd5e1;border-radius:6px;max-height:240px;overflow-y:auto;box-shadow:0 8px 24px rgba(15,23,42,.14)}
.cust-ac-item{padding:7px 12px;font-size:13px;cursor:pointer;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cust-ac-item small{color:#64748b;margin-right:8px;font-size:11px}
.cust-ac-item:hover{background:#eff6ff}
.cust-ac-empty{padding:9px 12px;font-size:12.5px;color:#64748b;line-height:1.6}

/* 产品逐级选择面板（报价明细：大类 → 小类 → 产品） */
.pp-panel{position:fixed;z-index:85;width:660px;max-width:calc(100vw - 20px);background:#fff;border:1px solid #e2e8f0;border-radius:10px;box-shadow:0 14px 36px rgba(15,23,42,.18);overflow:hidden}
.pp-search-wrap{display:flex;align-items:center;gap:6px;padding:8px 10px;border-bottom:1px solid #eef2f7;background:#f8fafc}
.pp-search-ico{font-size:12px;color:#94a3b8}
.pp-search{flex:1;height:30px;font-size:12.5px}
.pp-close{border:0;background:transparent;color:#94a3b8;font-size:18px;line-height:1;cursor:pointer;padding:0 4px}
.pp-close:hover{color:#dc2626}
.pp-body{display:flex;height:272px}
.pp-col{flex:1;min-width:0;overflow-y:auto;border-right:1px solid #f1f5f9}
.pp-col:last-child{border-right:0}
.pp-col-t{position:sticky;top:0;z-index:1;background:#f8fafc;color:#64748b;font-size:11px;font-weight:600;letter-spacing:.4px;padding:6px 10px;border-bottom:1px solid #eef2f7}
.pp-count{color:#94a3b8;font-weight:400}
.pp-item{display:flex;align-items:center;gap:8px;padding:6px 10px;font-size:12.5px;color:#334155;cursor:pointer;border-left:2px solid transparent}
.pp-item:hover{background:#eff6ff;color:#1d4ed8}
.pp-item.active{background:#dbeafe;color:#1d4ed8;border-left-color:#2563eb;font-weight:600}
.pp-item .pp-txt{flex:1;min-width:0}
.pp-item .pp-name{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pp-item .pp-thumb{width:38px;height:38px;object-fit:cover;border-radius:6px;border:1px solid #e2e8f0;background:#f8fafc;flex:none}
.pp-item .pp-meta{display:block;color:#94a3b8;font-size:11px;font-weight:400;margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pp-item.active .pp-meta{color:#3b82f6}
.pp-empty{padding:16px 10px;color:#94a3b8;font-size:12px;line-height:1.7}
.pp-foot{padding:6px 10px;border-top:1px solid #eef2f7;background:#f8fafc;color:#94a3b8;font-size:11px}


/* 报价明细行图片单元格 */
.qi-img-wrap{position:relative;width:60px;height:36px}
.qi-img-add{width:100%;height:100%;border:1px dashed #cbd5e1;border-radius:4px;background:#f8fafc;color:#64748b;font-size:11px;cursor:pointer;padding:0}
.qi-img-add:hover{border-color:#3b82f6;color:#2563eb}
.qi-img-thumb{width:100%;height:100%;object-fit:cover;border:1px solid #cbd5e1;border-radius:4px;display:block;cursor:pointer}
.qi-img-del{position:absolute;top:-5px;right:-5px;width:16px;height:16px;line-height:14px;padding:0;font-size:11px;border-radius:50%;border:0;background:rgba(15,23,42,.7);color:#fff;cursor:pointer}

/* 线索列表：列宽百分比自适应容器，不出横向滚动条 */
#crm-lead-table{table-layout:fixed;width:100%}
#crm-lead-table th:nth-child(1){width:5%}
#crm-lead-table th:nth-child(2){width:14%}
#crm-lead-table th:nth-child(3){width:6.5%}
#crm-lead-table th:nth-child(4){width:9.5%}
#crm-lead-table th:nth-child(5){width:8%}
#crm-lead-table th:nth-child(6){width:7%}
#crm-lead-table th:nth-child(7){width:5.5%}
#crm-lead-table th:nth-child(8){width:6%}
#crm-lead-table th:nth-child(9){width:7.5%}
#crm-lead-table th:nth-child(10){width:6%}
/* 操作列占剩余宽度，按钮紧凑排列不换行 */
#crm-lead-table th:nth-child(11){width:25%}
#crm-lead-table td{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* 操作列完整显示所有按钮，不截断 */
#crm-lead-table td:last-child{overflow:visible;text-overflow:clip;white-space:nowrap}
/* 电话列完整显示号码，不截断 */
#crm-lead-table td:nth-child(4){overflow:visible;text-overflow:clip}
/* 操作列按钮紧凑化 */
#crm-lead-table td:last-child .note-btn,#crm-lead-table td:last-child .del-btn{padding:2px 5px;font-size:11px;margin:1px 0;white-space:nowrap}
/* 列宽拖拽热区（th 已是 sticky 定位元素，可作 absolute 子元素包含块） */
/* 列宽拖拽手柄：默认隐藏线条（避免表头出现突兀竖线），悬停表头时显示浅灰提示、
   拖拽悬停时变蓝；命中区加宽到 12px 并跨在列边界上，更好抓 */
.col-resizer{position:absolute;top:0;right:-6px;width:12px;height:100%;cursor:col-resize;z-index:3;border-right:2px solid transparent}
/* 最后一列的手柄内收，避免伸出表格右缘产生横向滚动 */
th:last-child .col-resizer{right:0}
th:hover .col-resizer{border-right-color:#e2e8f0}
th:hover .col-resizer:hover{border-right-color:#3b82f6;background:rgba(37,99,235,.12)}
/* 线索列表：下滑时筛选行冻结在顶栏下方 */
#ld-filter-row{position:sticky;top:var(--topbar-h,54px);z-index:15;background:var(--card,#fff);padding:8px 0 4px;margin-top:2px}
/* 线索列表：表头在表格容器内冻结（容器高度扣除顶栏+筛选行） */
#crm-lead-wrap.table-wrap.sticky-head{max-height:calc(100vh - 300px)}

/* 产品价格库表：固定布局 + 百分比列宽，切换大类/小类筛选重渲染时列不再抖动 */
#crm-prod-table{table-layout:fixed;width:100%}
/* 容器固定高度 + 内部滚动：切换筛选时行数增减只影响容器内滚动，页面高度不变，产品价格库区域不上下跳动 */
#pr-table-wrap{height:min(55vh,640px);min-height:320px}
#crm-prod-table thead th:nth-child(1){width:12%}
#crm-prod-table thead th:nth-child(2){width:11%}
#crm-prod-table thead th:nth-child(3){width:17%}
#crm-prod-table thead th:nth-child(4){width:8%}
#crm-prod-table thead th:nth-child(5){width:18%}
#crm-prod-table thead th:nth-child(6){width:6%}
#crm-prod-table thead th:nth-child(7){width:5%}
#crm-prod-table thead th:nth-child(8){width:6%}
#crm-prod-table thead th:nth-child(9){width:6%}
#crm-prod-table thead th:nth-child(10){width:11%}
/* 文本列单行省略，避免行高跳动；操作列保持按钮完整 */
#crm-prod-table td{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#crm-prod-table td:last-child{overflow:visible}
#crm-prod-table td .qi-img-wrap{overflow:visible}

/* 订单/回款图片缩略图与查看 */
.img-thumbs{display:flex;gap:8px;flex-wrap:wrap;margin-top:8px}
.img-thumbs .img-thumb{position:relative;width:72px;height:72px;border:1px solid #e2e8f0;border-radius:8px;overflow:hidden}
.img-thumbs .img-thumb img{width:100%;height:100%;object-fit:cover;display:block;cursor:zoom-in}
.img-thumbs .img-thumb .img-del{position:absolute;top:0;right:0;background:rgba(15,23,42,.6);color:#fff;border:0;width:18px;height:18px;line-height:18px;font-size:12px;cursor:pointer;padding:0}
#iv-list img{max-width:100%;border:1px solid #e2e8f0;border-radius:8px;margin-bottom:10px;display:block}
/* 快递表单发货单照片预览区（2026-11-23）*/
#shipf-prev{margin-top:8px}
#shipf-prev .img-thumb{width:96px;height:96px}
#shipf-prev .img-thumb.ship-pdf-thumb{display:flex;align-items:center;justify-content:center;padding:4px;font-size:11px;text-align:center;color:#475569;word-break:break-all}
#shipf-prev .img-thumb.ship-pdf-thumb .img-del{position:absolute;top:0;right:0}
/* 发货单照片大粘贴区（2026-11-23）：常显虚线框，点击选择/Ctrl+V 粘贴/拖拽 */
.img-drop{margin-top:8px;border:2px dashed #cbd5e1;border-radius:10px;padding:8px;min-height:96px;background:#f8fafc;cursor:pointer;transition:border-color .15s, background .15s}
.img-drop:hover{border-color:#94a3b8}
.img-drop.over{border-color:#3b82f6;background:#eff6ff}
.img-drop-empty{color:#94a3b8;font-size:13px;text-align:center;padding:24px 6px}
.img-drop-empty b{color:#3b82f6}
@media (max-width: 640px) {
  .img-drop{min-height:80px}
  .img-drop-empty{padding:16px 4px;font-size:12px}
}

/* ---------- 移动端优化（2026-11-21） ---------- */
@media (max-width: 640px) {
  /* 1. 输入控件字号≥16px，避免 iOS 聚焦自动放大页面 */
  .input, select.input, textarea.input, .login-input { font-size: 16px !important; }
  /* 2. 顶栏紧凑化：标题缩小、角色文字缩小，防止挤压 */
  .topbar { padding: 8px 10px; }
  .topbar-title { font-size: 16px; }
  .whoami { font-size: 12px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* 3. 主导航横向滚动条隐藏（手机上占空间），保留滑动能力 */
  .sidebar { scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .sidebar::-webkit-scrollbar { display: none; }
  /* 4. 表格容器顺滑横向滚动 */
  .table-wrap, .sticky-head { -webkit-overflow-scrolling: touch; }
  /* 5. 按钮文字不折行，防止「选择图片」被拆成竖排 */
  .btn { white-space: nowrap; }
  /* 6. KPI 统计卡两列排布，数字更易读 */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  /* 7. 下拉/弹层卡片宽度贴边 */
  .modal-card, .note-card { max-width: calc(100vw - 24px) !important; }
}

/* 记住密码（2026-11-21） */
.login-remember { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--muted); margin-top: 12px; cursor: pointer; user-select: none; }
.login-remember input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }

/* 仓库人员（operator）隐藏设计单（2026-11-21） */
body.is-op .snav[data-page="design"] { display: none; }
/* 仓库人员隐藏生产管理组（2026-11-21） */
body.is-op .snav[data-group="prod"] { display: none; }
/* 仓库人员隐藏签约项目（2026-11-21） */
body.is-op .snav[data-page="projects"] { display: none; }
/* 仓库人员无采购角色：隐藏采购管理（2026-11-21；2026-11-23 改分组导航） */
body.is-op-nopo .snav[data-page="po"],
body.is-op-nopo .snav[data-group="po"] { display: none; }

/* 签约项目人员 / 设计单人员（2026-11-21）：多角色权限取并集，追加开放对应菜单 */
body.is-proj .snav[data-page="projects"] { display: block !important; }
body.is-designer .snav[data-page="design"] { display: block !important; }
/* 纯签约项目人员/设计单人员：只显示本人菜单 + 仓库管理组内仅库存总表（2026-11-21） */
body.is-restricted .snav { display: none; }
body.is-restricted .snav[data-group="wh"] { display: block; }
body.is-restricted.is-proj .snav[data-page="projects"] { display: block; }
body.is-restricted.is-designer .snav[data-page="design"] { display: block; }
/* 仓库细分角色（仅入库/出库/盘点/查询）：只显示仓库管理组与待确认 */
body.is-whonly .snav { display: none; }
body.is-whonly .snav[data-group="wh"],
body.is-whonly .snav[data-page="pending"] { display: block; }
/* 纯安装角色（安装调试/派工/调试/领料/验收/费用，无其他岗位角色）：只显示安装调试组与待确认（2026-11-25） */
body.is-instonly .snav { display: none; }
body.is-instonly .snav[data-group="inst"],
body.is-instonly .snav[data-page="pending"] { display: block; }
/* 修复手机端页面超宽：按钮行允许换行（2026-11-21） */
@media (max-width: 640px) {
  .btn-row { flex-wrap: wrap; }
  .btn-row .btn { flex: 1 1 calc(50% - 5px); min-width: 0; }
  /* BOM 三个按钮手机端两列换行（ID 规则优先级高，需 # 前缀覆盖）（2026-11-25） */
  #bom-form-card .btn-row .btn { flex: 1 1 calc(50% - 5px); }
  html, body { overflow-x: hidden; }
}
/* 手机端 inline-row 允许换行，提示文字单独成行（2026-11-21） */
@media (max-width: 640px) {
  .inline-row { flex-wrap: wrap; }
  .inline-row > span { flex: 1 1 100%; min-width: 0; }
}
/* 手机端子页签栏（入库/出库/调拨等）折成上下两栏，不再横向右滑（2026-11-21） */
@media (max-width: 640px) {
  .subtabs { flex-wrap: wrap; overflow-x: visible; }
  .subtab { flex: 1 1 calc(25% - 6px); min-width: 0; white-space: normal; padding: 9px 4px; text-align: center; }
}
/* 手机端明细行改为一行横排 + 向右滑动（与表头、操作记录表格滑动方向一致） */
@media (max-width: 640px) {
  /* 请购/退货明细行字段定宽（2026-11-23 采购扩展） */
  .rq-row .input, .rt-row .input { flex: 0 0 96px; min-width: 0; padding: 8px; font-size: 14px; }
  .rq-row .ri-name, .rt-row .rt-name { flex: 0 0 150px; }
  .rq-row input[type="date"] { flex: 0 0 94px; }
  .ai-row, .ai-row.no-new {
    display: flex; overflow-x: auto; -webkit-overflow-scrolling: touch;
    gap: 6px; padding-bottom: 4px; align-items: center;
  }
  .ai-row > * { flex: 0 0 auto; }
  .ai-row .row-no { flex: 0 0 20px; }
  .ai-row .ai-cat, .ai-row .ai-sub { flex: 0 0 96px; }
  .ai-row .ai-mat { flex: 0 0 180px; }
  .ai-row .ai-code { flex: 0 0 130px; }
  .ai-row .ai-name { flex: 0 0 170px; }
  .ai-row .ai-spec { flex: 0 0 150px; }
  .ai-row .ai-qty { flex: 0 0 72px; }
  .ai-row .ai-unit { flex: 0 0 64px; }
  .ai-row .ai-price { flex: 0 0 84px; }
  .ai-row .ai-amt { flex: 0 0 96px; }
  .ai-row .row-del { flex: 0 0 36px; }
}

/* AI 识别状态提示：蓝底高亮醒目，无内容时自动隐藏（2026-11-21） */
.ai-status-line {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid #2563eb;
  color: #1d4ed8;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.7;
  margin-top: 6px;
}
.ai-status-line:empty { display: none; }
/* AI 识别中的「取消识别」按钮：小号红字边框按钮，嵌在状态行右侧 */
.ai-cancel-btn {
  border: 1px solid #fca5a5; background: #fef2f2; color: #dc2626;
  border-radius: 6px; padding: 2px 10px; font-size: 12px; cursor: pointer;
  margin-left: 8px; vertical-align: middle;
}
.ai-cancel-btn:active { background: #fee2e2; }

/* ---------- 凭证图片管理：缩略图右上角×删除 + 末尾➕补传 ---------- */
.img-cell-wrap { position: relative; display: inline-block; margin-right: 3px; }
.img-cell-del {
  position: absolute; top: -5px; right: -5px; width: 16px; height: 16px;
  line-height: 13px; padding: 0; font-size: 12px; text-align: center;
  border-radius: 50%; border: 1px solid #fca5a5; background: #fef2f2;
  color: #dc2626; cursor: pointer; z-index: 2;
}
.img-cell-del:hover { background: #fee2e2; }
.img-cell-add {
  border: 1px dashed #94a3b8; background: transparent; color: #64748b;
  border-radius: 6px; width: 34px; height: 34px; font-size: 14px; cursor: pointer;
  vertical-align: middle; margin-right: 3px;
}
.img-cell-add:hover { border-color: var(--primary); color: var(--primary); }
/* 📋 粘贴按钮：与➕同尺寸并排，蓝色调区分 */
.img-cell-paste { border-style: solid; border-color: #bfdbfe; background: #eff6ff; color: #2563eb; font-size: 13px; }
.img-cell-paste:hover { border-color: var(--primary); background: #dbeafe; }
/* 凭证列（2026-11-24）：缩略图/➕/📋 强制同一行不折行（列宽不够时列自动变宽），
   避免被其它列挤窄后竖着一行一个、行高被撑高。带 id 的表需单独列出以压过 #表 td 的换行规则 */
#in-table td:has(.img-cell-add), #out-table td:has(.img-cell-add), #q-table td:has(.img-cell-add),
#tf-table td:has(.img-cell-add), #st-table td:has(.img-cell-add),
table[id] td:has(.img-cell-add) { white-space: nowrap; min-width: 140px; }

/* ---------- 产品分类设置 ---------- */
.mc-addrow { display: flex; gap: 8px; margin-bottom: 12px; }
.mc-list { display: flex; flex-direction: column; gap: 10px; }
.mc-cat {
  border: 1px solid var(--bd, #e2e8f0);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--card2, #f8fafc);
}
.mc-cat-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mc-dot { width: 10px; height: 10px; border-radius: 50%; background: #3b82f6; flex: none; }
.mc-cat-input { max-width: 220px; font-weight: 600; }
.mc-cnt { color: #64748b; font-size: 12px; }
.mc-subs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; padding-left: 18px; }
.mc-sub {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid #dbeafe; color: #1e40af;
  border-radius: 14px; padding: 3px 10px; font-size: 12.5px; line-height: 1.6;
}
.mc-sub i { font-style: normal; cursor: pointer; opacity: .55; font-size: 11px; }
.mc-sub i:hover { opacity: 1; }
.mc-sub-add { display: inline-flex; align-items: center; gap: 4px; }
.mc-sub-add .input { width: 110px; font-size: 12.5px; padding: 3px 8px; }
body.dark .mc-cat { background: #1e293b; border-color: #334155; }
body.dark .mc-sub { background: #0f172a; border-color: #334155; color: #93c5fd; }
.mc-idx {
  width: 22px; height: 22px; border-radius: 50%;
  background: #3b82f6; color: #fff; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; font-weight: 600;
}
.mc-move { display: inline-flex; gap: 4px; margin-left: auto; }
.mc-move .btn { padding: 2px 8px; min-width: 28px; }
.mc-sub i { width: 14px; text-align: center; }
body.dark .mc-idx { background: #2563eb; }
.mc-move-panel {
  background: #fff; border-radius: 12px; width: min(440px, 94vw);
  max-height: 80vh; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 24px 70px rgba(15, 23, 42, .35);
}
.mc-move-body {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.mc-move-cat-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left; padding: 10px 14px; font-weight: 600;
}
.mc-move-cnt { font-weight: 400; font-size: 12px; color: #64748b; }
body.dark .mc-move-panel { background: #1e293b; }
.mc-no {
  font-style: normal; font-weight: 700; font-size: 11px;
  color: #fff; background: #60a5fa; border-radius: 8px;
  min-width: 16px; height: 16px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
body.dark .mc-no { background: #3b82f6; }
.row-ops { white-space: nowrap; }
.row-ops .edit-btn, .row-ops .del-btn { margin: 0 2px; }
.mat-modal-panel {
  background: #fff; border-radius: 12px; width: min(640px, 94vw);
  max-height: 88vh; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 24px 70px rgba(15, 23, 42, .35);
}
.mat-modal-body { flex: 1; overflow-y: auto; padding: 14px 18px; }
body.dark .mat-modal-panel { background: #1e293b; }
/* 多行快速入库行：大类/小类/物料/数量/单价/删除 */
.ml-row.ml-in-row { grid-template-columns: 0.85fr 0.85fr 1.7fr 0.7fr 0.7fr 32px; }
@media (max-width: 640px) {
  .ml-row.ml-in-row {
    grid-template-columns: 1fr 1fr 32px;
    grid-template-areas: "cat sub del" "mat mat mat" "qty price price";
  }
  .ml-row.ml-in-row .ml-cat { grid-area: cat; }
  .ml-row.ml-in-row .ml-sub { grid-area: sub; }
  .ml-row.ml-in-row .row-del { grid-area: del; }
  .ml-row.ml-in-row .ml-mat { grid-area: mat; }
  .ml-row.ml-in-row .ml-qty { grid-area: qty; }
  .ml-row.ml-in-row .ml-price { grid-area: price; }
}

/* ---------- 全站体验统一抛光（2026-11-23，不改功能） ---------- */
/* 统一细滚动条：桌面端所有区域（表格/侧栏/明细横滑）观感一致 */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, .35); border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(100, 116, 139, .55); }
*::-webkit-scrollbar-track { background: transparent; }
/* 按钮/页签统一按压反馈与过渡，触感更一致 */
.btn, .subtab, .snav, .note-btn, .edit-btn, .del-btn, .row-del { transition: filter .15s ease, transform .06s ease; }
.btn:active, .subtab:active, .snav:active { transform: scale(.97); }
.btn:hover, .subtab:hover { filter: brightness(.96); }
/* 键盘操作焦点可见（无障碍/电脑端 Tab 导航） */
.btn:focus-visible, .input:focus-visible, .snav:focus-visible, .subtab:focus-visible, select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
/* 手机端触控目标加大：行内小按钮不小于 36px 高度 */
@media (max-width: 640px) {
  .note-btn, .edit-btn, .del-btn { padding: 7px 10px; font-size: 14px; }
  .row-del { min-width: 36px; min-height: 36px; }
}
/* 数字统一等宽显示（金额/数量列不再跳动） */
td.num, .num { font-variant-numeric: tabular-nums; }

/* 采购单列表折叠卡片（2026-11-23）：默认只显示摘要行，点表头展开明细 */
.po-card .po-detail { display: none; }
.po-card.open .po-detail { display: block; }
.po-card .po-head { cursor: pointer; flex-wrap: wrap; row-gap: 4px; }
.po-card .po-head:hover { background: rgba(37, 99, 235, .05); border-radius: 8px; }
.po-caret { color: var(--primary); font-size: 14px; font-weight: 700; width: 16px; text-align: center; flex: 0 0 auto; }

/* 采购单状态徽章（2026-11-23）：底色填充，一状态一颜色，显眼 */
.po-st { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; white-space: nowrap; letter-spacing: .5px; box-shadow: 0 1px 3px rgba(15, 23, 42, .18); }
.po-st-wait { background: #f59e0b; }    /* ⏳ 待发货 橙 */
.po-st-shipped { background: #2563eb; } /* 🚚 已发货 蓝 */
.po-st-part { background: #0891b2; }    /* 🟡 部分入库 青 */
.po-st-pay { background: #dc2626; }     /* 💰 待支付 红 */
.po-st-done { background: #16a34a; }    /* ✅ 已入库 绿 */
.po-st-closed { background: #9ca3af; }  /* 已关闭 灰 */

/* 采购单列表筛选栏（2026-11-23） */
.po-filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0 10px; }
.po-filter-bar .input { max-width: 240px; }
.po-filter-bar .tips { color: var(--muted); }
/* 流水查询筛选条：自适应多列，宽屏一行放下、窄屏自动折两行 */
.filter-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 8px 10px; align-items: end; margin-bottom: 14px; }
/* 采购单表单头部：更紧凑列宽，8 列位（2+2+1+1+1+1）一行放下 */
.po-form-bar { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); }
.filter-bar .fld { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter-bar .fld label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.filter-bar .fld .input { width: 100%; }
.filter-bar .btn { white-space: nowrap; }
@media (max-width: 640px) {
  .filter-bar { grid-template-columns: repeat(2, 1fr); }
  .filter-bar .btn { grid-column: 1 / -1; }
}
/* 日期范围紧凑一组：横排不折行 */
.po-date-range { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; flex: 0 0 auto; }
.po-date-range .input { width: 122px; min-width: 122px; max-width: 122px; padding: 7px 6px; }
@media (max-width: 640px) {
  .po-filter-bar .input { max-width: none; flex: 1 1 45%; }
  .po-date-range { flex: 1 1 100%; }
  .po-date-range .input { flex: 1; min-width: 0; width: auto; max-width: none; }
}

/* 采购单发货快递区块（2026-11-23） */
.ship-block { margin-top: 10px; padding: 8px 10px; background: rgba(37, 99, 235, .04); border-radius: 8px; }
.ship-title { font-size: 13px; font-weight: 700; display: flex; align-items: center; }
.ship-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0 0 0; }
.ship-no { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.ship-track { color: var(--primary); font-size: 13px; text-decoration: none; white-space: nowrap; }
.ship-track:hover { text-decoration: underline; }
.ship-thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; border: 1px solid rgba(100, 116, 139, .35); cursor: zoom-in; }
.ship-file { font-size: 13px; color: #2563eb; }

/* 最近出入库记录分页条（2026-11-23） */
.tbl-pager { display: flex; align-items: center; gap: 8px; padding: 6px 2px; flex-wrap: wrap; }
.tbl-pager .pg-info { color: var(--muted); font-size: 13px; margin-right: auto; }
.tbl-pager .btn[disabled] { opacity: .45; cursor: default; }
@media (max-width: 640px) {
  .tbl-pager { justify-content: center; }
  .tbl-pager .pg-info { width: 100%; text-align: center; margin-right: 0; }
}

/* 采购单明细行：单行横排（名称/编码/规格/单位/数量/单价/交期/删除），不再继承 ai-row 多行网格 */
.po-row {
  display: flex; flex-wrap: nowrap; gap: 6px; margin-bottom: 8px; align-items: center;
}
.po-row .pi-cat { flex: 0.5 1 76px; min-width: 0; }
.po-row .pi-sub { flex: 0.5 1 76px; min-width: 0; }
.po-row .pi-name { flex: 1.4 1 150px; min-width: 0; }
.po-row .pi-code { flex: 0.9 1 110px; min-width: 0; }
.po-row .pi-spec { flex: 0.8 1 96px; min-width: 0; }
.po-row .pi-unit { flex: 0.4 1 56px; min-width: 0; }
.po-row .pi-qty { flex: 0.5 1 70px; min-width: 0; }
.po-row .pi-price { flex: 0.6 1 80px; min-width: 0; }
.po-row .pi-expect { flex: 0 0 128px; min-width: 0; }
.po-row .row-del { flex: 0 0 32px; height: auto; }
@media (max-width: 640px) {
  .po-row { overflow-x: auto; }
  .po-row > * { flex: 0 0 auto; }
  .po-row .pi-cat { flex: 0 0 96px; }
  .po-row .pi-sub { flex: 0 0 96px; }
  .po-row .pi-name { flex: 0 0 170px; }
  .po-row .pi-code { flex: 0 0 120px; }
  .po-row .pi-spec { flex: 0 0 120px; }
  .po-row .pi-unit { flex: 0 0 64px; }
  .po-row .pi-qty { flex: 0 0 72px; }
  .po-row .pi-price { flex: 0 0 84px; }
  .po-row .pi-expect { flex: 0 0 94px; }
  .po-row .row-del { flex: 0 0 36px; }
}

/* ========== 财务管理（2026-11-23，11 子页） ========== */
/* 财务菜单仅管理员与财务人员可见 */
.fin-only { display: none !important; }
body.is-fin .fin-only { display: block !important; }
/* 总账/资金页内页签面板 */
.finpanel { margin-top: 10px; }
/* 凭证分录行（复用 ai-row 风格） */
[data-fv-row] .fve-code { flex: 1.4; min-width: 140px; }
[data-fv-row] .fve-amt { flex: 1; min-width: 90px; }
@media (max-width: 640px) {
  [data-fv-row] .fve-code { flex: 0 0 150px; }
  [data-fv-row] .fve-amt { flex: 0 0 96px; }
  [data-frc-row] .fr-date { flex: 0 0 118px; }
  [data-frc-row] .fr-desc { flex: 1; min-width: 130px; }
  [data-frc-row] .fr-amt { flex: 0 0 92px; }
}

/* 用户管理：角色按板块分组表格 */
.role-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.role-table th, .role-table td { border: 1px solid var(--border, #e2e8f0); padding: 6px 8px; text-align: left; vertical-align: middle; }
.role-table thead th { background: #f1f5f9; font-weight: 600; }
.role-table td:first-child { font-weight: 600; color: var(--primary); white-space: nowrap; }
.role-table input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* ========== 第三轮全局抛光（2026-11-23，功能零变化） ========== */
/* 文本选区配色（品牌蓝底白字，替代系统默认突兀高亮） */
::selection { background: rgba(37, 99, 235, 0.85); color: #fff; }
/* 移动端 webview 字号防自动放大，滚动回弹更顺滑 */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* 长列表滚动容器统一惯性滚动 */
table-wrap, .tbl-wrap, .list-scroll { -webkit-overflow-scrolling: touch; }
/* 尊重系统"减弱动态效果"偏好：关闭过渡与动画，避免晕动不适 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 签约项目两个表（查询+一览表）：列多，长文本列自动换行让整行在一屏内显示完整，不再横向滚动截断 */
#pj-table, #pjo-table { min-width: 720px; }
#pj-table th, #pj-table td, #pjo-table th, #pjo-table td { white-space: normal; vertical-align: middle; }
/* 短内容列不折行：pj 编号(1)/签约(5)/交货(6)/负责人(7)/操作(12)；pjo 编号(1)/负责人(4)/签约(5)/交货(6) */
#pj-table td:nth-child(1), #pj-table td:nth-child(5), #pj-table td:nth-child(6), #pj-table td:nth-child(7), #pj-table td:nth-child(12),
#pjo-table td:nth-child(1), #pjo-table td:nth-child(4), #pjo-table td:nth-child(5), #pjo-table td:nth-child(6) { white-space: nowrap; }

/* ========== 安装调试模块（2026-11-24） ========== */
.inst-item-row { display: flex; gap: 6px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.inst-item-row .input { flex: 1 1 110px; min-width: 0; }
.inst-item-row .input.inst-std { flex: 0 1 150px; }
.inst-item-row .input.inst-res { flex: 0 0 96px; }
.inst-item-row .row-del { flex: 0 0 auto; white-space: nowrap; }
.inst-ph-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; min-height: 0; }
.inst-ph { position: relative; display: inline-block; }
.inst-ph img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid rgba(0,0,0,.15); display: block; }
.inst-ph .ph-del { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; border: none; background: #e24b4a; color: #fff; font-size: 12px; line-height: 20px; text-align: center; cursor: pointer; padding: 0; }
.inst-ms { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; font-size: 12px; color: #5f5e5a; }
.inst-ms b { color: #0f6e56; font-weight: 500; }
@media (max-width: 640px) {
  .inst-item-row .input { flex: 1 1 100px; }
  .inst-ph img { width: 56px; height: 56px; }
}
.tag.run { background: #dbeafe; color: #185fa5; }

/* 手机端快速报工 FAB（2026-11-24） */
#qr-fab { display: none; position: fixed; right: 14px; bottom: 18px; z-index: 60; width: 56px; height: 56px; border-radius: 50%; border: none; background: #185fa5; color: #fff; font-size: 13px; line-height: 1.2; box-shadow: 0 2px 8px rgba(0,0,0,.25); cursor: pointer; }
#qr-fab:active { background: #0c447c; }
@media (max-width: 640px) { body.show-qr-fab #qr-fab { display: block; } }
#qr-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
#qr-mask.hidden { display: none; }
#qr-panel { background: var(--card, #fff); border-radius: 14px; padding: 16px; width: 100%; max-width: 420px; max-height: 86vh; overflow-y: auto; }
#qr-panel h3 { margin: 0 0 10px; font-size: 15px; font-weight: 500; }
.qr-grid { display: grid; grid-template-columns: 88px 1fr; gap: 8px; align-items: center; }
.qr-grid label { font-size: 13px; color: #444; }
.qr-grid .input { width: 100%; box-sizing: border-box; }

/* 客户档案表：电脑端 fixed 布局一行显示完、无横向滚动条（2026-11-25） */
#crm-cust-table { width: 100%; min-width: 0; }
.table-wrap:has(> #crm-cust-table) { overflow-x: hidden; }
#crm-cust-table .tag-row { flex-wrap: nowrap; overflow: hidden; }
@media (min-width: 641px) {
  #crm-cust-table { table-layout: fixed; }
  #crm-cust-table th, #crm-cust-table td {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
  }
  #crm-cust-table thead th:nth-child(1) { width: 6%; }     /* 编号 */
  #crm-cust-table thead th:nth-child(2) { width: 15%; }    /* 客户名称 */
  #crm-cust-table thead th:nth-child(3) { width: 9%; }     /* 联系人 */
  #crm-cust-table thead th:nth-child(4) { width: 9%; }     /* 电话 */
  #crm-cust-table thead th:nth-child(5) { width: 7%; }     /* 行业 */
  #crm-cust-table thead th:nth-child(6) { width: 7%; }     /* 标签 */
  #crm-cust-table thead th:nth-child(7) { width: 7%; }     /* 归属 */
  #crm-cust-table thead th:nth-child(8) { width: 4.5%; }   /* 优先级 */
  #crm-cust-table thead th:nth-child(9) { width: 7%; }     /* 最后跟进 */
  #crm-cust-table thead th:nth-child(10) { width: 12%; }   /* 跟进/商机 */
  #crm-cust-table thead th:nth-child(11) { width: 16.5%; } /* 操作（6 图标按钮一行放下） */
  /* 客户表操作按钮更紧凑：保证 6 个图标一行放下（2026-11-25） */
  #crm-cust-table .note-btn { padding: 3px 4px; margin-right: 2px; }
  #crm-cust-table .del-btn { padding: 3px 5px; margin: 0; }
}

/* v2026112537：生产组厂区页签改下拉 */
.fab-select { width: auto; flex: 0 0 auto; padding: 5px 10px; font-size: 13px; border-radius: 8px; border: 1px solid #cdd8ee; background: #fff; color: #24406e; min-width: 96px; height: auto; line-height: 1.4; }
@media (max-width: 640px) {
  .fab-select { flex: 1 1 auto; min-width: 0; }
}

/* v2026112538：设计 BOM 卡片折叠（对齐采购单卡片交互） */
.bom-card .bom-detail { display: none; }
.bom-card.open .bom-detail { display: block; }
.bom-card .bom-head { cursor: pointer; flex-wrap: wrap; row-gap: 4px; margin-bottom: 0; }
.bom-card .bom-head:hover { background: rgba(37, 99, 235, .05); border-radius: 8px; }
.bom-card.open .bom-head { margin-bottom: 8px; }

/* v2026112539：设计 BOM 筛选栏（项目/设计人/关键词，三容器共用样式） */
.bom-filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.bom-filter-bar .bom-f-kw { width: auto; flex: 1 1 220px; min-width: 0; }
.bom-filter-bar select.input { width: auto; flex: 0 1 auto; min-width: 130px; }
.bom-filter-bar .bom-f-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) {
  .bom-filter-bar .bom-f-kw { flex: 1 1 100%; }
}

/* v2026112543：库存型号匹配弹窗 */
.bom-match-list { max-height: 340px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 8px; }
.bm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; padding: 7px 10px; border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: 13px; }
.bm-row:hover { background: #f0f6ff; }
.bm-row.sel { background: #dbeafe; outline: 2px solid #2563eb; outline-offset: -2px; border-radius: 6px; }

/* v2026112546：厂区多选浮层（fab 按钮 + checkbox 弹层） */
.fab-wrap { position: relative; display: inline-block; }
.fab-btn { white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.fab-pop { position: fixed; z-index: 90; background: #fff; border: 1px solid #cdd8ee; border-radius: 10px; box-shadow: 0 8px 24px rgba(15,23,42,.16); padding: 8px; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.fab-opt { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.fab-opt:hover { background: #f0f6ff; }
.fab-pop-foot { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px 2px; border-top: 1px solid #eef2f7; margin-top: 4px; }
.fab-pop-foot a { font-size: 12px; color: #2563eb; }
/* 修改加工安排弹窗的加工工厂多选（v2549） */
.po-fab-opt { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border: 1px solid #cdd8ee; border-radius: 8px; font-size: 13px; cursor: pointer; user-select: none; background: #fff; }
.po-fab-opt:hover { background: #f0f6ff; border-color: #93b4f5; }
@media (max-width: 640px) {
  .fab-pop { min-width: 140px; }
}
