/* ===== 联馨玻璃下单系统 公共样式 ===== */
/* 快捷筛选标签（订单管理页） */
.quick-filter .qf.active { background: var(--primary); color: #fff; border-color: var(--primary); }

:root {
  --primary: #1a56db;
  --primary-dark: #1443ab;
  --bg: #f3f5f9;
  --card: #ffffff;
  --border: #e2e6ee;
  --text: #1f2937;
  --muted: #6b7280;
  --danger: #dc2626;
  --success: #059669;
  --warning: #d97706;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
}

/* ---- 顶栏 ---- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand { font-size: 18px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.brand small { font-weight: 400; color: var(--muted); margin-left: 6px; font-size: 13.5px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: thin; }
.nav::-webkit-scrollbar { height: 4px; }
.nav::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav a {
  padding: 6px 14px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  white-space: nowrap;
}
.nav a:hover { background: #eef2fb; color: var(--primary); }
.nav a.active { background: var(--primary); color: #fff; }
.topbar .right { font-size: 13.5px; color: var(--muted); white-space: nowrap; }

/* 中等宽度（1366 笔记本等）压缩导航项，避免菜单末尾被裁掉又看不出还能横向滚动（2026-09-28 易用性优化） */
@media (max-width: 1500px) {
  .nav { gap: 2px; }
  .nav a { padding: 6px 9px; font-size: 14.5px; }
  .brand small { display: none; }
}
@media (max-width: 1280px) {
  .nav a { padding: 6px 7px; font-size: 14px; }
}

/* 移动端汉堡菜单按钮（桌面隐藏） */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 20px;
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}
.nav-toggle:active { background: #eef2fb; }

/* ---- 手机竖屏响应式：导航折叠为下拉菜单 ---- */
@media (max-width: 768px) {
  .topbar { padding: 0 12px; gap: 10px; height: 48px; }
  .brand { font-size: 16px; }
  .brand small { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
    padding: 8px 12px;
    gap: 2px;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    z-index: 99;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; font-size: 16px; }
  .topbar .right { font-size: 13.5px; }
}

/* ---- 主容器 ---- */
.container { max-width: 1920px; margin: 0 auto; padding: 20px 10px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; }

/* ---- 卡片 ---- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.card h2 { font-size: 17px; margin-bottom: 12px; color: var(--text); }
.card h2 .badge { font-size: 13.5px; font-weight: 400; color: var(--muted); margin-left: 8px; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text); font-size: 14.5px; cursor: pointer;
  transition: all .15s; text-decoration: none; line-height: 1.4;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; padding: 7px 20px; font-size: 16px; box-shadow: 0 2px 6px rgba(26,86,219,.25); }
.btn.primary:hover { background: var(--primary-dark); box-shadow: 0 3px 10px rgba(26,86,219,.35); }
.btn.accent { background: #0e9f6e; border-color: #0e9f6e; color: #fff; font-weight: 600; }
.btn.accent:hover { background: #057a55; border-color: #057a55; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.small { padding: 3px 10px; font-size: 13.5px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- 表单 ---- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.form-item { display: flex; flex-direction: column; gap: 4px; }
.form-item.full { grid-column: 1 / -1; }
.form-item label { font-size: 13.5px; color: var(--muted); }
.form-item label .req { color: var(--danger); }
input, select, textarea {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14.5px; font-family: inherit; background: #fff; color: var(--text); width: 100%;
}
/* radio/checkbox 恢复默认宽度：上面的全局 width:100% 会把单选框拉满整行（如「使用库存」弹窗候选行被挤成窄竖列） */
input[type="radio"], input[type="checkbox"] { width: auto; flex: none; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26, 86, 219, .12); }
textarea { resize: vertical; min-height: 60px; }

/* ---- 表格 ---- */
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
th { background: #f6f8fc; color: #5b6b83; font-weight: 600; white-space: nowrap; }
/* 表头冻结：列表滚动时表头固定在顶部 */
thead th { position: sticky; top: 0; z-index: 5; }
tr:hover td { background: #fafbfe; }
td.num, th.num { text-align: right; }
td.center, th.center { text-align: center; }

/* 紧凑表格（生产工单列表） */
.mo-tbl th, .mo-tbl td { padding: 4px 7px; font-size: 13.5px; line-height: 1.45; }

/* 产品明细分组标题 */
.group-title {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0 8px; font-size: 14.5px; font-weight: 700; color: var(--text);
}
.group-title:first-child { margin-top: 4px; }
.group-title .line { flex: 1; height: 1px; background: #eef1f7; }
.group-title .btn { margin-left: auto; }
/* 行首的「＋」图标按钮（2026-10-07）：「手动添加」精简为加号并移到分组标题最前，功能不变。
   放在首位时必须抵消上面的 margin-left:auto，否则会被推到行尾。 */
.group-title > .btn:first-child { margin-left: 0; }

/* 合计行 */
.sum-line {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 12px 4px 4px; font-size: 16px; font-weight: 600;
}
.sum-line .amount {
  font-size: 20px; font-weight: 800; color: var(--primary);
}

/* ---- 状态标签 ---- */
.tag { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 13.5px; white-space: nowrap; }
.tag-draft { background: #f1f5f9; color: #475569; }
.tag-pending { background: #fef9c3; color: #a16207; }
.tag-confirmed { background: #dbeafe; color: #1d4ed8; }
.tag-reviewed { background: #cffafe; color: #0e7490; }
.tag-production { background: #fef3c7; color: #b45309; }
.tag-ready { background: #d1fae5; color: #047857; }
.tag-shipped { background: #a7f3d0; color: #065f46; }
.tag-done { background: #ede9fe; color: #6d28d9; }
.tag-info { background: #dcfce7; color: #15803d; }
.tag-canceled { background: #fee2e2; color: #b91c1c; }
.tag-paused { background: #fde8d8; color: #c2410c; }
.changed-mark { background: #fee2e2; color: #dc2626; font-weight: 700; margin-left: 4px; }
/* 状态下拉（列表页内联快改） */
.status-select {
  border: none; outline: none; cursor: pointer;
  border-radius: 9999px; padding: 3px 20px 3px 10px;
  font-size: 13.5px; font-weight: 500; appearance: none;
  min-width: 88px; max-width: 132px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
  background-color: #f1f5f9; color: #475569;
  transition: filter .15s, box-shadow .15s;
  border: 1px solid transparent;
}
.status-select:hover { filter: brightness(.94); }
.status-select:focus { box-shadow: 0 0 0 2px rgba(26, 86, 219, .18); border-color: rgba(26, 86, 219, .35); }
.status-select.s-draft     { background-color:#f1f5f9; color:#475569; }
.status-select.s-pending   { background-color:#fef9c3; color:#a16207; }
.status-select.s-confirmed { background-color:#dbeafe; color:#1d4ed8; }
.status-select.s-reviewed  { background-color:#cffafe; color:#0e7490; }
.status-select.s-production{ background-color:#fef3c7; color:#b45309; }
.status-select.s-paused    { background-color:#fde8d8; color:#c2410c; }
.status-select.s-ready     { background-color:#d1fae5; color:#047857; }
.status-select.s-shipped   { background-color:#a7f3d0; color:#065f46; }
.status-select.s-done      { background-color:#ede9fe; color:#6d28d9; }
.status-select.s-canceled  { background-color:#fee2e2; color:#b91c1c; }
.status-select.s-reject    { background-color:#fecaca; color:#991b1b; font-weight:600; }
/* 工单列表：操作下拉菜单 */
.mo-ops-wrap { position:relative; display:inline-block; }
.mo-ops-menu { position:absolute; left:50%; transform:translateX(-50%); top:calc(100% + 4px); background:#fff; border:1px solid #e2e8f0; border-radius:8px; box-shadow:0 10px 28px rgba(15,23,42,.14); z-index:40; min-width:150px; padding:5px; }
.mo-ops-menu a { display:block; padding:7px 12px; font-size:14px; color:#334155; text-decoration:none; border-radius:6px; white-space:nowrap; }
.mo-ops-menu a:hover { background:#f1f5f9; }
.mo-ops-menu a.danger { color:#dc2626; }
.mo-ops-menu a.danger:hover { background:#fef2f2; }
.field-changed {
  background: #fdecec !important; border-radius: 4px; padding: 2px 6px;
  color: #b91c1c; font-weight: 600;
}
.row-changed td { background: #fdecec !important; }
.tag-cat { padding: 1px 8px; border-radius: 6px; font-size: 13.5px; }
.tag-cat-bottle { background: #dbeafe; color: #1d4ed8; }
.tag-cat-part { background: #ede9fe; color: #6d28d9; }
.tag-cat-other { background: #d1fae5; color: #047857; }

/* ---- 工具栏 ---- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search], .toolbar select { width: auto; min-width: 140px; }
/* 日期选择框：固定紧凑宽度，避免被全局 width:100% 拉伸 */
.toolbar input[type="date"] { width: 132px !important; flex: none; padding: 6px 8px; }
.toolbar input[type="number"] { flex: none; }

/* ---- 空状态 ---- */
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.empty .icon { font-size: 42px; margin-bottom: 8px; }

/* ---- 弹窗 ---- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: none; align-items: center; justify-content: center; z-index: 999;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 12px; padding: 20px; width: min(560px, 92vw);
  max-height: 88vh; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.modal h3 { margin-bottom: 14px; }
.modal .form-grid { margin-bottom: 12px; }
/* 弹窗操作按钮常驻底部（2026-09-28 易用性优化）：
   弹窗内容超高滚动时，保存/取消按钮始终可见，不必滚到底才能提交；
   负 margin 抵消 .modal 的 padding，白底铺满弹窗宽度并加上分隔线，避免内容透到按钮下方。 */
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px;
  position: sticky; bottom: -20px; z-index: 6;
  background: #fff; padding: 12px 0 6px; margin-bottom: -20px;
  border-top: 1px solid var(--border);
}
/* 弹窗内自带边框/底色的单据类容器（如销售出入库单据）在按钮区上方不需要重复分隔线 */
.modal-actions.no-divider { border-top: none; }

/* ---- 分组明细 ---- */
.group-title {
  display: flex; align-items: center; gap: 10px; margin: 18px 0 8px;
  font-size: 16px; font-weight: 600;
}
.group-title .line { flex: 1; height: 1px; background: var(--border); }
.item-row td { padding: 6px 8px; }
.item-row input, .item-row select { padding: 5px 8px; font-size: 14.5px; }
.row-total { font-weight: 700; }
.sum-line { display: flex; justify-content: flex-end; align-items: baseline; gap: 8px; margin-top: 12px; font-size: 17px; }
.sum-line .amount { font-size: 24px; font-weight: 700; color: var(--primary); }

/* ---- 消息提示 ---- */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #111827; color: #fff; padding: 12px 26px; border-radius: 10px;
  font-size: 16px; z-index: 99999; opacity: 0; transition: opacity .25s; pointer-events: none;
  box-shadow: 0 10px 32px rgba(0,0,0,.35); white-space: nowrap; max-width: 80vw;
}
.toast.show { opacity: 1; }

/* ---- 滚动到底部提示（2026-10-08）----
   fixed 底部居中胶囊；z-index 990 低于弹窗遮罩(999)，弹窗打开时自然被盖住；
   pointer-events:none 不挡点击；.container 底部已有 60px 内边距，不会遮住分页条或按钮。 */
.scroll-bottom-hint {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 6px);
  background: #fff; border: 1px solid #dbe3ee; border-radius: 999px;
  padding: 5px 14px; font-size: 14px; line-height: 1.4; color: #64748b;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .10);
  opacity: 0; pointer-events: none; z-index: 990; white-space: nowrap;
  transition: opacity .18s ease, transform .18s ease;
}
.scroll-bottom-hint.show { opacity: 1; transform: translate(-50%, 0); }
@media print { .scroll-bottom-hint { display: none !important; } }


/* ---- 批量操作栏 ---- */
.batch-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #eef2fb; border: 1px solid #c7d5f3; border-radius: 10px;
  padding: 9px 14px; margin-bottom: 12px; font-size: 14.5px; color: #1d4ed8; font-weight: 600;
}
.batch-bar b { color: var(--danger); }
.batch-bar .btn { font-weight: 400; }

/* ---- 订单管理模块 UI ---- */
.seg-tab { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: #fff; }
.seg-tab button { border: none; background: #fff; padding: 7px 18px; font-size: 14.5px; cursor: pointer; color: var(--text); transition: all .15s; }
.seg-tab button.active { background: var(--primary); color: #fff; }
.filter-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filter-row + .filter-row { margin-top: 8px; border-top: 1px dashed var(--border); padding-top: 8px; }
.filter-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
/* 覆盖全局 input/select width:100%，让筛选行内控件紧凑水平排列 */
.filter-row input, .filter-row select { width: auto !important; flex: none !important; padding: 5px 8px; font-size: 14.5px; }
.filter-row input[type="search"] { width: 220px !important; }
.filter-row input[type="date"]   { width: 128px !important; }
.filter-row input[type="number"] { width: 78px !important; text-align: right; }
.filter-row select               { min-width: 90px; max-width: 150px; }
.stat-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-card { display: flex; align-items: baseline; gap: 8px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 9px 16px; font-size: 14.5px; color: var(--muted); }
.stat-card b { font-size: 20px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-card.hl b { color: var(--primary); }
.order-table { border-collapse: separate; border-spacing: 0; min-width: 1858px; table-layout: fixed; width: 100%; }
.order-table thead th { position: sticky; top: 0; background: #f8fafc; z-index: 5; box-shadow: inset 0 -1px 0 var(--border); padding: 9px 6px; }
.order-table tbody td { padding: 9px 6px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
/* 列宽（2026-10-07 四次调整·现行）：表撑满容器（width:100%+min-width:1858），规格合计恰好 1858
   ⇒ 无摊还、渲染=规格。内容最小合计 1515，富余 343 按「除客户列外 12 列均分 +29」（用户选「均匀铺满」，
   客户列保持 113=原 170 的 2/3 不变）。操作列 454：按钮去图标（📋/￥/🔒 已删）后单行（实测 420）。
   ⚠️ 改任一列宽必须同步增减其它列，保持合计=1858，否则比例摊还会让某列突然变宽。
   单元格左右内边距 6px；窄窗口 <1858 横向滚动。
   短内容列不折行、超长省略号（悬停看全）；状态/操作/本人记录允许折行。
   选择器必须用 > 直属链，否则会命中展开行内嵌的明细表；展开行(id=exp_*)排除。 */
.order-table > thead > tr > th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-table > tbody > tr:not([id^='exp_']) > td:nth-child(4),
.order-table > tbody > tr:not([id^='exp_']) > td:nth-child(5),
.order-table > tbody > tr:not([id^='exp_']) > td:nth-child(6),
.order-table > tbody > tr:not([id^='exp_']) > td:nth-child(7),
.order-table > tbody > tr:not([id^='exp_']) > td:nth-child(8),
.order-table > tbody > tr:not([id^='exp_']) > td:nth-child(9),
.order-table > tbody > tr:not([id^='exp_']) > td:nth-child(10),
.order-table > tbody > tr:not([id^='exp_']) > td:nth-child(11),
.order-table > tbody > tr:not([id^='exp_']) > td:nth-child(12) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-table tbody tr:nth-child(even) td { background: #fafbfe; }
.order-table tbody tr:hover td { background: #eef2fb; }
.order-table td.num { font-variant-numeric: tabular-nums; }
.order-table .btn.small { padding: 3px 9px; }

/* 必选未填（来源/口径/表单校验等）红色提示：输入框、下拉、文本域统一可见
   （2026-09-28 易用性优化：fieldError() 定位字段时会加 .invalid，原来只有 select 有样式） */
select.invalid, input.invalid, textarea.invalid {
  border-color: #dc2626 !important;
  background: #fef2f2 !important;
  color: #b91c1c;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, .15);
}
select.invalid:focus, input.invalid:focus, textarea.invalid:focus { outline-color: #dc2626; }

/* ---- 客户实时模糊搜索面板 ---- */
.cs-panel {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 300;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .12); max-height: 240px; overflow: auto;
}
.cs-item {
  padding: 8px 12px; font-size: 14.5px; cursor: pointer; border-bottom: 1px solid #f1f5f9;
  display: flex; justify-content: space-between; align-items: center;
}
.cs-item:hover, .cs-item.active { background: #eef2fb; color: var(--primary); }
.cs-item .cs-sub { font-size: 13.5px; color: var(--muted); }
.cs-item.cs-add { color: var(--success); font-weight: 600; border-bottom: none; background: #f0fdf4; }
.cs-item.cs-add:hover { background: #dcfce7; }
.cs-empty { padding: 10px 12px; font-size: 13.5px; color: var(--muted); }

/* ---- 产品行图片（确认图片 / 印刷图片）缩略与悬浮放大 ---- */
.img-cell {
  width: 48px; height: 48px; border: 1px dashed var(--border); border-radius: 6px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  position: relative; font-size: 20px; color: var(--muted);
  background: #fafbfe; overflow: visible; margin: 0 auto;
}
.img-cell img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 5px;
  transition: transform .15s ease, box-shadow .15s ease;
  position: relative; z-index: 1;
}
.img-cell img:hover {
  transform: scale(3); z-index: 99;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); border-radius: 6px;
}
.img-del {
  position: absolute; top: -5px; right: -5px; width: 16px; height: 16px; line-height: 14px;
  text-align: center; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
  font-size: 11.5px; cursor: pointer; border: none; z-index: 100;
}
.img-del:hover { background: var(--danger); }
.img-thumb-sm { width: 30px; height: 30px; object-fit: cover; border-radius: 4px; vertical-align: middle; cursor: zoom-in; }

/* ---- 明细表样式（工艺换行不溢出、图片列居中） ---- */
.detail-table table-layout: auto;
.detail-table td { vertical-align: middle; word-break: break-word; }
.detail-table td.col-wrap { white-space: normal; word-break: break-word; line-height: 1.5; }
.detail-table td.td-img { text-align: center; white-space: nowrap; }
.detail-table td.td-img img { vertical-align: middle; display: inline-block; }
.detail-table th { white-space: nowrap; }
/* 备注列：截断显示省略号，悬浮看全，点击进入订单详情看全部 */
.detail-table td.td-ellipsis {
  max-width: 150px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; cursor: pointer;
}

.img-ph {
  display: inline-block; width: 30px; height: 30px; border-radius: 4px;
  border: 1px dashed var(--border); background: #fafbfe; vertical-align: middle;
}

/* ---- 明细总表 UI 优化 ---- */
.detail-view-wrap { overflow-x: auto; }
.detail-table { border-collapse: separate; border-spacing: 0; min-width: 1200px; }
.detail-table thead th {
  position: sticky; top: 0; z-index: 5;
  background: #f8fafc; box-shadow: inset 0 -1px 0 var(--border);
  padding: 9px 10px; font-size: 13.5px;
}
.detail-table tbody td { padding: 8px 10px; border-bottom: 1px solid #eef1f6; }
.detail-table tbody tr:nth-child(even) td { background: #fafbfe; }
.detail-table tbody tr:hover td { background: #eef2fb; }
.detail-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.detail-table td { vertical-align: middle; word-break: break-word; }

/* ---- 凭证图片上传 ---- */
.upload-zone {
  border: 2px dashed var(--border); border-radius: 8px; padding: 18px;
  text-align: center; color: var(--muted); font-size: 13.5px; cursor: pointer;
  background: #fafbfe; transition: border-color .15s;
}
.upload-zone:hover { border-color: var(--primary); color: var(--primary); }
.upload-previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.preview-thumb {
  position: relative; width: 72px; height: 72px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); background: #f1f5f9;
}
.preview-thumb img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.preview-thumb .del {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; line-height: 16px;
  text-align: center; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
  font-size: 12.5px; cursor: pointer; border: none;
}
.preview-thumb .del:hover { background: var(--danger); }
/* 内联凭证小缩略图 */
.voucher-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.voucher-thumbs .preview-thumb { width: 48px; height: 48px; }

/* ---- 订单编辑页专属 ---- */
/* 分区布局 */
.oe-card { padding: 0; overflow: hidden; border-radius: 14px; }
.oe-section { padding: 14px 20px; }
.oe-divider { border: none; border-top: 1px dashed #e5e9f2; margin: 0; height: 1px; }
.oe-section-title {
  font-size: 13.5px; font-weight: 700; color: var(--primary);
  letter-spacing: .04em;
  margin-bottom: 12px; display: flex; align-items: center; gap: 7px;
}
.oe-section-title::before {
  content: ''; display: inline-block; width: 3px; height: 14px;
  background: linear-gradient(180deg, var(--primary), #6ea0f0); border-radius: 2px;
}
.oe-section-title::after {
  content: ''; flex: 1; height: 1px; background: #eef1f7; margin-left: 2px;
}
.oe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px 16px;
}
.oe-grid-dense {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.oe-grid .form-item.full { grid-column: 1 / -1; }
.oe-hint { font-size: 12.5px; font-weight: 400; color: var(--muted); margin-left: 4px; }

/* 统一控件高度与质感（仅订单编辑页） */
.oe-card input, .oe-card select {
  height: 32px;
  border-radius: 7px;
  border-color: #dfe4ee;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.oe-card textarea {
  border-radius: 7px;
  border-color: #dfe4ee;
  font-size: 14.5px;
  padding: 6px 9px;
}
.oe-card input:focus, .oe-card select:focus, .oe-card textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.10);
}
.oe-card input[readonly] { background: #f6f8fb !important; color: var(--muted); }
.oe-card label {
  font-size: 13px; color: #5b6b83; font-weight: 500;
  display: flex; align-items: center; gap: 4px;
}
.oe-card label .req { color: var(--danger); font-weight: 700; }
/* 表单标签行统一对齐 */
.oe-card .form-item { gap: 5px; }
/* 套袋/打托/备注两列网格 */
.oe-grid-2col {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}
/* 卡片内小按钮与输入框同高 */
.oe-card .btn.small {
  height: 32px; display: inline-flex; align-items: center;
  white-space: nowrap;
}

/* 关键按钮强化 */
.btn.save-draft {
  border-color: #64748b; color: #64748b; font-weight: 600;
}
.btn.save-draft:hover { background: #f1f5f9; border-color: #475569; color: #475569; }
.btn.save-confirm {
  padding: 8px 24px; font-size: 16px; font-weight: 700;
  box-shadow: 0 3px 10px rgba(26,86,219,.3);
  letter-spacing: .02em;
}
.btn.save-confirm:hover { box-shadow: 0 4px 16px rgba(26,86,219,.4); transform: translateY(-1px); }

/* ---- 打印（合同页） ---- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 12mm 10mm; }
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* 打印一律不带水印：.wm-layer 是 common.js 注入的登录人水印层（position:fixed 铺满整页），
     不隐藏会整页印出「人名+日期」，客户单据上不该出现内部信息 */
  .topbar, .no-print, .btn, .pager, .modal-mask, .quick-filter, .wm-layer { display: none !important; }
  .container { max-width: 100%; padding: 0; }
  .card { border: none; box-shadow: none; padding: 0; margin: 0; }
  table { page-break-inside: auto; }
  tr, td, th { page-break-inside: avoid; }
  th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { text-decoration: none; color: inherit; }
}

/* ---- 采购页内嵌视图切换标签 ---- */
.sub-tabs {
  display: flex; gap: 6px; background: #eef2f7; padding: 5px;
  border-radius: 12px; width: fit-content; margin-bottom: 14px;
  border: 1px solid #e2e8f0;
}
.sub-tab {
  border: 1px solid #d7dee8; background: #fff; padding: 8px 20px;
  border-radius: 9px; font-size: 15px; font-weight: 600;
  color: #475569; cursor: pointer; transition: all .15s;
  font-family: inherit; box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.sub-tab:hover { color: var(--primary); border-color: #93b4f5; background: #f5f8ff; }
.sub-tab.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff;
  border-color: #1d4ed8; box-shadow: 0 2px 8px rgba(37,99,235,.4);
}

/* ---- 采购管理表：字号优化（更清晰明朗） ---- */
.purchase-table { font-size: 14.5px; }
.purchase-table th { font-size: 14.5px; font-weight: 700; padding: 9px 8px; color: #334155; }
.purchase-table td { padding: 7px 8px; }
.purchase-table input[type="text"],
.purchase-table input[type="number"],
.purchase-table select { font-size: 14px !important; padding: 3px 5px !important; }
.purchase-table .btn.small { font-size: 13px !important; padding: 2px 8px !important; }
.purchase-table a { font-size: 14.5px !important; }
.purchase-table .tag { font-size: 13.5px; }
.purchase-table .num { font-size: 14.5px; }

/* 采购列表主表（.purchase-main，2026-10-07 与订单管理同口径）：
   width:100% + min-width:1858 + table-layout:fixed，17 列 th 显式宽度合计恰好 1858
   ⇒ 无比例摊还、渲染 = 规格；容器更宽时按比例均匀铺满。
   改任一列宽必须同步增减其它列，保持合计 = 1858，否则某列会突然变宽。
   仅作用于采购列表主表；同页「委外管理」表虽也用 .purchase-table 但未加 .purchase-main，不受影响。 */
.purchase-main { border-collapse: separate; border-spacing: 0; table-layout: fixed; width: 100%; min-width: 1858px; }
.purchase-main > thead > tr > th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.purchase-main > tbody > tr > td { vertical-align: middle; }
.purchase-main > tbody > tr > td:nth-child(2),
.purchase-main > tbody > tr > td:nth-child(4),
.purchase-main > tbody > tr > td:nth-child(5),
.purchase-main > tbody > tr > td:nth-child(6),
.purchase-main > tbody > tr > td:nth-child(7),
.purchase-main > tbody > tr > td:nth-child(12),
.purchase-main > tbody > tr > td:nth-child(17) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.purchase-main tbody tr:nth-child(even) td { background: #fafbfe; }
.purchase-main tbody tr:hover td { background: #eef2fb; }
/* 一色一喷组行（2026-10-08 晚，对齐工单）：组行 td 必须透明，否则上面两条
   斑马纹/悬停会盖掉 .spray-group-row(-collapsed) 的底色（工单表 .mo-tbl 无斑马纹，
   故只需在此修正采购主表）。同权重 + 源码在后 ⇒ 命中组行；整行仍可点击展开/折叠。 */
.purchase-main tbody tr.spray-group-row > td { background: transparent; }
.filter-row input, .filter-row select { font-size: 14px; }

/* 行内单价输入：隐藏原生调整箭头（避免误点），直接手输 */
input.price-inline::-webkit-inner-spin-button,
input.price-inline::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input.price-inline[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* ---- 分页控件 ---- */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 4px; padding: 10px 14px; flex-wrap: wrap; }
.pager .pg-info { font-size: 14px; color: var(--muted); margin-right: 10px; white-space: nowrap; flex: none; }
.pager .pg-info select { width: auto; flex: none; }
.pager .pager { width: 100%; flex: none; }  /* 2026-10-09 容器 div 与 pagerHtml 输出嵌套同名类：内层占满整行（宽屏一行排布，窄屏整项换行） */  /* 2026-10-09 全局 select{width:100%} 把「每页条数」下拉撑满整行 ⇒ 与「共N条」重叠（订单/采购/工单主分页条） */  /* 2026-10-09 防内部折行（「每页」叠在下拉上方）与被压缩：整项不可收缩，放不下时整体换行 */
.pager .pg-btn, .pager .pg-num {
  min-width: 28px; height: 28px; line-height: 26px; text-align: center;
  font-size: 14px; border: 1px solid var(--border); border-radius: 6px;
  color: #334155; background: #fff; text-decoration: none; padding: 0 6px;
  box-sizing: border-box; display: inline-block; cursor: pointer;
}
.pager .pg-btn:hover, .pager .pg-num:hover { border-color: var(--primary); color: var(--primary); }
.pager .pg-num.cur { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager .pg-btn[disabled], .pager .pg-btn.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ===================== 财务模块（2026-09-29 新增） =====================
   浅色主题：白底卡片 + 深色文字；金额语义色（逾期红 / 已结清绿 / 待收付橙） */
.fin-kpi { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.fin-kpi .k-label { font-size: 13.5px; color: var(--muted); margin-bottom: 4px; }
.fin-kpi .k-val { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.25; }
.fin-kpi .k-sub { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.fin-kpi.k-risk { border-color: #fecaca; background: #fff7f7; }
.fin-kpi.k-risk .k-val { color: #b91c1c; }
.fin-kpi.k-ok { border-color: #bbf7d0; background: #f7fffa; }
.fin-kpi.k-ok .k-val { color: #047857; }

.fin-amt-right { text-align: right; font-variant-numeric: tabular-nums; }
.fin-done { color: #047857; font-weight: 600; }
.fin-open { color: #b45309; font-weight: 600; }
.fin-over { color: #dc2626; font-weight: 600; }
.fin-muted { color: var(--muted); }

.fin-sec { margin-bottom: 12px; }
.fin-sec > h2 { font-size: 17px; margin-bottom: 10px; color: var(--text); }
.fin-sec > h2 .badge { font-size: 13.5px; font-weight: 400; color: var(--muted); margin-left: 8px; }

/* 账龄分档条 */
.fin-age-bar { display: flex; gap: 2px; height: 8px; border-radius: 6px; overflow: hidden; background: #f1f5f9; margin-top: 6px; }
.fin-age-bar > span { display: block; height: 100%; }

/* 对账期间汇总块 */
.fin-stmt-box { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; padding: 12px 16px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; font-size: 14.5px; }
.fin-stmt-box .sm-l { font-size: 13px; color: var(--muted); display: block; margin-bottom: 2px; }
.fin-stmt-box .sm-v { font-size: 18px; font-weight: 700; }
.fin-sum-row td { background: #f8fafc; font-weight: 600; }

/* 收付款登记弹窗里的凭证缩略图 */
.voucher-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.voucher-thumbs .preview-thumb { position: relative; width: 52px; height: 52px; }
.voucher-thumbs .preview-thumb img { width: 52px; height: 52px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; }
.voucher-thumbs .preview-thumb .del { position: absolute; right: -6px; top: -6px; width: 18px; height: 18px; line-height: 16px; border-radius: 50%; border: none; background: #dc2626; color: #fff; font-size: 12.5px; cursor: pointer; padding: 0; }

/* 收付款方向标记 */
.fin-dir-in { color: #047857; font-weight: 600; }
.fin-dir-out { color: #b45309; font-weight: 600; }

.fin-note { font-size: 13.5px; color: var(--muted); line-height: 1.7; }
.fin-clickable { cursor: pointer; color: var(--primary); }
.fin-clickable:hover { text-decoration: underline; }

/* ================= 采购筛选栏 v2（2026-10-09） =================
   结构：主行（搜索/状态/供应商/采购员/排序 ＋ 右侧 计数·更多筛选·重置）
         ＋ 抽屉行「更多筛选」（品名/规格/工艺/创建日期/需求到货日，默认收起）。
   全部控件 id 不变，uiState.bindFilters 的筛选记忆继续按 id 生效。
   取值：搜索 264 / 下拉 112~168 / 排序 168~186 / 日期 120 / 抽屉窄搜索 96。 */
#pcFilterBar .filter-row { gap: 8px 10px; }
#pcFilterBar #searchInput { width: 264px !important; }
#pcFilterBar select { min-width: 112px; max-width: 168px; }
#pcFilterBar #supplierFilter { width: 150px !important; }
#pcFilterBar #purchaserFilter { width: 132px !important; }
#pcFilterBar #purchaseSort { min-width: 168px !important; max-width: 186px !important; }
#pcFilterBar input[type="date"] { width: 120px !important; }
#pcFilterBar input[type="search"]:not(#searchInput) { width: 96px !important; }
#pcFilterBar .pc-flt-tail { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#pcFilterBar .pc-flt-stat { font-size: 12.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
#pcFilterBar .pc-flt-stat b { color: var(--primary); font-weight: 600; font-variant-numeric: tabular-nums; }
#pcFilterBar .pc-flt-badge { display: inline-block; min-width: 15px; margin-left: 5px; padding: 0 5px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 11.5px; line-height: 15px; text-align: center; vertical-align: 1px; }
#pcFilterBar .pc-flt-grp { display: inline-flex; align-items: center; gap: 6px; }
#pcFilterBar .pc-flt-grp + .pc-flt-grp { padding-left: 10px; border-left: 1px solid var(--border); }
#pcFilterBar .pc-flt-lbl { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
#pcFilterBar .pc-flt-tilde { font-size: 12.5px; color: var(--muted); }
/* ⚠️ 尺寸统一（关键）：实测浏览器默认下 搜索框 29px / 下拉框 31px / 小按钮 27px —— 三种高度错位
   正是「筛选栏看着乱」的底层原因。此处把三者钉成同高 32px（含 border，box-sizing:border-box），
   并把内边距收进高度里，视觉上成为一条整齐的基线。 */
#pcFilterBar .filter-row input,
#pcFilterBar .filter-row select { height: 32px; padding: 0 9px; box-sizing: border-box; }
#pcFilterBar input[type="date"] { padding: 0 6px; }
#pcFilterBar .filter-row .btn.small { height: 32px; padding: 0 12px; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; }
