/* 报工系统样式 —— 角色化色板(浅/深两套,见 dataviz 参考色板) */

* { box-sizing: border-box; }

/* hidden 属性永远优先:避免元素自身的 display(如 flex)覆盖掉隐藏 */
[hidden] { display: none !important; }

/* 登录态未确认前隐藏整页:app.js 鉴权通过后才移除,避免未登录时主页面闪现 */
body.auth-gate { display: none; }

:root {
  color-scheme: light;
  --page:      #f9f9f7;   /* 页面背景 */
  --surface:   #fcfcfb;   /* 卡片/表格表面 */
  --input-fill:#e9e9e5;   /* 编辑态录入框底色(浅灰) */
  --ink:       #0b0b0b;   /* 主文字 */
  --ink2:      #52514e;   /* 次文字 */
  --muted:     #898781;   /* 弱化文字 */
  --grid:      #e1e0d9;   /* 网格线 */
  --baseline:  #c3c2b7;   /* 轴线/边框 */
  --border:    rgba(11,11,11,0.10);
  --good:      #0ca30c;   /* 状态色:完成(固定,不随主题) */
  --goodink:   #006300;   /* 完成文字 */
  --bad:       #d03b3b;   /* 状态色:危险/撤销 */
  --blue:      #2a78d6;   /* 进度条/主按钮 */
  --blue-deep: #256abf;   /* 蓝色悬停加深 */
  --chip-good: rgba(12,163,12,0.10);
  --bom-lv0:   rgba(42,120,214,0.18);  /* BOM 顶层装配行底色 */
  --bom-lv1:   rgba(42,120,214,0.10);  /* BOM 子组件行底色 */
  --proc-0:    rgba(42,120,214,0.16);  /* 工艺 BOM 工序分组底色(3 色循环) */
  --proc-1:    rgba(42,120,214,0.08);
  --proc-2:    rgba(42,120,214,0.04);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page:      #0d0d0d;
    --surface:   #1a1a19;
    --input-fill:#2a2a27;   /* 编辑态录入框底色(深灰) */
    --ink:       #f0efec;
    --ink2:      #c3c2b7;
    --grid:      #2c2c2a;
    --baseline:  #383835;
    --border:    rgba(255,255,255,0.10);
    --goodink:   #0ca30c;
    --blue:      #3987e5;
    --blue-deep: #2a78d6;
    --chip-good: rgba(12,163,12,0.16);
    --bom-lv0:   rgba(57,135,229,0.28);
    --bom-lv1:   rgba(57,135,229,0.16);
    --proc-0:    rgba(57,135,229,0.26);
    --proc-1:    rgba(57,135,229,0.13);
    --proc-2:    rgba(57,135,229,0.06);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page:      #0d0d0d;
  --surface:   #1a1a19;
  --input-fill:#2a2a27;   /* 编辑态录入框底色(深灰) */
  --ink:       #f0efec;
  --ink2:      #c3c2b7;
  --grid:      #2c2c2a;
  --baseline:  #383835;
  --border:    rgba(255,255,255,0.10);
  --goodink:   #0ca30c;
  --blue:      #3987e5;
  --blue-deep: #2a78d6;
  --chip-good: rgba(12,163,12,0.16);
  --bom-lv0:   rgba(57,135,229,0.28);
  --bom-lv1:   rgba(57,135,229,0.16);
  --proc-0:    rgba(57,135,229,0.26);
  --proc-1:    rgba(57,135,229,0.13);
  --proc-2:    rgba(57,135,229,0.06);
}

html, body { margin: 0; }
body {
  background: var(--page);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
main { padding: 20px 24px 40px; }
button { font: inherit; cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }

/* 顶栏 */
.topbar {
  display: flex; flex-direction: column; gap: 10px;
  padding: 10px 24px 12px; background: var(--surface);
  border-bottom: 1px solid var(--grid);
  /* 吸顶时与正文之间形成轻柔的悬浮层次 */
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar-main { display: flex; align-items: center; gap: 18px; }
/* 搜索框 + 点选 Tab 所在工具栏:做成内凹面板,与品牌行形成两层层次 */
.topbar-tools {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px;
  background: var(--page);
  border: 1px solid var(--grid);
  border-radius: 12px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.03);
}
.topbar-tools .sub {
  margin: 0; display: flex; align-items: center;
  justify-content: flex-end; gap: 6px;
}
/* 更新于…左侧的“在线/自动刷新”小圆点 */
.topbar-tools .sub::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(12,163,12,0.15);
}
/* 搜索框与点选 Tab 迁入吸顶栏后,清零其在正文中的外边距 */
.topbar-tools .order-search { margin: 0; }
.topbar-tools #valveTabs { margin: 0; }
.topbar-tools #viewTabs { margin: 0; }
.topbar-tools #filterBar { margin: 0; }
.top-logo { max-height: 34px; max-width: 160px; width: auto; height: auto; object-fit: contain; cursor: pointer; }

/* 流程环节:产品爆炸图 → BOM → 下单 → 报工(Tab 宽度压缩 30%) */
.steps { display: flex; align-items: center; gap: 10px; }
.step {
  background: var(--page); border: 1px solid var(--baseline); color: var(--ink2);
  border-radius: 10px; padding: 7px 12px; font-size: 15px;
  min-width: 98px; text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.step:hover { border-color: var(--muted); background: var(--surface); }
.step.on {
  background: linear-gradient(var(--blue), var(--blue-deep)); color: #fff;
  border-color: var(--blue-deep);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 2px 4px rgba(42,120,214,0.28);
}
.step[draggable="true"] { cursor: grab; user-select: none; }
.step[draggable="true"]:active { cursor: grabbing; }
.step.drag-over { outline: 2px dashed var(--blue); outline-offset: 2px; }
.arrow { color: var(--muted); font-size: 16px; }

#pageBlank { padding: 40px 0; text-align: center; }
#pageBlank h2 { font-size: 20px; margin: 0 0 8px; }
#mrpPage { padding: 40px 0; text-align: center; }
#mrpPage h2 { font-size: 20px; margin: 0 0 8px; }
/* BOM 页面:产品选择 + 三个子 Tab(设计/采购/工艺) */
.bom-product-bar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
#bomProductTabs { margin: 0; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.bom-product-tools {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto;
}
.bom-product-tools input {
  width: 160px; padding: 5px 10px; font: inherit;
  border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--page); color: var(--ink);
}
.bom-product-tools input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
#bomTabs { margin: 0 0 12px; flex-wrap: wrap; }
.bom-content { min-height: 120px; }
.bom-content > p.empty { padding: 40px 0; text-align: center; margin: 0; }
.bom-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--grid);
}
.bom-meta { font-size: 13px; color: var(--bad); font-weight: 600; }
.bom-toolbar { display: flex; align-items: center; gap: 8px; }
.bom-toolbar a.mini { text-decoration: none; display: inline-block; line-height: 1.4; }
#bomTableWrap, #summaryBomTableWrap, #processBomTableWrap { max-height: calc(100vh - 190px); min-height: 120px; }
.bom-table { width: 100%; table-layout: auto; }
.bom-table th, .bom-table td {
  text-align: left; padding: 7px 10px;
  border-bottom: 1px solid var(--grid); vertical-align: middle; font-size: 13px;
}
/* BOM 表头底色(完整/汇总/工艺一致) */
#bomTable thead th, #summaryBomTable thead th, #processBomTable thead th { background: var(--grid); }
.bom-table .bom-th-name { min-width: 260px; }
.bom-name-cell { white-space: nowrap; }
.bom-name { font-weight: 500; }
/* 汇总 BOM 表头排序 */
.bom-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.bom-table th.sortable:hover { color: var(--blue); }
.sort-arrow { font-size: 10px; color: var(--muted); margin-left: 3px; }
.bom-table th.sorted .sort-arrow { color: var(--blue); }
/* 按层级给行上色:顶层装配 → 子组件 → 零件,逐层由深到浅,形成层次感 */
.bom-table tbody tr.bom-lv0 { background: var(--bom-lv0); }
.bom-table tbody tr.bom-lv1 { background: var(--bom-lv1); }
/* 工艺 BOM:不同工序号分组交替上色(3 色循环) */
.bom-table tbody tr.bom-proc-0 { background: var(--proc-0); }
.bom-table tbody tr.bom-proc-1 { background: var(--proc-1); }
.bom-table tbody tr.bom-proc-2 { background: var(--proc-2); }
.bom-table tbody tr.bom-lv0 .bom-name { font-weight: 650; }
.bom-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; margin-right: 5px;
  border: 1px solid var(--baseline); border-radius: 4px;
  background: var(--surface); color: var(--ink2); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 0;
}
.bom-toggle:hover { border-color: var(--blue); color: var(--blue); }
.bom-toggle-blank { visibility: hidden; }
.bom-table tr[data-bomhaskids] { cursor: pointer; } /* 有子节点的行整行可点击折叠/展开 */

/* 订单 BOM:左右两栏(左订单列表,右采购BOM表格) */
#mrpPage { margin: -20px -24px 0; } /* 上移贴近顶栏 + 消除左右留白,横向占满页面 */
#mrpPage .card { margin-bottom: 0; } /* 去掉卡片下边距,纵向尽量占满 */
#mrpPage .card-head { padding: 8px 16px 8px; } /* 卡片头压缩,让表格再往上 */
.orderbom-layout { display: flex; gap: 16px; align-items: flex-start; }
.orderbom-left { flex: 1 1 35%; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.orderbom-right { flex: 1 1 65%; min-width: 0; }
/* 录入订单:整行横排,字段从左上排到右 */
.orderbom-form { display: flex; align-items: flex-end; gap: 14px; padding: 12px 16px 14px; flex-wrap: wrap; }
.orderbom-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink2); flex: 1 1 140px; min-width: 110px; }
.orderbom-form input {
  width: 100%; box-sizing: border-box; padding: 7px 10px; font: inherit;
  border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--page); color: var(--ink);
}
.orderbom-form input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
.orderbom-form .primary.sm { flex: 0 0 auto; }
.orderbom-ref { display: flex; flex-direction: column; gap: 6px; font-size: 13px; flex: 1 1 200px; min-width: 170px; }
.ob-ref-label { color: var(--ink2); white-space: nowrap; }
.ob-ref-row { display: flex; align-items: center; gap: 8px; min-height: 33px; }
.ob-ref-name { color: var(--blue); font-weight: 600; }
#mrpPage .ob-list-wrap,
#mrpPage .ob-bom-wrap {
  height: calc(100vh - 140px);
  max-height: calc(100vh - 140px);
  overflow: auto;               /* 表格装入显示框,内容超出时在框内滚动 */
}
#obList thead th, #obBomTable thead th {
  background: var(--grid);
  position: sticky; top: 0; z-index: 2; /* 冻结表头,滚动时表头不动 */
}
#obBomTable { table-layout: fixed; width: 100%; } /* 固定列宽,内容尽量多显示 */
#obBomTable th, #obBomTable td { word-break: break-word; }
#obBomTable .bom-name-cell { white-space: normal; }
#obBomTable td.num { white-space: nowrap; }
#obBomTable .ob-cell { min-width: 0; }
#obBomTable .ob-draw { white-space: nowrap; }
#obList { table-layout: fixed; width: 100%; } /* 固定列宽,内容尽量多显示 */
#obList th, #obList td { padding: 7px 6px; word-break: break-word; overflow: hidden; }
#obList td.num { white-space: nowrap; }
#obList td.ob-time { white-space: normal; } /* 录入时间:日期与时间可换行,完整显示 */
#obList tbody tr { cursor: pointer; }
#obList tbody tr:hover { background: var(--hover, rgba(42,120,214,0.06)); }
#obList tbody tr.ob-sel { background: var(--bom-lv0); }
#obList .num, #obList td { text-align: left; }
.ob-row-acts { display: flex; flex-direction: column; gap: 4px; align-items: center; } /* 两按钮纵向排列,压缩列宽 */
.ob-row-acts .mini { white-space: nowrap; }
.ob-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  border: 1px solid var(--baseline); border-radius: 6px;
  background: var(--surface); color: var(--ink2); cursor: pointer;
}
.ob-icon-btn svg { display: block; }
.ob-icon-btn:hover { border-color: var(--blue); color: var(--blue); }
.ob-icon-btn.del:hover { border-color: var(--bad); color: var(--bad); }
.ob-form-acts { display: flex; align-items: center; gap: 8px; }
/* 订单录入/修改弹窗(两列) */
.ob-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; margin: 4px 0; }
.ob-modal-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink2); }
.ob-modal-grid input { padding: 7px 10px; font: inherit; border: 1px solid var(--baseline); border-radius: 8px; background: var(--page); color: var(--ink); }
.ob-modal-grid input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
.ob-modal-grid .orderbom-ref { grid-column: 1 / -1; flex: none; min-width: 0; }
#obRefModal { z-index: 90; } /* 引用BOM选择弹窗叠在订单录入弹窗之上 */
/* 引用BOM 弹窗列表 */
.ob-ref-list { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow: auto; padding: 4px 2px; }
.ob-ref-item {
  text-align: left; padding: 10px 12px; font: inherit; font-size: 14px;
  border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--page); color: var(--ink); cursor: pointer;
}
.ob-ref-item:hover { border-color: var(--blue); color: var(--blue); }
.ob-ref-item.on { border-color: var(--blue); color: var(--blue); background: var(--bom-lv1); }
/* 引用BOM 明细编辑(增删改/排序) */
.ob-bom-toolbar { display: flex; align-items: center; gap: 8px; }
.ob-cell {
  width: 100%; box-sizing: border-box; min-width: 72px;
  padding: 4px 6px; font: inherit; font-size: 12px;
  border: 1px solid var(--baseline); border-radius: 6px;
  background: var(--page); color: var(--ink);
}
.bom-name-cell .ob-cell { min-width: 150px; }
.ob-cell:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
.ob-act { white-space: nowrap; text-align: center; width: 92px; }
.ob-ico {
  width: 24px; height: 24px; margin: 0 2px;
  border: 1px solid var(--baseline); border-radius: 5px;
  background: var(--surface); color: var(--ink2); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 0;
}
.ob-ico:hover { border-color: var(--blue); color: var(--blue); }
.ob-ico.del:hover { border-color: var(--bad); color: var(--bad); }
/* 图纸列 */
.ob-draw { white-space: nowrap; text-align: center; }
.ob-draw-item { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 2px 0; }
.ob-link { color: var(--blue); text-decoration: underline; cursor: pointer; }
.ob-link:hover { color: var(--blue); filter: brightness(1.1); }
.ob-file-link { color: var(--blue); text-decoration: underline; cursor: pointer; font-size: 12px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
.ob-file-link:hover { color: var(--blue); filter: brightness(1.1); }
.ob-draw-name { font-size: 12px; color: var(--ink2); display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.ob-pending { font-style: normal; color: var(--bad); font-size: 11px; margin-left: 4px; }

/* 物料需求:一级目录(物料名称分组)+ 二级目录(订单明细) */
#materialPage { margin: -20px -24px 0; } /* 全宽:顶/左右贴边,占满页面 */
#materialPage .card { margin-bottom: 0; min-height: calc(100vh - 80px); }
#materialBody .table-wrap { max-height: none; min-height: 0; }
#materialBody thead th { position: static; } /* 页面整体滚动,表头随内容走,避免多表头叠在顶栏下 */
.mat-tools { display: flex; align-items: center; gap: 12px; }
.mat-tools .sub { margin: 0; }
/* 全部展开/全部折叠:与顶部「全部折叠」按钮同款深蓝渐变 */
#matToggleAllBtn {
  white-space: nowrap; width: 105px; padding: 4px 0; text-align: center; font-size: 14px;
  border: 1px solid #0c3560; border-radius: 6px; color: #fff;
  background: linear-gradient(#1c5fa8, #104281);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 2px 3px rgba(0,0,0,0.28);
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}
#matToggleAllBtn:hover { filter: brightness(1.1); }
#matToggleAllBtn:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0,0,0,0.35); }
/* 固定列宽:保证不同物料组之间相同字段垂直对齐 */
#materialBody .bom-table { table-layout: fixed; }
#materialBody td { overflow: hidden; }
#materialBody td.mat-cell { text-overflow: ellipsis; white-space: nowrap; }
.mat-group { border-bottom: 1px solid var(--grid); }
.mat-group:last-child { border-bottom: none; }
.mat-head {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 10px 16px;
  background: var(--bom-lv1); border: 1px solid var(--baseline);
  color: var(--ink); text-align: left; cursor: pointer;
}
.mat-head:hover { background: var(--bom-lv0); }
.mat-head[draggable="true"] { cursor: grab; }
.mat-head[draggable="true"]:active { cursor: grabbing; }
.mat-group.drag-over { outline: 2px dashed var(--blue); outline-offset: 2px; }
.mat-head .chev { font-size: 12px; color: var(--muted); transition: transform .15s; }
.mat-group.folded .chev { transform: rotate(-90deg); }
.mat-name { font-weight: 650; font-size: 14px; }
/* 到料完成进度(折叠按钮右侧) */
.mat-progress { margin-left: auto; display: flex; flex-direction: row; align-items: center; gap: 8px; }
.mat-progress-txt { font-size: 13px; color: var(--ink2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mat-meter { width: 140px; margin: 0; }
/* 是否下单 切换按钮 */
.mat-toggle-btn {
  border: 1px solid var(--baseline); border-radius: 6px;
  background: var(--surface); color: var(--muted);
  padding: 3px 10px; font-size: 12px; white-space: nowrap; cursor: pointer;
}
.mat-toggle-btn:hover { border-color: var(--muted); }
.mat-toggle-btn.on { background: var(--chip-good); border-color: var(--good); color: var(--goodink); }
.mat-static { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mat-static.on { color: var(--goodink); }
/* 到货数量:录入按钮 + 编辑态 */
.mat-arrival-btn {
  border: 1px solid var(--baseline); border-radius: 6px;
  background: var(--surface); color: var(--ink2);
  padding: 3px 10px; font-size: 12px; white-space: nowrap; cursor: pointer;
}
.mat-arrival-btn:hover { border-color: var(--blue); color: var(--blue); }
.mat-arrival-btn.on { background: var(--chip-good); border-color: var(--good); color: var(--goodink); }
.mat-arrival-btn.on:hover { border-color: var(--good); color: var(--goodink); }
.mat-arrival-edit { display: inline-flex; align-items: center; gap: 4px; }
.mat-arrival-input {
  width: 48px; padding: 3px 6px; font: inherit; font-size: 12px;
  border: 1px solid var(--baseline); border-radius: 6px;
  background: var(--page); color: var(--ink);
}
.mat-arrival-input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
.mat-body { padding-left: 24px; } /* 二级表格向右缩进,形成层次;边框线已由 .mat-head 提供 */
.mat-group.folded .mat-body { display: none; }

/* 下单页面 */
.order-form { display: flex; gap: 20px; padding: 4px 16px 16px; flex-wrap: wrap; }
.order-form input {
  width: 220px; padding: 5px 10px; font: inherit; /* 高度压缩 15%:垂直内边距 8px → 5px */
  border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--page); color: var(--ink);
}
.order-form input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
/* 交付日期:日期框不显示占位符,故用前置文字标明 */
.delivery-field {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.delivery-field span { font-size: 13px; color: var(--ink2); }
#orderValveTabs { margin: 0 0 12px; flex-wrap: wrap; }
#orderValveTabs .vtab { padding: 4px 20px; } /* 阀型 Tab 高度压缩 15%:7px → 4px */
.valve-tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }
.valve-tabs-row #orderValveTabs { margin: 0; }
.add-valve { display: flex; align-items: center; gap: 8px; }
.add-valve input {
  width: 150px; padding: 4px 10px; font: inherit; /* 高度压缩 15%:垂直内边距 7px → 4px */
  border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--page); color: var(--ink);
}
.add-valve input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
/* 下单模块冻结区:表单与阀型 Tab 迁入吸顶工具栏,清掉默认外边距 */
#orderTools .order-form { padding: 0; }
/* 分割线:表单与阀型 Tab 之间,以及阀型 Tab 与「部件名称」表头之间 */
#orderTools .valve-tabs-row {
  margin: 0;
  border-top: 1px solid var(--grid);
  padding-top: 8px;
}
#orderTools #orderTableHead {
  border-top: 1px solid var(--grid);
  padding-top: 8px;
}
/* 无部件时表头为空,不显示多余的分割线 */
#orderTools #orderTableHead:empty { border-top: 0; padding-top: 0; }
/* 工具栏内凹面板上,输入框用浅一档背景,形成浮起效果(同报工搜索框) */
#orderTools .order-form input { background: var(--surface); }
#orderTools .add-valve input { background: var(--surface); }
/* 正文表体容器左右各留 12px,与吸顶表头(工具栏 12px 内边距)对齐 */
#orderTable { padding: 0 12px; }
/* 冻结区表头去掉底部边框,避免与工具栏底边重复 */
.order-entry.order-entry-head th { border-bottom: 0; }
/* 部件/规格/材质/数量列压缩,把空间留给加工工序;前四列水平垂直居中,单元格加高 */
.order-entry { width: 100%; table-layout: fixed; }
.order-entry th, .order-entry td { border-bottom: 1px solid var(--grid); padding: 12px 8px; text-align: left; vertical-align: middle; }
.order-entry th { font-size: 12px; color: var(--ink2); }
.order-entry th:nth-child(1), .order-entry td:nth-child(1) { width: 88px; }
.order-entry th:nth-child(2), .order-entry td:nth-child(2) { width: 150px; }
.order-entry th:nth-child(3), .order-entry td:nth-child(3) { width: 150px; }
.order-entry th:nth-child(4), .order-entry td:nth-child(4) { width: 96px; }
.order-entry th:nth-child(5), .order-entry td:nth-child(5) { width: 105px; } /* 图纸列:按规格列 150px 压缩 30% */
.order-entry th:nth-child(-n+5), .order-entry td:nth-child(-n+5) { text-align: center; vertical-align: middle; }
.order-entry td:first-child { font-weight: 600; }
.order-entry input {
  width: 100%; padding: 6px 8px; font: inherit;
  border: 1px solid var(--baseline); border-radius: 6px;
  background: var(--page); color: var(--ink);
}
.order-entry input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }

/* 工序编辑器 */
.stage-editor { min-width: 0; }
.stage-chips { display: flex; flex-wrap: wrap; gap: 5px; }
/* 工序标签:圆角矩形,与报工按钮一致的蓝色风格 */
.chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 13px; color: #fff;
  background: var(--blue); border-radius: 6px;
  padding: 3px 6px 3px 10px; white-space: nowrap;
  cursor: grab; user-select: none;
}
.chip:active { cursor: grabbing; }
.chip.drag-over { filter: brightness(0.85); }
.chip-name { pointer-events: none; }
.chip-del {
  background: none; border: 0; color: rgba(255,255,255,0.8);
  font-size: 14px; line-height: 1; padding: 0 4px; cursor: pointer;
}
.chip-del:hover { color: #fff; }
.stage-add { display: flex; gap: 6px; margin-top: 8px; align-items: center; justify-content: flex-end; }
.stage-add .mini { flex-shrink: 0; } /* 按钮不被挤压,文字保持水平单行 */
.stage-input {
  width: 84px; padding: 4px 8px; font: inherit; font-size: 12px;
  border: 1px solid var(--baseline); border-radius: 6px;
  background: var(--page); color: var(--ink);
}
.stage-input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
#defaultStageInput { width: 120px; } /* 默认工艺的「新增工序名」录入框加宽(与已有部件右对齐) */
.mini {
  background: none; border: 1px solid var(--baseline); color: var(--ink2);
  border-radius: 6px; padding: 4px 10px; font-size: 12px;
  white-space: nowrap; /* 按钮文字保持水平单行,不被挤压成竖排 */
}
.mini:hover { border-color: var(--muted); }
.order-actions { padding: 14px 16px 16px; display: flex; justify-content: flex-end; }
/* 「增加部件」栏:用与表格一致的 6 列网格,使默认工艺「采购到货」与表格「加工工序」列左对齐 */
.add-part {
  display: grid;
  grid-template-columns: 88px 150px 150px 96px 105px minmax(0, 1fr);
  align-items: center;
  padding: 0 12px 12px;
}
.add-part-left { grid-column: 1 / 6; display: flex; align-items: center; gap: 10px; padding-left: 16px; }
.add-part-left input {
  width: 180px; padding: 8px 10px; font: inherit;
  border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--page); color: var(--ink);
}
.add-part-left input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
.default-stages { grid-column: 6 / 7; min-width: 0; padding-left: 8px; padding-right: 8px; margin-top: 10px; }
.primary {
  background: var(--blue); color: #fff; border: 0;
  border-radius: 8px; padding: 10px 28px; font-size: 15px;
}
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: translateY(1px); }
.sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.ghost {
  background: none; border: 1px solid var(--baseline); color: var(--ink);
  border-radius: 8px; padding: 6px 12px; font-size: 13px;
}
.ghost:hover { border-color: var(--muted); }

/* 报工页订单搜索框 */
.order-search { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; }
.order-search input {
  width: 280px; padding: 5px 16px; font: inherit; /* 高度压缩 15%:垂直内边距 8px → 5px */
  border: 1px solid var(--baseline); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}
.order-search input:focus {
  outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05), 0 0 0 3px rgba(42,120,214,0.12);
}
.topbar-tools #collapseAllBtn {
  margin-left: auto; white-space: nowrap;
  width: 105px; padding: 4px 0; text-align: center; font-size: 14px; /* 高度压缩 15%,与阀型 Tab 一致 */
  border: 1px solid #0c3560; border-radius: 6px; color: #fff;
  background: linear-gradient(#1c5fa8, #104281); /* 深蓝渐变:上浅下深形成立体感 */
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 2px 3px rgba(0,0,0,0.28);
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}
.topbar-tools #collapseAllBtn:hover { filter: brightness(1.1); }
.topbar-tools #collapseAllBtn:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0,0,0,0.35); }

/* 视图切换 Tab(高度压缩 15%:垂直内边距 7px → 4px) */
.view-tabs { display: flex; gap: 8px; margin: 20px 0 12px; }
#valveTabs { margin: 20px 0 8px; }
#valveTabs .vtab { width: 105px; padding: 4px 0; text-align: center; }
#viewTabs { margin-top: 0; }
#viewTabs .vtab { width: 105px; padding: 4px 0; text-align: center; }
#filterBar { margin-top: 0; flex-wrap: wrap; }
#filterBar .vtab { padding: 4px 20px; }
#filterBar[hidden] { display: none; }
.vtab {
  background: var(--surface); border: 1px solid var(--baseline);
  color: var(--ink2); border-radius: 8px; padding: 7px 20px; font-size: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.vtab:hover { border-color: var(--muted); }
.vtab.on {
  background: linear-gradient(var(--blue), var(--blue-deep)); color: #fff;
  border-color: var(--blue-deep);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 1px 3px rgba(0,0,0,0.22);
}
#orderValveTabs .vtab[draggable="true"] { cursor: grab; }
#orderValveTabs .vtab[draggable="true"]:active { cursor: grabbing; }
#orderValveTabs .vtab.drag-over { outline: 2px dashed var(--blue); outline-offset: 2px; }
.vtab-del { margin-left: 6px; color: var(--muted); font-size: 14px; line-height: 1; }
.vtab-del:hover { color: var(--bad); }
.vtab.on .vtab-del { color: rgba(255,255,255,0.85); }
.vtab.on .vtab-del:hover { color: #fff; }
.del-part { margin-left: 8px; }
.del-part:hover { border-color: var(--bad); color: var(--bad); }

/* 部件折叠区块 */
.part-card { margin-bottom: 16px; }
.part-head {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--blue); border: 0; padding: 13px 16px;
  color: #fff; text-align: left;
}
.part-head:hover { background: var(--blue-deep); }
.chev { font-size: 12px; color: rgba(255,255,255,0.85); transition: transform .15s; }
.part-card.folded .chev { transform: rotate(-90deg); }
.part-name { font-weight: 650; font-size: 15px; }
.part-due {
  flex: 1; text-align: center;
  font-size: 15px; font-weight: 650; color: #fff;
  font-variant-numeric: tabular-nums;
}
.part-due .due-orange { color: #ffb84d; } /* 剩余 ≤10 天:橙色 */
.part-due .due-red { color: #ff9c9c; }    /* 剩余 ≤5 天:浅红 */
.part-due .due-overdue { color: #ff5c5c; font-weight: 700; } /* 逾期:醒目红色 */
.part-stat { margin-left: auto; font-size: 12px; color: var(--ink2); font-variant-numeric: tabular-nums; }
.part-head .part-stat { color: #fff; }
.part-head .part-export {
  display: inline-block;
  border: 1px solid #452a86; border-radius: 6px;
  padding: 3px 12px; font-size: 12px; color: #fff;
  white-space: nowrap; cursor: pointer;
  background: linear-gradient(#7b5bd0, #5737a8); /* 深紫渐变:上浅下深形成立体感 */
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), 0 2px 3px rgba(0,0,0,0.28);
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
}
.part-head .part-export:hover { filter: brightness(1.1); }
.part-head .part-export:active { transform: translateY(1px); box-shadow: inset 0 1px 2px rgba(0,0,0,0.35); }
.part-meter { width: 180px; margin: 0; background: rgba(255,255,255,0.35); }
.meter.part-meter i { background: #6f42c1; /* 深紫色(双类选择器,优先于通用 .meter i 的蓝色) */ }
.meter.thin.part-meter { height: 12px; } /* 折叠按钮进度条加高 3 倍(原 4px → 12px) */
.part-card.folded .part-body { display: none; }
.part-body { border-top: 1px solid var(--grid); }

/* 订单号视图内的部件子区块 */
.order-part { border-bottom: 1px solid var(--grid); }
.order-part:last-child { border-bottom: 0; }
.order-part-head {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 16px; background: var(--page);
}
.order-part-head .part-name { font-size: 14px; }
/* 部件之间(如阀体与阀盖)的空白主要来自表格容器 min-height:180px,
   收窄到 90px(压缩 50%),消除过高的空白间隙 */
.order-part .table-wrap { min-height: 90px; }

/* 进度条(同色渐变轨道) */
.meter { height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--blue); transition: width .3s; }
.meter.thin { height: 4px; margin-top: 4px; }
.meter-txt { font-size: 11px; color: var(--ink2); margin-top: 3px; font-variant-numeric: tabular-nums; }

/* 卡片与表格 */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 20px; overflow: hidden;
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px 10px; }
.card-head h2 { font-size: 15px; margin: 0; }

.table-wrap { overflow: auto; max-height: calc(100vh - 280px); min-height: 180px; }
/* 固定布局:前 6 列按表头指定宽度固定,每个工序列固定 104px(按钮等宽等高),
   总宽超出容器时横向滚动 */
table { border-collapse: separate; border-spacing: 0; table-layout: fixed; }
th, td { border-bottom: 1px solid var(--grid); padding: 8px; text-align: center; vertical-align: middle; font-size: 13px; }

thead th {
  position: sticky; top: 0; z-index: 6; background: var(--surface);
  font-size: 12px; color: var(--ink2); font-weight: 600; line-height: 1.35; min-width: 92px;
}
thead th.sticky { z-index: 8; }
.sticky { position: sticky; background: var(--surface); z-index: 3; box-shadow: 1px 0 0 var(--grid); }
.sticky.s9 { box-shadow: 2px 0 0 var(--grid); }

/* 扫码报工二维码列 */
.qrcode-cell { text-align: center; }
.qrcode { display: inline-block; line-height: 0; }
.qrcode img { border-radius: 4px; border: 1px solid var(--grid); padding: 2px; background: #fff; }

/* 流程卡列 */
.flowcard-cell { text-align: center; }
.flowcard { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.flowcard a {
  font-size: 12px; color: var(--blue); text-decoration: none;
  border: 1px solid var(--baseline); border-radius: 5px; padding: 2px 8px;
  white-space: nowrap; line-height: 1.4; background: var(--surface);
}
.flowcard a:hover { border-color: var(--blue); }

/* 图纸列(下单页上传 / 报工页缩略图查看下载) */
.drawing-cell { text-align: center; }
.drawing-thumbs { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: flex-start; }
.thumb { position: relative; display: inline-block; line-height: 0; }
.thumb-view { display: inline-block; line-height: 0; }
.thumb embed { border: 1px solid var(--grid); border-radius: 4px; background: #fff; display: block; pointer-events: none; }
.thumb-del {
  position: absolute; top: -7px; right: -7px;
  width: 18px; height: 18px; border-radius: 50%; border: 0;
  background: var(--bad); color: #fff; font-size: 13px; line-height: 18px;
  padding: 0; cursor: pointer;
}
.thumb-dl {
  position: absolute; top: -7px; left: -7px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--blue); color: #fff; font-size: 12px; line-height: 18px;
  text-align: center; text-decoration: none;
}

/* 产品爆炸图页面(独立模块:多张命名图片,Tab 切换) */
/* 单行工具条:名称 Tab 靠左,名称录入框 + 上传按钮靠右 */
.explode-bar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
#explodeTabs { margin: 0; flex: 1 1 auto; min-width: 0; flex-wrap: wrap; }
.explode-toolbar {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0; margin-left: auto;
}
.explode-toolbar input {
  width: 200px; padding: 5px 10px; font: inherit;
  border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--page); color: var(--ink);
}
.explode-toolbar input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
/* 图片尽量占满页面剩余空间 */
.explode-viewer {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px;
}
.explode-img {
  max-width: 100%; max-height: calc(100vh - 200px); width: auto; height: auto;
  object-fit: contain; cursor: zoom-in; border-radius: 6px;
  border: 1px solid var(--grid); background: #fff;
}
.explode-viewer-acts { display: flex; gap: 8px; }
.explode-viewer-acts .del-user { color: var(--bad); }
.explode-viewer-acts .del-user:hover { border-color: var(--bad); }

/* 工序单元格(按钮自带工序名,无表头目录);按钮等宽等高 */
.cell { width: 104px; padding: 6px 4px; }
/* 报工表格单元格内容垂直居中 */
#parts table th, #parts table td { vertical-align: middle; }
.report-btn {
  width: 100%; height: 46px;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue); color: #fff; border: 0; border-radius: 6px;
  padding: 0 4px; font-size: 12px; line-height: 1.35;
  white-space: normal; overflow: hidden;
}
.report-btn:hover { filter: brightness(1.08); }
.report-btn:active { transform: translateY(1px); }
.qty-num {
  width: 100%; margin-top: 6px; padding: 2px 4px;
  font-size: 12px; font-variant-numeric: tabular-nums;
  background: none; border: 0; border-bottom: 1px dashed var(--muted);
  color: var(--ink2);
}
.qty-num:hover { color: var(--blue); border-color: var(--blue); }
.cell.done .qty-num { color: var(--goodink); }
.report-meta {
  display: block; margin-top: 4px; font-size: 11px;
  color: var(--muted); line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.done-btn {
  width: 100%; height: 46px;
  display: flex; align-items: center; justify-content: center;
  background: var(--good); color: #fff;
  border: 0; cursor: pointer; font-family: inherit; border-radius: 6px;
  padding: 0 4px; font-size: 12px; line-height: 1.35;
  white-space: normal; font-weight: 600; overflow: hidden;
}
.done-btn:hover { filter: brightness(1.08); }
.done-btn:active { transform: translateY(1px); }
.done-btn::before { content: "✓ "; font-weight: 700; }
.fld {
  display: block; font-size: 12px; color: var(--ink2);
  max-width: 100%; white-space: normal; overflow-wrap: anywhere;
  line-height: 1.35;
}
.fld.empty { color: var(--muted); }

/* 报工记录 */
.logs { list-style: none; margin: 0; padding: 0 16px 8px; }
.logs li {
  display: flex; gap: 10px; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: 13px;
}
.logs li:last-child { border-bottom: 0; }
.log-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 86px; }
.tag { font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--baseline); color: var(--ink2); }
.tag.ok { color: var(--goodink); border-color: rgba(12,163,12,0.45); }
.tag.undo { color: var(--muted); }
.tag.seed { color: var(--muted); border-style: dashed; }
.op { margin-left: auto; color: var(--muted); }
.empty { color: var(--muted); }

/* 报工按钮下方的「录入数量」入口与数字输入窗口 */
.qty-open {
  width: 100%; margin-top: 6px; padding: 5px 4px; font-size: 12px;
  color: var(--blue); background: none; border: 1px dashed var(--blue);
  border-radius: 6px;
}
.qty-open:hover { background: rgba(42,120,214,0.08); }
.qty-inline { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.qty-file { display: none; }
.qty-file-label {
  font-size: 12px; color: var(--blue); text-align: center;
  border: 1px dashed var(--blue); border-radius: 6px;
  padding: 4px 2px; cursor: pointer;
}
.qty-file-label:hover { background: rgba(42,120,214,0.08); }
.qty-upload-prog { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--ink2); }
.qty-upload-prog .prog-bar { height: 6px; background: var(--grid); border-radius: 3px; overflow: hidden; }
.qty-upload-prog .prog-bar i { display: block; height: 100%; background: var(--blue); transition: width .2s; }

/* 工序图片缩略图(工序按钮上方,默认居中,点击放大) */
.cell-imgs { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 5px; justify-content: center; }
.cell-imgs img {
  width: 30px; height: 30px; object-fit: cover; border-radius: 4px;
  border: 1px solid var(--baseline); cursor: zoom-in; display: block;
}
.lightbox {
  position: fixed; inset: 0; z-index: 95;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 30px; cursor: zoom-out;
}
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 6px; background: #fff; }
.lightbox-del {
  position: absolute; top: 24px; right: 24px; z-index: 2;
  background: var(--bad); color: #fff; border: 0;
  border-radius: 8px; padding: 8px 18px; font-size: 14px; cursor: pointer;
}
.lightbox-del:hover { filter: brightness(1.1); }
.qty-input {
  width: 100%; padding: 5px 6px; font: inherit; font-size: 12px;
  border: 1px solid var(--baseline); border-radius: 6px;
  background: var(--page); color: var(--ink);
}
.qty-input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
.qty-acts { display: flex; gap: 4px; }
.qty-acts .mini { flex: 1; }

/* 提示 */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 18px; font-size: 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18); z-index: 60;
}
.toast.err { border-color: var(--bad); }

/* 登录页 */
.login-body {
  min-height: 100vh;
  display: flex; flex-direction: column; gap: 20px;
  align-items: center; justify-content: center;
  background: linear-gradient(to bottom right, #0f172a, #172554); /* 视频加载前的深色渐变兜底 */
  padding: 24px;
}
/* 登录页背景:滚动地球视频(阿里 CDN 公共资源,不占自有带宽) */
.login-bg {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}
.login-card {
  position: relative; z-index: 1;
  width: 360px; max-width: 100%;
  background: rgba(255, 255, 255, 0.5); border: 1px solid var(--border);
  border-radius: 14px; padding: 36px 32px 32px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { margin: 0; font-size: 22px; text-align: center; }
.login-mascot { font-size: 64px; line-height: 1; text-align: center; }
.login-card label { font-size: 13px; color: var(--ink2); display: flex; flex-direction: column; gap: 6px; }
.login-card input {
  padding: 9px 12px; font: inherit;
  border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--page); color: var(--ink);
}
.login-card input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
.password-field { position: relative; }
.password-field input { width: 100%; padding-right: 40px; }
.eye-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
  padding: 6px; border-radius: 6px; line-height: 0;
  color: var(--ink2);
}
.eye-toggle:hover { color: var(--ink); }
.eye-icon { width: 18px; height: 18px; }
.login-err { margin: 0; color: var(--bad); font-size: 13px; }
.login-btn { width: 100%; margin-top: 6px; }

/* 右上角账号区 */
.top-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.user-chip {
  font-size: 12px; color: var(--ink2); font-family: inherit;
  border: 1px solid var(--baseline); border-radius: 999px;
  padding: 3px 10px; background: var(--surface);
  cursor: pointer;
}
.user-chip:hover { border-color: var(--blue); color: var(--blue); }
.user-chip.static { cursor: default; }
.user-chip.static:hover { border-color: var(--baseline); color: var(--ink2); }
.topbar .ghost { padding: 5px 10px; font-size: 12px; }

/* 账号一览表 */
.card-head.between { display: flex; justify-content: space-between; align-items: center; }
.primary.sm { padding: 7px 18px; font-size: 13px; }
.ghost.sm { padding: 6px 14px; font-size: 13px; }
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td { padding: 10px 14px; border-bottom: 1px solid var(--grid); text-align: left; font-size: 14px; }
.users-table th { font-size: 12px; color: var(--ink2); }
.users-table .w150 { width: 150px; }
.users-table td .mini + .mini { margin-left: 6px; }
.users-table td .mini { white-space: nowrap; }
.user-name { font-weight: 600; }
.del-user { color: var(--bad); }
.del-user:hover { border-color: var(--bad); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  width: 380px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px 26px;
  box-shadow: 0 12px 44px rgba(0,0,0,0.25);
  display: flex; flex-direction: column; gap: 14px;
}
.modal h3 { margin: 0; font-size: 17px; }
.modal-wide { width: 620px; max-width: 100%; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.users-table-wrap { max-height: 55vh; overflow: auto; border: 1px solid var(--grid); border-radius: 8px; }
.modal label { font-size: 13px; color: var(--ink2); display: flex; flex-direction: column; gap: 6px; }
.modal input {
  padding: 8px 12px; font: inherit;
  border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--page); color: var(--ink);
}
.modal input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
.modal-note { margin: 0; font-size: 13px; color: var(--ink2); }
.modal-acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* 角色三选项按钮 */
.role-group { display: flex; gap: 8px; }
.role-group button {
  flex: 1; padding: 8px 0; font-size: 13px;
  background: none; border: 1px solid var(--baseline); border-radius: 8px;
  color: var(--ink2);
}
.role-group button.on { background: var(--blue); color: #fff; border-color: var(--blue); }
.role-group button:disabled { opacity: 0.45; }

/* 组织信息:Logo 预览与操作 */
.org-logo-box {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--grid); border-radius: 8px; padding: 12px;
}
.org-logo-label { font-size: 13px; color: var(--ink2); }
.org-logo-empty { font-size: 13px; color: var(--muted); }
.org-logo-box img {
  max-width: 100%; max-height: 96px; width: auto; height: auto;
  object-fit: contain; align-self: flex-start;
  border: 1px solid var(--grid); border-radius: 6px;
}
.org-logo-acts { display: flex; gap: 8px; }

/* 是否为管理员:左右滑动开关(已由角色选项替代,样式保留备用) */
.switch-row { flex-direction: row !important; align-items: center; justify-content: space-between; }
.switch { position: relative; display: inline-block; width: 46px; height: 25px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--baseline); transition: background 0.2s; cursor: pointer;
}
.switch i::before {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.switch input:checked + i { background: var(--blue); }
.switch input:checked + i::before { transform: translateX(21px); }
.switch input:focus-visible + i { outline: 2px solid var(--blue); outline-offset: 2px; }

/* 普通账号只读:报工/完成按钮仅展示 */
.report-btn.static, .done-btn.static { cursor: default; user-select: none; }
.report-btn.static:hover, .done-btn.static:hover { filter: none; }
.order-entry input:disabled { opacity: 0.6; }
.primary:disabled { opacity: 0.5; filter: none; }

/* ---------- 工艺卡模块 ---------- */
#craftcardPage { padding: 20px 0 40px; text-align: left; }
.craft-layout { display: flex; gap: 12px; align-items: flex-start; }
.craft-col {
  flex: 0 0 auto; width: 200px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  max-height: calc(100vh - 140px); display: flex; flex-direction: column;
}
.craft-valves { width: 220px; } /* 阀型列 +10%(原 200px) */
.craft-parts { width: 230px; }
.craft-col-head {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 650; color: var(--ink);
}
.craft-col-list { overflow: auto; padding: 8px; flex: 1 1 auto; }
.craft-col-add { padding: 10px 12px; border-top: 1px solid var(--border); }
.craft-col-add input {
  width: 100%; box-sizing: border-box; padding: 7px 9px; font: inherit; font-size: 13px;
  border: 1px solid var(--baseline); border-radius: 8px; background: var(--page); color: var(--ink);
}
.craft-col-add input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; }
.craft-col-add.drag-over { background: rgba(42,120,214,0.14); outline: 2px dashed var(--blue); outline-offset: -2px; }
.craft-vt {
  display: flex; align-items: center; gap: 6px; padding: 7px 8px;
  border-radius: 8px; margin: 2px 0; color: var(--ink2); cursor: pointer;
  border: 1px solid transparent;
}
.craft-vt:hover { background: var(--page); }
.craft-vt.on { background: rgba(42,120,214,0.14); color: var(--ink); font-weight: 650; border-color: var(--blue); }
.craft-vt[draggable="true"] { cursor: grab; }
.craft-vt[draggable="true"]:active { cursor: grabbing; }
.craft-vt.drag-over { outline: 2px dashed var(--blue); outline-offset: 1px; }
.craft-vt-name { flex: 1 1 auto; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.craft-vt-fold { width: 14px; text-align: center; color: var(--muted); cursor: pointer; user-select: none; flex: 0 0 auto; }
.craft-vt-fold-spacer { width: 14px; flex: 0 0 auto; }
.craft-vt-acts { display: none; gap: 2px; }
.craft-vt:hover .craft-vt-acts { display: flex; }
.craft-vt-pub {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: #0ca30c; color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
  box-sizing: border-box;
}
.craft-ico { padding: 2px 6px; line-height: 1; }
.craft-ico:disabled { opacity: 0.3; cursor: default; }
.craft-del { color: var(--bad); }
.craft-part {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  border-radius: 8px; margin: 2px 0; color: var(--ink2); cursor: pointer;
  border: 1px solid transparent;
}
.craft-part:hover { background: var(--page); }
.craft-part.on { background: rgba(42,120,214,0.14); color: var(--ink); font-weight: 650; border-color: var(--blue); }
.craft-part-name { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.craft-part-acts { display: none; gap: 2px; }
.craft-part:hover .craft-part-acts { display: flex; }
.craft-pub-badge {
  flex: 0 0 auto; font-size: 11px; line-height: 1; padding: 2px 6px;
  border-radius: 999px; background: #0ca30c; color: #fff; white-space: nowrap;
}

.craft-main { flex: 1 1 auto; min-width: 0; }
.craft-main-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.craft-main-head h2 { font-size: 16px; margin: 0; }
.craft-tools { display: flex; gap: 8px; }
.craft-editor { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.craft-editor-body { padding: 16px; }
.craft-header-fields {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px 14px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.craft-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--ink2); }
.craft-field input {
  padding: 7px 9px; font: inherit; border: 1px solid var(--baseline); border-radius: 8px;
  background: var(--page); color: var(--ink);
}
.craft-field input:enabled { background: var(--input-fill); }           /* 编辑态:灰色底,与工序明细录入框一致 */
.craft-field input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: transparent; background: var(--page); }
.craft-field input:disabled { opacity: 0.6; }
.craft-steps-head { display: flex; justify-content: space-between; align-items: center; margin: 14px 0 8px; }
.craft-steps-head h3 { font-size: 14px; margin: 0; }
.craft-steps-wrap { overflow: auto; }
.craft-steps { width: 100%; border-collapse: collapse; table-layout: fixed; }
.craft-steps th, .craft-steps td {
  border: 1px solid var(--baseline); padding: 5px 6px; text-align: left;
  font-size: 12px; vertical-align: middle;
}
.craft-steps th { background: var(--page); color: var(--ink2); font-weight: 650; white-space: nowrap; }
.craft-steps th:nth-child(1) { width: 44px; text-align: center; }        /* 工序 */
.craft-steps th:nth-child(2) { width: 100px; text-align: center; }         /* 工序名称 横向居中 */
.craft-steps th:nth-child(3) { width: 35%; text-align: center; }           /* 工艺内容(吸收示意图腾出的空间) */
.craft-steps th:nth-child(4) { width: 90px; text-align: center; }          /* 示意图(与设备等宽,横向居中) */
.craft-steps th:nth-child(5) { width: 90px; text-align: center; }          /* 设备 */
.craft-steps th:nth-child(6) { width: 90px; text-align: center; }          /* 工、量具 */
.craft-steps th:nth-child(7) { width: 80px; text-align: center; }          /* 规格 */
.craft-steps th:nth-child(8) { width: 64px; text-align: center; }          /* 操作(插入/删除) */
.craft-steps td { word-break: break-word; vertical-align: middle; }        /* 各列内容垂直居中 */
.craft-steps td.c-content { white-space: pre-wrap; }                       /* 工艺内容保留换行 */
.craft-steps td.c-seq { text-align: center; color: var(--ink2); }
.craft-steps td:nth-child(2) { text-align: center; }                       /* 工序名称 横向居中 */
.craft-steps td.c-act { text-align: center; white-space: nowrap; vertical-align: middle; }
.craft-steps input {
  width: 100%; box-sizing: border-box; padding: 5px 6px; font: inherit; font-size: 12px;
  border: 1px solid var(--baseline); border-radius: 6px; background: var(--input-fill); color: var(--ink);
}
.craft-steps input:hover { border-color: var(--muted); background: var(--input-fill); }
.craft-steps input:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: transparent; background: var(--page); }
.craft-steps input:disabled { opacity: 0.6; }
.craft-steps textarea {
  width: 100%; box-sizing: border-box; padding: 5px 6px; font: inherit; font-size: 12px;
  border: 1px solid var(--baseline); border-radius: 6px; background: var(--input-fill); color: var(--ink);
  resize: none; overflow: hidden; min-height: 44px; line-height: 1.5;
}
.craft-steps textarea:hover { border-color: var(--muted); background: var(--input-fill); }
.craft-steps textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: transparent; background: var(--page); }
tr.craft-step[draggable="true"] { cursor: grab; }
tr.craft-step.drag-over { outline: 2px dashed var(--blue); outline-offset: -2px; }
.craft-step-del { color: var(--bad); padding: 2px 6px; }
.craft-step-ins { color: var(--blue); padding: 2px 6px; }
/* 示意图缩略图 */
.craft-steps td.c-img { vertical-align: middle; text-align: center; }
.craft-img-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.craft-thumb { position: relative; display: inline-flex; }
.craft-thumb img { width: 56px; height: 56px; object-fit: cover; border: 1px solid var(--baseline); border-radius: 6px; display: block; }
.craft-thumb-empty { color: var(--muted); font-size: 12px; }
.craft-img-del {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; line-height: 1;
  border: 0; border-radius: 50%; background: var(--bad); color: #fff; font-size: 12px; cursor: pointer; padding: 0;
}
.craft-img-up { margin-top: 6px; }
