/* ================= 基础 ================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2f6fed;
  --primary-d: #1d55c4;
  --primary-l: #eaf1ff;
  --danger: #e5484d;
  --warn: #f5a524;
  --ok: #17a673;
  --text: #18202f;
  --text-2: #5b667a;
  --text-3: #8b95a7;
  --line: #e6eaf1;
  --bg: #f4f6fa;
  --card: #ffffff;
  --side: #131c2e;
  --side-2: #1b2740;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.05);
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--primary); text-decoration: none; }

/* ================= 登录页 ================= */
.login-page {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1000px 500px at 15% -10%, #dbe7ff 0%, transparent 60%),
    radial-gradient(800px 400px at 100% 100%, #e3f0ff 0%, transparent 55%),
    linear-gradient(180deg, #f7f9fd 0%, #eef2f9 100%);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 16px;
  padding: 34px 32px 26px;
  box-shadow: 0 20px 60px rgba(16,24,40,.12), 0 2px 6px rgba(16,24,40,.06);
  border: 1px solid #eef1f6;
}
.login-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 26px; }
.login-brand h1 { font-size: 19px; letter-spacing: -.3px; }
.login-brand p { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.logo-mark {
  width: 46px; height: 46px; border-radius: 12px; flex: 0 0 auto;
  background: linear-gradient(135deg, #2f6fed, #5b8dff);
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 16px rgba(47,111,237,.32);
}
.logo-mark.sm { width: 30px; height: 30px; border-radius: 8px; box-shadow: none; }
#loginForm label { display: block; font-size: 12.5px; color: var(--text-2); margin: 14px 0 6px; font-weight: 500; }
#loginForm input {
  width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 9px;
  padding: 0 12px; font-size: 14px; outline: none; transition: .15s; background: #fbfcfe;
}
#loginForm input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
.login-err { color: var(--danger); font-size: 12.5px; height: 18px; margin-top: 8px; }
.login-tip {
  margin-top: 18px; padding: 10px 12px; background: #f7f9fc; border: 1px dashed #e2e8f2;
  border-radius: 8px; font-size: 11.5px; color: var(--text-3); line-height: 1.7;
}
.login-tip b { color: var(--text-2); }

/* 备案号（工信部要求：网站底部必须显示并能点进 beian.miit.gov.cn） */
.icp-badge {
  position: absolute; left: 0; right: 0; bottom: 16px;
  text-align: center; font-size: 12px; color: #97a1b3;
  text-decoration: none; transition: .15s;
}
.icp-badge:hover { color: var(--primary); text-decoration: underline; }
.app-foot {
  padding: 0 22px 18px; text-align: center;
  font-size: 11.5px; color: var(--text-3); line-height: 1.6;
}
.app-foot a { color: var(--text-3); text-decoration: none; transition: .15s; }
.app-foot a:hover { color: var(--primary); text-decoration: underline; }

/* ================= 布局 ================= */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px; flex: 0 0 216px;
  background: linear-gradient(180deg, var(--side) 0%, var(--side-2) 100%);
  color: #c3cddf; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.side-brand {
  display: flex; align-items: center; gap: 9px;
  padding: 18px 18px 16px; font-weight: 700; font-size: 15px; color: #fff;
  letter-spacing: .2px;
}
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 10px; }
.nav::-webkit-scrollbar { width: 5px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 8px; margin-bottom: 2px;
  cursor: pointer; font-size: 13.5px; color: #a9b6cc; transition: .14s; user-select: none;
}
.nav-item svg { flex: 0 0 auto; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #e8eefb; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(47,111,237,.95), rgba(47,111,237,.72));
  color: #fff; box-shadow: 0 4px 12px rgba(47,111,237,.28);
}
.nav-item.active svg { opacity: 1; }

.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.07); }
.side-user { display: flex; align-items: center; gap: 9px; margin-bottom: 9px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, #3f7bf0, #6f9dff);
  display: grid; place-items: center; color: #fff; font-size: 12.5px; font-weight: 600;
}
.side-user-info { font-size: 12.5px; color: #dbe4f5; line-height: 1.35; }
.side-user-info small { color: #7f8da6; font-size: 11px; }
.btn-ghost-sm {
  width: 100%; height: 30px; border-radius: 7px; cursor: pointer;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09);
  color: #a9b6cc; font-size: 12px; transition: .15s;
}
.btn-ghost-sm:hover { background: rgba(229,72,77,.16); color: #ffb4b6; border-color: rgba(229,72,77,.3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.crumb { display: flex; align-items: center; gap: 10px; }
/* 顶栏中间的「今天是：…」，和页面标题同一水平线（标题在副标题上方，所以略微上移） */
.top-today {
  position: absolute; left: 50%; top: calc(50% - 8px); transform: translate(-50%, -50%);
  font-size: 14px; color: var(--text-2); white-space: nowrap; letter-spacing: .3px;
}
.top-today:empty { display: none; }
@media (max-width: 1024px) { .top-today { display: none; } }
.icon-btn.only-mobile { display: none; }
.crumb h2 { font-size: 16.5px; font-weight: 650; letter-spacing: -.2px; }
.page-sub { font-size: 12px; color: var(--text-3); }
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text-2); cursor: pointer; display: grid; place-items: center; transition: .15s;
}
.icon-btn:hover { background: var(--primary-l); color: var(--primary); border-color: #cfe0ff; }

.view { padding: 20px 22px 40px; flex: 1; min-width: 0; }

/* ================= 按钮 ================= */
.btn {
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: .15s; white-space: nowrap;
  font-family: inherit;
}
.btn:hover { background: #f7f9fc; border-color: #d5dced; }
.btn:active { transform: translateY(.5px); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); }
.btn-danger { color: var(--danger); border-color: #f4c9ca; background: #fff; }
.btn-danger:hover { background: #fef2f2; border-color: #e9a8aa; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-block { width: 100%; height: 42px; justify-content: center; font-size: 14.5px; margin-top: 6px; }
.btn-link {
  border: none; background: none; color: var(--primary); cursor: pointer;
  font-size: 12.5px; padding: 2px 5px; border-radius: 5px; font-family: inherit;
}
.btn-link:hover { background: var(--primary-l); }
/* 灰掉的按钮（比如已下单的合同不能再编辑）：看得见、点不动，鼠标停上有说明 */
.btn-link[disabled] { color: var(--text-3); opacity: .6; cursor: not-allowed; background: none; }
.btn-link.danger { color: var(--danger); }
.btn-link.danger:hover { background: #fef2f2; }
/* 合同列表的「下单」是主操作，做成小实心按钮，别跟旁边一排文字链接混在一起 */
.btn-link.go { background: var(--primary); color: #fff; padding: 3px 10px; border-radius: 6px; }
.btn-link.go:hover { background: var(--primary-d); }
/* 订单详情里明细的生产编号：点一下能进去改工艺 */
.part-link { color: var(--primary); cursor: pointer; border-bottom: 1px dashed currentColor; }
.part-link:hover { color: var(--primary-d); }
/* 订单查询里能点改的格子（单价 / 交期）：鼠标放上去像可以编辑 */
.ord-edit {
  cursor: pointer; padding: 1px 4px; border-radius: 4px;
  border-bottom: 1px dashed var(--line); white-space: nowrap;
}
.ord-edit:hover { background: var(--primary-l); border-bottom-color: var(--primary); color: var(--primary-d); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ================= 卡片 ================= */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--line); gap: 12px; flex-wrap: wrap;
}
.card-head h3 { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.card-head h3 .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); }
.card-body { padding: 16px; }
.card-body.p0 { padding: 0; }

/* ================= 工具栏 ================= */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line); background: #fff;
}
/* 工具栏三栏：左边搜索/筛选，中间新增，右边导出
   新增要真正居中（2026-11-15 用户要求），所以左右两栏等分（`flex: 1 1 0`）。
   ⚠️ 等分的前提是左边这一栏的内容必须装得下：里面 `flex-wrap: wrap` 兜底，
      装不下就折行，绝不会像改之前那样溢出到「新增」底下把「清除」盖死。
      所以日期框、搜索框都压窄了，别随手放大。 */
.tb-left { display: flex; align-items: center; gap: 8px; flex: 1 1 0; min-width: 0; flex-wrap: wrap; row-gap: 8px; }
.tb-mid { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; padding: 0 8px; }
.tb-right { display: flex; align-items: center; gap: 8px; flex: 1 1 0; justify-content: flex-end; min-width: 0; }
/* 中间没有按钮的工具栏（订单查询这类手写列表）：左右就不用等分了，
   左边按内容取宽，日期条才排得进一行（等分只有 489px，塞不下「状态 + 日期区间」）。
   有「新增」的页面照旧等分，按钮才真的在正中间。 */
.toolbar:has(.tb-mid:empty) .tb-left { flex: 1 1 auto; }
.toolbar:has(.tb-mid:empty) .tb-right { flex: 0 0 auto; }
.search-box { position: relative; flex: 1 1 136px; min-width: 104px; max-width: 240px; }
.search-box input {
  width: 100%; height: 34px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 12px 0 32px; font-size: 13px; outline: none; background: #fbfcfe; font-family: inherit;
}
.search-box input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(47,111,237,.1); }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.toolbar .spacer { flex: 1; }
.filter-select {
  height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px;
  font-size: 13px; background: #fbfcfe; color: var(--text); outline: none; font-family: inherit;
}
.filter-select:focus { border-color: var(--primary); }
/* 筛选栏里的勾选框（2026-11-17）：成品管理「只看还有货」 */
.filter-check {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #fbfcfe; font-size: 12.5px; color: var(--text-2);
  cursor: pointer; white-space: nowrap; user-select: none;
}
.filter-check:hover { border-color: var(--primary); }
.filter-check input { margin: 0; cursor: pointer; accent-color: var(--primary); }

/* 日期区间筛选（2026-11-15）：搜索框右边「开始日期 至 结束日期」
   框压窄了（128 → 106px），好让左边的筛选条整条塞进半个工具栏，「新增」才能居中 */
.date-range { display: inline-flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.date-range .dr-lab { font-style: normal; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.date-range input[type="date"] {
  height: 32px; border: 1px solid var(--line); border-radius: 8px;
  padding: 0 4px; font-size: 12px; background: #fbfcfe; color: var(--text);
  outline: none; font-family: inherit; width: 96px; flex: 0 0 auto;
}
/* 日历小图标默认左右留白很宽，压一压才放得下 106px 里的年月日 */
.date-range input[type="date"]::-webkit-calendar-picker-indicator {
  padding: 0; margin: 0 0 0 -2px; opacity: .5; width: 14px;
}
.date-range input[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: .85; }
.date-range input[type="date"]:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(47,111,237,.1); }
.date-range em { font-style: normal; font-size: 12px; color: var(--text-3); flex: 0 0 auto; }
/* 「清除」不许被挤成竖排两行，也不许占太宽（窄屏要靠这几像素才塞得下） */
.date-range [data-dclear] {
  flex: 0 0 auto; white-space: nowrap;
  font-size: 12px; padding: 0 2px; line-height: 1;
}

/* ================= 表格 ================= */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; white-space: nowrap;
  table-layout: fixed; /* 列宽按 colgroup 的百分比分配，屏幕多宽都正好铺满，不横向滚动 */
}
table.data th, table.data td { overflow: hidden; text-overflow: ellipsis; }
table.data th {
  /* 表头底色（2026-11-15 用户要求「加深一些」）：原来是近乎白的 #f8fafd，现在深一档 */
  background: #e6edf9; color: var(--text-2); font-weight: 600; font-size: 12px;
  text-align: left; padding: 9px 6px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
  white-space: normal; line-height: 1.3; /* 列窄时表头允许折行，别被裁掉 */
}
table.data th.sortable { cursor: pointer; user-select: none; }
/* 最后一列（操作列）钉在右边：左右拖动看后面的列时，这一列原地不动（2026-11-13 用户要求）
   td 必须自己有底色，否则底下的内容会透过来；hover 时单独给这一格换色，别被 tr 的背景盖住 */
table.data th:last-child,
table.data td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--card);
  /* 一条竖线 + 一道软阴影：让人一眼看出这列是浮在上面没动 */
  box-shadow: -1px 0 0 0 var(--line), -10px 0 12px -8px rgba(15, 32, 66, .32);
}
table.data thead th:last-child { z-index: 4; background: #e6edf9; }
table.data tbody tr:hover td:last-child { background: #e3eeff; }
/* 表头右边缘的列宽拖拽手柄（th 本身是 sticky，可作定位基准） */
.col-resizer {
  position: absolute; top: 0; right: 0; width: 7px; height: 100%;
  cursor: col-resize; z-index: 3; border-radius: 2px;
}
.col-resizer:hover { background: rgba(37,99,235,.28); }
body.col-resizing { cursor: col-resize; user-select: none; }
table.data th.sortable:hover { color: var(--primary); }
table.data td { padding: 10px 6px; border-bottom: 1px solid #f1f4f9; vertical-align: middle; }
/* ===== 列表描边（2026-11-14 用户要求「所有列表都先加上边框看效果」，先做成整格网格） =====
   每列之间一条竖线、每行之间一条横线，外圈闭合，看数据时不会串行串列。
   只是样式，想调深浅改下面这 3 处颜色就行；不想要了整段删掉即恢复原样。 */
table.data th,
table.data td { border-right: 1px solid var(--line); }
table.data tr > *:first-child { border-left: 1px solid var(--line); }
table.data thead th { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
table.data tbody td { border-bottom: 1px solid #eef1f6; }

table.data tbody tr { transition: background .12s; }
/* 鼠标划过那一行的高亮（2026-11-15 用户要求加深）：原来是几乎看不出的 #f8faff */
table.data tbody tr:hover { background: #e3eeff; }
table.data tbody tr:last-child td { border-bottom: 1px solid var(--line); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
/* 备注这类长文本，列表里只占一行，超出用省略号（悬停看全文） */
table.data .cell-ellipsis,
table.data .cell-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data .muted { color: var(--text-3); }
/* 操作列：表头「操作」和第一个按钮左边对齐（按钮自己带 5px 内边距，所以这格左内边距只留 1px），
   右边的空白交给「按按钮实际宽度收紧列宽」去消掉，别让按钮飘在右边、中间一大片空 */
table.data td.ops { text-align: left; white-space: nowrap; padding-left: 1px; }
table.data .strong { font-weight: 600; }
/* 窗口窄的时候（平板、小笔记本）列宽改回按内容算，宁可横向滚动，也别把字挤成一坨 */
@media (max-width: 1100px) {
  table.data { table-layout: auto; }
  table.data th { min-width: 86px; }
}
.empty { padding: 46px 20px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty svg { display: block; margin: 0 auto 10px; opacity: .35; }

/* ================= 标签 ================= */
.tag {
  display: inline-flex; align-items: center; height: 21px; padding: 0 8px;
  border-radius: 5px; font-size: 12px; font-weight: 500; white-space: nowrap;
  background: #f1f4f9; color: var(--text-2);
}
.tag.blue { background: #eaf1ff; color: #2459c9; }
.tag.green { background: #e6f7f0; color: #0d7a54; }
.tag.orange { background: #fef3e2; color: #a5640a; }
.tag.red { background: #fdecec; color: #b83236; }
.tag.gray { background: #f1f4f9; color: #6b7688; }
.tag.purple { background: #f2ecfd; color: #6b3fc4; }

/* ============ 列表下面的合计条（合同制作：合计 / 本月 / 今天，一行三块、颜色区分） ============ */
.list-sum {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px;
  padding: 9px 16px; border-top: 1px solid var(--line);
  background: #f7f9fe; font-size: 12.5px; color: var(--text-2);
}
.list-sum .ls-note { color: var(--text-3); font-size: 12px; margin-right: 2px; }
.list-sum .ls-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 5px 13px; border-radius: 999px; white-space: nowrap;
}
.list-sum .ls-chip .ls-name { font-weight: 700; font-size: 12.5px; }
.list-sum .ls-kv { display: inline-flex; align-items: baseline; gap: 4px; }
.list-sum .ls-kv i { font-style: normal; color: #6b7688; font-size: 12px; }
.list-sum .ls-kv b { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .2px; }
/* 三块各自的颜色：合计=蓝、本月=橙、今天=绿 */
.list-sum .ls-chip.all { background: #eaf1ff; color: #1d55c4; }
.list-sum .ls-chip.month { background: #fef3e2; color: #a5640a; }
.list-sum .ls-chip.today { background: #e6f7f0; color: #0d7a54; }

/* ================= 分页 ================= */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-2);
  flex-wrap: wrap; gap: 8px;
}
.pager { display: flex; gap: 4px; align-items: center; }
.pager button {
  min-width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-size: 12.5px; color: var(--text-2); font-family: inherit;
}
.pager button:hover:not([disabled]) { border-color: var(--primary); color: var(--primary); }
.pager button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager button[disabled] { opacity: .4; cursor: not-allowed; }

/* ================= 弹窗 ================= */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.42); z-index: 1000;
  display: flex; align-items: flex-start; justify-content: center; padding: 46px 16px;
  overflow-y: auto; animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: 13px; width: 100%; max-width: 720px;
  box-shadow: 0 24px 60px rgba(15,23,42,.24); animation: pop .18s ease;
  display: flex; flex-direction: column; max-height: calc(100vh - 92px);
}
@keyframes pop { from { transform: translateY(10px) scale(.985); opacity: 0 } to { transform: none; opacity: 1 } }
.modal.wide { max-width: 980px; }
.modal.xwide { max-width: 1180px; }
.modal.xxwide { max-width: 1600px; width: calc(100vw - 56px); }
.modal.slim { max-width: 460px; }
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.modal-head h3 { font-size: 15.5px; font-weight: 650; }
.modal-close {
  width: 30px; height: 30px; border-radius: 7px; border: none; background: #f4f6fa;
  cursor: pointer; color: var(--text-2); font-size: 17px; line-height: 1; display: grid; place-items: center;
}
.modal-close:hover { background: #eceff6; color: var(--danger); }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 13px 20px; border-top: 1px solid var(--line);
  display: flex; justify-content: center; gap: 8px; background: #fcfdfe;
  border-radius: 0 0 13px 13px;
}

/* ================= 表单 ================= */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px 16px; }
.form-grid.one { grid-template-columns: 1fr; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
/* 8 列：报价单表头这种一行放完的场景，客户名称给宽一点 */
.form-grid.eight { grid-template-columns: 1.15fr 1fr 1.35fr 1fr .85fr .9fr .9fr 1fr; gap: 14px 12px; }
/* 7 列：合同弹窗（没交期）用，比例是上面那套去掉最后一列 */
.form-grid.seven { grid-template-columns: 1.15fr 1fr 1.35fr 1fr .85fr .9fr 1fr; gap: 14px 12px; }
.fld { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* 字段名在左、输入框在右（横排）：同样的宽度能少占一半高度（2026-11-15 用户要求，全站统一）。
   8 / 7 列那种「一行平铺」的表头格子太窄（一格才 110 像素），横排会把输入框挤没，所以这两种保持上下排。 */
.form-grid:not(.eight):not(.seven) .fld {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: start;
  gap: 3px 10px;
}
.form-grid:not(.eight):not(.seven) .fld > label {
  padding-top: 10px; text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 字段下面的常驻小字 / 提示（.fld-note、.hint）跟着输入框走，别掉到左边那列去 */
.form-grid:not(.eight):not(.seven) .fld-note,
.form-grid:not(.eight):not(.seven) .fld > .hint { grid-column: 2 / -1; margin-top: 1px; }
/* 手写的 .fld 里只有一个框、没有字段名（合同/订单底部备注那种），让它铺满整行，别缩在左边 80px 里 */
.form-grid:not(.eight):not(.seven) .fld > :only-child { grid-column: 1 / -1; }
/* 表单分块小标题（2026-11-15 美化）：左边一道竖色条 + 文字 + 右边一条细线铺到底 */
.form-sec {
  display: flex; align-items: center; gap: 7px;
  margin: 20px 0 11px; font-size: 12.5px; font-weight: 650; color: #3d4f6b;
  letter-spacing: .3px;
}
.form-sec:first-child { margin-top: 0; }
.form-sec::before {
  content: ''; width: 3px; height: 13px; border-radius: 2px;
  background: var(--primary); flex: none;
}
.form-sec::after {
  content: ''; flex: 1; height: 1px; margin-left: 2px;
  background: linear-gradient(90deg, var(--line), rgba(230,234,241,0));
}
.fld.span2 { grid-column: span 2; }
.fld.span3 { grid-column: span 3; }
.fld.span4 { grid-column: span 4; }
.fld.span8 { grid-column: 1 / -1; }
/* 屏幕不够宽时，8 / 7 列自动降成 4 列，免得每个框挤成一条缝 */
@media (max-width: 1280px) {
  .form-grid.eight, .form-grid.seven { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
/* 字段名：字重加重、颜色压深一点，跟输入框里的字拉开层次（2026-11-15 美化） */
.fld > label { font-size: 12.5px; color: #47556e; font-weight: 600; letter-spacing: .2px; }
.fld > label .req { color: var(--danger); margin-left: 2px; }
/* 常驻小字说明（鼠标不用放上去也能看到），比如生产编号的生成规则 */
.fld-note { font-size: 11.5px; color: var(--text-3); line-height: 1.5; margin-top: -1px; }
/* 输入框（2026-11-15 美化）：白底 + 稍深一点边的圆角框，比原来的浅灰底更清爽、边界更清楚。
   hover 边框加深提示「这里能点」，focus 主色描边 + 一圈淡光晕。 */
.fld input, .fld select, .fld textarea {
  width: 100%; border: 1px solid #dbe3f0; border-radius: 9px; padding: 9px 12px;
  font-size: 13.5px; outline: none; background-color: #fff; color: var(--text);
  font-family: inherit; min-height: 38px;
  box-shadow: 0 1px 1px rgba(16,24,40,.03);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.fld input::placeholder, .fld textarea::placeholder { color: #aab4c6; }
.fld input:hover, .fld select:hover, .fld textarea:hover { border-color: #c2cfe3; }
/* 下拉框去掉系统那个丑箭头，换成右边一个细细的灰色小箭头 */
.fld select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238b95a7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  padding-right: 28px; cursor: pointer;
}
.fld textarea { resize: vertical; line-height: 1.65; }
.fld input:focus, .fld select:focus, .fld textarea:focus {
  border-color: var(--primary); background-color: #fff;
  box-shadow: 0 0 0 3px rgba(47,111,237,.13);
}
.fld input[readonly] {
  background-color: #f5f7fb; color: var(--text-3); border-color: #e8edf6;
  box-shadow: none; cursor: default;
}
/* 必填项没填就点保存：那一格标红 + 淡红圈，光标也自动跳过去（2026-11-15） */
.fld input.req-miss, .fld select.req-miss, .fld textarea.req-miss {
  border-color: var(--danger); background-color: #fff;
  box-shadow: 0 0 0 3px rgba(217,72,72,.13);
}
.fld .hint { font-size: 11.5px; color: var(--text-3); }
/* 字段说明改成小问号：鼠标放上去才显示那句话 */
/* 2026-11-15 用户要求：验收标准右边那个小问号不要了，「其它问号」也一起去掉 —— 整站隐藏。
   说明文字还在（鼠标停在字段上照样能看到），想恢复把这个 display:none 删掉就行。 */
.fld .hint-i { display: none; }

/* 计算公式页：一行一条公式，最后那个数能改 */
.cf-list { display: grid; gap: 12px; max-width: 720px; }
.cf-row { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; align-items: center; }
.cf-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  padding: 7px 0 7px 11px; border-left: 3px solid var(--primary); line-height: 1.25;
}
.cf-body { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cf-expr {
  font-size: 13.5px; color: var(--text-2); letter-spacing: .2px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.cf-ipt {
  flex: 0 0 176px; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fbfcfe; padding: 0 10px; transition: .14s; min-height: 36px;
}
.cf-ipt:focus-within { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(47,111,237,.1); }
.cf-ipt input {
  flex: 1 1 auto; min-width: 0; border: 0; outline: none; background: transparent;
  padding: 7px 0; font-size: 13.5px; color: var(--text);
  font-family: inherit; font-variant-numeric: tabular-nums;
}
.cf-unit { flex: none; white-space: nowrap; font-size: 12px; color: var(--text-3); }
.cf-tip {
  margin: 14px 0 0; padding: 10px 12px; border-radius: 8px;
  background: #f5f8ff; color: var(--text-2); font-size: 12px; line-height: 1.7;
}
@media (max-width: 820px) {
  .cf-row { grid-template-columns: 1fr; gap: 6px; }
  .cf-name { border-left: 0; padding-left: 0; }
}

/* 单位换算页：一列输入框，填哪一格其它几格跟着算 */
.uc-sec { font-size: 12px; font-weight: 600; color: var(--text-3); letter-spacing: .5px; margin-bottom: 12px; }
.uc-list { display: grid; gap: 9px; max-width: 340px; }
.uc-row { display: flex; align-items: center; gap: 10px; }
.uc-row input {
  flex: none; width: 150px; border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 10px; font-size: 13.5px; outline: none; background: #fff;
  color: var(--text); font-family: inherit; font-variant-numeric: tabular-nums;
  transition: .14s; min-height: 34px;
}
.uc-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,237,.1); }
.uc-name { font-size: 13px; color: var(--text-2); white-space: nowrap; }
.uc-tip { margin: 12px 0 0; font-size: 11.5px; color: var(--text-3); }

/* 可搜索下拉框 */
.ss { position: relative; }
.ss-pop {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 80; margin-top: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 10px 26px rgba(20, 40, 80, .14); max-height: 250px; overflow-y: auto; padding: 4px;
}
.ss-item {
  padding: 7px 10px; border-radius: 6px; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.ss-item:hover { background: #eef4ff; }
.ss-item b { font-weight: 500; }
.ss-sub { color: var(--text-3); font-size: 12px; flex: none; }
.ss-empty { padding: 10px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.form-section { margin: 20px 0 12px; font-size: 13px; font-weight: 650; color: var(--text); display: flex; align-items: center; gap: 8px; }
.form-section::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.form-section:first-child { margin-top: 0; }
/* 打印设置里的小分组标题（比 form-section 轻一档） */
.form-sub { margin: 16px 0 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.form-sub:first-of-type { margin-top: 6px; }

/* ================= 看板 ================= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; right: -22px; top: -22px; width: 76px; height: 76px;
  border-radius: 50%; background: var(--primary-l); opacity: .7;
}
.stat .label { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; position: relative; z-index: 1; }
.stat .value { font-size: 25px; font-weight: 700; letter-spacing: -.6px; margin-top: 7px; position: relative; z-index: 1; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.stat .foot { font-size: 11.5px; color: var(--text-3); margin-top: 5px; position: relative; z-index: 1; }
.stat.warn .value { color: var(--warn); }
.stat.danger .value { color: var(--danger); }
.stat.ok .value { color: var(--ok); }
.stat .value.money { font-size: 23px; }

.board-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1080px) { .board-grid { grid-template-columns: 1fr; } }

.mini-list { display: flex; flex-direction: column; }
.mini-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border-bottom: 1px solid #f3f5fa; font-size: 13px;
}
.mini-item:last-child { border-bottom: none; }
.mini-item .mi-main { flex: 1; min-width: 0; }
.mini-item .mi-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item .mi-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item .mi-right { text-align: right; flex: 0 0 auto; font-size: 12px; color: var(--text-2); }

.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 148px; padding: 8px 4px 0; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 46px; border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #5b8dff, #2f6fed); min-height: 3px; transition: .3s;
  position: relative;
}
.bar-val { font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.bar-lbl { font-size: 11.5px; color: var(--text-3); }

/* ================= 详情页 ================= */
.detail-hero {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 16px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.detail-hero .dh-main { display: flex; gap: 14px; align-items: center; }
.dh-avatar {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primary-l); color: var(--primary); font-size: 17px; font-weight: 700; flex: 0 0 auto;
}
.dh-title { font-size: 16.5px; font-weight: 650; }
.dh-sub { font-size: 12.5px; color: var(--text-3); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.dh-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 14px; background: #fff; }
.tab {
  padding: 10px 13px; font-size: 13px; color: var(--text-2); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: .14s; user-select: none;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 20px; }
.info-item .k { font-size: 12px; color: var(--text-3); margin-bottom: 3px; }
.info-item .v { font-size: 13.5px; color: var(--text); word-break: break-all; }

.timeline { padding: 4px 0; }
.tl-item { position: relative; padding: 0 0 18px 22px; border-left: 1.5px solid #e6ebf4; margin-left: 6px; }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-item::before {
  content: ''; position: absolute; left: -5.5px; top: 3px; width: 9px; height: 9px;
  border-radius: 50%; background: #fff; border: 2px solid var(--primary);
}
.tl-item .tl-top { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; flex-wrap: wrap; }
.tl-item .tl-stage { font-size: 13px; font-weight: 600; }
.tl-item .tl-date { font-size: 11.5px; color: var(--text-3); }
.tl-item .tl-note { font-size: 12.5px; color: var(--text-2); line-height: 1.6; }

.progress-bar { height: 6px; border-radius: 3px; background: #eef1f7; overflow: hidden; min-width: 64px; }
.progress-bar > i { display: block; height: 100%; background: linear-gradient(90deg, #5b8dff, #2f6fed); border-radius: 3px; }
.progress-line { display: flex; align-items: center; gap: 8px; }
.progress-line span { font-size: 12px; color: var(--text-2); min-width: 32px; }

/* ================= 明细表编辑 ================= */
.items-table { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.items-table th {
  /* 和列表表头保持同一个底色（2026-11-15 加深一档） */
  background: #e6edf9; color: var(--text-2); font-weight: 600; text-align: left;
  padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 12px; white-space: nowrap;
}
.items-table td { padding: 5px 4px; border-bottom: 1px solid #f3f5fa; vertical-align: middle; }
.items-table input, .items-table select {
  width: 100%; border: 1px solid transparent; border-radius: 6px; padding: 6px 7px;
  font-size: 12.5px; outline: none; background: transparent; font-family: inherit; color: var(--text);
}
.items-table input:hover, .items-table select:hover { border-color: var(--line); background: #fbfcfe; }
.items-table input:focus, .items-table select:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 2px rgba(47,111,237,.1); }
.items-table .w-num { width: 74px; }
.items-table .w-qty { width: 84px; }
.items-table .w-money { width: 90px; text-align: right; }
.items-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
.items-foot { display: flex; justify-content: flex-end; gap: 26px; padding: 12px 14px; background: #fafbfe; border-top: 1px solid var(--line); font-size: 13px; }
.items-foot b { font-size: 17px; color: var(--primary); font-variant-numeric: tabular-nums; }

/* ================= 报价明细：两段式（上段管钱，下段管工艺） ================= */
.qm-sec { font-size: 13px; font-weight: 600; color: var(--text); margin: 16px 0 7px; }
.qm-sec:first-child { margin-top: 4px; }
.qm-sec span { font-weight: 400; color: var(--text-3); font-size: 12px; margin-left: 6px; }
/* 「一、加工品名称、数量及交期」右边那排：新单 / 返单 / 样板 / 批量（2026-11-12 用户要求）
   跟着当前选中的那一行走，点哪一行按钮就显示哪一行选的是哪个 */
.qm-sec-order { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qm-sec-t { font-size: 13px; font-weight: 600; color: var(--text); }
/* 按钮组放在标题右边的空白里居中（2026-11-12 用户要求「移到中间」），
   两边各留一半空间，既不贴着标题也不贴着右边框 */
.qm-ot-bar { margin: 0 auto; display: flex; gap: 4px; flex-wrap: wrap; }
.qm-ot {
  height: 25px; padding: 0 11px; border-radius: 13px; cursor: pointer;
  border: 1px solid #d9e6fa; background: #fff; color: #3d5a86;
  font-size: 12px; line-height: 1; font-family: inherit;
}
.qm-ot:hover { border-color: #8fb4e8; color: #1e5fa8; background: #f6faff; }
.qm-ot.on { background: #1677ff; border-color: #1677ff; color: #fff; font-weight: 600; }
.qm-table { width: auto; min-width: 0; border: 1px solid #d9e6fa; }
.qm-table th {
  /* 列宽是按内容自动收放算的，表头字多就折成两行，不硬撑宽 */
  position: relative; white-space: normal; word-break: break-word; line-height: 1.25;
  padding: 7px 8px; border: 1px solid #d9e6fa; background: #f2f7ff; color: #2a4a7f;
}
.qm-table td { padding: 0; border: 1px solid #e8eef8; }
.qm-table tbody tr:hover td { background: #fbfdff; }
/* 明细表自己就是外框，外层容器不用再套一圈，免得出现双线。
   容器不能自己带滚动条，否则表头吸顶会被截在容器里、不跟着弹窗滚，所以 overflow 放开 */
.qm-wrap { border: none; border-radius: 0; overflow: visible; }
/* 表头吸顶（2026-11-11 用户要求）：行数一多往下翻时，「文件名」那行表头钉在最上面。
   top 取负值 = 弹窗滚动区 18px 的内边距，让表头正好贴到弹窗标题栏下沿，不留缝 */
.qm-table thead th { position: sticky; top: -18px; z-index: 4; box-shadow: 0 1px 0 #d9e6fa; }
.qm-table td input, .qm-table td select {
  height: 32px; border: 1px solid transparent; border-radius: 0; padding: 0 8px; font-size: 12.5px;
  /* 用 background-color，别用 background 简写：简写会把下拉框自带的箭头也清掉 */
  background-color: #fff; color: #16233a;
}
/* 空着的格子：浅蓝底 + 虚线圈，一眼看出还没填 */
.qm-table td input.empty, .qm-table td select.empty {
  background-color: #e7f1ff; border: 1px dashed #a9c6f0; color: #93a9c9;
}
.qm-table td input::placeholder { color: #a9bcd8; }
.qm-table td.ro {
  text-align: right; padding: 0 8px; font-variant-numeric: tabular-nums;
  color: #0b1f3a; font-weight: 700; background: #f6f9ff;
}
/* 跟钱有关的（单价、金额）用暗红加粗，扫一眼就找到重点 */
.qm-table td input.money { color: #b3261e; font-weight: 600; }
.qm-table td input.money.empty { color: #93a9c9; font-weight: 400; }
.qm-table td.ro.money { color: #b3261e; }
.qm-table td input:focus, .qm-table td select:focus {
  border-color: var(--primary); background: #fff; box-shadow: inset 0 0 0 1px var(--primary);
  color: #16233a;
}
.qm-table .qm-no, .qm-table th.qm-no { background: #f7f9fc; color: var(--text-2); }
.qm-table td.qm-no input { font-weight: 600; color: var(--text-2); text-align: center; }
.qm-table td.qm-op, .qm-table th.qm-op { text-align: center; }
/* 下段最左边的文件名：跟上段同一个值，两边都能直接打字（2026-11-12 改） */
.qm-table th.qm-mirror-h { background: #f2f7ff; color: #2a4a7f; }
/* 序号列：只给眼睛看的行号，不是字段，不能填也不能拖宽 */
.qm-table th.qm-sn-h { text-align: center; background: #f7f9fc; color: var(--text-2); }
.qm-table td.qm-sn {
  text-align: center; background: #f7f9fc; color: #7b8aa3;
  font-size: 12.5px; height: 32px; line-height: 32px; font-variant-numeric: tabular-nums;
}
/* 选中哪一行，那一行的序号就变红，一眼看出正在改第几行 */
.qm-table tr.sel td.qm-sn { color: #e2402f; font-weight: 700; }
.qm-table .rs {
  position: absolute; top: 0; right: -3px; width: 7px; height: 100%;
  cursor: col-resize; z-index: 3; border-radius: 0 3px 3px 0;
}
.qm-table .rs:hover, .qm-table .rs:active { background: var(--primary); opacity: .3; }
.qm-total {
  display: flex; justify-content: flex-end; align-items: baseline; flex-wrap: wrap; gap: 8px 24px;
  padding: 10px 14px; margin-top: -1px; border: 1px solid #dbe7f8; border-top: none;
  border-radius: 0 0 9px 9px; background: #f8fbff; font-size: 13px; color: #5a6478;
}
/* 小写合计最显眼：客户翻开报价单第一眼就找总价 */
.qm-total b { color: #b3261e; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.qm-total .qm-cn b { color: #1f3a5f; font-size: 13px; font-weight: 400; }
.qm-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.qm-tools-btns { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.qm-pop {
  position: fixed; z-index: 9999; background: #fff; border: 1px solid var(--line);
  border-radius: 9px; box-shadow: 0 10px 26px rgba(20,30,60,.14);
  max-height: 260px; overflow-y: auto; font-size: 12.5px;
}
.qm-pop-i { padding: 7px 10px; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.qm-pop-i:hover { background: #f3f7ff; }
.qm-pop-i span { color: var(--text-3); font-size: 12px; }
.qm-pop-e { padding: 10px; color: var(--text-3); }

/* 文件名格子里的小回形针（2026-11-12）：不占列宽，浮在格子右端；传过文件就变绿 */
.qm-table td.qm-file { position: relative; }
.qm-table td.qm-file > input[data-prodsug] { padding-right: 27px; }
/* 下段的文件名格没有回形针，右边不用留空，能多打几个字 */
.qm-table td.qm-file-b > input[data-prodsug] { padding-right: 8px; }
.qm-table .qm-clip {
  position: absolute; right: 3px; top: 5px; width: 23px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #dbe6f5; border-radius: 5px; background: #fff;
  color: #9aa8bd; cursor: pointer; padding: 0;
}
.qm-table .qm-clip:hover { border-color: #b9d2f2; color: #2f6fd0; background: #f4f9ff; }
.qm-table .qm-clip.has { border-color: #bcd9a5; background: #f1f8e8; color: #3b6d11; }
.qm-table .qm-clip.has:hover { border-color: #9ec97c; background: #eaf4dc; }
.qm-upmenu {
  position: fixed; z-index: 9999; background: #fff; border: 1px solid var(--line);
  border-radius: 9px; box-shadow: 0 10px 26px rgba(20,30,60,.14);
  padding: 4px; min-width: 126px;
}
.qm-upmenu button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 7px 10px; font-size: 12.5px; color: #16233a; border-radius: 6px; cursor: pointer;
}
.qm-upmenu button:hover { background: #f3f7ff; }
.qm-upmenu button[data-act="del"] { color: #c0392b; }
/* 菜单顶上那行：告诉我这份文件叫什么（太长就省略号） */
.qm-up-name {
  padding: 6px 10px 7px; margin-bottom: 2px; border-bottom: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-3);
  max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* 自定义下拉列表：永远向下展开 */
.seldown-pop {
  position: fixed; z-index: 9999; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 10px 26px rgba(20, 30, 60, .16);
  overflow-y: auto; overscroll-behavior: contain; padding: 4px; font-size: 12.5px;
  width: max-content;
}
.seldown-item {
  padding: 6px 10px; border-radius: 5px; cursor: pointer; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seldown-item:hover { background: #f3f7ff; }
.seldown-item.on { background: #eaf1ff; color: var(--primary); font-weight: 600; }

/* 点「工艺」后，在明细下方就地展开的参数面板 */
.tech-panel {
  margin-top: 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #f8fafd; padding: 14px 16px 12px;
}
.tech-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; font-size: 13px; color: var(--text);
}
.tech-head b { font-weight: 600; }
.tech-panel .form-grid { gap: 16px 14px; }
.tech-panel .fld { gap: 4px; }
.tech-panel textarea { min-height: 58px; }
/* 工艺面板里「文件名」的联想列表往上弹，免得被弹窗底部裁掉 */
.tech-panel .ss-pop { top: auto; bottom: 100%; margin: 0 0 4px; }
.tech-panel .ss-pop.empty { pointer-events: none; }
.tech-panel .ss-input, .tech-panel .ss input { width: 100%; }
.tech-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ================= 系统设置 ================= */
.set-grid { display: grid; grid-template-columns: 178px 1fr; gap: 16px; align-items: start; }
.set-nav { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.set-nav-item {
  padding: 9px 12px; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--text-2);
  display: flex; align-items: center; gap: 9px; transition: .13s; user-select: none; margin-bottom: 2px;
}
.set-nav-item:hover { background: #f5f8fd; color: var(--primary); }
.set-nav-item.active { background: var(--primary-l); color: var(--primary); font-weight: 600; }

.dict-layout { display: grid; grid-template-columns: 236px 1fr; gap: 16px; align-items: start; }
.dict-list { background: #fff; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; max-height: 620px; overflow-y: auto; }
.dict-item {
  padding: 10px 13px; font-size: 13px; cursor: pointer; border-bottom: 1px solid #f3f5fa;
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
}
.dict-item:hover { background: #f7f9fd; }
.dict-item.active { background: var(--primary-l); color: var(--primary); font-weight: 600; }
.dict-item small { font-size: 11px; color: var(--text-3); font-weight: 400; }
.dict-tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; font-size: 12.5px;
  background: #f6f8fc; border: 1px solid var(--line); border-radius: 6px; margin: 0 6px 6px 0;
}
.dict-tag button {
  border: none; background: none; color: var(--text-3); cursor: pointer; font-size: 13px;
  line-height: 1; padding: 0 1px;
}
.dict-tag button:hover { color: var(--danger); }
/* 字典项代码：生产编号要用，比如表面处理的 H / G / O */
.dict-code {
  font-size: 11.5px; font-weight: 700; letter-spacing: .5px; color: var(--primary);
  background: #eaf1ff; border: 1px solid #cfe0ff; border-radius: 4px; padding: 0 4px; line-height: 1.4;
  margin-left: 4px; vertical-align: 1px;
}

/* ================= Toast ================= */
.toast-root { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 9px 16px; border-radius: 9px; background: #1f2a3d; color: #fff; font-size: 13px;
  box-shadow: 0 8px 24px rgba(15,23,42,.22); animation: toastIn .2s ease; max-width: 90vw;
}
.toast.ok { background: #0f8a5f; }
.toast.err { background: #d1393e; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) } to { opacity: 1; transform: none } }

/* ================= 打印 ================= */
.print-area { display: none; }
@media print {
  body { background: #fff; }
  .layout, .modal-mask, .toast-root { display: none !important; }
  .print-area { display: block !important; padding: 0 10mm; }
  .print-area table { width: 100%; border-collapse: collapse; font-size: 12px; }
  .print-area th, .print-area td { border: 1px solid #444; padding: 6px 8px; }
  .print-area h1 { font-size: 20px; text-align: center; margin: 0 0 14px; letter-spacing: 4px; }
  .print-area .p-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 10px; }
  .print-area pre { white-space: pre-wrap; font-family: inherit; font-size: 12.5px; line-height: 2; }

  /* 抬头（公司名 / Logo） */
  .print-area .p-company {
    display: flex; align-items: center; gap: 14px;
    border-bottom: 2px solid #333; padding-bottom: 9px; margin-bottom: 14px;
  }
  .print-area .p-logo { height: 48px; max-width: 190px; object-fit: contain; }
  .print-area .p-cname { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
  .print-area .p-cinfo { font-size: 11.5px; margin-top: 4px; color: #333; }

  /* 合计 / 大写 / 条款 / 落款 */
  .print-area .p-sec { font-size: 12.5px; font-weight: 600; margin: 12px 0 6px; }
  .print-area .p-total { text-align: right; margin-top: 12px; font-size: 13.5px; }
  .print-area .p-upper { font-size: 12px; margin-top: 4px; }
  .print-area .p-note { margin-top: 16px; }
  .print-area .p-sign {
    margin-top: 42px; display: flex; justify-content: space-between; font-size: 13px;
  }

  /* ---------- 合同打印 · 订货合同书（A4 横版，18 格 A~R，逐格复刻 Excel） ---------- */
  .print-area .pct-page { break-after: page; page-break-after: always; margin: 0 -10mm; position: relative; }
  .print-area .pct-page:last-child { break-after: auto; page-break-after: auto; }
  .print-area table.pct-form {
    width: 100%; border-collapse: collapse; table-layout: fixed; margin: 0;
    font-family: SimSun, "宋体", serif; color: #000;
  }
  .print-area table.pct-form td {
    font-size: 15px; line-height: 21px; height: 21px;
    padding: 0 2px; vertical-align: middle;
    white-space: nowrap; overflow: hidden; border: 0; color: #000;
  }
  /* 三种边：四面包 / 只有横线（抬头用） / 不要边（空格） */
  .print-area table.pct-form td.pct-b { border: 1px solid #000; }
  .print-area table.pct-form td.pct-bb { border-bottom: 1px solid #000; }
  .print-area table.pct-form td.pct-nb { border: 0; }

  /* 抬头：左边 Logo、中间公司名 + 标题、右上角合同编号小框 */
  .print-area table.pct-form td.pct-hcell { height: 84px; padding: 0; border: 0; }
  .print-area .pct-hbar { display: flex; align-items: center; height: 84px; }
  .print-area .pct-hlogo { flex: 0 0 31.73%; display: flex; align-items: center; justify-content: center; }
  .print-area .pct-hlogo img { height: 62px; width: auto; max-width: 100%; transform: translateX(200%); }
  .print-area .pct-hmid { flex: 0 0 40.12%; text-align: center; }
  .print-area .pct-cname { font-size: 24px; line-height: 27px; letter-spacing: 1px; }
  .print-area .pct-title { font-size: 24px; line-height: 29px; letter-spacing: 8px; }
  .print-area .pct-suf { font-size: 14px; letter-spacing: 0; }
  .print-area .pct-hgap { flex: 0 0 4.99%; }
  .print-area table.pct-hno { flex: 0 0 23.16%; border-collapse: collapse; }
  .print-area table.pct-hno td {
    border: 1px solid #000; font-size: 15px; line-height: 21px; height: 21px;
    padding: 0 2px; text-align: center; vertical-align: middle; white-space: nowrap;
  }
  .print-area table.pct-hno td.pct-hnol { width: 39.2%; }
  .print-area table.pct-hno td.pct-hnov { width: 60.8%; }

  /* 两个分区标题：一.加工品… / 二.加工要求，无框、左对齐 */
  .print-area table.pct-form td.pct-sec { border: 0; text-align: left; }

  /* 对齐 */
  .print-area table.pct-form td.pct-l { text-align: left; }
  .print-area table.pct-form td.pct-c { text-align: center; }
  .print-area table.pct-form td.pct-r { text-align: right; }

  /* 表头一律居中，写在上面三行之后才能盖住 */
  .print-area table.pct-form td.pct-hd { text-align: center; }

  /* 序号列：列窄字少，字号小一号，保证「序号」两个字和两位数字都放得下不被裁 */
  .print-area table.pct-form td.pct-sn { font-size: 12.5px; padding: 0 1px; }

  /* 合计行（货款大写人民币 / 小写合计）：整行文字加粗 */
  .print-area table.pct-form tr.pct-total td { font-weight: 700; }

  /* 条款区：没有框，1~5 一行、6~11 一整段 */
  .print-area table.pct-form td.pct-terms {
    border: 0; padding: 0; height: auto; white-space: normal; overflow: visible; vertical-align: top;
  }
  .print-area .pct-tline { display: flex; height: 21px; line-height: 21px; }
  .print-area .pct-tline > div { flex: 0 0 auto; white-space: nowrap; }
  .print-area .pct-flow {
    margin: 0; height: 126px; font-size: 15px; line-height: 21px; padding-right: 3px;
    text-align: justify; word-break: break-all; overflow: hidden;
  }
  .print-area table.pct-form td.pct-blank2 { border: 0; height: 42px; }

  /* 落款两行 */
  .print-area table.pct-form td.pct-sign { height: 21px; }

  /* 供方合同专用章：压在落款那格上，章顶落在落款上方的空行里，不遮字 */
  .print-area table.pct-form td.pct-sealcell { position: relative; overflow: visible; }
  .print-area .pct-seal {
    position: absolute; z-index: 5;
    right: 114px; bottom: -65px;
    width: 40mm; height: 40mm;
    opacity: .88; pointer-events: none;
  }

  /* 下边距比上/左右小一点（8mm），给右下角那颗公司章留出落脚的高度。
     正文本身只到 175mm，离纸边还有 21mm，常规打印机都打得下。 */
  @page { margin: 14mm 14mm 8mm; }
}

/* ================= 响应式 ================= */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 100; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .only-mobile.icon-btn { display: grid; }
  .form-grid, .form-grid.three, .form-grid.four, .form-grid.eight { grid-template-columns: 1fr; }
  .fld.span2, .fld.span3, .fld.span4 { grid-column: span 1; }
  /* 窄屏一格一行：生产编号弹窗里「另起一行 / 对齐第2列」的格子要放掉，不然会撑出多余的列 */
  .form-grid .fld[style*="grid-column-start"] { grid-column-start: auto !important; }
  .set-grid, .dict-layout { grid-template-columns: 1fr; }
  .view { padding: 14px; }
  .search-box { flex: 1 1 100%; }
  /* 窄屏：工具栏分两行，搜索独占一行，新增和导出排在下面，不硬挤 */
  .toolbar { flex-wrap: wrap; }
  .tb-left { flex: 1 1 100%; }
  .tb-mid, .tb-right { flex: 0 0 auto; }
}

/* ================= 打印设置页 ================= */
.logo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview {
  width: 190px; height: 64px; border: 1px dashed var(--line); border-radius: 9px;
  display: flex; align-items: center; justify-content: center; background: #fff;
  overflow: hidden; font-size: 12px; color: var(--muted);
}
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* 打印设置里「Logo 和印章」那一列：一行一张图，右边是上传按钮和显示开关 */
.img-list { display: flex; flex-direction: column; }
.img-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.img-row:first-child { padding-top: 0; }
.img-row:last-child { border-bottom: 0; padding-bottom: 0; }
.img-name { flex: 0 0 74px; font-size: 13px; font-weight: 600; color: var(--text); }
.img-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.img-show select { min-width: 96px; }
.seal-preview {
  width: 84px; height: 84px; border: 1px dashed var(--line); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; background: #fff;
  overflow: hidden; font-size: 11px; color: var(--muted); text-align: center; padding: 4px;
}
.seal-preview img { width: 100%; height: 100%; object-fit: contain; }
.col-picker { display: flex; flex-wrap: wrap; gap: 9px 18px; }
.col-picker .chk {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; cursor: pointer; user-select: none; color: var(--text);
}
.col-picker .chk input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }

/* ================= 日期提示气泡：鼠标放到日期上显示"还有几天" ================= */
.date-tip {
  position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none;
  background: #1f2a3d; color: #fff; border-radius: 9px; padding: 8px 13px;
  font-size: 12.5px; line-height: 1.45; white-space: nowrap;
  box-shadow: 0 10px 26px rgba(16, 32, 64, .28);
  opacity: 0; transition: opacity .12s ease;
}
.date-tip.show { opacity: 1; }
.date-tip b { display: block; font-size: 15px; font-weight: 700; color: #8fc0ff; }
.date-tip span { display: block; color: #aebbd0; font-size: 11.5px; margin-top: 2px; }
.date-tip.today b { color: #6fe3b4; }
.date-tip.warn b { color: #ffc266; }
.date-tip.past b { color: #9aa7bb; }
@media print { .date-tip { display: none !important; } }

/* ================= 自制日历：每个日子下面显示「还有几天」 ================= */
/* 关掉系统日历自带的那个按钮，点日期框时由我们自己的日历接手 */
input[type="date"]::-webkit-calendar-picker-indicator {
  display: none; pointer-events: none;
}
/* 换成我们自己画的小日历图标（纯装饰，点了也是开自己的日历） */
input[type="date"] {
  padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b86ab' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='4' width='18' height='17' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 5px center;
  background-size: 13px 13px;
  cursor: pointer;
}
.dp-open .date-tip { display: none !important; }

.dp-pop {
  position: fixed; z-index: 9997; width: 356px; padding: 10px 12px 8px;
  background: #fff; border: 1px solid #dbe4f2; border-radius: 12px;
  box-shadow: 0 16px 40px rgba(16, 32, 64, .18);
  font-size: 12.5px; color: #16233a; user-select: none;
  opacity: 0; transform: translateY(-4px); pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}
.dp-pop.show { opacity: 1; transform: none; pointer-events: auto; }

.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.dp-title { font-size: 13.5px; font-weight: 700; color: #16233a; letter-spacing: .3px; }
.dp-nav {
  width: 28px; height: 28px; border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: #6b86ab; font-size: 18px; line-height: 1; cursor: pointer; padding: 0;
}
.dp-nav:hover { background: #eef4ff; border-color: #cfe0fa; color: #1a7cff; }

.dp-week { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 2px; }
.dp-week span { text-align: center; font-size: 11px; color: #9aabc4; padding: 2px 0; }

.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }

.dp-d {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  height: 44px; padding: 0; border: 1px solid transparent; border-radius: 8px;
  background: transparent; cursor: pointer; font-family: inherit;
}
.dp-d i { font-style: normal; font-size: 13.5px; font-weight: 600; line-height: 1; color: #16233a; }
.dp-d em { font-style: normal; font-size: 10px; line-height: 1; color: #6b86ab; }
.dp-d:hover { background: #eef4ff; border-color: #cfe0fa; }
.dp-d.out { opacity: .35; }
.dp-d em.today { color: #12916a; font-weight: 700; }
.dp-d em.soon { color: #e08a00; font-weight: 700; }
.dp-d em.future { color: #4a86d8; }
.dp-d em.past { color: #b3bfd0; }

.dp-d.is-today { background: #eafaf2; border-color: #bfe8d5; }
.dp-d.is-today em { color: #12916a; font-weight: 700; }

.dp-d.is-sel { background: #1a7cff; border-color: #1a7cff; box-shadow: 0 4px 10px rgba(26, 124, 255, .35); }
.dp-d.is-sel i { color: #fff; }
.dp-d.is-sel em { color: #d8e8ff; }

.dp-foot { display: flex; justify-content: space-between; margin-top: 6px; padding-top: 6px; border-top: 1px solid #eef2f9; }
.dp-foot button {
  border: none; background: transparent; color: #1a7cff; font-size: 12.5px; cursor: pointer;
  padding: 4px 8px; border-radius: 6px; font-family: inherit;
}
.dp-foot button:hover { background: #eef4ff; }

@media print { .dp-pop { display: none !important; } }

/* ================= 报价明细：快速算价面板（添加一行下面） ================= */
.qm-calc {
  margin-top: 12px; border: 1px solid #dbe4f2; border-radius: 10px; background: #fbfcff;
}
.qc-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; }
.qc-bar .btn.on { background: #eaf2ff; border-color: #bcd8ff; color: #1a6fe0; font-weight: 600; }
.qc-body { padding: 0 12px 12px; }

.qc-rowpick {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: #3d5a86; white-space: nowrap;
}
.qc-rowpick[hidden] { display: none; }
.qc-rowpick select {
  height: 30px; border: 1px solid #d9e6fa; border-radius: 7px; background: #fff;
  padding: 0 8px; font-size: 12.5px; color: #16233a; max-width: 260px;
}
.qc-mirror { color: #6b86ab; }
.qc-mirror b { color: #16233a; font-variant-numeric: tabular-nums; }

/* 1~4 卡只有一个输入框，收窄；5 卡（超金）要三个输入，加宽 */
.qc-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 0.8fr)) minmax(0, 2.4fr); gap: 8px; align-items: start; }
/* 窗口没那么宽时把差距收一收，否则前四张标题会被截掉 */
@media (max-width: 1440px) { .qc-grid { grid-template-columns: repeat(4, minmax(0, 0.95fr)) minmax(0, 2fr); } }
@media (max-width: 1180px) { .qc-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; } }
@media (max-width: 860px) { .qc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .qc-grid { grid-template-columns: 1fr; } }
/* 5 张卡必须排在同一行：字段名挪到输入框上方，横向省出位置，
   超金那三个输入才塞得进一格 */
.qc-gold { display: flex; gap: 6px; }
.qc-gold .qc-line { flex: 1 1 0; min-width: 0; }
.qc-card {
  background: #fff; border: 1px solid #e3ebf8; border-radius: 10px;
  padding: 9px 9px 8px; display: flex; flex-direction: column;
}
.qc-sum-card { background: #f7fbff; border-color: #cfe2fb; }
.qc-h { font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 5px; margin-bottom: 6px; }
.qc-h .qc-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 算出来的数就显示在标题这一行的最右边 */
.qc-h .qc-val {
  flex: none; font-size: 14px; font-weight: 700; color: #b3261e;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.qc-n {
  width: 17px; height: 17px; border-radius: 50%; background: #1a7cff; color: #fff;
  font-size: 10.5px; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.qc-f { font-size: 10.5px; color: #8098b8; margin-bottom: 7px; line-height: 1.45; }

.qc-line { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.qc-line > label {
  font-size: 10px; color: #8098b8; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qc-line-b { display: flex; align-items: center; gap: 4px; min-width: 0; }
.qc-line input {
  flex: 1; min-width: 0; width: 100%; height: 27px; border: 1px solid #dbe4f2; border-radius: 6px;
  padding: 0 6px; font-size: 12px; color: #16233a; font-variant-numeric: tabular-nums;
  font-family: inherit; outline: none;
}
.qc-line input:focus { border-color: #1a7cff; box-shadow: 0 0 0 3px rgba(26, 124, 255, .12); }
.qc-unit { flex: none; white-space: nowrap; font-size: 10.5px; color: #8098b8; }
.qc-auto {
  flex: 1; min-width: 0; color: #7a6320; background: #fbf3dd; border: 1px solid #ecd9a6;
  border-radius: 6px; padding: 4px 6px; font-size: 11.5px; font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.qc-unit-note { font-size: 10.5px; color: #9aabc4; line-height: 1.45; }

.qc-res {
  margin-top: auto; display: flex; align-items: baseline; gap: 5px;
  padding-top: 7px; border-top: 1px dashed #e2eaf7;
}
.qc-txt { font-size: 10.5px; color: #8098b8; flex: 1; line-height: 1.45; }
.qc-txt b { color: #3d5a86; font-family: Consolas, "Courier New", monospace; }
.qc-val { font-size: 15.5px; font-weight: 700; color: #b3261e; font-variant-numeric: tabular-nums; white-space: nowrap; }
.qc-card .btn { margin-top: 7px; width: 100%; padding: 0 4px; font-size: 12px; white-space: nowrap; }

/* 横栏右边的「单位换算」：点开一个小浮窗，填哪格其它跟着算，纯查着用不存 */
.qc-unitbtn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
  border-color: #cfdcf0; color: var(--primary); flex: none;
}
.qc-unitbtn:hover { background: #f4f8ff; border-color: #b6d1f7; }
.uc-pop {
  position: fixed; z-index: 960; display: flex; flex-direction: column;
  width: 300px; max-height: 470px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 18px 44px rgba(23,43,77,.18); overflow: hidden;
}
.uc-pop[hidden] { display: none; }
.uc-pop-h {
  display: flex; align-items: baseline; gap: 8px; flex: none;
  padding: 11px 13px 9px; border-bottom: 1px solid var(--line);
}
.uc-pop-h b { font-size: 13.5px; color: var(--text); }
.uc-pop-h span { font-size: 11.5px; color: var(--text-3); }
.uc-pop-h button {
  margin-left: auto; border: 0; background: transparent; cursor: pointer;
  font-size: 17px; line-height: 1; color: var(--text-3); padding: 0 2px;
}
.uc-pop-h button:hover { color: var(--text); }
.uc-pop-b { padding: 11px 13px 13px; overflow-y: auto; }
.uc-pop .uc-list { max-width: none; gap: 6px; }
.uc-pop .uc-row input { width: 126px; padding: 4px 8px; font-size: 12.5px; min-height: 29px; }
.uc-pop .uc-name { font-size: 12.5px; }

.qc-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 4px; }
.qc-sum > div { background: #fff; border: 1px solid #e3ebf8; border-radius: 7px; padding: 3px 6px; min-width: 0; }
.qc-sum span { display: block; font-size: 10px; color: #8098b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qc-sum b { font-size: 12px; color: #16233a; font-variant-numeric: tabular-nums; }

/* 第 6 张「这一行合计」横跨一整行，避免 6 张卡排 5 列时最后一张孤零零占一格 */
.qc-sum-card { grid-column: 1 / -1; flex-direction: row; align-items: center; flex-wrap: wrap; column-gap: 14px; row-gap: 7px; }
.qc-sum-card .qc-h { margin-bottom: 0; flex: none; }
.qc-sum-card .qc-f { margin-bottom: 0; flex: none; }
.qc-sum-card .qc-sum { flex: 1 1 260px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 0; }
.qc-sum-card .qc-unit-note { flex: none; }
.qc-sum-card .qc-res { margin-top: 0; padding-top: 0; border-top: 0; flex: none; gap: 8px; }
.qc-sum-card .btn { margin-top: 0; width: auto; padding: 0 12px; }

@media print { .qm-calc { display: none !important; } }

/* =========================================================
   打印模版（报价单 / 合同共用，见 pages.js 的 pctRender）
   类名统一 pt- 前缀。屏幕和打印都能用，设置页的模版预览也用它。
   ========================================================= */
.pt-sheet {
  --pt-fs: 15px; --pt-rh: 21px; --pt-bw: 1px;
  width: 100%; box-sizing: border-box;
  font-family: SimSun, "宋体", serif; color: #000;
  font-size: var(--pt-fs); line-height: var(--pt-rh);
}
/* 抬头：左 Logo、中间公司名 + 标题、右上角单号小框 */
.pt-hdr { display: flex; align-items: center; height: 84px; }
.pt-hlogo { flex: 0 0 31.73%; display: flex; align-items: center; justify-content: center; min-width: 0; }
.pt-hlogo img { max-width: 100%; width: auto; }
.pt-hmid { flex: 0 0 40.12%; text-align: center; }
.pt-cname { line-height: 1.12; letter-spacing: 1px; }
.pt-title { line-height: 1.2; }
.pt-suf { font-size: 14px; letter-spacing: 0 !important; }
.pt-hgap { flex: 0 0 4.99%; }
.pt-hno { flex: 0 0 23.16%; border-collapse: collapse; }
.pt-hno td {
  border: var(--pt-bw) solid #000; font-size: var(--pt-fs);
  height: var(--pt-rh); line-height: var(--pt-rh); padding: 0 2px;
  text-align: center; vertical-align: middle; white-space: nowrap;
}
.pt-hnol { width: 39.2%; }
.pt-hnov { width: 60.8%; }

/* 双方信息：一行一段，只有横线 */
.pt-prow { display: flex; }
.pt-pc {
  border-bottom: var(--pt-bw) solid #000;
  height: var(--pt-rh); line-height: var(--pt-rh); padding: 0 2px;
  white-space: nowrap; overflow: hidden;
}
.pt-pg { border: 0; }

/* 两个分区标题：无框、左对齐 */
.pt-sec { height: var(--pt-rh); line-height: var(--pt-rh); padding: 0 2px; white-space: nowrap; overflow: hidden; }

/* 明细表 */
table.pt-grid { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 0; }
table.pt-grid td {
  border: var(--pt-bw) solid #000; font-size: var(--pt-fs);
  height: var(--pt-rh); line-height: var(--pt-rh); padding: 0 2px;
  vertical-align: middle; white-space: nowrap; overflow: hidden; color: #000;
}
table.pt-grid td.pt-l { text-align: left; padding-left: 5px; }
table.pt-grid td.pt-c { text-align: center; }
table.pt-grid td.pt-r { text-align: right; }
table.pt-grid td.pt-sn { font-size: calc(var(--pt-fs) - 2.5px); padding: 0 1px; }

/* 合计行：现在就是上段明细表里的最后一行（tr.pt-trow），
   跟表头、数据行共用同一套列宽，竖线不会再错开。 */
tr.pt-trow td { font-weight: 700; }

/* 条款：1~5 一行，6~11 一整段（6 行高） */
.pt-terms { padding-bottom: 6px; }
.pt-tline { display: flex; height: var(--pt-rh); line-height: var(--pt-rh); }
.pt-tline > div { min-width: 0; white-space: nowrap; overflow: hidden; }
.pt-flow {
  margin: 0; height: calc(var(--pt-rh) * 6); line-height: var(--pt-rh);
  font-size: var(--pt-fs); text-align: justify; word-break: break-all;
  overflow: hidden; padding-right: 3px;
}

/* 落款 + 章 */
.pt-signwrap { position: relative; }
.pt-sgn > .pt-bb {
  border-bottom: var(--pt-bw) solid #000;
  height: var(--pt-rh); line-height: var(--pt-rh); padding: 0 2px;
  white-space: nowrap; overflow: hidden;
}
.pt-seal { position: absolute; z-index: 5; opacity: .88; pointer-events: none; }

/* 每一页就是一个定高的「纸盒」：A4 横版 210mm 减掉上边距 14mm、下边距 8mm = 188mm，
   这里留 1.5mm 余量取 186.5mm。章钉在纸盒的右下角，跟内容长短无关，
   永远不会再撑出第二张纸（真被拖出纸外也只会在纸边裁掉）。 */
.pct-page { position: relative; min-height: 186.5mm; overflow: hidden; }

/* 设置页里的模版预览框：纸面留出和真打印一样的 14mm 页边距，
   这样预览里章的位置、表格宽度都和打出来的一模一样 */
.pt-preview { background: #e9edf3; border: 1px solid #dbe2ec; border-radius: 8px; padding: 12px; overflow: auto; }
.pt-preview .pt-paper {
  background: #fff; box-shadow: 0 2px 12px rgba(20,35,60,.16);
  padding: 14mm 14mm 8mm; box-sizing: border-box; overflow: hidden;
}
.pt-preview .pt-paper > .pt-sheet { width: 100%; }

/* ================= 设置页 · 打印模版 ================= */
.pt-tpl-wrap { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 16px; align-items: start; }
.pt-tpl-set { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pt-grp { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.pt-grp > summary {
  cursor: pointer; padding: 9px 12px; font-weight: 600; font-size: 13px;
  list-style: none; user-select: none; color: var(--text);
}
.pt-grp > summary::-webkit-details-marker { display: none; }
.pt-grp > summary::before { content: "▸ "; color: var(--text-3); }
.pt-grp[open] > summary::before { content: "▾ "; }
.pt-gb { padding: 4px 12px 12px; border-top: 1px solid var(--line); }

.pt-row { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.pt-row > label { flex: 0 0 96px; font-size: 12.5px; color: var(--text-2); }
.pt-ctl { flex: 1 1 auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
.pt-ctl input[type="text"], .pt-ctl select {
  flex: 1 1 auto; min-width: 0; padding: 4px 7px; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 5px; background: #fff; font-family: inherit;
}
.pt-ctl input[type="range"] { flex: 1 1 auto; min-width: 0; }
.pt-v { flex: 0 0 42px; text-align: right; font-size: 11.5px; color: var(--text-3); }
.pt-ck2 { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.pt-ta {
  width: 100%; min-height: 64px; margin-top: 6px; padding: 6px 8px;
  font-size: 12.5px; line-height: 1.6; font-family: inherit; resize: vertical;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}

.pt-colbox { margin-top: 8px; }
.pt-colhd {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  font-size: 12px; color: var(--text-2); padding: 4px 0 6px; border-bottom: 1px dashed var(--line);
}
.pt-colhd span { color: var(--text-3); font-size: 11px; }
.pt-colrow { display: flex; align-items: center; gap: 5px; padding: 3px 0; border-bottom: 1px dashed #f0f4f9; }
.pt-ck { flex: 0 0 auto; display: flex; align-items: center; }
.pt-cn { flex: 0 0 66px; font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-mv {
  flex: 0 0 auto; width: 20px; height: 20px; padding: 0; line-height: 1;
  border: 1px solid var(--line); background: #fff; border-radius: 4px;
  cursor: pointer; font-size: 11px; color: var(--text-2);
}
.pt-mv:hover { background: #eef4fc; border-color: #b9cdea; }
.pt-colrow input[type="range"] { flex: 1 1 auto; min-width: 36px; }
.pt-fv { flex: 0 0 34px; text-align: right; font-size: 11px; color: var(--text-3); }

.pt-tpl-prev { min-width: 0; }
.pt-prev-hd { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.pt-prev-hd::before { content: "▸ "; }

@media (max-width: 1180px) {
  .pt-tpl-wrap { grid-template-columns: 1fr; }
}

/* ================= 询价自动识别（2026-11-15） ================= */
/* 设置页那段说明文字 */
.ai-note { margin-top:2px; padding:12px 14px; background:#f7f9fe; border:1px solid var(--line); border-radius:10px; font-size:13px; line-height:1.8; color:var(--text-2) }
.ai-note p { margin:0 0 5px; }
.ai-note p:last-child { margin-bottom:0; }
.ai-note b { color:var(--text); }
.ai-note .warn { color:#a5640a; }

/* 识别面板 */
.aif-drop { border:1.5px dashed #c9d6ea; border-radius:10px; padding:16px; text-align:center; color:var(--text-3); font-size:13px; line-height:1.7; cursor:pointer; background:#fafbff }
.aif-drop.on { border-color:var(--primary); background:var(--primary-l); color:var(--primary-d) }
.aif-drop .dim { font-size:12px; color:var(--text-3); margin-top:2px }
/* 财务页（2026-11-16）：月度条形图 + 小节标题 */
.fin-chart { display:flex; align-items:flex-end; gap:16px; height:200px; padding:14px 6px 0; border-bottom:1px solid var(--line); background:linear-gradient(to top, rgba(47,111,237,.04), transparent 70%) }
.fin-col { flex:1; display:flex; flex-direction:column; height:100%; min-width:0 }
.fin-bars { flex:1; display:flex; align-items:flex-end; justify-content:center; gap:4px }
.fin-bar { width:15px; border-radius:3px 3px 0 0; background:var(--primary); min-height:1px; transition:opacity .12s }
.fin-bar:hover { opacity:.75 }
.fin-bar.b-paid { background:var(--ok) }
.fin-bar.b-profit { background:#8b5cf6 }
.fin-bar.b-neg { background:var(--danger) }
.fin-bar.hide { display:none }
/* 表单里的「更多」折叠块（2026-11-16 外发单简化） */
.form-more { margin-top:12px; border-top:1px dashed var(--line); padding-top:10px }
.form-more summary { cursor:pointer; font-size:12.5px; color:var(--text-3); list-style:none; user-select:none }
.form-more summary::-webkit-details-marker { display:none }
.form-more summary::before { content:'+ '; font-weight:600 }
.form-more[open] summary::before { content:'− ' }
.form-more .form-grid { margin-top:10px }
.fin-x { text-align:center; font-size:12px; color:var(--text-3); padding:6px 0 2px }
.fin-legend { display:flex; gap:16px; flex-wrap:wrap; font-size:12px; color:var(--text-2); padding:2px 2px 0 }
.fin-legend i { display:inline-block; width:10px; height:10px; border-radius:2px; margin-right:5px }
.fin-note { font-size:12.5px; color:var(--text-3); padding:10px 4px 2px }
.fin-sec-title { font-size:13px; font-weight:600; color:var(--text); margin:2px 0 8px; display:flex; align-items:baseline; gap:8px }
.fin-sec-sub { font-size:12px; font-weight:400; color:var(--text-3) }

.aif-docs { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px }
.aif-doc { display:inline-flex; align-items:center; gap:6px; padding:4px 6px 4px 8px; border:1px solid var(--line); border-radius:8px; background:#fff; font-size:12.5px; color:var(--text-2); max-width:340px }
.aif-doc b { font-size:10.5px; font-weight:600; color:#fff; background:var(--primary); border-radius:4px; padding:1px 4px; letter-spacing:.3px }
.aif-doc i { font-style:normal; color:var(--text-3); font-size:11.5px }
.aif-doc button { border:none; background:transparent; color:var(--text-3); cursor:pointer; font-size:15px; line-height:1; padding:0 2px }
.aif-doc button:hover { color:var(--danger) }
.aif-src { display:flex; flex-direction:column; gap:2px; margin:-2px 0 10px; font-size:12px; color:var(--text-3) }
.aif-src .bad { color:var(--danger) }
.aif-thumbs { display:flex; gap:8px; flex-wrap:wrap; margin-top:10px }
.aif-thumb { position:relative; width:74px; height:74px; border-radius:8px; overflow:hidden; border:1px solid var(--line); background:#fff }
.aif-thumb img { width:100%; height:100%; object-fit:cover; display:block }
.aif-thumb button { position:absolute; top:2px; right:2px; width:18px; height:18px; border:none; border-radius:50%; background:rgba(20,30,50,.62); color:#fff; cursor:pointer; line-height:1; font-size:12px; padding:0 }
.aif-bar { display:flex; align-items:center; gap:10px; margin-top:10px; flex-wrap:wrap }
.aif-status { font-size:12.5px; color:var(--text-3) }
.aif-status.err { color:var(--danger) }
.aif-result { margin-top:14px; border-top:1px solid var(--line); padding-top:12px; display:none }
.aif-result.on { display:block }
.aif-item { border:1px solid var(--line); border-radius:10px; padding:10px 12px; margin-bottom:8px; background:#fcfdff }
.aif-item-h { display:flex; align-items:center; gap:10px; margin-bottom:7px; font-size:13.5px; flex-wrap:wrap }
.aif-sum { display:flex; align-items:flex-start; gap:12px; margin-bottom:8px }
.aif-sum .page-sub { flex:1 1 auto; margin:0 }
.aif-sum .aif-on { flex:0 0 auto; margin-top:1px; white-space:nowrap }
.aif-item-h .aif-warn { color:#a5640a; background:#fef3e2; border-radius:999px; padding:1px 9px; font-size:12px }
.aif-chips { display:flex; flex-wrap:wrap; gap:6px }
.aif-chip { font-size:12.5px; color:var(--text-2); background:#f1f4fa; border:1px solid transparent; border-radius:6px; padding:2px 8px; font-family:inherit; line-height:1.5; cursor:pointer }
.aif-chip:hover { border-color:#c2cfe4 }
.aif-chip i { font-style:normal; color:var(--text-3); margin-right:4px }
.aif-chip.un { background:#fef3e2; color:#a5640a }
.aif-chip.un i { color:#a5640a }
/* 系统字典里没有这个说法：红色，让人一眼看出「这个要我自己定」 */
.aif-chip.off { background:#fdeaea; color:#a92c2c }
.aif-chip.off i { color:#a92c2c }
.aif-chip.bad { cursor:default }
/* 点了不要的：划掉、变淡，填的时候不带进去 */
.aif-chip.drop { opacity:.42; text-decoration:line-through }
/* 整块板不写入 */
.aif-on { display:inline-flex; align-items:center; gap:4px; font-size:12.5px; color:var(--text-3); cursor:pointer; user-select:none; margin-right:2px }
.aif-on input { margin:0; cursor:pointer }
.aif-item.off-row { opacity:.45; background:#f7f7f9 }
/* 没认准的格子：填进去以后是淡黄底，你改一下就自动变回白的 */
input.ai-unsure, select.ai-unsure, textarea.ai-unsure { background:#fff8e6 !important; box-shadow: inset 0 0 0 1px #f0c36d !important }
/* 字典里没有的说法：填进去是淡红底 */
input.ai-off, select.ai-off, textarea.ai-off { background:#fdeaea !important; box-shadow: inset 0 0 0 1px #e08b8b !important }

/* 设置页「测一下连接」的结果提示（2026-11-15） */
.ai-test-res { font-size:12.5px; line-height:1.6; max-width:520px; margin-right:auto; }
.ai-test-res.wait { color:var(--text-3); }
.ai-test-res.ok { color:#137a3f; }
.ai-test-res.err { color:var(--danger); }

/* ================= 查重提醒（2026-11-16 用户要求） =================
   客户名称/联系人/电话/地址撞车、报价明细的文件名撞车，都在这里挂一条。
   黄条=有像的，看一眼就行；红条=基本就是同一个，保存前还会再问一句。 */
.dup-box { margin-bottom:12px; border:1px solid #f0c36d; background:#fff8e6; border-radius:8px; padding:9px 12px; font-size:12.8px; line-height:1.65 }
.dup-box[hidden] { display:none }
.dup-box.strong { border-color:#e08b8b; background:#fdeaea }
.dup-box-t { font-weight:600; color:#a5640a; margin-bottom:3px }
.dup-box.strong .dup-box-t { color:#a92c2c }
.dup-row { display:flex; flex-wrap:wrap; align-items:baseline; gap:8px; padding:3px 0; border-top:1px dashed rgba(16,24,40,.08) }
.dup-row:first-of-type { border-top:none }
.dup-row b { color:var(--text) }
.dup-meta { color:var(--text-3); font-size:12px }
.dup-val { font-weight:600; color:var(--text) }
.dup-hit-t { color:#a92c2c; background:#fff; border-radius:999px; padding:1px 8px; font-size:12px }
.dup-box-f { color:var(--text-3); font-size:12px; margin-top:4px }
.dup-bar { margin-top:10px; border:1px solid #f0c36d; background:#fff8e6; border-radius:8px; padding:8px 12px; font-size:12.6px; line-height:1.6 }
.dup-bar[hidden] { display:none }
.dup-bar-t { font-weight:600; color:#a5640a; margin-bottom:2px }
/* 明细里撞了的那一格：淡黄底 + 黄边；鼠标放上去能看到是哪张单、哪个客户做过 */
input.dup-hit { background:#fdebc8 !important; box-shadow: inset 0 0 0 1.5px #e0a040 !important; font-weight:600 }

/* ================= 客户对账单（2026-11-16 第三批） ================= */
.stmt-bar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; padding:9px 12px; background:#f7f9fd; border:1px solid var(--line); border-radius:9px; margin-bottom:12px; font-size:13px; color:var(--text-2) }
.stmt-bar input[type="date"] { border:1px solid var(--line); border-radius:6px; padding:5px 8px; font-size:13px; font-family:inherit; color:var(--text); background:#fff }
.stmt-head { margin-bottom:10px }
.stmt-head b { font-size:15px }
.stmt-sub { color:var(--text-3); font-size:12.5px; margin-top:3px }
.stmt-table td { font-variant-numeric:tabular-nums }
.stmt-open td { background:#fafbfe; color:var(--text-2) }
.stmt-pay td { background:#f4fbf7 }
.stmt-foot { margin-top:10px; font-size:13px; color:var(--text-2); line-height:1.9 }
.stmt-due { color:var(--danger); font-size:15px }
/* 账龄表「信用额度」格子里那行小字 */
.fin-mini { font-size:11.5px; color:var(--text-3); line-height:1.4; font-weight:400 }
/* 报价单选完客户后的额度提示（2026-11-16 第三批） */
.credit-tip { margin:-2px 0 10px; padding:7px 11px; border-radius:8px; background:#f2f6fe; border:1px solid #d7e3fa; color:var(--text-2); font-size:12.8px; line-height:1.65 }
.credit-tip[hidden] { display:none }
.credit-tip.over { background:#fdeaea; border-color:#e8b4b4; color:#a92c2c }
.credit-tip.over b { color:#8c1f1f }
/* 首页卡片能点：鼠标放上去给点反馈 */
.stat[onclick]:hover { box-shadow:0 4px 16px rgba(16,24,40,.10); transform:translateY(-1px) }
.stat[onclick] { transition:box-shadow .16s, transform .16s }
.stmt-bar .spacer { flex:1 }
