/* Harmon Bond 管理系统 - 商务简约主题
   配色取自公司 LOGO：深藏蓝 #1B3A6B / 亮黄 #F5C518
   风格：内部办公、克制、无炫技动效 */

:root {
  --hb-navy: #1B3A6B;
  --hb-navy-700: #142C52;
  --hb-navy-600: #24487F;
  --hb-navy-50: #EEF2F8;
  --hb-yellow: #F5C518;
  --hb-yellow-600: #D9AC10;
  --hb-ink: #1F2937;
  --hb-ink-2: #4B5563;
  --hb-ink-3: #9AA3AF;
  --hb-line: #E3E7ED;
  --hb-bg: #F4F6F9;
  --hb-white: #FFFFFF;
  --hb-green: #15803D;
  --hb-green-bg: #E8F5EC;
  --hb-orange: #B45309;
  --hb-orange-bg: #FDF3E3;
  --hb-red: #B91C1C;
  --hb-red-bg: #FBEAEA;
  --hb-blue: #1D4ED8;
  --hb-blue-bg: #E9EFFC;
  --hb-radius: 6px;
  --hb-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --hb-shadow-lg: 0 4px 16px rgba(16, 24, 40, .1);
  --sb-w: 232px;
  --sb-w-collapsed: 60px;
  --top-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--hb-ink);
  background: var(--hb-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--hb-navy-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ================= 布局 ================= */
.layout { display: flex; min-height: 100vh; }

/* ---- 侧边栏 ---- */
.sidebar {
  width: var(--sb-w);
  flex: 0 0 var(--sb-w);
  background: var(--hb-navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  transition: width .18s ease, flex-basis .18s ease;
  overflow: hidden;
}
body.sb-collapsed .sidebar { width: var(--sb-w-collapsed); flex-basis: var(--sb-w-collapsed); }

.sidebar-brand {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  flex: 0 0 auto;
}
.sidebar-brand img {
  height: 30px;
  width: auto;
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
  padding: 2px 4px;
  flex: 0 0 auto;
}
.sidebar-brand .brand-text { overflow: hidden; white-space: nowrap; }
.sidebar-brand .brand-name {
  font-size: 14px; font-weight: 700; letter-spacing: .3px; line-height: 1.2;
}
.sidebar-brand .brand-sub { font-size: 11px; color: rgba(255,255,255,.6); line-height: 1.2; }
body.sb-collapsed .sidebar-brand .brand-text { display: none; }

.sidebar-scroll { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 10px 0 20px; }
.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 3px; }

.nav-group { margin-bottom: 3px; }

/* 大模块标题：加粗 + 字间距 + 深底色带，与功能项明显区分 */
.nav-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: rgba(0, 0, 0, .22);
  border: 0;
  border-left: 3px solid var(--hb-yellow);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255, 255, 255, .95);
  padding: 10px 12px;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.nav-group-title:hover { background: rgba(0, 0, 0, .34); color: #fff; }
.nav-group-title .gt-icon { width: 18px; flex: 0 0 18px; text-align: center; font-size: 13px; }
.nav-group-title .gt-text { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; }
.nav-group-title .gt-arrow { font-size: 9px; opacity: .7; transition: transform .15s ease; }
.nav-group.collapsed .nav-group-title .gt-arrow { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-items { display: none; }

/* 第127轮：分组标题上的角标（汇总其下所有可见项的待办数）
   —— 角标原本只挂在叶子项上，分组收起时完全看不到待办提醒。 */
.nav-group-title .nav-badge {
  margin-left: 0;
  flex: 0 0 auto;
  font-size: 10.5px;
  line-height: 16px;
  min-width: 16px;
  padding: 0 5px;
}

.nav-group.collapsed .nav-group-title {
  color: rgba(255, 255, 255, .95);
  background: rgba(0, 0, 0, .34);
  border-left-color: var(--hb-yellow);
}

/* 模块内功能项：整体左缩进 + 左侧竖线引导，弱化处理 */
.nav-group-items { border-left: 1px solid rgba(255, 255, 255, .16); margin-left: 22px; }

body.sb-collapsed .nav-group-title { justify-content: center; padding: 10px 0; }
body.sb-collapsed .nav-group-title .gt-text { display: none; }
body.sb-collapsed .nav-group-title .gt-arrow { display: none; }
body.sb-collapsed .nav-group-title .gt-icon { width: auto; }
body.sb-collapsed .nav-group-items { margin-left: 0; border-left: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 16px;
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .2px;
  white-space: nowrap;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav-item.active {
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-left-color: var(--hb-yellow);
  font-weight: 600;
}
.nav-icon { width: 18px; text-align: center; flex: 0 0 18px; font-size: 14px; }
.nav-item .nav-text { overflow: hidden; }
.nav-badge {
  margin-left: auto;
  background: var(--hb-yellow);
  color: var(--hb-navy-700);
  font-size: 11px;
  font-weight: 700;
  border-radius: 9px;
  padding: 0 6px;
  line-height: 17px;
  min-width: 18px;
  text-align: center;
}
body.sb-collapsed .nav-text { display: none; }
body.sb-collapsed .nav-badge { display: none; }

/* 折叠态：在图标右上角用小圆点提示有待办 */
body.sb-collapsed .nav-item { position: relative; }
body.sb-collapsed .nav-item.has-badge .nav-icon::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 20px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hb-yellow);
  border: 1px solid var(--hb-navy);
}

.sidebar-foot {
  flex: 0 0 auto;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, .1);
}
.sb-toggle {
  width: 100%;
  background: rgba(255, 255, 255, .08);
  border: 0;
  color: rgba(255, 255, 255, .8);
  border-radius: var(--hb-radius);
  padding: 7px 0;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}
.sb-toggle:hover { background: rgba(255, 255, 255, .16); }
body.sb-collapsed .sb-toggle .lbl { display: none; }

/* 全部展开 / 全部收起 */
.sb-groups-all {
  display: flex; gap: 6px; margin-bottom: 8px;
}
.sb-ga-btn {
  flex: 1 1 0; min-width: 0;
  background: rgba(255, 255, 255, .06);
  border: 0; color: rgba(255, 255, 255, .72);
  border-radius: var(--hb-radius);
  padding: 5px 0; cursor: pointer;
  font-size: 12px; font-family: inherit; white-space: nowrap;
}
.sb-ga-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
body.sb-collapsed .sb-groups-all { display: none; }

/* ---- 主区 ---- */
.main {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: var(--sb-w);
  display: flex;
  flex-direction: column;
  transition: margin-left .18s ease;
}
body.sb-collapsed .main { margin-left: var(--sb-w-collapsed); }

/* ---- 顶栏 ---- */
.topbar-sb-toggle {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  background: #fff;
  color: var(--hb-ink-2);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .12s ease, color .12s ease;
}
.topbar-sb-toggle:hover {
  background: var(--hb-navy-50);
  color: var(--hb-navy);
  border-color: var(--hb-navy-600);
}
.topbar-sb-toggle .ico { display: block; }

.topbar {
  height: var(--top-h);
  background: var(--hb-white);
  border-bottom: 1px solid var(--hb-line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-motto {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.25;
  min-width: 0;
}
.topbar-motto .motto {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--hb-navy);
  letter-spacing: .4px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-motto .company {
  font-size: 11.5px;
  color: var(--hb-ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-motto .company .company-en {
  color: var(--hb-ink-3);
  opacity: .8;
  letter-spacing: .2px;
}
.topbar-motto .company .sep { margin: 0 6px; opacity: .5; }
.topbar-spacer { flex: 1 1 auto; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 10px;
  border-radius: var(--hb-radius);
  border: 1px solid var(--hb-line);
  background: #fff;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--hb-navy);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; flex: 0 0 auto;
}
.topbar-user .u-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.topbar-user .u-role { font-size: 11px; color: var(--hb-ink-3); line-height: 1.2; }

.content { padding: 20px; flex: 1 1 auto; }

/* ================= 通用件 ================= */
.page-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.page-head h1 { font-size: 20px; margin: 0 0 3px; font-weight: 700; letter-spacing: .3px; }
.page-head .desc { color: var(--hb-ink-3); font-size: 13px; margin: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--hb-white);
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  box-shadow: var(--hb-shadow);
  margin-bottom: 12px;
}
.card-head {
  padding: 10px 16px;
  border-bottom: 1px solid var(--hb-line);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.card-head h2 { font-size: 15px; margin: 0; font-weight: 700; }
.card-head .sub { color: var(--hb-ink-3); font-size: 12.5px; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 14px; }
.card-body.tight { padding: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--hb-line);
  background: #fff;
  color: var(--hb-ink);
  border-radius: var(--hb-radius);
  padding: 6px 13px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.5;
  white-space: nowrap;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--hb-bg); text-decoration: none; }
.btn-primary { background: var(--hb-navy); border-color: var(--hb-navy); color: #fff; }
.btn-primary:hover { background: var(--hb-navy-600); }
.btn-accent { background: var(--hb-yellow); border-color: var(--hb-yellow-600); color: var(--hb-navy-700); font-weight: 600; }
.btn-accent:hover { background: var(--hb-yellow-600); }
.btn-danger { background: #fff; border-color: #eab8b8; color: var(--hb-red); }
.btn-danger:hover { background: var(--hb-red-bg); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.table-wrap { overflow-x: auto; }
/* 第30轮：明细表容器放开纵向裁剪，
   否则 overflow-x:auto 会使 overflow-y 计算为 auto，
   绝对定位的「物料候选列表」会被容器下边界裁掉。 */
.item-wrap { overflow: visible; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  padding: 8px 12px;
  background: #FAFBFC;
  border-bottom: 1px solid var(--hb-line);
  color: var(--hb-ink-2);
  font-weight: 600;
  white-space: nowrap;
  font-size: 12.5px;
}
table.data td {
  padding: 7px 12px;
  border-bottom: 1px solid #F0F2F5;
  vertical-align: middle;
}
table.data tbody tr:hover { background: var(--hb-navy-50); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .code { font-family: "Consolas", "Monaco", monospace; font-size: 12.5px; color: var(--hb-navy-600); }
table.data .muted { color: var(--hb-ink-3); }
/* 第33轮：日期串如 2026-10-27 的连字符是合法断行点，
   在窄列中会被折成两行。日期/编码类单元格统一禁止换行。 */
table.data th.nowrap,
table.data td.nowrap { white-space: nowrap; }
/* 第58轮：拜访记录「一行式」信息单元格
   客户 / 类型 / 被拜访人 / 发生时间 / 下次拜访日期 合并到同一格内横排。
   第59轮：改用 flex 布局 —— 各项按内容自适应宽度，
   类型标签不会被拉宽、被拜访人不会被换行、时间与日期宽度自然紧凑。 */
td.inline-info { padding: 0; }
.ii-row {
  display: flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  padding: 2px 0;
}
.ii-row > * { flex: 0 0 auto; }
.ii-row .ii-cust {
  font-weight: 600;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 类型标签在紧凑行内收窄内边距 */
.ii-row .tag { padding: 0 6px; }
.ii-row .ii-person { color: var(--hb-ink-2); }
/* 日期时间用等宽数字，宽度整齐不跳动 */
.ii-row .ii-time,
.ii-row .ii-next {
  font-variant-numeric: tabular-nums;
  color: var(--hb-ink-3);
  font-size: 12.5px;
}
.ii-row .ii-next b { color: var(--hb-ink-2); font-weight: 600; }
/* 第58轮：销售出库单表头专用栅格
   客户 / 关联需求单 / 出货仓库 / 出货库位 / 运费 五项同行一排。
   客户要输关键字检索 → 给最宽；仓库/库位/运费是下拉与数字 → 收窄。 */
.form-grid-outbound {
  display: grid;
  grid-template-columns:
    minmax(220px, 1.5fr)   /* 客户 */
    minmax(150px, 1fr)     /* 关联需求单 */
    minmax(120px, .8fr)    /* 出货仓库 */
    minmax(130px, .9fr)    /* 出货库位 */
    minmax(90px, .6fr);    /* 运费 */
  gap: 14px 14px;
}
.form-grid-outbound .field.full { grid-column: 1 / -1; }
.form-grid-outbound .field input,
.form-grid-outbound .field select { min-width: 0; }
@media (max-width: 1100px) {
  .form-grid-outbound {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 640px) {
  .form-grid-outbound {
    grid-template-columns: 1fr;
  }
}
.empty { padding: 40px 16px; text-align: center; color: var(--hb-ink-3); }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}
.tag-gray { background: #EEF0F3; color: var(--hb-ink-2); }
.tag-blue { background: var(--hb-blue-bg); color: var(--hb-blue); }
.tag-green { background: var(--hb-green-bg); color: var(--hb-green); }
.tag-orange { background: var(--hb-orange-bg); color: var(--hb-orange); }
.tag-red { background: var(--hb-red-bg); color: var(--hb-red); }
.tag-navy { background: var(--hb-navy-50); color: var(--hb-navy); }

/* 统计卡 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  background: #fff;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  padding: 14px 16px;
  box-shadow: var(--hb-shadow);
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--hb-navy);
}
.stat.s-yellow::before { background: var(--hb-yellow); }
.stat.s-green::before { background: var(--hb-green); }
.stat.s-orange::before { background: var(--hb-orange); }
.stat.s-red::before { background: var(--hb-red); }
.stat .label { font-size: 12.5px; color: var(--hb-ink-3); margin-bottom: 5px; }
.stat .value { font-size: 23px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 12px; font-weight: 500; color: var(--hb-ink-3); margin-left: 3px; }
.stat .foot { font-size: 11.5px; color: var(--hb-ink-3); margin-top: 5px; }

.mini-title {
  font-size: 13px; font-weight: 700; color: var(--hb-ink-2);
  margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--hb-line);
}

/* 页签 */
.tab-bar { display: flex; gap: 4px; }
.tab-bar .tab {
  padding: 7px 16px; border-radius: var(--hb-radius);
  font-size: 13px; color: var(--hb-ink-2); text-decoration: none;
  border: 1px solid transparent;
}
.tab-bar .tab:hover { background: var(--hb-navy-50); color: var(--hb-navy); }
.tab-bar .tab.active {
  background: var(--hb-navy); color: #fff; font-weight: 600;
}

/* 进度条 */
.progress {
  height: 8px; background: #EEF1F5; border-radius: 4px; overflow: hidden;
}
.progress-bar { height: 100%; border-radius: 4px; background: var(--hb-navy); }

/* 导入导出卡片网格 */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.grid-card {
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  padding: 14px 16px;
  background: #fff;
  display: flex; flex-direction: column; gap: 10px;
}
.grid-card .gc-head { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.grid-card .gc-icon {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--hb-navy-50); color: var(--hb-navy);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.grid-card .gc-notes {
  margin: 0; padding-left: 16px; flex: 1;
  font-size: 12px; color: var(--hb-ink-3); line-height: 1.75;
}
.grid-card .gc-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 无序说明列表 */
.plain-list { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--hb-ink-3); line-height: 1.9; }

/* 表单 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px 18px;
}
.field { display: flex; flex-direction: column; gap: 5px; }

/* ★ 第131轮：新增账号的填报区 —— 六个字段放同一行，节省页面空间。
   用户要求：「用户名、姓名、初始密码、手机号、岗位、初始权限，放在同一行显示」。
   原来的 .form-grid 是 auto-fit 250px，且「岗位」「初始权限」是 .field.full
   （grid-column: 1/-1 独占整行）→ 实际占了两整行。
   这里改成一行的 6 列，窄屏时逐级降为 3 列 / 2 列 / 1 列。 */
.form-grid-user {
  display: grid;
  grid-template-columns:
    minmax(120px, 1fr)     /* 用户名 */
    minmax(110px, 1fr)     /* 姓名 */
    minmax(130px, 1fr)     /* 初始密码 */
    minmax(120px, .9fr)    /* 手机号 */
    minmax(140px, 1.1fr)   /* 岗位 */
    minmax(160px, 1.2fr);  /* 初始权限 */
  gap: 12px 14px;
  align-items: start;
}
.form-grid-user .field input,
.form-grid-user .field select { min-width: 0; }
.form-grid-user .field label { font-size: 12px; }
@media (max-width: 1200px) {
  .form-grid-user { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .form-grid-user { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .form-grid-user { grid-template-columns: 1fr; }
}
.field.full { grid-column: 1 / -1; }
/* 需求单第二行：需求内容 1/2、质量要求 1/4、是否加急 1/4 */
.form-grid-row2 {
  grid-template-columns: 2fr 1fr 1fr;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--hb-line, #E3E7EC);
}
@media (max-width: 1180px) {
  .form-grid-row2 { grid-template-columns: 1fr; }
}
.field label { font-size: 12.5px; color: var(--hb-ink-2); font-weight: 600; }
.field label .req { color: var(--hb-red); margin-left: 2px; }
.field .hint { font-size: 11.5px; color: var(--hb-ink-3); }
p.hint { font-size: 12px; color: var(--hb-ink-3); margin: 0 0 10px; }
input[type=text], input[type=number], input[type=date], input[type=password],
input[type=email], input[type=search], select, textarea {
  border: 1px solid #D6DBE2;
  border-radius: var(--hb-radius);
  padding: 7px 10px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--hb-ink);
  background: #fff;
  width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
/* 第59轮：日期 / 时间输入框收窄。
   原先 input[type=date] 会被 .field 的 flex 拉伸到整列宽（实测 310px），
   但日期本身只显示「2026-11-18」+ 日历图标，约 130px 就够 ——
   剩下的宽度全是浪费。统一收窄，日期时间框不再占满整列。 */
input[type=date],
input[type=time],
input[type=datetime-local],
input[type=month] {
  width: 140px;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
/* 表格行内的紧凑日期框（本来就更窄） */
td input[type=date] { width: 128px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--hb-navy-600);
  box-shadow: 0 0 0 3px rgba(36, 72, 127, .1);
}
textarea { resize: vertical; min-height: 78px; line-height: 1.6; }
input[readonly], input:disabled, select:disabled, textarea:readonly { background: #F6F7F9; color: var(--hb-ink-2); }

.check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; cursor: pointer; user-select: none;
}
.check input { width: 15px; height: 15px; accent-color: var(--hb-navy); cursor: pointer; }

/* 第13轮：点选式多选按钮组（改善关注点 / 创新点） */
.check-group {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  padding: 7px 10px;
  border: 1px solid #D6DBE2;
  border-radius: var(--hb-radius);
  background: #fff;
  min-height: 36px;
  align-items: center;
}
.check-group .check { font-size: 13px; }

/* 第13轮：半宽字段（新产品开发：产品名称占 1/2） */
.form-grid .field.half { grid-column: span 1; }
/* 第61轮：质量投诉登记专用栅格
   第一行四项**强制同排**：投诉分类 / 客户 / 接诉日期 / 关联出库单
   第二行两项：投诉标题 / 投诉内容

   关键约束：这四项必须始终在同一行，不随窗口宽度换行。
   做法 = 栅格本身不设媒体查询断点，改为给容器一个 min-width 并允许
   横向滚动：窗口再窄也是「一行四项」，只是出现横向滚动条，
   而不是把关联出库单挤到第二行。
   （沿用第54轮物料表单的成熟做法。） */
.form-grid-comp {
  display: grid;
  grid-template-columns:
    minmax(104px, 0.85fr)   /* 投诉分类 */
    minmax(190px, 1.7fr)   /* 客户（关键字检索，需较宽） */
    minmax(140px, 0.95fr)  /* 接诉日期 */
    minmax(210px, 1.8fr);  /* 关联出库单（单号+客户+金额，最长） */
  gap: 14px 16px;
  /* 四列并排所需的最小宽度（含列间距约 48px）。 */
  min-width: 692px;
}
.form-grid-comp .field input,
.form-grid-comp .field select { min-width: 0; }
/* 第二行：投诉标题 / 投诉内容 各占一半 */
/* 容器：窗口不够宽时横向滚动，保证第一行四项永远同一行 */
.form-grid-comp-scroll {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
}
.form-grid-comp-second {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(320px, 1.35fr);
  gap: 14px 16px;
  /* 上边距略大 —— 客户字段下方的提示文字在窄屏会折行，
     需留出间距避免与本行标签贴在一起。 */
  margin-top: 22px;
}

/* 第62轮：拜访与沟通记录专用栅格
   第一行五项**强制同排**：
     客户(关键字检索) / 类型 / 拜访日期与时间 / 被拜访人 / 下次拜访日期
   宽度按实际内容分配：
     · 类型是短枚举 → 窄
     · 拜访日期与时间为 date+time 组合 → 中等
     · 被拜访人是短人名 → 窄
     · 客户全称较长 → 最宽

   同样不设媒体查询断点：容器给 min-width 并允许横向滚动，
   保证五项始终同一行，窗口再窄只出滚动条而不换行。 */
.form-grid-comm {
  display: grid;
  grid-template-columns:
    minmax(190px, 1.75fr)   /* 客户（关键字检索，需较宽） */
    minmax(96px, 0.62fr)    /* 类型（短枚举） */
    minmax(226px, 1.35fr)   /* 拜访日期与时间（date+time 组合） */
    minmax(130px, 0.85fr)   /* 被拜访人 */
    minmax(140px, 0.9fr);   /* 下次拜访日期 */
  gap: 14px 16px;
  min-width: 830px;
}
.form-grid-comm .field input,
.form-grid-comm .field select { min-width: 0; }
/* 容器：窗口不够宽时横向滚动，保证五项永远同一行 */
.form-grid-comm-scroll {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
}
/* 日期 + 时间并排组合控件 */
.dt-pair {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dt-pair input[type=date] { flex: 0 0 auto; }
.dt-pair input[type=time] { flex: 0 0 auto; width: 96px; }
.dt-pair span { color: var(--hb-ink-3, #7A8899); font-size: 13px; }
.form-grid-comp-second .field textarea { min-height: 66px; }

/* 第67轮：托盘往来登记专用栅格
   第一行五项**强制同排**：
     日期 / 方向 / 托盘归属 / 对方类型 / 对方单位
   第二行两分：
     左 50% —— 托盘数量 / 经手员工 / 关联单据（三项同行）
     右 50% —— 备注

   与前几轮一致的做法：不设媒体查询断点，容器给 min-width 并允许
   横向滚动，保证第一行五项与第二行三分始终同排，窗口再窄只出滚动条。 */
.form-grid-pallet {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 14px 18px;
  min-width: 900px;
}
.form-grid-pallet .field input,
.form-grid-pallet .field select,
.form-grid-pallet .field textarea { min-width: 0; }
/* 第一行：五项并排。对方单位含关键字检索框，需较宽 */
.form-grid-pallet .pg-row1 {
  display: grid;
  grid-template-columns:
    minmax(132px, 0.85fr)   /* 日期 */
    minmax(150px, 1fr)      /* 方向（带提示文字） */
    minmax(140px, 0.95fr)  /* 托盘归属 */
    minmax(130px, 0.85fr)  /* 对方类型 */
    minmax(230px, 1.6fr);   /* 对方单位（关键字检索） */
  gap: 14px 16px;
}
/* 第二行：左右各占 50% */
.form-grid-pallet .pg-row2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px 18px;
  align-items: start;
}
/* 第二行左半：三项并排，共占 50% 宽度 */
.form-grid-pallet .pg-row2-l {
  display: grid;
  grid-template-columns:
    minmax(100px, 0.8fr)   /* 托盘数量 */
    minmax(130px, 1.05fr)  /* 经手员工 */
    minmax(170px, 1.45fr); /* 关联单据 */
  gap: 14px 14px;
}
/* 第二行右半：备注占 50% 宽度 */
.form-grid-pallet .pg-row2-r .field textarea {
  min-height: 58px;
  width: 100%;
}
/* 提交按钮行 */
.form-grid-pallet .pg-actions {
  display: flex;
  gap: 10px;
}
/* 容器：窗口不够宽时横向滚动，保证各行始终同排 */
.form-grid-pallet-scroll {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
}

/* 第61轮：质量投诉登记已改用 .form-grid-comp（见上），
   原 .form-grid-4 四列栅格随之废弃 —— 全站已无引用，故移除。 */
/* 第54轮：物料新增表单专用栅格
   第一行六列**强制同排**：所属大类 / 物料编码 / 名称 / 规格 / 外观(窄) / 单位(窄)
   第二行：备注整行

   关键约束：外观与单位必须与其它四项**同一行**，不随窗口宽度换行。
   做法 = 栅格本身不设媒体查询断点，改为给容器一个 min-width 并允许横向滚动：
   窗口再窄也是「一行六项 + 一行备注」，只是出现横向滚动条，
   而不是把规格/外观/单位挤到第二行。 */
.form-grid-mat {
  display: grid;
  grid-template-columns:
    minmax(118px, 1.1fr)   /* 所属大类 */
    minmax(136px, 1.25fr)  /* 物料编码 */
    minmax(118px, 1.35fr)  /* 名称 */
    minmax(148px, 1.45fr)  /* 规格 */
    minmax(74px, 0.85fr)   /* 外观 */
    minmax(66px, 0.7fr);   /* 单位 */
  gap: 14px 14px;
  /* 六列并排所需的最小宽度（含列间距约 70px）。
     低于此值出横向滚动条而非换行 —— 保证外观/单位永不单独成行。 */
  min-width: 736px;
}
.form-grid-mat .field.full { grid-column: 1 / -1; }
.form-grid-mat .field input,
.form-grid-mat .field select { min-width: 0; }
/* 容器：窗口不够宽时横向滚动，保证六项永远同一行 */
.form-grid-mat-scroll {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
}
/* 独立两列栅格：产品名称 / 目标客户 各占 1/2 */
.field-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  grid-column: 1 / -1;
}
@media (max-width: 820px) {
  .field-grid-2 { grid-template-columns: 1fr; }
}
/* 第73轮：新产品开发提报表首行 —— 填报日期 / 物料大类 / 创新点 / 产品名称 四项同行
   产品名称由第二行上移至首行创新点之后；物料大类收窄（原 auto-fit 下占 260px，
   但选项最长仅 6 字「PE复合袋类」，严重浪费），改为 132px。

   实现要点（同第72轮合理化建议）：**不能**沿用外层 .form-grid 的 auto-fit 布局。
   auto-fit 会把表单分成 N 个等宽列，内部行栅格的 grid-column:1/-1 在多列
   上下文里只跨 1 列，导致内部列被裁切。故表单自身用 grid-template-rows
   逐行排布，每行内部自管列数，行宽由外层滚动容器保证。 */
.form-grid-np {
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 14px 18px;
  min-width: 860px;
}
.form-grid-np-scroll {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
}
/* 除首行外的整行字段（目标客户 / 产品说明 / 按钮）占满一整行 */
.form-grid-np > .field.full { grid-column: 1 / -1; }
/* 首行四项：日期 140 / 物料大类 132 / 创新点 210 / 产品名称 占剩余 */
.form-grid-np .np-row1 {
  display: grid;
  grid-template-columns:
    minmax(140px, 0.85fr)   /* 填报日期（原生 date 控件） */
    minmax(132px, 0.8fr)    /* 物料大类（最长选项 6 字） */
    minmax(210px, 1.25fr)   /* 创新点（复选组，需容下两个复选框） */
    minmax(260px, 2.1fr);   /* 产品名称（长文本，占剩余） */
  gap: 14px 16px;
}
.form-grid-np .field input,
.form-grid-np .field select,
.form-grid-np .field textarea { min-width: 0; }
/* 创新点复选组：两项并排，容器不再被拉伸 */
.form-grid-np .check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  justify-content: flex-start;
}
/* 第72轮：合理化建议提报表首行 —— 填报日期 / 改善关注点 / 建议标题 三项同行
   改善关注点由复选组改为下拉选择（单选），故列宽按内容重新分配：
     填报日期    140px 起（原生 date 控件所需）
     改善关注点  130px 起（五个短枚举：成本/效率/质量/安全/管理）
     建议标题    260px 起（长文本，占据剩余空间）

   实现要点（同第67轮托盘表单）：**不能**沿用外层 .form-grid 的
   auto-fit 布局。auto-fit 会把表单分成 N 个等宽列，而 .field-grid-sg
   的 grid-column:1/-1 在这种多列上下文里只跨 1 列，
   导致内部三列栅格被裁到只剩约 260px（第三项「建议标题」被挤出可视区）。
   故此处改为：表单自身用 grid-template-rows 逐行排布，
   每行内部自管列数，行的宽度由外层滚动容器保证。 */
.form-grid-sg {
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  gap: 14px 18px;
  min-width: 580px;
}
.form-grid-sg-scroll {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
}
/* 除首行外的整行字段（问题 / 内容 / 效果 / 按钮）占满一整行 */
.form-grid-sg > .field.full { grid-column: 1 / -1; }
.form-grid-sg .field-grid-sg {
  display: grid;
  grid-template-columns:
    minmax(140px, 0.9fr)
    minmax(130px, 0.85fr)
    minmax(260px, 2.2fr);
  gap: 14px 18px;
}
.form-grid-sg .field input,
.form-grid-sg .field select,
.form-grid-sg .field textarea { min-width: 0; }
/* 第16轮：托盘流向看板 —— 两栏 */
.grid-2cols {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}
@media (max-width: 1000px) {
  .grid-2cols { grid-template-columns: 1fr; }
}
/* 第14轮：设备维保汇总 —— 统计分析三栏 */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 1000px) {
  .grid-3 { grid-template-columns: 1fr; }
}
@media (min-width: 900px) {
  .form-grid-2col { grid-template-columns: repeat(2, 1fr); }
  .form-grid-2col .field.half { grid-column: span 1; }
}

.form-actions {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--hb-line);
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}

.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 12px 16px; border-bottom: 1px solid var(--hb-line); background: #FAFBFC;
}
.filter-bar .field { min-width: 150px; }
.filter-bar .spacer { flex: 1 1 auto; }

/* 提示 */
.alert {
  padding: 10px 14px; border-radius: var(--hb-radius); font-size: 13px;
  margin-bottom: 14px; border: 1px solid;
}
.alert-success { background: var(--hb-green-bg); border-color: #BFE3CB; color: var(--hb-green); }
.alert-error { background: var(--hb-red-bg); border-color: #EFC3C3; color: var(--hb-red); }
.alert-info { background: var(--hb-blue-bg); border-color: #C7D6F5; color: var(--hb-blue); }
.alert-warn { background: var(--hb-orange-bg); border-color: #EED6AE; color: var(--hb-orange); }

/* 分页 */
.pager { display: flex; gap: 6px; align-items: center; justify-content: flex-end; padding: 12px 16px; }
.pager a, .pager span {
  padding: 4px 10px; border: 1px solid var(--hb-line); border-radius: var(--hb-radius);
  font-size: 12.5px; color: var(--hb-ink-2); background: #fff;
}
.pager .cur { background: var(--hb-navy); border-color: var(--hb-navy); color: #fff; font-weight: 600; }
.pager .disabled { color: var(--hb-ink-3); background: #F7F8FA; }

/* 时间线 */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--hb-line); margin-left: 6px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--hb-navy); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--hb-line);
}
.timeline .tl-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.timeline .tl-title { font-weight: 600; font-size: 13.5px; }
.timeline .tl-time { font-size: 11.5px; color: var(--hb-ink-3); }
.timeline .tl-body { font-size: 13px; color: var(--hb-ink-2); margin-top: 3px; white-space: pre-wrap; }
.timeline .tl-photos { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.timeline .tl-photos img { width: 78px; height: 78px; object-fit: cover; border-radius: 4px; border: 1px solid var(--hb-line); cursor: pointer; }

/* 详情描述列表 */
.desc-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; }
.desc-list .dl-item { border-bottom: 1px dashed var(--hb-line); padding-bottom: 8px; }
.desc-list .dl-label { font-size: 12px; color: var(--hb-ink-3); margin-bottom: 2px; }
.desc-list .dl-value { font-size: 13.5px; font-weight: 500; word-break: break-all; }
.desc-list .dl-value.big { font-size: 17px; font-weight: 700; color: var(--hb-navy); }

/* 步骤条 */
.steps { display: flex; gap: 0; flex-wrap: wrap; margin-bottom: 16px; }
.step {
  flex: 1 1 120px; padding: 10px 12px; background: #fff; border: 1px solid var(--hb-line);
  border-right-width: 0; position: relative;
}
.step:first-child { border-radius: var(--hb-radius) 0 0 var(--hb-radius); }
.step:last-child { border-right-width: 1px; border-radius: 0 var(--hb-radius) var(--hb-radius) 0; }
.step .s-idx { font-size: 11px; color: var(--hb-ink-3); }
.step .s-name { font-size: 13px; font-weight: 600; }
.step.done { background: var(--hb-green-bg); border-color: #BFE3CB; }
.step.done .s-name { color: var(--hb-green); }
.step.cur { background: var(--hb-navy); border-color: var(--hb-navy); }
.step.cur .s-name, .step.cur .s-idx { color: #fff; }

/* 登录页 */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--hb-navy) 0%, var(--hb-navy-700) 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 10px; box-shadow: var(--hb-shadow-lg);
  width: 100%; max-width: 400px; overflow: hidden;
}
.login-brand { padding: 30px 28px 18px; text-align: center; }
.login-brand img { height: 44px; margin-bottom: 12px; }
.login-brand h1 { font-size: 19px; margin: 0 0 4px; color: var(--hb-navy); }
.login-brand p { margin: 0; font-size: 12.5px; color: var(--hb-ink-3); }
.login-brand .login-en {
  margin-top: 3px;
  font-size: 10.5px;
  letter-spacing: .3px;
  color: var(--hb-ink-3);
  opacity: .75;
  line-height: 1.4;
}
.login-form { padding: 6px 28px 28px; }
.login-form .field { margin-bottom: 14px; }
.login-form input { padding: 9px 12px; }
.login-btn { width: 100%; padding: 10px; font-size: 14.5px; }
.login-hint {
  margin-top: 16px; padding: 10px; background: var(--hb-blue-bg);
  border-radius: var(--hb-radius); font-size: 12px; color: var(--hb-blue);
}

/* ★ 第131轮：维护模式提示框（登录页）
   目的：让员工一眼看懂「不是系统坏了，是在维护」，并且**不能**登录。 */
.login-form .maintenance-box {
  margin-bottom: 16px; padding: 12px 14px; text-align: left;
  border-radius: var(--hb-radius); line-height: 1.65;
}
.login-form .maintenance-title {
  font-size: 14px; font-weight: 700; margin-bottom: 4px;
}
.login-form .maintenance-reason {
  font-size: 13px; color: var(--hb-ink); margin-bottom: 3px;
}
.login-form .maintenance-since {
  font-size: 11.5px; opacity: .8; margin-bottom: 3px;
}
.login-form .maintenance-tip {
  font-size: 11.5px; opacity: .85; margin-top: 4px;
  padding-top: 5px; border-top: 1px dashed rgba(0, 0, 0, .12);
}
.login-form input:disabled,
.login-form button:disabled {
  opacity: .55; cursor: not-allowed;
}

/* 打印 */
@media print {
  .sidebar, .topbar, .no-print, .pager, .filter-bar { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  body { background: #fff; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
.print-head { text-align: center; margin-bottom: 18px; }
.print-head h1 { font-size: 20px; margin: 0 0 4px; }
.print-head .meta { font-size: 12px; color: #555; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: #fff; border-radius: 8px; box-shadow: var(--hb-shadow-lg);
  width: 100%; max-width: 680px; max-height: 88vh; overflow: auto;
}
.modal-head { padding: 14px 18px; border-bottom: 1px solid var(--hb-line); display: flex; align-items: center; }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-head .x { margin-left: auto; cursor: pointer; color: var(--hb-ink-3); font-size: 20px; line-height: 1; }
.modal-body { padding: 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--hb-line); display: flex; gap: 8px; justify-content: flex-end; }

/* 子表行编辑 */
.item-rows { width: 100%; border-collapse: collapse; font-size: 13px; }
.item-rows th { background: #FAFBFC; padding: 8px 10px; border: 1px solid var(--hb-line); font-size: 12.5px; text-align: left; }
.item-rows td { padding: 5px 6px; border: 1px solid var(--hb-line); vertical-align: middle; }
.item-rows input, .item-rows select { padding: 5px 7px; font-size: 13px; }
.item-rows .col-narrow { width: 100px; }
.item-rows .col-mid { width: 160px; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  body.sb-open .sidebar { transform: translateX(0); width: var(--sb-w); flex-basis: var(--sb-w); }
  .main, body.sb-collapsed .main { margin-left: 0; }
  .topbar-motto .company { display: none; }
}

/* ---- 发票/凭证照片墙 ---- */
.photo-row { display: flex; flex-wrap: wrap; gap: 12px; }
.photo-row a {
  display: block; width: 168px; height: 120px; overflow: hidden;
  border: 1px solid var(--line, #E3E8EF); border-radius: 6px; background: #FAFBFC;
}
.photo-row img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-row a:hover { border-color: var(--navy, #1B3A6B); }

/* ---- 交付进度条（采购订单等） ---- */
.prog { display: flex; align-items: center; gap: 8px; }
.prog-track {
  flex: 1 1 auto; height: 8px; min-width: 70px;
  background: #EEF0F3; border-radius: 4px; overflow: hidden;
}
.prog-fill {
  height: 100%; background: var(--hb-blue, #2F5FA8); border-radius: 4px;
  transition: width .2s ease;
}
.prog-fill.done { background: var(--hb-green, #1E7A4D); }
.prog-num {
  font-size: 12px; font-weight: 600; color: var(--hb-ink-2);
  font-variant-numeric: tabular-nums; min-width: 34px; text-align: right;
}
.overdue { color: var(--hb-red, #C0392B); font-weight: 600; }
.hint-warn { font-size: 11.5px; color: var(--hb-red, #C0392B); margin-top: 2px; }

/* ---- 客户检索下拉（客户多时快速查找） ---- */
.pick-list {
  position: absolute;
  z-index: 60;
  margin-top: 4px;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--hb-line, #E3E8EF);
  border-radius: var(--hb-radius, 6px);
  box-shadow: 0 6px 20px rgba(27, 58, 107, .14);
  min-width: 260px;
}
.field { position: relative; }
/* 第81轮：检索候选框改到输入框**正下方**
   问题：候选框 .pick-list 是 position:absolute，直接放在 .field 里。
     而 .field 是 display:flex; flex-direction:column —— 按 CSS Flexbox 规范，
     绝对定位子元素的静态位置落在 flex 内容盒的**起点**（不是它前面的兄弟节点之后），
     于是候选框压住了标签与输入框。
     实测（1600 视口，需求单新建页）：输入框 top=190 / bottom=224，
     候选框 top=169 —— 整个盖在输入框上，用户看不到自己刚输入了哪个字。
   修法：把「关键字输入框 + 隐藏域 + 候选框」包进 .pick-wrap（position:relative），
     候选框用 top:100% 贴在输入框正下方。 */
.pick-wrap { position: relative; }
.pick-wrap > .pick-list {
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  min-width: 0;
}
.pick-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border: 0;
  background: transparent;
  font-size: 13.5px;
  color: var(--hb-ink, #1F2D3D);
  cursor: pointer;
  border-bottom: 1px solid #F2F4F7;
  font-family: inherit;
}
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover { background: #F4F7FB; color: var(--hb-navy, #1B3A6B); }
.pick-none { padding: 10px 14px; font-size: 12.5px; color: var(--hb-ink-3, #7A8899); }
/* 第31轮：退货单「往来单位」关键字检索（供应商 / 客户通用） */
.pick-kw { width: 100%; }

/* ===== 第30轮：物料关键字检索选择器 + 可用库存显示 =====
   物料条目多（1900+），下拉滚动查找不便，改为输入关键字后弹出候选列表。 */
.mat-cell { position: relative; }
.mat-cell .mat-kw { width: 100%; }
.mat-list {
  position: absolute;
  z-index: 60;
  margin-top: 3px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--hb-line, #E3E8EF);
  border-radius: var(--hb-radius, 6px);
  box-shadow: 0 6px 20px rgba(27, 58, 107, .14);
  min-width: 260px;
  left: 0; right: 0;
}
.mat-list .pick-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  border: 0;
  background: transparent;
  cursor: pointer;
  border-bottom: 1px solid #F2F4F7;
  font-family: inherit;
  line-height: 1.35;
}
.mat-list .pick-item:hover,
.mat-list .pick-item.active { background: #F4F7FB; }
.mat-list .m-code {
  font-size: 11.5px; color: var(--hb-navy, #1B3A6B);
  font-weight: 700; margin-right: 6px;
  font-variant-numeric: tabular-nums;
}
.mat-list .m-name { font-size: 13px; color: var(--hb-ink, #1F2D3D); }
.mat-list .m-spec {
  font-size: 11.5px; color: var(--hb-ink-3, #7A8899);
  margin-left: 6px;
}
.mat-list .m-stock {
  float: right; font-size: 11.5px; font-weight: 700;
  color: var(--hb-green, #1E8E5A);
  font-variant-numeric: tabular-nums;
}
.mat-list .m-stock.zero { color: var(--hb-red, #C0392B); }
.mat-list .m-stock.warn { color: var(--hb-orange, #C87A00); }

/* 明细表内：单位列要能完整显示 3 个中文字符
   实测（Chromium / Microsoft YaHei 12.5px）：「立方米」三字 scrollWidth = 56px，
   加 input 自身 padding 2px 与边框 2px → 至少需 60px，取 62px 列宽 / 58px 输入框。
   46px 只能显示 1.5 个字，是第31轮用户反馈的问题。

   注意：HTML table 的自动布局会把「百分比宽度」按内容重新分配，
   单位列常被放大到 95px+。因此本项目对明细表统一采用
   table-layout: fixed + 明确的像素列宽（见各模板 colgroup），
   这样每一列的宽度才是最终值，不会被内容撑开。 */
.item-rows { table-layout: fixed; }
/* 第33轮：新增「外观」列（物料外观快照），宽度与规格列一致 */
.item-rows .col-appearance { width: 130px; }
.item-rows td.col-appearance { padding-left: 4px; padding-right: 4px; }
.item-rows td.col-appearance input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.item-rows .col-unit { width: 62px; }
.item-rows td.col-unit {
  width: 62px; padding-left: 2px; padding-right: 2px;
}
.item-rows td.col-unit input,
.item-rows td.col-unit select {
  width: 58px;
  min-width: 0;
  box-sizing: border-box;
  text-align: center;
  padding-left: 1px; padding-right: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12.5px;
}
.item-rows td.col-unit select {
  padding-right: 0;
  min-width: 0;
  text-overflow: clip;
  background-image: none;
  padding-left: 0;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 4px;
}
/* 可用库存提示 */
.stock-hint {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--hb-ink-3, #7A8899);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.stock-hint.ok { color: var(--hb-green, #1E8E5A); }
.stock-hint.warn { color: var(--hb-orange, #C87A00); }
.stock-hint.bad { color: var(--hb-red, #C0392B); font-weight: 600; }

/* ---- 物料大类内联编辑 / 编码前缀 ---- */
.inline-edit { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.inline-edit .w-name { min-width: 130px; }
.inline-edit .w-prefix { min-width: 80px; max-width: 100px; }
input[readonly] { background: var(--hb-bg-2, #F5F7FA); color: var(--hb-ink-2, #5A6B7F); }

/* 第68轮：计量单位列表的行内编辑输入框收窄
   问题：单位名称最长 3 个字（「千克」「平方米」），但 input 默认
     width:100% 会撑满整列 —— 实测输入框宽 533px，浪费约 11 倍空间，
     备注列也被撑得很宽，整张表横向拉得很长。
   处理：给单位列表专用类，固定为内容所需宽度。
   注意：名称+备注+保存按钮三者合计约 76+96+56+间距 ≈ 250px，
     单元格必须留够这个宽度，否则 flex-wrap 会让它们竖排成三行、
     行高反而变大 —— 故单元格宽度按内容给足。 */
.unit-edit .w-unit-name {
  width: 76px;
  min-width: 76px;
  flex: 0 0 auto;
  text-align: center;
}
/* 第78轮：备注框加宽
   收窄到 96px 后无法显示完整内容 —— 实测「用于气泡膜卷、珍珠棉卷」（11 字）
   实际需要 169px，框宽仅 96px，内容被截断。
   现按最长的实际内容给足宽度（190px，可容 12 字以上），
   所在列同步加宽，保证「名称 + 备注 + 保存按钮」仍排在一行。 */
/* 第79轮：备注框改为「按内容自适应」
   固定 190px 仍然偏窄 —— 用户实际填写的备注更长时会被截断，
   实测框内可见宽度 188px，11 字备注恰好贴边，再长就看不见全文。
   现改为：基准 220px（较 190px 更宽松），由页面脚本按实际文字宽度自动加宽
   （上限 460px，见 max-width），加载与输入时都会重新计算；
   超过上限的极长内容可通过悬停 title 查看完整备注。 */
.unit-edit .w-unit-remark {
  width: 220px;
  min-width: 220px;
  max-width: 460px;
  flex: 0 0 auto;
}
/* 单位名称列：宽度按内容（名称+备注+保存按钮）给足，保证三者同一行 */
/* 单位名称列：宽度按内容（名称76 + 备注上限460 + 按钮56 + 间距）给足，保证三者同一行 */
.unit-list-table td.unit-name-cell {
  width: 610px;
  white-space: nowrap;
}
.unit-list-table th.unit-name-col { width: 610px; white-space: nowrap; }
/* 排序列同样收窄 */
.unit-list-table td.unit-sort-cell { width: 1%; white-space: nowrap; }
.unit-list-table th.unit-sort-col { width: 1%; white-space: nowrap; }

/* 第81轮：需求单「业务进度」单元格
   审批 / 采购 / 到货 / 检验入库 四段进度用小标签横排，
   让销售员一眼看出单子卡在哪一段、哪些还没配送给客户。 */
.prog-cell {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.prog-cell .prog-step {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11.5px;
  line-height: 18px;
  background: #F2F5F9;
  color: var(--hb-ink-2, #5A6B7F);
  border: 1px solid var(--hb-line, #E3E8EF);
  white-space: nowrap;
}

/* 第81轮：管理任务「下达任务」表单 —— 四项同行
   任务标题 / 责任人 / 开始日期 / 截止日期 排在一行，节省页面空间。
   宽度按内容分配：标题是自由文本，占大头；其余三项内容短。
   沿用既有做法：栅格不设媒体查询断点，容器给 min-width 并允许横向滚动。 */
.form-grid-task {
  display: grid;
  grid-template-columns:
    minmax(260px, 2.4fr)   /* 任务标题 */
    minmax(150px, 0.9fr)   /* 责任人 */
    minmax(150px, 0.8fr)   /* 开始日期 */
    minmax(150px, 0.8fr);  /* 截止日期 */
  gap: 14px 18px;
  min-width: 760px;
}
.form-grid-task .field input,
.form-grid-task .field select { min-width: 0; }
.form-grid-task-scroll {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
}

/* 第81轮：检验记录顶部统计卡片（待检验 / 隔离 / 不合格） */
.insp-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px 18px;
  margin-bottom: 14px;
}

/* 第79轮：新增单位表单 —— 四项同行
   单位名称 / 排序 / 备注 / 「新增」按钮 全部排在一行，节省页面空间。
   原来用 .form-grid（auto-fit），备注与按钮各占一整行，表单高达 3 行。
   宽度按内容分配：名称与排序都很短，备注占剩余。
   按钮所在列无标签，用 align-items:flex-end 让按钮底边与输入框对齐。 */
.form-grid-unit {
  display: grid;
  grid-template-columns:
    minmax(132px, 0.85fr)   /* 单位名称 */
    minmax(96px, 0.5fr)     /* 排序 */
    minmax(300px, 2.9fr)    /* 备注 */
    auto;                   /* 新增按钮 */
  gap: 14px 18px;
  align-items: flex-end;
  min-width: 660px;
}
.form-grid-unit .field input { min-width: 0; }
.form-grid-unit .unit-submit { justify-content: flex-end; }
/* 容器：窗口不够宽时横向滚动，保证四项永远同一行 */
.form-grid-unit-scroll {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 4px;
}

/* 第78轮：检验记录按项目逐项检验
   每个物料一个分组（组头显示物料名与检验责任人），
   组内表格列出该物料需检验的项目、标准、方法，逐项填实测值与判定。 */
.insp-group {
  border: 1px solid var(--hb-line, #E3E7EC);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  background: var(--hb-bg-1, #fff);
}
.insp-group-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--hb-line, #E3E7EC);
}
.insp-group-head strong { font-size: 14px; }
.insp-group-head .muted { font-size: 12.5px; }
/* 检验项目表：列多，收窄字号与间距 */
.insp-check-table { font-size: 13px; }
.insp-check-table th,
.insp-check-table td { padding: 6px 8px; }
.insp-check-table input,
.insp-check-table select { font-size: 13px; height: 30px; }
/* 检验明细中的项目子行：浅底以区分物料行 */
.insp-check-row td { background: var(--hb-bg-2, #F7F9FB); }

/* 第75轮：检验标准库的行内编辑
   需求：检验标准需可修改（客户要求、工艺变更会调整标准），
   故把「适用大类 / 适用物料 / 检验项目 / 检验标准 / 检验方法」
   五个字段直接放进表格第一列的表单里，保存即生效。
   布局：上下两行 —— 第一行两个下拉（大类、物料），
        第二行三个输入框（项目、标准、方法）+ 保存按钮。
   宽度按内容给足，避免 flex-wrap 竖排导致行高暴涨。 */
.std-edit {
  display: flex;
  /* 横向排列五个字段，与表头列一一对应。
     用 stretch 而非 flex-start：flex-start 会让容器收缩到内容宽度
     （实测收缩到 230px），导致内部字段被迫竖排、行高暴涨。 */
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  flex-wrap: nowrap;
}
.std-edit-fields {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
}
.std-edit .w-std-cat { width: 108px; flex: 0 0 auto; }
/* 第76轮：物料名称（按名称匹配，不区分规格） */
.std-edit .w-std-name { width: 138px; flex: 0 0 auto; }
.std-edit .w-std-item { width: 118px; flex: 0 0 auto; }
.std-edit .w-std-text { flex: 1 1 auto; min-width: 180px; }
.std-edit .w-std-method { width: 138px; flex: 0 0 auto; }
/* 保存按钮与编辑字段同属一个 form（放在这里才能把新值提交上去），
   用 margin-left:auto 把它推到行末，视觉上靠近「状态/操作」列 */
.std-edit > button[type='submit'] {
  margin-left: auto;
  flex: 0 0 auto;
}
/* 停用行整体淡化，与启用中的规范区分 */
.row-inactive { opacity: 0.6; }
.row-inactive:hover { opacity: 1; }
/* 编辑表单所在单元格：让输入框不被表格默认样式挤压 */
.std-table td .std-edit input,
.std-table td .std-edit select { height: 30px; }

/* ---- 收款核销：发票勾选与部分收款 ---- */
input.w-amt { width: 110px; text-align: right; font-variant-numeric: tabular-nums; }
.tag-gray { background: #EEF1F5; color: #5A6B7F; }

/* ---- 报价登记：成交率浮层 ---- */
.rate-board {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 0;
  background: #fff;
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  box-shadow: var(--hb-shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.rb-main {
  padding: 16px 18px;
  border-right: 1px solid var(--hb-line);
  background: linear-gradient(180deg, #FAFBFD 0%, #fff 100%);
}
.rb-label { font-size: 12.5px; color: var(--hb-ink-3); margin-bottom: 4px; }
.rb-value {
  font-size: 32px; font-weight: 700; line-height: 1.1;
  color: var(--hb-navy); font-variant-numeric: tabular-nums;
}
.rb-value small { font-size: 15px; font-weight: 600; margin-left: 2px; }
.rb-sub { font-size: 12px; color: var(--hb-ink-3); margin-top: 4px; }
.rb-bar {
  height: 7px; border-radius: 4px; margin-top: 10px;
  background: #EEF1F5; overflow: hidden; display: flex;
}
.rb-bar-win { display: block; height: 100%; background: var(--hb-green); }
.rb-legend {
  display: flex; gap: 14px; margin-top: 8px;
  font-size: 11.5px; color: var(--hb-ink-3);
}
.rb-legend .dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 4px;
}
.dot-win { background: var(--hb-green); }
.dot-lose { background: #B8C0CC; }
.dot-pend { background: var(--hb-blue); }

.rb-cats { padding: 14px 18px; }
.rb-cats-title {
  font-size: 13px; font-weight: 700; color: var(--hb-ink-2);
  padding-bottom: 6px; border-bottom: 1px solid var(--hb-line); margin-bottom: 10px;
}
.rb-cats-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  max-height: 190px; overflow-y: auto;
}
.rb-cat {
  border: 1px solid var(--hb-line);
  border-radius: var(--hb-radius);
  padding: 9px 11px;
  background: #FCFDFE;
}
.rb-cat-name { font-size: 13px; font-weight: 600; color: var(--hb-ink); }
.rb-cat-rate {
  font-size: 19px; font-weight: 700; color: var(--hb-navy);
  font-variant-numeric: tabular-nums; margin-top: 1px;
}
.rb-cat-rate small { font-size: 11px; font-weight: 600; }
.rb-cat-bar { height: 5px; border-radius: 3px; background: #EEF1F5; overflow: hidden; margin-top: 5px; }
.rb-cat-sub { font-size: 11px; color: var(--hb-ink-3); margin-top: 4px; }
.rb-cat-empty { font-size: 12.5px; color: var(--hb-ink-3); padding: 10px 0; }

/* 列表行内操作 */
.row-inline { display: flex; gap: 4px; align-items: center; }
.row-inline select.sm, .row-inline input.sm {
  padding: 4px 6px; font-size: 12.5px; border-radius: 4px; min-width: 0;
}
.row-inline input.sm { width: 128px; }

/* ---- 系统导览：业务流程图 ---- */
.flowchart {
  display: flex; align-items: stretch; flex-wrap: wrap;
  gap: 4px; padding: 4px 0 10px;
}
.fc-step {
  flex: 1 1 118px; min-width: 112px; max-width: 168px;
  border: 1px solid var(--hb-line); border-radius: var(--hb-radius);
  background: #FCFDFE; padding: 10px 8px; text-align: center;
  text-decoration: none; transition: border-color .12s, background .12s;
}
.fc-step:hover { border-color: var(--hb-navy); background: #F5F8FC; }
.fc-num {
  width: 22px; height: 22px; line-height: 22px; margin: 0 auto 6px;
  border-radius: 50%; background: var(--hb-navy); color: #fff;
  font-size: 12px; font-weight: 700;
}
.fc-name { font-size: 13px; font-weight: 600; color: var(--hb-ink); line-height: 1.4; }
.fc-role { font-size: 11.5px; color: var(--hb-ink-3); margin-top: 3px; }
.fc-arrow {
  align-self: center; color: var(--hb-ink-3); font-size: 20px;
  padding: 0 1px; line-height: 1;
}
.fc-badge {
  display: inline-block; width: 24px; height: 24px; line-height: 24px;
  text-align: center; border-radius: 50%;
  background: var(--hb-navy-50); color: var(--hb-navy);
  font-size: 12.5px; font-weight: 700;
}

/* 分支路径 */
.branch {
  border-left: 3px solid var(--hb-line);
  padding: 8px 0 8px 14px; margin-bottom: 12px;
}
.branch:last-child { margin-bottom: 0; }
.branch-title { font-size: 13.5px; font-weight: 700; color: var(--hb-ink); }
.branch-steps {
  font-size: 12.5px; color: var(--hb-ink-2); margin-top: 4px; line-height: 1.8;
}
.branch-note { font-size: 12px; color: var(--hb-ink-3); margin-top: 3px; }
.branch-green { border-left-color: var(--hb-green); }
.branch-blue { border-left-color: var(--hb-blue); }
.branch-orange { border-left-color: var(--hb-orange); }
.branch-gray { border-left-color: #B8C0CC; }

/* 岗位职责 */
.role-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px;
}
.role-card {
  border: 1px solid var(--hb-line); border-radius: var(--hb-radius);
  padding: 11px 13px; background: #FCFDFE;
}
.role-head { display: flex; align-items: center; gap: 8px; }
.role-icon {
  width: 22px; height: 22px; line-height: 22px; text-align: center;
  border-radius: 5px; background: var(--hb-navy); color: #fff; font-size: 12px;
}
.role-duty { font-size: 12.5px; color: var(--hb-ink-2); margin-top: 7px; line-height: 1.7; }
.role-steps { font-size: 11.5px; color: var(--hb-ink-3); margin-top: 6px; }

/* 单据流转 */
.chain { display: flex; gap: 28px; flex-wrap: wrap; }
.chain-col { flex: 1 1 200px; }
.chain-title {
  font-size: 12.5px; font-weight: 700; color: var(--hb-ink-3);
  padding-bottom: 6px; border-bottom: 1px solid var(--hb-line); margin-bottom: 10px;
}
.chain-node {
  border: 1px solid var(--hb-line); border-radius: var(--hb-radius);
  background: #FCFDFE; padding: 8px 12px; font-size: 13px; text-align: center;
  color: var(--hb-ink-2);
}
.chain-node.accent-blue { border-color: var(--hb-blue); background: var(--hb-blue-bg); color: var(--hb-blue); }
.chain-node.accent-green { border-color: var(--hb-green); background: var(--hb-green-bg); color: var(--hb-green); }
.chain-node.accent-navy { border-color: var(--hb-navy); background: var(--hb-navy-50); color: var(--hb-navy); }
.chain-arrow { text-align: center; color: var(--hb-ink-3); font-size: 15px; padding: 3px 0; }

/* ===== 第十一轮：可排序表头 / 合计行 / 供应商资质 ===== */
table.data th a.th-sort {
  color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 3px;
}
table.data th a.th-sort:hover { color: var(--hb-navy); }
table.data th.sorted a.th-sort { color: var(--hb-navy); font-weight: 700; }
table.data th .sort-arrow { font-size: 9.5px; opacity: .55; }
table.data th.sorted .sort-arrow { opacity: 1; }
table.data tfoot td {
  background: #F4F7FB; border-top: 2px solid var(--hb-line); font-size: 12.5px;
}

/* ===== 第19轮：表头列级筛选 ===== */
table.data th.th-filterable {
  white-space: normal; vertical-align: top; padding: 8px 10px;
}
/* 第34轮：既带表头筛选控件、又要求标题不换行时（如「下单日期」）
   恢复 nowrap —— 需与上面的 .th-filterable 同等特指度且在其之后。 */
table.data th.th-filterable.nowrap { white-space: nowrap; }
/* 第36轮：改为纯排序（th-sortable）的日期列同样不换行 */
table.data th.th-sortable.nowrap { white-space: nowrap; }
table.data th.th-filterable > .th-label {
  display: block; margin-bottom: 5px; font-size: 12.5px; font-weight: 600;
  color: var(--hb-ink-2);
}
.th-filter {
  width: 100%; min-width: 90px; max-width: 170px;
  padding: 4px 7px; font-size: 12px; border-radius: 4px;
  border: 1px solid #DCE1E8; background: #fff; color: var(--hb-ink);
  font-family: inherit;
}
.th-filter:focus {
  outline: none; border-color: var(--hb-navy-600);
  box-shadow: 0 0 0 2px rgba(36, 72, 127, .1);
}
select.th-filter { padding-right: 4px; }
.th-range { display: flex; align-items: center; gap: 3px; }
.th-range .th-filter { min-width: 62px; max-width: none; flex: 1 1 0; }
.th-range .th-sep { font-size: 11px; color: var(--hb-ink-3); flex: 0 0 auto; }
/* 第34轮：<input type="date"> 在 Chromium 有约 148px 的固有宽度，
   会把表头列撑得很宽（实测 329px）。这里显式收窄，并隐藏日期选择器图标，
   只保留 yyyy/mm/dd 文本，两个日期框合计控制在 ~190px。 */
.th-range input[type="date"] {
  width: 88px; min-width: 0; flex: 1 1 88px; padding: 4px 3px;
  font-size: 11.5px; letter-spacing: -0.2px;
}
.th-range input[type="date"]::-webkit-calendar-picker-indicator {
  display: none; padding: 0; margin: 0; width: 0;
}
.th-filter-actions {
  display: flex; gap: 6px; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--hb-line); background: #FAFBFC;
}
.th-filter-actions .btn { padding: 5px 12px; font-size: 12.5px; }
.th-filter-tip {
  font-size: 11.5px; color: var(--hb-ink-3); margin-left: auto;
}
.supplier-products { white-space: pre-wrap; font-size: 12.5px; color: var(--hb-ink-2); }
.qual-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.qual-pick label {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px;
  border: 1px solid var(--hb-line); border-radius: 5px; cursor: pointer;
  font-size: 12.5px; font-weight: 500; background: #fff;
}
.qual-pick input:checked + span { font-weight: 700; color: var(--hb-navy); }
.qual-pick label:has(input:checked) { border-color: var(--hb-navy); background: var(--hb-navy-50); }

/* ==========================================================================
   第15轮：A4 单据打印模板（采购合同 / 入库单 / 出库单共用）
   版式基准：A4 纵向 210×297mm，页边距 12mm；打印时隐藏一切界面元素
   ========================================================================== */
.doc-sheet {
  /* ★ 第134轮（需求6）：宽度与内边距改为**变量驱动** ——
     打印预览可调页边距，调整后页面自适应。
     · 宽度用 auto + max-width：纸张按「内容 + 边距」自适应，
       左右边距由用户调，表格始终撑满可打印区，不会忽宽忽窄；
     · 原来写死的 width:194mm + padding:0 组合会让「加了 padding
       就窄 16mm」（内容区 194-16=178mm），改 auto 后宽度自动重算。
     · 默认值与原版式一致：左右各 8mm、上下 0mm。 */
  --hb-mt: 0mm; --hb-mb: 0mm; --hb-ml: 8mm; --hb-mr: 8mm;
  width: auto;
  max-width: calc(210mm - var(--hb-ml) - var(--hb-mr));
  min-height: 273mm;          /* A4 高 297mm - 上下页边距各 12mm */
  margin: 0 auto;
  padding: var(--hb-mt) var(--hb-mr) calc(var(--hb-mb) + 12mm) var(--hb-ml);
  background: #fff;
  color: #000;
  font-size: 12px;
  line-height: 1.5;
  box-sizing: border-box;
}
.doc-sheet.doc-landscape {
  width: auto;
  max-width: calc(297mm - var(--hb-ml) - var(--hb-mr));
  min-height: 186mm;
}

/* 抬头 */
.doc-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; padding-bottom: 10px; border-bottom: 2px solid #1B3A6B;
}
.doc-head .co { flex: 1; }
.doc-head .co-name {
  font-size: 17px; font-weight: 700; color: #1B3A6B;
  letter-spacing: .5px; margin-bottom: 2px;
}
.doc-head .co-en { font-size: 10px; color: #555; letter-spacing: .2px; }
.doc-head .co-contact { font-size: 10.5px; color: #333; margin-top: 6px; line-height: 1.7; }
.doc-head .co-contact b { font-weight: 600; color: #1B3A6B; }
.doc-head .doc-title { text-align: right; }
.doc-head .doc-title h1 {
  font-size: 20px; font-weight: 700; letter-spacing: 3px;
  color: #1B3A6B; margin: 0 0 6px; white-space: nowrap;
}
.doc-head .doc-title .doc-no {
  font-size: 12px; color: #333;
}
.doc-head .doc-title .doc-no b { font-weight: 700; font-size: 13.5px; }

/* 主体信息栏 */
.doc-info {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 0 24px; margin: 10px 0 8px;
}
.doc-info.one-col { grid-template-columns: 1fr; }
.doc-info.three-col { grid-template-columns: repeat(3, 1fr); }
.doc-info .it {
  display: flex; font-size: 11.5px; padding: 3px 0;
  border-bottom: 1px dotted #BBB; line-height: 1.6;
}
.doc-info .it .lb {
  flex: 0 0 78px; color: #666; letter-spacing: .5px;
  white-space: nowrap;          /* 第23轮：标签不换行（如「联系人/电话」） */
}
.doc-info .it .vl { flex: 1; color: #000; font-weight: 600; word-break: break-all; }
.doc-info .it.full { grid-column: 1 / -1; }

/* 明细表 */
.doc-table { width: 100%; border-collapse: collapse; margin: 8px 0 0; }
.doc-table th, .doc-table td {
  border: 1px solid #333; padding: 5px 7px;
  font-size: 11px; line-height: 1.45; vertical-align: middle;
}
.doc-table th {
  background: #EDF1F7; font-weight: 700; text-align: center;
  color: #1B3A6B; font-size: 11px;
}
.doc-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.doc-table td.ctr { text-align: center; }
.doc-table tfoot td { font-weight: 700; background: #F6F8FB; }
.doc-table .amt-cn { font-size: 10.5px; font-weight: 700; }

/* ★ 第131轮：采购合同 —— 物料行下方的「质量要求」行
   紧跟在物料行下面，用浅底 + 左侧竖线区分，
   不喧宾夺主但一眼能找到（合同是发给供应商的凭证，
   质量要求必须显眼、且与对应物料明确绑定）。 */
.doc-table tr.quality-row td {
  background: #FBFCFE; color: #333; font-size: 10.5px;
  line-height: 1.5; padding: 4px 7px;
}
.doc-table tr.quality-row td:first-child { border-right: none; }
.doc-table tr.quality-row td:last-child { border-left: none; }
.doc-table tr.quality-row td b { color: #1B3A6B; font-weight: 700; }
.doc-table .amt-en { font-size: 10px; color: #666; font-family: Georgia, "Times New Roman", serif; }

/* 条款正文 */
.doc-terms { margin-top: 12px; }

/* 第127轮（需求12）：单号下方的副信息行 —— 签订日期 / 下单人 */
.doc-subline {
  font-size: 11.5px; color: #222; line-height: 1.9;
  margin: 6px 0 10px; padding: 4px 0 0;
  border-top: 1px dashed #D8DEE8;
}
.doc-subline b { color: #1B3A6B; }

.doc-terms h3 {
  font-size: 12px; font-weight: 700; color: #1B3A6B;
  margin: 10px 0 4px; padding-left: 6px; border-left: 3px solid #1B3A6B;
}
.doc-terms .body {
  font-size: 11px; line-height: 1.85; color: #222;
  white-space: pre-wrap; text-align: justify;
}
.doc-terms .body.blank { color: #999; font-style: italic; }

/* 合计金额条 */
.doc-total {
  display: flex; justify-content: flex-end; gap: 20px;
  margin-top: 8px; font-size: 12px; font-weight: 700; color: #1B3A6B;
}
.doc-total .num { font-variant-numeric: tabular-nums; }

/* 签字盖章区 */
.doc-sign {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 10px 40px; margin-top: 26px; page-break-inside: avoid;
}
.doc-sign .sg { font-size: 11.5px; min-height: 66px; }
.doc-sign .sg .who { font-weight: 700; margin-bottom: 4px; }
.doc-sign .sg .ln {
  border-bottom: 1px solid #333; height: 30px; margin-top: 20px;
}
.doc-sign .sg .cap { font-size: 10.5px; color: #666; margin-top: 3px; }
.doc-sign.cols-3 { grid-template-columns: repeat(3, 1fr); gap: 10px 26px; }
.doc-sign.no-date .sg { min-height: 52px; }
.doc-sign.no-date .sg .ln { margin-top: 16px; }
.doc-sign .sg .who .auto { font-weight: 600; color: #1B3A6B; }

/* 页脚 */
.doc-foot {
  margin-top: 14px; padding-top: 6px; border-top: 1px solid #999;
  display: flex; justify-content: space-between;
  font-size: 10px; color: #666;
}

/* 打印时：隐藏系统界面，只留单据 */
@media print {
  /* 第26轮：上/下页边距设为 0。
     原因：Chrome 打印预览自带的页眉（日期+文档标题）与页脚（URL+页码）
     绘制在页边距区，而单据内容绘制在页边距内 —— 两者必然分处两行，
     造成「日期重复显示」。把上下页边距置 0 后，浏览器页眉/页脚失去绘制空间
     自动消失，单据左上角只剩系统自己的一行「时间 + 第几次打印」。
     第28轮：左右页边距由 12mm 收窄为 8mm，
     纸张可打印宽度 186mm → 194mm，两侧空白明显减少，版面更饱满。
     单据表格与信息栏均为 100% 自适应宽度，放宽后自动等比铺满。 */
  @page { size: A4 portrait; margin: 0 8mm; }
  @page landscape { size: A4 landscape; margin: 0 8mm; }
  .doc-sheet.doc-landscape { page: landscape; }
  body { background: #fff !important; }
  .sidebar, .topbar, .no-print, .pager, .filter-bar { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  .card { border: 0 !important; box-shadow: none !important; }
  /* 上下页边距置 0 后，底部安全区改由纸张自身 padding 承担 */
  /* 第134轮（需求6）：打印时的页边距由 CSS 变量驱动（可被页边距调节器改）。
     左右 padding 置 0 —— 打印时页边距由 @page 的 margin 负责，
     .doc-sheet 再加 padding 就等于边距加倍（内容会缩两次）。
     底部保留「下边距 + 12mm 安全区」，避免内容压到页脚。 */
  .doc-sheet {
    width: 100%; max-width: none; min-height: 0; margin: 0;
    padding-top: 0; padding-left: 0; padding-right: 0;
    padding-bottom: calc(var(--hb-mb, 0mm) + 12mm);
  }
  /* 打印时右侧联次竖排的额外右边距也要清掉 ——
     打印态的页边距由 @page 的 margin 负责。 */
  .doc-sheet.doc-copies-host { padding-right: 0 !important; }
  /* 第28轮：打印时去掉外层 .card / .card-body 的 16px 内边距。
     否则纸张内容会被 card-body 再缩进 16px(≈4.2mm)，
     导致改 @page 页边距看不出效果（屏幕态 186mm+16px≈194mm 恰好抵消，
     打印态却多缩了一次）。去掉后单据真正撑满 @page 的可打印宽度。 */
  .card, .card-body { padding: 0 !important; margin: 0 !important; border: 0 !important; }
  .doc-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-table tfoot td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-info .it { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ===== 第15轮：合同 / 打印抬头相关补充样式 ===== */
.term-block { margin-bottom: 14px; }
.term-block:last-child { margin-bottom: 0; }
.term-block h3 {
  font-size: 12.5px; font-weight: 700; color: var(--hb-navy);
  margin: 0 0 5px; padding-left: 7px; border-left: 3px solid var(--hb-navy);
}
.term-block .pre {
  margin: 0; font-size: 12.5px; line-height: 1.8; color: var(--hb-ink-2);
  white-space: pre-wrap;
}
table.data.kv th {
  width: 132px; background: #FAFBFC; font-weight: 500; color: var(--hb-ink-2);
}
table.data.kv td { font-size: 13px; }
td.row-actions { white-space: nowrap; }
td.row-actions .btn { margin-right: 4px; }
.form-actions {
  display: flex; gap: 10px; align-items: center;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--hb-line);
}

/* ===== 第15轮补充：LOGO / 右侧联次竖排 / 签字区 ===== */
/* 抬头带 LOGO 时：LOGO | 公司信息 | 单据标题 */
.doc-head.with-logo { align-items: center; }
.doc-head .co-logo { flex: 0 0 auto; margin-right: 14px; }
.doc-head .co-logo img {
  height: 17mm; width: auto; max-width: 46mm;
  object-fit: contain; display: block;
}
.doc-head .co { min-width: 0; }
.doc-head .doc-title .title-extra {
  font-size: 12px; font-weight: 400; letter-spacing: 0;
  color: #444; margin-left: 6px; white-space: nowrap;
}
.doc-head .doc-title .doc-subtitle {
  font-size: 11px; color: #666; letter-spacing: .3px; margin-bottom: 2px;
}

/* 右侧竖排联次说明（本单一式三联 白联仓库 黄联采购 红联财务）
   第24轮：整块移入纸张可打印范围内（原 right:-14mm 会溢出页边距被裁掉），
   并给 doc-sheet 预留右侧竖条空间；竖线独立成元素，由 JS 按签字行位置限高。 */
.doc-sheet { position: relative; }
/* ★ 第134轮：右侧联次竖排需要一点右边距。
   原来写死 `padding-right: 8mm`，会与页边距变量 --hb-mr **叠加**
   （用户把右边距调成 0 时，这里又多出 8mm）。
   改为「至少 8mm」：用户调大了就用用户的值，不会叠加。 */
.doc-sheet.doc-copies-host {
  padding-right: max(var(--hb-mr), 8mm);
}
.doc-copies-wrap {
  position: absolute; right: 1mm; top: 46.2mm; /* 第28轮：纸张上移4.2mm后补偿 */
  display: flex; align-items: flex-start; gap: 1.6mm;
  z-index: 2;
}
.doc-copies-line {
  width: 1px; background: #999; height: 92mm; flex: 0 0 1px;
}
.doc-copies {
  writing-mode: vertical-rl; text-orientation: upright;
  font-size: 8px; line-height: 1.3; color: #333;
  letter-spacing: .5px; white-space: nowrap;
}
/* 第21轮：四联联次文字较长，竖线默认加高避免溢出（JS 会按签字行再校正） */
.doc-copies-wrap.copies-4 .doc-copies-line { height: 118mm; }

/* 第26轮：单据左上角打印标识 —— 打印时间 + 第几次打印（合并为一行）
   绝对定位于纸张左上角，不再占据正文流中的一行，
   故公司抬头（及出库单的 LOGO）整体下移，避免被压住。 */
/* 顶部 12mm 安全带：原先由 @page 上页边距承担，
   页边距置 0 后改由纸张自身 padding 承担，版式位置与原先一致。 */
.doc-sheet.doc-stamp-host { padding-top: 12mm; }
.doc-stamp {
  position: absolute;
  /* 第28轮：4.5mm -> 7.5mm。
     打印态去掉 card-body 的 16px padding 后，纸张整体上移约 4.2mm，
     标识需同步下移，才与第27轮时的视觉位置一致（离纸边约 8mm）。 */
  top: 7.5mm;
  left: 0;
  font-size: 9px;
  color: #666;
  line-height: 1.4;
  letter-spacing: .2px;
  text-align: left;
  white-space: nowrap;
  color-adjust: exact;
  -webkit-print-color-adjust: exact;
}
@media print {
  .doc-stamp { color: #555; }
}

/* 出库单：客户名称占 2/3，联系人/电话占 1/3 */
.doc-info .it.w-2of3 { grid-column: span 2; }
.doc-info .it.w-1of3 { grid-column: span 1; }
@media (max-width: 820px) {
  .doc-info .it.w-2of3 { grid-column: 1 / -1; }
}

/* ===== 第21轮：打印版式调整 ===== */
/* 序号列表头改「NO.」并缩小字号，避免换行 */
.doc-table th.col-no,
.doc-table td.col-no {
  font-size: 9.5px; font-weight: 700; letter-spacing: .2px;
  white-space: nowrap; padding: 5px 3px;
}
/* 签字区不画横线 */
.doc-sign.no-line .sg { min-height: 46px; }
.doc-sign.no-line .sg .ln { display: none; }
/* 出库单信息栏 4 列布局 */
.doc-info.four-col { grid-template-columns: repeat(4, 1fr); }
.doc-info .it.w-2of4 { grid-column: span 2; }
.doc-info .it.w-3of4 { grid-column: span 3; }
.doc-info .it.w-1of4 { grid-column: span 1; }
/* 第22轮：出库单信息栏 6 列栅格，便于精确控制 1/3 宽度 */
.doc-info.six-col { grid-template-columns: repeat(6, 1fr); }
.doc-info .it.w-2of6 { grid-column: span 2; }
.doc-info .it.w-4of6 { grid-column: span 4; }
.doc-info .it.w-6of6 { grid-column: span 6; }
/* 第24轮：入库单信息栏 —— 供应商 1/2、收货仓库 1/3、入库日期 1/3。
   三者同处一行，1/2+1/3+1/3 已超出行宽（合计 7/6），
   故按 7 列栅格等比化：供应商占 3/7、收货仓库占 2/7、入库日期占 2/7，
   三者相对比例与 1/2 : 1/3 : 1/3 完全一致。 */
.doc-info.ratio-322 { grid-template-columns: repeat(7, 1fr); }
.doc-info .it.w-3of7 { grid-column: span 3; }
.doc-info .it.w-2of7 { grid-column: span 2; }
/* 窄标签（日期等短标签），避免值换行 */
.doc-info .it.lbw-46 .lb { flex: 0 0 46px; }
.doc-info .it.lbw-56 .lb { flex: 0 0 56px; }
.doc-info .it.lbw-72 .lb { flex: 0 0 72px; }
.doc-info .it.vlnw .vl { white-space: nowrap; }
/* 第23轮：仅屏幕窄屏时折叠，打印时 A4 视口宽度不足 900px，必须保持原栅格 */
@media screen and (max-width: 900px) {
  .doc-info.four-col { grid-template-columns: repeat(2, 1fr); }
  .doc-info .it.w-2of4,
  .doc-info .it.w-3of4,
  .doc-info .it.w-1of4 { grid-column: 1 / -1; }
  .doc-info.ratio-322 { grid-template-columns: 1fr; }
  .doc-info .it.w-3of7,
  .doc-info .it.w-2of7 { grid-column: 1 / -1; }
  .doc-info.six-col { grid-template-columns: repeat(2, 1fr); }
  .doc-info .it.w-2of6,
  .doc-info .it.w-4of6,
  .doc-info .it.w-6of6 { grid-column: 1 / -1; }
}

/* 备注区：固定条款文字 */
.doc-notice {
  /* 第29轮：备注区压缩 —— 收紧外边距与内边距 */
  margin-top: 6px; padding: 5px 8px;
  border: 1px solid #999; background: #FAFAFA;
}
.doc-notice .body {
  /* 第29轮：行距 1.75 -> 1.35，中英文行更紧凑，节省纵向空间 */
  font-size: 10.5px; line-height: 1.35; color: #222;
  white-space: pre-wrap;
}
/* 第29轮：英文条款行独立成行、与上一行中文之间不留空隙 */
.doc-notice .body .en {
  display: block; margin-top: 0;
  color: #333; font-family: Georgia, "Times New Roman", serif;
}

/* ================================================================
   检验规范与逐项检验结果（第136轮 · 需求4）
   ---------------------------------------------------------------
   原来检验规范只是一段 `doc-notice` 里的普通文字，打印出来看不出
   「哪一项 / 对照什么标准 / 实测多少 / 判定如何」的对应关系。
   现在改成结构化表格，下面的样式配套。

   · .doc-block-title —— 区块小标题（表格式区块的标题行）
   · .check-material —— 同一物料的第一个检验项上显示物料名
                        （后面的同物料行不重复显示，避免视觉噪声）
   ================================================================ */
.doc-block-title {
  margin: 12px 0 0;
  padding: 3px 8px;
  background: #EDF1F7;
  border-left: 3px solid #1B3A6B;
  font-size: 11.5px;
  font-weight: 700;
  color: #1B3A6B;
  letter-spacing: 0.5px;
}
.doc-table-check {
  margin-top: 0;
  font-size: 10.5px;
  line-height: 1.4;
}
.doc-table-check th,
.doc-table-check td {
  padding: 3px 6px;
  vertical-align: top;
}
.doc-table-check th {
  font-size: 10.5px;
}
.doc-table-check td.muted {
  color: #555;
}
.doc-table-check .check-material {
  font-size: 10px;
  color: #1B3A6B;
  font-weight: 700;
  margin-bottom: 1px;
  padding-bottom: 1px;
  border-bottom: 1px dashed #C6D0DE;
}

/* 打印时右侧联次位置需留出空间
   第24轮：联次文字已改为 .doc-copies-wrap 绝对定位（right:0），
   落在纸张 194mm 可打印宽度之内，不再使用负偏移溢出页边距。 */
@media print {
  .doc-sheet.doc-copies-host { padding-right: 8mm; }
  .doc-copies-wrap { right: 1mm; top: 46.2mm; } /* 第28轮：纸张上移4.2mm后补偿 */
}

/* ===== 第20轮：表头排序 + 合计行 ===== */
a.th-sort {
  display: flex; align-items: center; gap: 4px;
  color: var(--hb-ink-2); text-decoration: none; font-weight: 600; font-size: 12.5px;
  white-space: nowrap;
}
a.th-sort:hover { color: var(--hb-navy-600); }
a.th-sort.active { color: var(--hb-navy-700); }
a.th-sort .th-sort-ico { font-size: 10px; color: var(--hb-ink-3); }
a.th-sort.active .th-sort-ico { color: var(--hb-navy-600); }
a.th-sort.num { justify-content: flex-end; }

table.data tfoot.tfoot-sum td {
  background: #F4F6F9; font-weight: 600; color: var(--hb-ink);
  border-top: 1px solid var(--hb-line); padding: 8px 10px;
}
table.data tfoot.tfoot-sum td.right { text-align: right; }
.pick-tag {
  float: right; margin-left: 10px; padding: 1px 6px; border-radius: 2px;
  font-size: 11px; color: var(--hb-ink-3); background: #EEF1F5;
}

/* ===== 第20轮：客户联系人表格与添加行列宽对齐 ===== */
table.data.contact-table { table-layout: fixed; }
table.data.contact-table td { overflow-wrap: anywhere; }

/* 添加联系人：内嵌为表格最后一行，输入框天然与表头列对齐 */
tr.contact-add-row td { background: #FAFBFC; padding: 8px 10px; vertical-align: middle; }
tr.contact-add-row input[type="text"] { width: 100%; min-width: 0; }
tr.contact-add-row .check { font-size: 12.5px; color: var(--hb-ink-2); white-space: nowrap; }
tr.contact-add-row .check input { vertical-align: -1px; }

/* 修改行：与表头列严格对齐的内联栅格 */
tr.contact-edit-row td { background: var(--hb-bg-2, #FAFBFC); }
.contact-inline-form {
  display: grid;
  grid-template-columns: 13% 12% 13% 15% 10% 25% 12%;
  gap: 0 12px;
  align-items: center;
  padding: 10px;
}
.contact-inline-form > label {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  font-size: 12.5px; color: var(--hb-ink-2); font-weight: 600;
}
.contact-inline-form > label .req { color: var(--hb-red); margin-left: 2px; }
.contact-inline-form input[type="text"] { width: 100%; min-width: 0; font-weight: 400; }
.contact-inline-form .check { font-weight: 400; display: flex; align-items: center; gap: 4px; }
.contact-inline-form .act { display: flex; gap: 6px; align-items: center; }
@media (max-width: 1180px) {
  .contact-inline-form { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .contact-inline-form { grid-template-columns: 1fr; }
}

/* 第35轮：入库单明细「检验责任人」下拉 —— 按物料大类默认带出，可另选 */
.item-rows .col-inspector { width: 96px; }
.item-rows td.col-inspector { padding-left: 2px; padding-right: 2px; }
.item-rows td.col-inspector select {
  width: 92px; min-width: 0; box-sizing: border-box;
  font-size: 12.5px; padding-left: 3px; padding-right: 3px;
}

/* 第89轮：报价列表「修改」行内链接 —— 紧跟单号显示的小入口 */
table.data .link-mini {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--hb-navy-600, #1B3A6B);
  border: 1px solid var(--hb-line, #DDE3EC);
  border-radius: 4px;
  text-decoration: none;
  vertical-align: middle;
}
table.data .link-mini:hover {
  background: var(--hb-navy-50, #EEF3FA);
  border-color: var(--hb-navy-600, #1B3A6B);
}

/* 第93轮：开票登记页 —— 已被开票申请占用的出库单行（不可勾选） */
table.data tr.row-locked td {
  background: #FAFBFC;
  color: #8A94A6;
}
table.data tr.row-locked a.code {
  color: #8A94A6;
}
table.data tr.row-locked input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

/* 第94轮：开票登记页两行布局
   第一行：客户 / 票种 / 发票号码 / 开票日期
   第二行：开票金额 / 税额 / 备注 */
.form-grid-invoice {
  grid-template-columns:
    minmax(240px, 1.4fr)   /* 客户 */
    minmax(140px, 1fr)     /* 票种 */
    minmax(160px, 1fr)     /* 发票号码 */
    minmax(140px, .9fr)    /* 开票日期 */
    minmax(140px, 1fr)     /* 开票金额 */
    minmax(120px, .8fr)    /* 税额 */
    minmax(180px, 1.2fr);  /* 备注 */
  gap: 14px 16px;
}
.form-grid-invoice .field input,
.form-grid-invoice .field select { min-width: 0; }
/* 税额不可编辑时的视觉提示 */
.form-grid-invoice .field input[readonly] {
  background: #F5F7FA;
  color: #8A94A6;
  cursor: not-allowed;
}
@media (max-width: 1280px) {
  .form-grid-invoice { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 860px) {
  .form-grid-invoice { grid-template-columns: repeat(2, 1fr); }
}

/* 第95轮：物料大类列表的行内编辑
   名称框收窄（大类名一般 3~6 个字），备注框放宽 ——
   用户需要在备注里写清「这个大类包括哪些品种的物料」，
   物料有 2000 多种，只看大类名无法判断具体涵盖范围。 */
.inline-edit .w-name {
  min-width: 90px;
  max-width: 120px;
}
.inline-edit .w-remark {
  min-width: 320px;
  width: 100%;
  max-width: none;
}

/* 第100轮：表单空间精简 —— 备注并入上一行、缩短宽度
   原来「备注」用 .field.full 独占一整行（grid-column: 1 / -1），
   一行只放备注，页面被拉得很长。现在把备注放到同一行的最后一列，
   宽度由 --remark-w 控制（默认 220px），不再撑满整行。 */
.form-grid-tight {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(150px, 1fr))
    minmax(var(--remark-w, 220px), var(--remark-w, 220px));
  gap: 12px 14px;
  align-items: end;
}
.form-grid-tight .field input,
.form-grid-tight .field select { min-width: 0; }
/* 备注列：占最后一行剩余空间，但不超过 --remark-w */
.form-grid-tight > .field.remark {
  grid-column: -2 / -1;
}
.form-grid-tight > .field.remark input { max-width: var(--remark-w, 220px); }
/* 窄屏时备注另起一行（避免挤成一条缝） */
@media (max-width: 900px) {
  .form-grid-tight { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .form-grid-tight > .field.remark { grid-column: 1 / -1; }
  .form-grid-tight > .field.remark input { max-width: none; }
}

/* 第100轮：运营成本汇总「费用明细」—— 类别标题即登记入口
   原来每个类别下面挂一个「去登记」小按钮，表格被撑高；
   现在标题本身就是链接，加下划线 + 箭头提示可点击。 */
table.data td .cat-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--hb-navy);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  white-space: nowrap;
}
table.data td .cat-link::after {
  content: "›";
  font-size: 15px;
  line-height: 1;
  color: var(--hb-navy-600);
}
table.data td .cat-link:hover {
  color: var(--hb-navy-600);
  text-decoration-style: solid;
}

/* ===== 第112轮：新增客户表单 —— 固定列数的紧凑栅格 ===== */
/*   .form-grid-tight 是 auto-fit 自适应，列数随宽度浮动，
     无法保证「第一行 4 个字段、第二行 3 个字段」的固定布局。
     这里新增 .form-grid-cols，用 --cols 显式指定列数。 */
.form-grid-cols {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}
.form-grid-cols .field input,
.form-grid-cols .field select { min-width: 0; }
@media (max-width: 1100px) {
  .form-grid-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .form-grid-cols { grid-template-columns: 1fr; }
}

/* ===== 第114轮：付款登记表单 —— 两行定宽栅格 ===== */
/*   第一行：付款日期 / 收款方供应商 / 付款金额 / 付款方式 /
             付款账户票据号 / 备注
     第二行：收款方名称 / 关联进项发票 / 关联预付款申请
     两行各自用独立的比例模板，字段宽度按实际内容长短分配，
     不再出现「非供应商收款方输入框占半屏」的情况。 */
.form-grid-pay1 {
  display: grid;
  grid-template-columns:
    1fr    /* 付款日期 */
    1.7fr  /* 收款方供应商（要放关键词检索框，列要宽一些） */
    .9fr   /* 付款金额 */
    .9fr   /* 付款方式 */
    1.5fr  /* 付款账户 / 票据号 */
    1.5fr; /* 备注 */
  gap: 10px 12px;
  align-items: start;
}
.form-grid-pay2 {
  display: grid;
  grid-template-columns:
    1fr    /* 收款方名称（短输入框） */
    1.6fr  /* 关联进项发票 */
    1.6fr; /* 关联预付款申请 */
  gap: 10px 12px;
  align-items: end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--hb-line, #E3E7EC);
}
.form-grid-pay1 .field input,
.form-grid-pay1 .field select,
.form-grid-pay2 .field input,
.form-grid-pay2 .field select { min-width: 0; }

/* 第115轮：收款方供应商改用与出库单「客户名称」同款的候选框
   （.pick-wrap + .pick-list + picker.js），此处只微调栅格里的宽度。
   .pick-wrap / .pick-list / .pick-item 的样式在文件前面已统一定义。 */
.form-grid-pay1 .pick-wrap { width: 100%; }
@media (max-width: 1280px) {
  .form-grid-pay1 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid-pay2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .form-grid-pay1, .form-grid-pay2 { grid-template-columns: 1fr; }
}


/* ===== 第134轮（需求6）：打印页边距调节器 ===== */
.print-margin {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  margin: 0 0 12px; padding: 8px 12px;
  background: #F5F7FA; border: 1px solid var(--hb-line); border-radius: 4px;
  font-size: 12.5px; color: var(--hb-ink-2);
}
.print-margin .pm-label {
  font-weight: 600; color: var(--hb-navy); margin-right: 2px;
}
.print-margin label {
  display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
}
.print-margin .pm-input {
  width: 58px; padding: 3px 6px; text-align: right;
  border: 1px solid var(--hb-line); border-radius: 3px;
  font-size: 12.5px; font-family: inherit;
}
.print-margin .pm-input:focus {
  outline: none; border-color: var(--hb-navy);
  box-shadow: 0 0 0 2px rgba(27, 58, 107, .12);
}
.print-margin .pm-hint {
  margin-left: auto; color: var(--hb-ink-3); font-size: 11.5px;
}


/* ===== 第135轮（需求4）：打印件上的「本单备注」框 ===== */
/* 与下面的固定条款区（doc-notice）**视觉上明确区分**：
   固定条款是「1、以上货物收妥无误…」这种法律条款文字，
   本单备注是「合同号 HT-xxx」「客户要求分两批送货」这种本单信息。
   两者用同一个 doc-notice 框时，收货的人分不清哪个是本单备注。 */
.doc-remark-box {
  margin-top: 10px; padding: 6px 10px;
  border: 1px solid #1B3A6B; border-left-width: 3px;
  background: #F7F9FC;
}
.doc-remark-title {
  font-size: 10.5px; font-weight: 700; color: #1B3A6B;
  letter-spacing: .5px; margin-bottom: 3px;
}
.doc-remark-body {
  font-size: 11px; line-height: 1.5; color: #222;
  white-space: pre-wrap;
}
