:root {
  /* 相对平台 FIT-1（墨绿 #2f5d50 + 暖米底）：分销用冷灰蓝，一眼可辨即可 */
  --bg: #f0f3f8;
  --panel: #fff;
  --line: #dde3ec;
  --line-soft: #edf1f7;
  --text: #1e293b;
  --muted: #64748b;
  --brand: #2563a8;
  --brand-hover: #1f5390;
  --brand-soft: #e8f0f8;
  /* 行选择统一（2026-08-18 主人定：选中/未选清晰易区分、简单大方不突兀）：
     选中 = --row-sel-bg 浅蓝底 + 品牌色左条；选中态 hover 再深半档；未选 hover = --row-hover */
  --row-hover: #f6f9fd;
  --row-sel-bg: #c2d9ef;
  --row-sel-hover: #aecde8;
  --row-sel-bar: inset 3px 0 0 var(--brand);
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  /* 合计算出的金额（主人 2026-11-16 令：所有「合挤出来的金额」一律红色）。
     比 --danger 略亮一档（#d92b2b）—— 金额是高频信息，用 #b91c1c 偏暗、
     和删除按钮撞色；此处取「醒目但仍沉稳」的红，且**不**与错误态混用。 */
  --money-sum: #d92b2b;
  --ok: #047857;
  --sidebar: #f7f8fb;
  --sidebar-text: #1e293b;
  --sidebar-line: #e6e9f0;
  --nav-head: #1e4b8c;
  --nav-head-open-bg: #eef1f7;
  --radius: 10px; /* 卡片圆角 */
  --radius-sm: 6px; /* 按钮 / chip / 输入框圆角 */
  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-pop: 0 16px 40px rgba(15, 23, 42, 0.16);
  /* 字台阶梯：页面标题 20 / 卡片题 16 / 正文 14 / 辅助 12 */
  --fs-page: 20px;
  --fs-card: 16px;
  --fs-body: 14px;
  --fs-aux: 12px;
  /* 间距基数 8：8 / 12 / 16 / 24 */
  --sp-1: 8px;
  --sp-2: 12px;
  --sp-3: 16px;
  --sp-4: 24px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* === 主题换肤（2026-08-18 主人定：CSS 变量驱动，顶栏可选风格，localStorage 持久化） ===
   默认 = 冷灰蓝（:root 原值）；覆盖块只列主题相关令牌，其余沿用 :root */
:root[data-theme="green"] {
  /* FIT-1 平台墨绿系 */
  --brand: #2f5d50;
  --brand-hover: #254a40;
  --brand-soft: #e4efeb;
  --nav-head: #265142;
  --nav-head-open-bg: #e9f0ed;
  --row-hover: #f3f8f5;
  --row-sel-bg: #bcd8ca;
  --row-sel-hover: #a8cdbb;
}
:root[data-theme="pink"] {
  /* 消费端唯品粉系（与小程序/App 令牌 v1.1 同源） */
  --brand: #f10180;
  --brand-hover: #c40d6a;
  --brand-soft: #fde7f1;
  --nav-head: #b0106a;
  --nav-head-open-bg: #fbeef4;
  --row-hover: #fdf2f7;
  --row-sel-bg: #f6c4dd;
  --row-sel-hover: #f2aed1;
}
/* 顶栏风格选择器 */
.theme-select {
  height: 26px; padding: 0 6px; font-size: var(--fs-aux);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--muted); cursor: pointer;
}
.theme-select:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: var(--font); color: var(--text); background: var(--bg); }
body { font-size: var(--fs-body); line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* === 登录页 === */
.login-wrap {
  min-height: 100%; display: grid; place-items: center;
  background: linear-gradient(160deg, #e4eef7 0%, #f0f3f8 48%, #e8eef4 100%);
}
.login-card {
  width: min(400px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 32px 28px; box-shadow: var(--shadow-pop);
}
.login-card h1 { margin: 0 0 6px; font-size: var(--fs-page); font-weight: 700; }
.login-card p { margin: 0 0 18px; color: var(--muted); font-size: var(--fs-aux); }
.login-card label { display: block; font-size: var(--fs-aux); color: var(--muted); margin: 12px 0 4px; }
.login-card input, .login-card select { width: 100%; height: 36px; }
.login-card .btn { width: 100%; height: 36px; margin-top: 16px; }
.org-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.org-pick-btn {
  width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel); cursor: pointer;
}
.org-pick-btn:hover { border-color: var(--brand); background: var(--brand-soft); }
.org-pick-btn b { display: block; font-size: var(--fs-body); color: var(--text); }
.org-pick-btn span { display: block; margin-top: 2px; font-size: var(--fs-aux); color: var(--muted); }

/* === 布局：侧边栏 + 顶栏 === */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100%; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-line);
  padding: 12px 10px 16px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.brand {
  font-weight: 700; font-size: 15px; padding: 10px 12px 14px;
  letter-spacing: .02em; color: var(--nav-head);
  border-bottom: 1px solid var(--sidebar-line); margin-bottom: 4px;
}
.nav { display: flex; flex-direction: column; gap: 0; }
.nav-panel {
  border-bottom: 1px solid var(--sidebar-line);
}
.nav-panel:last-child { border-bottom: none; }
.nav-panel-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: none;
  background: transparent;
  color: var(--nav-head);
  font-size: 13px;
  font-weight: 600;
  padding: 10px;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-sm);
}
.nav-panel-head:hover { background: #f0f2f7; }
.nav-panel.open .nav-panel-head {
  background: var(--nav-head-open-bg);
}
.nav-panel-head .chev {
  flex-shrink: 0;
  width: 16px;
  text-align: center;
  font-size: 11px;
  color: #8b95a8;
  transition: transform .15s ease;
  transform: rotate(180deg);
}
.nav-panel.open .nav-panel-head .chev { transform: rotate(0deg); color: var(--nav-head); }
.nav-panel-body {
  display: none;
  padding: 2px 4px 10px 4px;
  background: #fff;
}
.nav-panel.open .nav-panel-body { display: block; }
.nav a {
  display: block; color: #334155; padding: 7px 10px 7px 22px; border-radius: var(--radius-sm);
  font-size: 13px; margin: 1px 0; font-weight: 400;
}
.nav a:hover { background: #f3f5f9; color: var(--nav-head); }
/* 当前项：brand-soft 底 + 品牌色左条 */
.nav a.active {
  background: var(--brand-soft); color: var(--brand); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--brand);
}
.nav a.soon { opacity: .45; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
  gap: 10px;
}
.topbar .title { font-weight: 700; font-size: var(--fs-card); flex: 1; min-width: 0; }
.topbar .user { color: var(--muted); font-size: var(--fs-aux); display: flex; gap: 12px; align-items: center; }
.btn-menu {
  display: none;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: var(--radius-sm); padding: 6px 10px; cursor: pointer; font-size: 13px; flex-shrink: 0;
}
/* 2026-09-19 版式统一（layout1）：页面名只在顶栏出现一次，页内重复的页面级 h2 已全删；
   内容区留白收紧 20/20/40 → 12/16/28，左右与 .topbar 的 16 对齐（顶栏标题与卡片左线同一条）。 */
.content { padding: 12px 16px 28px; }

/* === 多标签页（2026-11-16：生产管理改成「打开多个页面」）=== */
/* 面包屑：分组 / 页面名，跟随当前标签 */
.crumb-bar {
  height: 30px; display: flex; align-items: center; gap: 6px;
  padding: 0 16px; background: var(--panel);
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-aux); color: var(--muted);
}
.crumb-bar:empty { display: none; }
.crumb-group { color: var(--muted); }
.crumb-sep { color: var(--line); }
.crumb-page { color: var(--text); font-weight: 500; }

/* 标签条：横向可滚动，不换行 */
.tab-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: thin;
}
.tab-bar::-webkit-scrollbar { height: 6px; }
.tab-bar::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.tab-item {
  display: inline-flex; align-items: center; gap: 5px;
  flex: 0 0 auto; max-width: 190px;
  padding: 5px 10px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--panel);
  color: var(--muted); font-size: 13px; cursor: pointer;
  user-select: none; transition: background .12s, border-color .12s, color .12s;
}
.tab-item:hover { background: var(--row-hover); border-color: #c6d4e6; color: var(--text); }
.tab-item.active {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500;
}
.tab-item .tab-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tab-item .tab-dot { font-size: 7px; line-height: 1; opacity: .9; }
.tab-item .tab-close {
  border: 0; background: transparent; color: inherit;
  font-size: 14px; line-height: 1; padding: 0 1px; cursor: pointer;
  opacity: .6; border-radius: 3px;
}
.tab-item .tab-close:hover { opacity: 1; background: rgba(15, 23, 42, .12); }
.tab-item.active .tab-close:hover { background: rgba(255, 255, 255, .22); }

/* 每个标签自己一块画布：切换只改 hidden，状态（表格筛选/滚动/表单）不丢 */
.tab-pane { display: block; }
.tab-pane[hidden] { display: none; }
.nav-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 40;
}

/* === 卡片 / 工具条 / KPI === */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 12px;
  box-shadow: var(--shadow-card);
}
.card h2 { margin: 0 0 12px; font-size: var(--fs-card); font-weight: 600; }
.card h3 { margin: 0 0 12px; font-size: var(--fs-body); font-weight: 600; }
.toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-1); align-items: center; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.report-filters { margin-bottom: 8px; }
.report-filters .filter-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.report-filters .filter-item .input {
  width: 110px;
  min-width: 0;
  padding: 4px 8px;
  font-size: 12px;
}
.report-filters .filter-item input[type="date"].input { width: 128px; }
.report-sub {
  margin: 16px 0 8px;
  font-size: 14px;
  font-weight: 600;
}
.report-summary { margin: 8px 0 12px; }
.report-detail { margin-top: 4px; }
.report-chart-wrap {
  margin: 8px 0 4px;
  padding: 8px 4px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fafbfc;
}
.report-chart-canvas {
  display: block;
  width: 100%;
  height: 280px;
}
.report-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 8px 8px;
  font-size: 12px;
  color: var(--muted);
}
.report-chart-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.report-chart-legend .legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.report-chart-legend .legend-line {
  width: 14px;
  height: 0;
  border-top: 2px solid #e11d48;
  display: inline-block;
}
.btn-group.chart-by { display: inline-flex; gap: 0; margin-left: 8px; }
.btn-group.chart-by .btn { border-radius: 0; }
.btn-group.chart-by .btn:first-child { border-radius: 6px 0 0 6px; }
.btn-group.chart-by .btn:last-child { border-radius: 0 6px 6px 0; }

.schedule-board {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.schedule-card {
  display: grid;
  grid-template-columns: 30% 70%;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow-card);
}
.schedule-card-main {
  padding: 14px 16px 16px;
  border-right: 1px solid var(--line-soft);
}
.schedule-card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.schedule-card-title strong {
  font-size: 16px;
  color: var(--nav-head);
}
.schedule-remain {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.schedule-remain.tone-ok { color: var(--brand); }
.schedule-remain.tone-warn { color: #c47b2c; }
.schedule-remain.tone-danger { color: #c23b3b; }
.schedule-remain.tone-muted { color: var(--muted); }
.schedule-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #526074;
}
.schedule-meter { margin-top: 8px; }
.schedule-meter-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.schedule-meter-detail { color: #334155; font-variant-numeric: tabular-nums; }
.schedule-meter-track {
  height: 8px;
  border-radius: 999px;
  background: #eef2f6;
  overflow: hidden;
}
.schedule-meter-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-hover));
}
.schedule-card-chart {
  padding: 12px 14px 10px;
  background: #f7f9fb;
}
.schedule-chart-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--nav-head);
  margin-bottom: 4px;
}
.schedule-process-canvas {
  display: block;
  width: 100%;
  height: 150px;
}
@media (max-width: 900px) {
  .schedule-card { grid-template-columns: 1fr; }
  .schedule-card-main { border-right: 0; border-bottom: 1px solid var(--line-soft); }
}
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--sp-2); }
.kpi {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 12px 14px;
}
.kpi .label { font-size: var(--fs-aux); color: var(--muted); }
.kpi .value {
  font-size: 22px; font-weight: 700; margin-top: 4px;
  color: var(--nav-head); font-variant-numeric: tabular-nums;
}

/* === 数据表：独立滚动容器内表头 sticky；数字列右对齐（.num 由 DistUI.dataTable 按列 key / num 钩子判定） === */
.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 11.5rem);
  min-width: 0;
}
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 8px 10px; text-align: left; vertical-align: top; }
table.data th {
  color: var(--muted); font-weight: 600; font-size: var(--fs-aux);
  background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
  box-shadow: 0 1px 0 var(--line);
}
table.data td { border-bottom: 1px solid var(--line-soft); }
table.data tbody tr:hover td { background: var(--row-hover); }
table.data th.num, table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.muted[colspan] { text-align: center; padding: 24px 10px; }
table.data tr.row-clickable { cursor: pointer; }
/* 行选择统一配方：浅蓝底 + 品牌色左条（令牌 --row-sel-*）；左条只落行首格，否则每格一条竖线 */
table.data tr.row-active td { background: var(--row-sel-bg); }
table.data tr.row-active td:first-child { box-shadow: var(--row-sel-bar); }
table.data tr.row-active:hover td { background: var(--row-sel-hover); }
/* checkbox 行：勾选即选中态（:has 纯 CSS，现代浏览器均支持） */
table.data tbody tr:has(td input:checked) td { background: var(--row-sel-bg); }
table.data tbody tr:has(td input:checked):hover td { background: var(--row-sel-hover); }

/* 派单列表：色码列最大约占表宽 1/5，超出省略（悬停 title 看全文） */
table.data.mfg-dispatch-table { table-layout: fixed; width: 100%; }
table.data.mfg-dispatch-table th.col-sku-clamp,
table.data.mfg-dispatch-table td.col-sku-clamp {
  width: 20%;
  max-width: 20%;
  overflow: hidden;
  vertical-align: middle;
}
table.data.mfg-dispatch-table td.col-sku-clamp .cell-ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === 按钮：统一 32px 高；主按钮品牌色实心、次按钮描边、危险操作 --danger === */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 14px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #f8fafc; border-color: #c9d2e0; }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: var(--danger-soft); border-color: #fca5a5; }
.btn.sm { height: 26px; padding: 0 10px; font-size: var(--fs-aux); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* === 表单控件：统一 32px 高，focus 描边品牌色；:where 零优先级，页面内更具体的规则仍可覆盖 === */
:where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), select, textarea) {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 0 10px; height: 32px; background: #fff; color: var(--text); font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 8px 10px; }
:where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]), select, textarea):focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 168, .14);
}
input[type="number"] { width: 100px; }
input.wage-coeff-input {
  width: 88px;
  height: 28px;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
input.wage-coeff-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  background: #f8fafc;
}
.field { margin-bottom: 12px; }
.field label { display: block; font-size: var(--fs-aux); color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; }
.field-readonly {
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text);
  min-height: 36px;
  box-sizing: border-box;
}
/* 宽屏表单铺开：字段一列到底太浪费横向空间（新建生产单等页用） */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; align-items: start; }
.form-grid .field { margin-bottom: 0; }
/* 新建价格表模板（2026-11-15）：分类 → 编码 → 名称 三行；控件宽度保持原两列时的观感 */
.pb-create-form .field { margin-bottom: 10px; }
.pb-create-form .field > input,
.pb-create-form .field > select { max-width: 340px; }
.form-grid .field.wide { grid-column: 1 / -1; }
/* 裁床编菲：每行两个信息项；每项内标签+控件 → 观感四列；备注 .wide 单独一行 */
.cut-bed-form.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
}
.cut-bed-form .field:not(.wide) {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  align-items: center;
}
.cut-bed-form .field:not(.wide) > label {
  margin: 0;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}
.cut-bed-form .field:not(.wide) > .field-hint {
  grid-column: 2;
  margin: 0;
}
.cut-bed-form .field.wide {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
@media (max-width: 720px) {
  .cut-bed-form.form-grid { grid-template-columns: 1fr; }
}
/* 色码矩阵 / 合计行：与 .field.wide 一样占满表单栅格，避免挤在 220px 列里 */
.form-grid > .matrix-wrap,
.form-grid > .matrix-summary {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
/* 多选清单（款号颜色/尺码）：一格一勾，可换行 */
.opt-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.field .opt-check { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text); margin: 0; }
.field .opt-check input { width: auto; margin: 0; }
/* 规格矩阵：颜色 / 尺码 / 件数 / 删，四列对齐成表 */
.sku-grid { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) 120px auto; gap: 8px; align-items: center; max-width: 900px; margin-bottom: 8px; }
.sku-grid .sku-head { font-size: var(--fs-aux); color: var(--muted); }
.sku-grid input, .sku-grid select { width: 100%; }
.sku-grid .sku-chk { width: auto; justify-self: center; }
.master-detail-panel { margin-top: 16px; }
/* 生产管理列表：对齐分销 #/md/spu —— 上 card 主表、下 card 详情 */
.production-list-page .production-list-card + .production-order-detail {
  margin-top: 16px;
}
/* 主从详情内嵌色×码矩阵（对齐分销 matrix-wrap 内嵌，非弹窗） */
.production-order-detail .production-plan-matrix-embed {
  width: 100%;
  max-width: 100%;
}
.production-order-detail .production-plan-matrix-embed h4 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}
.production-order-detail .production-plan-matrix-embed .matrix-wrap {
  width: 100%;
  max-width: 100%;
  margin-top: 0;
}
.opt-check-disabled { opacity: 0.45; cursor: not-allowed; }
.opt-check-disabled input[type="checkbox"] { cursor: not-allowed; }
.sku-picker-bar { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; margin: 12px 0; }
.sku-picker-bar label.field-label { display: block; font-size: var(--fs-aux); color: var(--muted); margin-bottom: 4px; }
.sku-picker-cols { display: flex; flex-wrap: wrap; gap: 24px 32px; margin-bottom: 8px; }
.sku-picker-cols > div { min-width: 180px; flex: 1 1 200px; }
.sku-picker-cols h4 { margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.perm-matrix { font-size: 12px; }
.perm-matrix th, .perm-matrix td { white-space: nowrap; text-align: center; padding: 4px 6px; }
.perm-matrix .sticky-col { position: sticky; left: 0; background: var(--card, #fff); text-align: left; z-index: 1; }
.perm-matrix .perm-cell { text-align: center; }
.perm-matrix input[type=checkbox] { width: auto; margin: 0; }

/* 花色 HEX：色相 + 饱和度×明度二维取色 */
.color-picker { max-width: 260px; }
.color-sv-wrap {
  position: relative; width: 220px; height: 140px;
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  cursor: crosshair; touch-action: none; user-select: none;
}
.color-sv { display: block; width: 100%; height: 100%; }
.color-sv-cursor {
  position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,.45); pointer-events: none;
}
.color-hue {
  width: 220px; margin: 10px 0 8px; padding: 0; height: 14px;
  appearance: none; -webkit-appearance: none; border: none; border-radius: 6px;
  background: linear-gradient(
    to right,
    #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%
  );
}
.color-hue::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 1px solid #64748b; cursor: pointer;
}
.color-hue::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 1px solid #64748b; cursor: pointer;
}
.color-hex-row { display: flex; align-items: center; gap: 8px; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--line);
  flex-shrink: 0;
}
.color-hex-input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; }
.color-native {
  width: 36px; height: 28px; padding: 0; border: 1px solid var(--line);
  border-radius: 6px; background: transparent; cursor: pointer;
}
.color-swatch-inline {
  display: inline-block; width: 14px; height: 14px; border-radius: 3px;
  border: 1px solid var(--line); vertical-align: middle;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--danger); font-size: 13px; margin-top: 8px; }
.ok { color: var(--ok); }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--muted); }
.pager span { font-variant-numeric: tabular-nums; }

/* 弹层须高于 Leaflet（约 400–1000）与 geo 绘图层（500/510）；勿用过小 z-index */
.modal-mask {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0; /* 兼容旧浏览器无 inset */
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: -ms-grid;
  display: grid;
  place-items: center;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-pack: center;
  -ms-flex-pack: center;
  justify-content: center;
  z-index: 100000;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.modal {
  position: relative;
  z-index: 100001;
  width: min(640px, 94vw);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border-radius: 12px;
  padding: 16px 22px 14px;
  box-shadow: var(--shadow-pop);
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}
.modal.wide { width: min(960px, 96vw); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  margin-bottom: 8px;
}
.modal h3 { margin: 0; font-size: var(--fs-card); flex: 1 1 auto; }
.modal-close {
  flex: 0 0 auto;
  min-width: 32px;
  padding: 2px 10px;
  font-size: 18px;
  line-height: 1.2;
}
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border, #e5e7eb);
}

/* 忙碌遮蔽层（对齐商家控制台智能出片 mcw-gen-progress：挡点击 + 进度） */
.mfg-busy-progress {
  position: fixed;
  inset: 0;
  z-index: 100200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: rgba(248, 250, 252, 0.82);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.mfg-bp-card {
  display: flex;
  flex-direction: column;
  width: min(28rem, 100%);
  max-height: min(70vh, 520px);
  padding: 1rem 1.1rem 0.85rem;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-pop, 0 8px 32px rgba(0, 0, 0, 0.1));
}
.mfg-bp-card.is-done { border-color: #b7dfc4; }
.mfg-bp-card.is-bad { border-color: #e7b4b4; }
.mfg-bp-head h3 { margin: 0; font-size: 1rem; }
.mfg-bp-sub { margin: 0.35rem 0 0; font-size: 13px; }
.mfg-bp-bar {
  margin: 0.65rem 0 0;
  height: 8px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
}
.mfg-bp-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--brand, #2563eb);
  transition: width 0.2s ease;
}
.mfg-bp-card.is-done .mfg-bp-bar-fill { background: #16a34a; }
.mfg-bp-card.is-bad .mfg-bp-bar-fill { background: var(--danger, #dc2626); }
.mfg-bp-sum {
  margin: 0.45rem 0 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.mfg-bp-now {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  margin: 0.55rem 0 0;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: #f7f9fb;
  font-size: 0.82rem;
}
.mfg-bp-now-tag {
  flex: 0 0 auto;
  font-weight: 600;
  color: #0369a1;
}
.mfg-bp-now-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mfg-bp-feed {
  flex: 1 1 auto;
  min-height: 72px;
  max-height: 180px;
  overflow: auto;
  margin: 0.55rem 0 0;
  padding: 0.35rem 0.5rem;
  border: 1px solid #eef2f7;
  border-radius: 8px;
  background: #fafbfc;
  font-size: 12px;
  color: var(--muted);
}
.mfg-bp-feed-line { padding: 0.15rem 0; line-height: 1.4; }
.mfg-bp-feed-line.is-bad { color: var(--danger, #dc2626); }
.mfg-bp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.65rem;
  flex: 0 0 auto;
}
.mfg-bp-state { font-size: 12px; }

/* 提示条只是展示，不能吃鼠标事件：常驻节点淡出后仍在右上角，
   不设 pointer-events:none 会盖住顶栏「退出」等按钮（点不动、hover 不变色）。 */
.toast {
  position: fixed; right: 16px; top: 16px; z-index: 100010;
  background: #111827; color: #fff; padding: 10px 14px; border-radius: 8px;
  font-size: 13px; opacity: 0; transform: translateY(-8px); transition: .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--danger); }

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--nav-head); font-size: var(--fs-aux); }
.tag.warn { background: #fef3c7; color: #92400e; }
.tag.ok { background: #d1fae5; color: #065f46; }
.report-proxy-badge { margin-left: 6px; padding: 1px 6px; font-size: 11px; vertical-align: 1px; cursor: default; }

/* 页签：胶囊样式，当前项品牌色实心 */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.tabs .tab {
  border: 1px solid var(--line); background: #fff; border-radius: var(--radius-sm);
  padding: 6px 12px; font-size: 13px; cursor: pointer; color: var(--text);
}
.tabs .tab:hover { border-color: #c9d2e0; }
.tabs .tab.active { background: var(--brand); color: #fff; border-color: var(--brand); font-weight: 600; }
.line-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.line-row input { width: 110px; }
label.inline { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
label.inline select { min-width: 220px; }
.soon-card { max-width: 560px; }
h4 { margin: 14px 0 8px; font-size: 13px; color: var(--muted); }
img.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); background: #f8fafc; }
img.thumb-lg { max-width: 220px; max-height: 220px; object-fit: contain; border-radius: 6px; border: 1px solid var(--line); background: #f8fafc; display: block; margin: 6px 0 12px; }
.thumb-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.thumb-item { width: 100px; font-size: 11px; text-align: center; }
.img-preview { margin: 8px 0 4px; }
.check-list { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.check-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 4px;
  font-size: 13px; border-bottom: 1px solid #f1f5f9; cursor: pointer;
}
.check-row:hover { background: var(--row-hover); }
.check-row:has(input:checked) { background: var(--row-sel-bg); }
.check-row:has(input:checked):hover { background: var(--row-sel-hover); }
.check-row:last-of-type { border-bottom: none; }
.check-row input { width: auto; }

/* 页面 JS 已用但原样式表缺失的纯视觉钩子 */
.tree { font-size: 13px; line-height: 1.6; margin: 4px 0; }
.tree li { margin: 2px 0; }

/* 部门管理 · 树表（2026-11-17：组织靠 parent_id，废 dept_type 标签） */
.dept-tree-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  white-space: nowrap;
}
.dept-tree-toggle {
  width: 28px;
  min-width: 28px;
  padding: 0 4px;
  line-height: 1.2;
}
.dept-tree-leaf {
  display: inline-block;
  width: 28px;
  text-align: center;
  color: var(--muted);
}
.dept-tree-label { font-weight: 500; }
table.dept-tree-table td.dept-tree-col { min-width: 220px; }
table.dept-tree-table tr.dept-tree-root td.dept-tree-col .dept-tree-label { font-weight: 600; }
.form-row { display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 8px; align-items: center; }
.form-row label { font-size: 13px; color: var(--muted); }

.matrix-wrap {
  max-height: 420px; overflow: auto; border: 1px solid var(--line);
  border-radius: 8px; margin-top: 8px;
}
table.matrix {
  border-collapse: collapse; font-size: 12px; width: 100%;
}
table.matrix th, table.matrix td {
  border: 1px solid var(--line); padding: 6px 8px; text-align: center;
  white-space: nowrap;
}
table.matrix th.col-toggle {
  white-space: normal; min-width: 112px; vertical-align: middle;
}
table.matrix th { background: #f8fafc; color: var(--muted); font-weight: 600; position: sticky; top: 0; z-index: 1; }
table.matrix th.sticky-col, table.matrix td.sticky-col {
  position: sticky; left: 0; background: #fff; z-index: 2; text-align: left; min-width: 120px;
}
table.matrix th.sticky-col { z-index: 3; background: #f8fafc; }
table.matrix td.checked { background: var(--row-sel-bg); }

/* === 生产单计划明细：下单数 / 裁床数 / 出货数 三段显示（2026-11-16 主人给的格式）===
   每格两行：
     第一行 `下单 / 裁床 / 出货` —— 红 / 蓝 / 绿（与图例同色）
     第二行 `未裁 / 未出货` —— 灰字（未裁=下单−裁床；未出货=裁床−出货）
   三色刻意复用 --money-sum / 一个新蓝色 / --ok：红=下单是这页的主指标，
   蓝=裁床（已投入）、绿=出货（已完成），一眼能看出「排到哪一步」。
   可编辑态（改计划弹窗）第一行的「下单数」渲染成输入框，另两数仍是只读文字。 */
.matrix-sku-stat td {
  vertical-align: middle;
  line-height: 1.35;
}
.sku-stat-line1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  font-variant-numeric: tabular-nums;
}
.sku-stat-line2 {
  margin-top: 1px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sku-stat-plan { color: var(--money-sum); font-weight: 600; }
.sku-stat-cut { color: #1d4ed8; font-weight: 600; }
.sku-stat-ship { color: var(--ok); font-weight: 600; }
.sku-stat-sep { color: var(--muted); }
/* 可编辑格里的下单数输入框：窄一点，别把「/ 0 / 0」挤掉 */
.matrix-sku-stat .sku-stat-line1 .dim-val {
  width: 62px;
  padding: 2px 4px;
  font-size: 12px;
}
/* 图例行（矩阵上方说明三种颜色与两行含义） */
.sku-stat-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  margin: 8px 0 4px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffbeb;
  font-size: 12px;
}
table.matrix td.checked:hover { background: var(--row-sel-hover); }
table.matrix input[type="checkbox"] { width: auto; margin: 0; cursor: pointer; }
table.matrix th.col-toggle, table.matrix td.row-toggle { cursor: pointer; }
table.matrix th.col-toggle:hover, table.matrix td.row-toggle:hover { color: var(--brand); }
.matrix-summary { margin-top: 8px; font-size: 13px; color: var(--muted); }
.matrix-summary strong { color: var(--text); }
table.matrix input.dim-val {
  width: 78px; padding: 2px 4px; font-size: 12px; text-align: center;
}
table.matrix th.col-toggle .matrix-col-head {
  display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center;
  justify-content: center; gap: 4px; width: 100%;
}
table.matrix th.col-toggle .matrix-col-size {
  font-weight: 600; flex: 0 0 auto; white-space: nowrap;
}
table.matrix th.col-toggle .matrix-col-head input[type="checkbox"] {
  flex: 0 0 auto;
}
table.matrix input.matrix-col-qty {
  width: 52px; min-width: 48px; margin: 0; flex: 0 0 auto; padding: 2px 4px;
}
.import-catalog { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.import-catalog .cat-row {
  display: flex; gap: 10px; align-items: center; padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9; cursor: pointer; font-size: 13px;
}
.import-catalog .cat-row:hover { background: var(--row-hover); }
.import-catalog .cat-row.selected {
  background: var(--row-sel-bg); box-shadow: var(--row-sel-bar);
}
.import-catalog .cat-row.selected:hover { background: var(--row-sel-hover); }
.import-catalog .cat-row:last-child { border-bottom: none; }
.spec-meta { display: grid; grid-template-columns: repeat(3, minmax(140px, 1fr)); gap: 10px; margin: 8px 0 12px; }
@media (max-width: 900px) {
  .spec-meta { grid-template-columns: 1fr 1fr; }
}
.pair-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px;
}
@media (max-width: 640px) {
  .pair-cols { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .btn-menu { display: inline-flex; align-items: center; }
  .sidebar {
    display: none;
    position: fixed; left: 0; top: 0; bottom: 0; width: min(280px, 86vw);
    z-index: 50; box-shadow: 8px 0 24px rgba(0,0,0,.2);
  }
  body.nav-open .sidebar { display: flex; }
  body.nav-open .nav-backdrop { display: block; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* === geo-cover · channel territory === */
/* 锁死视口：右侧地图区不出现页面级上下滚动；左侧列表内部滚动 */
.app:has(.geo-cover) {
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}
.main:has(.geo-cover) {
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.content:has(.geo-cover) {
  padding: 0;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: auto;
  overflow: hidden;
}
.geo-cover {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(300px, 360px) 1fr;
  gap: 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
  overflow: hidden;
}
.geo-side {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px;
  border-right: 1px solid var(--line); min-height: 0; overflow: hidden;
}
.geo-org-block {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  max-height: 38%;
  overflow: hidden;
}
.geo-region-block {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 42%;
  overflow: hidden;
}
@media (max-width: 900px) {
  .geo-cover {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(48vh, 52vh) 1fr;
  }
  .geo-side {
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .geo-org-block {
    max-height: 38%;
    min-height: 0;
    flex-shrink: 0;
  }
  .geo-region-block {
    min-height: 42%;
  }
}
@media (min-width: 901px) and (max-width: 1366px) {
  .geo-cover { grid-template-columns: minmax(280px, 32vw) 1fr; }
}
.geo-side h3 { margin: 2px 0 0; font-size: 13px; }
.geo-meta { font-size: 12px; color: var(--muted); line-height: 1.35; }
.geo-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.geo-row select, .geo-row input[type=search], .geo-row input[type=text] {
  flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
}
.geo-pick-org-btn {
  width: 100%;
  min-height: 44px;
  font-size: 14px;
  touch-action: manipulation;
}
.geo-org-tree {
  flex: 1 1 auto;
  min-height: 4.5rem;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 12px;
  line-height: 1.3;
  background: #fafbfc;
  -webkit-overflow-scrolling: touch;
}
.geo-org-tree .org-node { margin: 0; }
.geo-org-tree .org-row {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-height: 44px;
}
.geo-org-tree .org-expand {
  flex: 0 0 44px;
  width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.geo-org-tree .org-expand:hover { background: var(--row-hover); }
.geo-org-tree .org-expand-icon {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--muted);
  transition: transform .12s;
}
.geo-org-tree .org-node.is-open > .org-row > .org-expand .org-expand-icon {
  transform: rotate(90deg);
}
.geo-org-tree .org-kids { padding-left: 8px; }
.geo-org-tree .org-pick,
.org-pick-list .org-pick {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: transparent; padding: 10px 12px; border-radius: 8px;
  cursor: pointer; font: inherit; text-align: left; color: inherit;
  touch-action: manipulation; min-height: 44px; box-sizing: border-box;
}
.geo-org-tree .org-row > .org-pick {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
}
.geo-org-tree .org-pick:focus-visible,
.org-pick-list .org-pick:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px;
}
.geo-org-tree .org-pick:hover,
.org-pick-list .org-pick:hover { background: var(--row-hover); }
.geo-org-tree .org-pick.active,
.org-pick-list .org-pick.active {
  background: var(--row-sel-bg); box-shadow: var(--row-sel-bar);
  color: var(--nav-head); font-weight: 600;
}
.geo-org-tree .org-pick.active:hover,
.org-pick-list .org-pick.active:hover { background: var(--row-sel-hover); }
.geo-org-tree .org-badge,
.org-pick-list .org-badge {
  flex-shrink: 0; font-size: 11px; line-height: 1; padding: 3px 6px;
  border-radius: 4px; background: #e8eef5; color: #3a5a7a;
}
.geo-org-tree .org-pick[data-org-type="STORE"] .org-badge,
.org-pick-list .org-pick[data-org-type="STORE"] .org-badge {
  background: #f3ebe4; color: #8a5a32;
}
.geo-org-tree .org-name,
.org-pick-list .org-name {
  flex: 1 1 auto;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.geo-org-tree .org-pick code,
.org-pick-list .org-pick code { font-size: 11px; color: var(--muted); background: transparent; flex-shrink: 0; }
.geo-org-tree .org-empty { padding: 4px 4px 6px 52px; font-size: 11px; }
.geo-org-tree .org-search-label,
.org-pick-list .org-search-label {
  font-size: 11px; color: var(--muted); padding: 6px 4px 4px; font-weight: 600;
}
.org-pick-list .org-search-group { margin-bottom: 4px; }
.geo-current-tap {
  cursor: pointer;
  touch-action: manipulation;
}
.geo-current-tap:hover { border-color: var(--brand); }
.geo-org-sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.geo-org-sheet {
  width: 100%;
  max-width: 520px;
  max-height: 82vh;
  background: #fff;
  border-radius: 14px 14px 0 0;
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
}
@media (min-width: 600px) {
  .geo-org-sheet-mask { align-items: center; padding: 16px; }
  .geo-org-sheet { border-radius: 12px; max-height: 78vh; }
}
.geo-org-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.geo-org-sheet-head h3 { margin: 0; font-size: 16px; }
.geo-org-sheet > input[type=search] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 16px;
  box-sizing: border-box;
}
.geo-org-sheet-list {
  flex: 1 1 auto;
  min-height: 12rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #fafbfc;
}
.geo-current {
  font-size: 12px; padding: 6px 8px; border-radius: 6px;
  border: 1px dashed var(--line); color: var(--muted); line-height: 1.35;
}
.geo-current.has-owner {
  border-style: solid; background: #f6f8fa; color: inherit;
}
.geo-current.dirty { border-color: #c45c26; background: #fff8f3; }
.geo-current .badge {
  display: inline-block; font-size: 10px; padding: 1px 5px; border-radius: 3px;
  background: #e8eef5; color: #3a5a7a; margin-right: 2px;
}
.geo-tree {
  flex: 1 1 auto;
  min-height: 8rem;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.35;
  background: #fafbfc;
  -webkit-overflow-scrolling: touch;
}
.geo-tree .node-row.region-node {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 2px 0;
  min-height: 40px;
}
.geo-tree .node-row > input[type="checkbox"] {
  margin: 10px 0 0;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  touch-action: manipulation;
}
.geo-tree .region-body {
  flex: 1 1 auto;
  min-width: 0;
}
.geo-tree .region-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
}
.geo-tree .region-expand {
  flex: 0 0 36px;
  width: 36px;
  min-height: 36px;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.geo-tree .region-expand:hover { background: var(--row-hover); }
.geo-tree .region-expand-icon {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid var(--muted);
  transition: transform .12s;
}
.geo-tree .region-node.is-open > .region-body > .region-row > .region-expand .region-expand-icon {
  transform: rotate(90deg);
}
.geo-tree .region-label,
.geo-tree .region-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
}
.geo-tree .kids { padding-left: 8px; }
.geo-tree .node-row.zone-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-left: 12px;
  min-height: 36px;
}
.geo-tree .node-row.zone-row > input[type="checkbox"] { margin-top: 8px; }
.geo-tree .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  max-width: 9rem;
}
.geo-tree .name:hover { color: var(--brand); }
.geo-tree code { font-size: 11px; color: var(--muted); background: transparent; padding: 0; flex-shrink: 0; }
.geo-tree .lv { color: var(--muted); font-size: 10px; flex-shrink: 0; }
.geo-tree .leaf-row { margin-left: 4px; }
.geo-tree .zone-row { margin-left: 8px; }
.geo-tree .zone-row .lv { color: var(--brand); }
.geo-tree .btn-zone {
  margin-left: 2px;
  padding: 4px 8px;
  min-height: 32px;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  color: var(--brand);
  flex-shrink: 0;
  touch-action: manipulation;
}
.geo-hit { display: flex; align-items: center; gap: 4px; padding: 2px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.geo-hits { max-height: 5.5rem; overflow: auto; }
.geo-map-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.geo-map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #e8ece9;
  overflow: hidden;
}
#geo-map { position: absolute; inset: 0; }
.geo-map-status {
  position: absolute; z-index: 500; left: 10px; bottom: 10px;
  background: rgba(255,255,255,.92); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--muted);
  max-width: min(420px, 70vw); pointer-events: none;
}
.geo-draw-bar {
  display: none; position: absolute; z-index: 510; left: 10px; top: 10px; right: 10px;
  flex-wrap: wrap; gap: 6px; align-items: center;
  background: rgba(255,255,255,.96); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 12px;
}
.geo-draw-bar.active { display: flex; }
.geo-draw-bar .hint { flex: 1; min-width: 10rem; color: var(--muted); }
.geo-map-wrap.draw-cursor #geo-map { cursor: crosshair; }

.field-hint { margin: 4px 0 0; font-size: 12px; }
.lock-banner {
  margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--line);
  background: #f8fafc; color: var(--text); font-size: 13px; border-radius: 8px;
}
.badge.lock {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  background: #e8eef5; color: #334155; font-size: 12px;
}
.code-rule-editor { display: flex; flex-direction: column; gap: 4px; }
.code-rule-editor > p { margin: 4px 0; }
.code-parts { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.code-part-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.code-part-row select, .code-part-row input { width: auto; min-width: 7rem; }
.code-preview {
  margin: 10px 0 0; font-family: ui-monospace, Consolas, monospace;
  font-size: 13px; color: var(--text);
}
.form-row-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
input:disabled, select:disabled { background: #f1f5f9; color: #64748b; }

/* —— 网销 · 平台对接配置（#/ol/integration）—— */
.ol-platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}
.ol-platform-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-3);
  background: var(--panel);
  box-shadow: var(--shadow-card);
}
.ol-platform-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.ol-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--fs-aux);
  font-weight: 600;
  line-height: 1.4;
}
.ol-badge.live { background: #d1fae5; color: var(--ok); }
.ol-badge.mock { background: var(--line-soft); color: var(--muted); }
.ol-badge.warn { background: #fef3c7; color: #b45309; }
.ol-dl { margin: 0; display: grid; grid-template-columns: 88px 1fr; gap: 4px 8px; font-size: var(--fs-aux); }
.ol-dl dt { margin: 0; color: var(--muted); }
.ol-dl dd { margin: 0; word-break: break-all; }
.ol-subtitle { font-size: var(--fs-aux); font-weight: 600; margin: var(--sp-2) 0 6px; }
.ol-oauth-block { margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px dashed var(--line); }
.ol-copy-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ol-copy-row code {
  flex: 1 1 180px;
  font-size: 11px;
  background: var(--line-soft);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  word-break: break-all;
}
.ol-oms-flag { margin: var(--sp-2) 0 0; font-size: var(--fs-aux); }
.ol-auth-detail .ol-kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: var(--fs-aux);
}
.ol-auth-detail .ol-kv .k { color: var(--muted); }
.ol-auth-detail .ol-kv .v { word-break: break-all; }
p.small { font-size: 11px; margin: 4px 0; }

/* —— 实体选择（下拉 / 弹窗）—— */
.entity-filter { min-width: 9rem; max-width: 16rem; }
.entity-pick-wrap { display: flex; flex-direction: column; gap: 4px; }
.entity-pick-row { display: flex; gap: 6px; align-items: center; }
.entity-pick-display {
  flex: 1; min-width: 0; background: #f8fafc; cursor: default;
}
.entity-pick-search { width: 100%; margin-bottom: 8px; }
.entity-pick-list {
  max-height: 320px; overflow: auto; display: flex; flex-direction: column; gap: 4px;
}
.entity-pick-item { text-align: left; justify-content: flex-start; }
.line-row .entity-pick-wrap { flex: 1 1 180px; min-width: 140px; }
.line-row .entity-pick-row { width: 100%; }
.entity-chip-x {
  border: none; background: transparent; cursor: pointer; padding: 0 2px;
  color: inherit; font-size: 14px; line-height: 1;
}
.entity-multi-wrap { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.entity-multi-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }
.entity-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 12px;
  background: var(--line-soft); border: 1px solid var(--line);
}

/* 价格表：从工序主数据勾选组路线 */
.pb-process-pick { margin-top: 12px; }
.pb-process-hint { margin: 0 0 8px; }
.pb-process-list { max-height: 320px; }
.pb-process-head,
.pb-process-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}
.pb-process-head {
  padding: 4px 4px 8px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
  cursor: default;
}
.pb-process-row { margin: 0; }
.pb-process-row > input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 16px;
}
.pb-col-check { flex: 0 0 16px; text-align: center; }
.pb-col-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pb-col-price { flex: 0 0 120px; text-align: right; }
.pb-process-row .pb-price-input,
.pb-price-input {
  flex: 0 0 120px;
  width: 120px !important;
  max-width: 120px;
  margin: 0;
}
/* 「已在本工段」只读行：压暗说明它不可勾选（本表只增不删） */
.pb-process-in { opacity: 0.62; }
.pb-kw { width: 240px; }
.pb-hide { display: none !important; }

/* 组路线：工段（第一层）→ 子工序（第二层）。
   一个工段一张卡片，卡片头是工段名/子工序数/小计，卡内是该工段的子工序表。 */
.pb-route-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  flex-wrap: wrap;
  padding: 10px 12px;
  margin: 4px 0 var(--sp-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand-soft);
}
.pb-route-title { font-weight: 600; }
.pb-route-meta { font-size: var(--fs-aux); }
.pb-route-head > .btn { margin-left: auto; }
/* 右栏头部的按钮组（「导入模板文件」+「+ 新建工序组」，2026-11-16）。
   靠右对齐：`margin-left:auto` 顶开左侧标题与合计；两钮并排、右端对齐。
   `align-self:center` 是因为 `.pb-route-head` 是 `align-items:baseline` —— 按钮按基线
   对齐会跟标题的字脚错位一两像素，看着像没对齐。 */
.pb-route-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  align-self: center;
}
.pb-groups { display: flex; flex-direction: column; gap: var(--sp-2); }
.pb-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.pb-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--line-soft);
  border-bottom: 1px solid var(--line);
}
.pb-group-name { font-weight: 600; }
.pb-group-code {
  font-size: var(--fs-aux);
  color: var(--muted);
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.pb-group-meta { font-size: var(--fs-aux); }
.pb-group-head > .btn { margin-left: auto; }

.order-step-group-head {
  width: 100%;
  cursor: pointer;
  border: none;
  text-align: left;
  font: inherit;
  color: inherit;
}
.order-step-group-body {
  padding: 0 8px 8px;
}
.order-step-group-body .table-scroll {
  margin-top: 6px;
}

.order-step-nested-table tr.order-step-group-row td {
  background: var(--line-soft);
  border-top: 2px solid var(--line);
  padding: 8px 10px;
}
.order-step-nested-table tr.order-step-group-row.is-collapsible td,
.order-step-nested-table tr.order-step-group-row[role="button"] td {
  cursor: pointer;
}
.order-step-nested-table tr.order-step-group-row:first-child td {
  border-top: none;
}
.order-step-nested-table .order-step-group-caret {
  display: inline-block;
  width: 1.2em;
  margin-right: 4px;
  color: var(--muted);
  font-size: 11px;
}
.order-step-nested-table .order-step-group-label {
  font-weight: 600;
}
.order-step-nested-table .order-step-group-meta,
.order-step-nested-table .pb-group-meta {
  margin-left: 8px;
  font-weight: 400;
}
.order-step-nested-table .pb-group-code {
  margin-left: 4px;
  vertical-align: middle;
}
/* 子工序相对组标题左缩进约两个汉字 */
.order-step-nested-table tr.order-step-data-row td:first-child {
  padding-left: 2em;
}

/* === 所有「合计出来的金额」一律红色（主人 2026-11-16 令）===
   三处生产/工价页面，覆盖整单合计、分类小计、工序组小计、模板合计与模板组小计：

   1. 工序调整页 `#/production/order-steps`（容器 `[data-wage-scope="order-steps"]`）
      → 整单工价合计 `[data-wage-total]` + 工序组小计 `[data-group-total]`
   2. 整款工价页 `#/base/style-wage`（容器 `[data-wage-scope="style-wage"]`）
      → 整款合计 `[data-wage-total]` + 每个分类小计 `[data-kind-total]`
      （该页的组小计也走 `[data-group-total]`，一并覆盖）
   3. 价格表模板页 `#/base/pricebooks`（无 wage-scope 容器，用专用标记 `[data-pb-total]`）
      → 左栏模板卡片「合计 ¥」+ 右栏路线头「合计 ¥」+ 每个工序组「小计 ¥」

   **不覆盖**：生产清单的工序详情弹窗（只读视图，沿用原色）、
   `#/base/style-prices`（款单详情里的「合计」也保留原色，主人只点了三页）。

   为什么单列一个颜色：金额是这些页面的核心信息，得一眼扫到；但也不该用 `.err`
   的深红（那是错误语义，且与「删除」按钮撞色），故取 --money-sum（#d92b2b）。 */
[data-wage-scope="order-steps"] [data-wage-total],
[data-wage-scope="order-steps"] [data-group-total],
[data-wage-scope="style-wage"] [data-wage-total],
[data-wage-scope="style-wage"] [data-kind-total],
[data-wage-scope="style-wage"] [data-group-total],
[data-pb-total] {
  color: var(--money-sum);
  font-weight: 600;
}

/* 「已在本工段」的只读 chip（不加勾选框 —— 本表只增不删，勾选框会暗示可移除） */
.pb-in-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 4px 0 10px;
}
.pb-chip {
  display: inline-flex;
  align-items: center;
  max-width: 240px;
  padding: 2px 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: var(--fs-aux);
  background: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* 质检门（`is_qc`）：一个下拉定「哪道工序报满即入待质检」。
   下拉是**单选**控件 —— 一床只有一个门，这一点由控件形状本身保证（见 master.js 注释）。 */
.pb-qc-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line-soft);
}
.pb-qc-label { font-weight: 600; }
.pb-qc-select { max-width: 320px; }
.pb-qc-note { font-size: var(--fs-aux); flex: 1 1 320px; }

/* 本单工序 · 新增：质检门 = 勾选 + 标题 + 说明合一条控件 */
.field-qc-gate-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line-soft);
  cursor: pointer;
  user-select: none;
}
.field-qc-gate-inner input[type="checkbox"] {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}
.field-qc-gate-title { font-weight: 600; color: var(--text); font-size: 13px; }
.field-qc-gate-note { font-size: var(--fs-aux); flex: 1; min-width: 0; }

/* === ⚠️ 已停用（2026-11-16 主人令：模板一览改整宽一行多列）===
   下面 `.pb-split` / `.pb-side` 两条规则**当前没有任何元素使用** —— 页面已从
   「左栏竖排卡片 + 右栏详情」改成「① 整宽多列卡片 → ② 详情 → ③ 款单状态」上下堆叠。
   保留不删的理由：一是这两条规则上方的长注释记录了 2026-09-19 那次版式改造的推导
   （左栏 `min(340px,26vw)` 怎么算出来的），对后续若要走回两栏仍有参考价值；二是
   删除后若他席分支还带着旧的 `pb-split` 标记，页面会退化成无样式堆叠。
   真要清理时，请连同 `@media (max-width: 900px)` 里的两条一起删。
   下方「价格表模板页：左栏模板卡片 + 右栏组路线（2026-09-19 版式改造）」是原注释。 */
/* 价格表模板页：左栏模板卡片 + 右栏组路线（2026-09-19 版式改造 · 已停用见上）
   刻意**不套** `.geo-cover` 那套现成的「左窄栏 + 右宽栏」骨架。它看着合适，但真正干活的是
   `.app:has(.geo-cover)` / `.main:has()` / `.content:has()` 三条**视口锁定**
   （`.content{padding:0;overflow:hidden;flex:1}`、`.app{height:100%;overflow:hidden}`）。
   本页需要在两栏**下方**还留一个整宽、要能滚到的「③ 款号款单状态」—— 与「锁死视口、
   不许页面级滚动」直接冲突。而且 `:has()` 是按「整页有没有 .geo-cover」生效的，套上即把
   本页与地图页的滚动方式耦死。复用省 8 行 CSS，换 3 条全局耦合，不划算。 */
.pb-split {
  display: grid;
  /* 右栏必须写 `minmax(0, 1fr)`，不能图省事写 `1fr`：`1fr` 的最小尺寸是 min-content，
     右栏那张 6 列工序表会把整页撑破。`.geo-cover` 靠父级 overflow:hidden 兜住这个，
     本页不锁视口 ⇒ 必须自己把下限写成 0。 */
  /* 左栏跟着视口收（上限 340），而不是钉死一档宽度。**推导（实测得出，不是估的）**：
       两栏可用宽 = 视口 − 232(侧栏) − 40(内容区 padding) − 2(卡片边框) − 40(卡片 padding)
                              = 视口 − 314；再减 16(gap) 才是左右两栏之和。
     右栏的 6 列工序表**最小内容宽实测 328px**（低于它就靠 .table-scroll 横滑）。
     于是「右栏不出横滑」的条件 = 左栏 ≤ 视口 − 658；在断点 901px 处即 ≤ 243。
     901 × 26% = 234，被 240px 下限抬到 240 ⇒ 右栏 331，留 3px 余量；
     视口 ≥ 1307 时 26vw ≥ 340，左栏封顶在 340。
     这正是**为了让断点能取文件惯例的 900** 而付的代价：900~1307 这段靠左栏让位，
     而不是靠提前塌单列（主人 09-19 选定 900；另一条路是把断点提到 1100）。 */
  grid-template-columns: minmax(240px, min(340px, 26vw)) minmax(0, 1fr);
  gap: var(--sp-3);
  align-items: start; /* 左栏必须是 start 才能 sticky：被拉伸成整行高就没有可粘的行程了 */
}
/* 左栏粘住：右栏再长，模板列表始终在视野里（这就是本次改造要解决的那件事）。 */
.pb-side { position: sticky; top: var(--sp-2); min-width: 0; }
.pb-detail { min-width: 0; }

/* ① 模板一览：**整宽一行多列**（2026-11-16 主人令，参考切图）。
   卡片宽度由**内容**决定，不是等分。

   ⚠️ 这里试过 `grid-template-columns: repeat(auto-fill, minmax(min-content, 1fr))`，
   **实测不成立**：卡片里的文字全都允许换行，`min-content` 会退化成最长单词的宽度
   （实测只有 82px），`1fr` 于是把唯一那条轨道拉满整行 ⇒ 仍是 1 列。
   正解是 flex + `width: max-content`：每张卡按自己最长的一行文字取自然宽度，
   放不下就换行（`flex-wrap: wrap`），这才是「宽度按有字的宽度设置」。

   `max-width: 100%` 是兜底：万一某张卡的 meta 行比容器还宽（超长模板名），
   允许它收缩换行，而不是把页面撑出横向滚动条。 */
.pb-cards {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--sp-2);
}
/* 卡片本体是 <button>（见 master.js 注释）：焦点环、Tab/Enter/Space 都由浏览器给，
   故这里只需把 button 的默认外观抹掉，改成一个块级卡片。 */
.pb-card {
  display: block;
  width: max-content;
  max-width: 100%;
  text-align: left; cursor: pointer;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); color: var(--text);
  transition: background .15s, border-color .15s;
}
.pb-card:hover { background: var(--row-hover); border-color: #c9d2e0; }
.pb-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
/* 选中 = **与表格行同一套配方**（浅蓝底 + 品牌色左条 + hover 再深半档）。
   不另发明一套「卡片选中色」：同一个系统里「当前选的是哪个」只该有一种视觉。 */
.pb-card.is-active {
  background: var(--row-sel-bg);
  border-color: var(--brand);
  box-shadow: var(--row-sel-bar);
}
.pb-card.is-active:hover { background: var(--row-sel-hover); }
/* 卡片外层：只负责定位删除按钮。宽度仍由内层 `.pb-card` 的 `max-content` 决定，
   所以这里用 `inline-flex` + `width: max-content`，否则 flex 容器会把卡拉满一行。 */
.pb-card-wrap {
  position: relative;
  display: inline-flex;
  width: max-content;
  max-width: 100%;
}
/* 卡上删除链接（2026-11-16 主人令：右上角红色删除链接）。
   原先是右上角圆形「×」，两个问题：① 太隐晦，看不出是删除；② `opacity:0` 只在 hover
   显形，等于把危险操作藏起来 —— 用户根本不知道能删。现改为**常显的红色文字链接**。
   位置仍贴右上角，但用负向偏移让文字不压住卡片编码（padding-right 在 `.pb-card` 上留位）。 */
.pb-card-del {
  position: absolute;
  top: 4px;
  right: 8px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: var(--fs-aux);
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
}
.pb-card-del:hover {
  text-decoration: underline;
  color: #991b1b;
}
/* 卡右上留出「删除」文字的位置，避免与模板编码（pb-card-code）重叠 */
.pb-card { padding-right: 44px; }
/* 卡内单价输入（子工序单价可改）：够短，不把「单价」列撑宽 */
.pb-price-input {
  width: 92px;
  text-align: right;
  padding: 2px 6px;
}

.pb-card-top { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.pb-card-code { font-weight: 600; font-variant-numeric: tabular-nums; }
/* 三行都 `nowrap`：卡片宽度由 `width:max-content` 反推，若允许换行，
   max-content 会取一个换行后的更小宽度、把 meta 挤成两行 —— 那样就不是
   「按现在有字的宽度设置」了。`white-space:nowrap` 保证一行到底，
   卡片宽度 = 最长那行的自然宽度。 */
.pb-card-name {
  display: block;
  margin-top: 2px;
  white-space: nowrap;
}
.pb-card-meta {
  display: block;
  margin-top: 4px;
  font-size: var(--fs-aux);
  color: var(--muted);
  white-space: nowrap;
}
/* 选中卡底色是 --row-sel-bg(#c2d9ef)，上面压 --muted(#64748b) 的 12px 小字只有约 3.2:1，
   不合格 ⇒ 选中态把这行提到 --text（约 9:1）。 */
.pb-card.is-active .pb-card-meta { color: var(--text); }

/* 右栏柱内的工序表**不再各自限高**。`.table-scroll` 原本是 `max-height:calc(100vh - 11.5rem)`，
   单栏时没问题；左右栏之后会变成「页面一条滚动条 + 每张工序表各一条」的多层嵌套滚动，
   且每张表都只露一条缝。放开上限 ⇒ 整页一条纵向滚动条，左栏 sticky 跟随。
   横向 overflow:auto 保留（窄屏下工序表仍可横滑）。 */
.pb-route .table-scroll { max-height: none; }

/* 窄屏塌单列（右栏落到左栏下方）。断点取**文件惯例的 900**（主人 09-19 拍板；本文件
   另有三处同类媒体查询也是 900）。我原提 1100（依据实测「1101px 两轨时页面与工序表横向
   溢出均为 0」），主人选惯例值 ⇒ 900~1307 这段仍是两栏，靠上面左栏的 `min(340px,26vw)`
   让位来避免右栏挤压（见 .pb-split 的注释），而不是靠提前塌单列。 */
@media (max-width: 900px) {
  .pb-split { grid-template-columns: 1fr; }
  .pb-side { position: static; }
}
