:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --border: #e3e7ed;
  --border-strong: #cfd6e0;
  --text: #1b1f26;
  --text-2: #5b6472;
  --text-3: #8b95a5;
  --primary: #1a66d6;
  --primary-dark: #12509f;
  --primary-soft: #e8f0fd;
  --accent: #d9480f;
  --accent-soft: #fff1e8;
  --green: #0f8b4c;
  --green-soft: #e6f6ee;
  --red: #c92a2a;
  --red-soft: #fdeceb;
  --amber: #b8860b;
  --amber-soft: #fdf6e3;
  --canvas-bg: #fcfcfd;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 8px 24px rgba(16,24,40,.10);
  --radius: 8px;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, Monaco, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: 60px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--primary); }
.brand-title { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--text-3); letter-spacing: .3px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a {
  padding: 6px 14px;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
}
.nav a:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary-dark); }
.sysinfo {
  font-size: 12px;
  color: var(--text-3);
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); display: inline-block; }
.dot.ok { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.dot.err { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }

main { padding: 22px 24px 60px; width: 100%; max-width: none; margin: 0; }

/* ---------------- 通用 ---------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-h {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-h h3 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: .2px; }
.card-b { padding: 18px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all .14s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-2); color: var(--text); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-soft); }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.tag.gray { background: #eef1f5; color: var(--text-2); }
.tag.blue { background: var(--primary-soft); color: var(--primary-dark); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }

.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }

/* ---------------- 首页 ---------------- */
.hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: 20px; margin-bottom: 20px; }
@media (max-width: 1080px) { .hero { grid-template-columns: 1fr; } }

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: 10px;
  background: var(--panel-2);
  padding: 46px 24px;
  text-align: center;
  transition: all .18s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.dropzone .dz-icon { color: var(--primary); opacity: .8; }
.dropzone h2 { margin: 14px 0 6px; font-size: 17px; font-weight: 650; }
.dropzone p { margin: 0; color: var(--text-2); font-size: 13px; }
.dz-hint { margin-top: 18px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; letter-spacing: .2px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.field textarea { resize: vertical; min-height: 64px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.stat {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
}
.stat .v { font-size: 20px; font-weight: 700; font-family: var(--mono); letter-spacing: -.5px; }
.stat .k { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* ---------------- 表格 ---------------- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left;
  padding: 9px 12px;
  background: var(--panel-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky; top: 0; z-index: 1;
}
table.tbl td { padding: 9px 12px; border-bottom: 1px solid #f0f2f6; vertical-align: middle; white-space: nowrap; }
table.tbl td.wrap { white-space: normal; min-width: 104px; max-width: 190px; }
table.tbl tbody tr:hover { background: #f8fafd; }
table.tbl tbody tr.selected { background: var(--primary-soft); }
table.tbl tbody tr.dimmed { opacity: .35; }
table.tbl tbody tr.hl { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
table.tbl .num { font-family: var(--mono); text-align: right; white-space: nowrap; }
table.tbl .ctr { text-align: center; }
table.tbl .tight { font-size: 11.5px; line-height: 1.4; }
.tbl-wrap { overflow: auto; max-height: 100%; }

/* ---------------- 任务详情布局 ---------------- */
.task-head {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px; flex-wrap: wrap;
}
.task-head h1 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.2px; }
.spacer { flex: 1; }

.work { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(500px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1320px) { .work { grid-template-columns: 1fr; } }

.viewer-box { position: relative; height: calc(100vh - 210px); min-height: 460px; background: var(--canvas-bg); border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
#cv { display: block; width: 100%; height: 100%; cursor: grab; }
#cv.grabbing { cursor: grabbing; }

.view-tools {
  display: flex; gap: 6px; align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  flex-wrap: wrap;
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  color: var(--text-2);
}
.chip.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.chip .sw { width: 9px; height: 9px; border-radius: 2px; }

.hover-tip {
  position: absolute;
  pointer-events: none;
  background: rgba(20,26,36,.92);
  color: #fff;
  font-size: 11.5px;
  padding: 4px 8px;
  border-radius: 5px;
  font-family: var(--mono);
  white-space: nowrap;
  z-index: 20;
  display: none;
}

/* ---------------- 侧栏 tabs ---------------- */
.tabs { display: flex; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.tabs button {
  flex: 1;
  padding: 11px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  font-weight: 500;
}
.tabs button:hover { color: var(--text); background: #f2f5f9; }
.tabs button.on { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: 650; background: #fff; }
.tab-body { padding: 0; max-height: calc(100vh - 260px); overflow: auto; }

/* 层级树 */
.tree { padding: 10px 14px; font-size: 13px; }
.tree-tools { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.tree-tools .muted { margin-left: auto; }
.tree-root { font-weight: 650; padding: 6px 0 4px; color: var(--text); }
.tree-node { padding: 4px 0 2px 14px; color: var(--text); }
.tree-leaf { padding: 3px 0 3px 30px; color: var(--text-2); cursor: pointer; border-radius: 6px; display: flex; gap: 6px; align-items: baseline; }
.tree-leaf:hover { background: #eef3fb; color: var(--primary-dark); }
.tree-leaf .mono { font-weight: 650; color: var(--primary-dark); }
.tree-leaf .muted { margin-left: auto; font-size: 12px; }

/* 3D 视图 */
.three-box { width: 100%; height: calc(100vh - 320px); min-height: 460px; background: #0f1320; }
.three-box iframe { width: 100%; height: 100%; border: 0; display: block; }

/* 工程图 */
.dwg-tools { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dwg-tools select { padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border); }
.dwg-box { padding: 14px; display: flex; justify-content: center; background: #fff; }
.dwg-box img { max-width: 100%; height: auto; box-shadow: 0 2px 14px rgba(0,0,0,.12); }

.detail-sec { padding: 14px 18px; border-bottom: 1px solid #f0f2f6; }
.detail-sec h4 {
  margin: 0 0 10px; font-size: 12px; font-weight: 700;
  color: var(--text-3); letter-spacing: .6px; text-transform: uppercase;
}
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 12px; font-size: 13px; }
.kv .k { color: var(--text-3); }
.kv .v { color: var(--text); font-weight: 500; word-break: break-all; }

.hole-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px dashed #eef1f5;
}
.hole-row:last-child { border-bottom: none; }
.hole-row input {
  width: 74px; padding: 4px 6px; font-family: var(--mono); font-size: 12px;
  border: 1px solid var(--border-strong); border-radius: 4px; text-align: right;
}

.empty { padding: 48px 20px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty .big { font-size: 15px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }

/* ---------------- 进度 ---------------- */
.progress-line { height: 4px; background: #e9edf3; border-radius: 2px; overflow: hidden; }
.progress-line > i { display: block; height: 100%; background: var(--primary); transition: width .4s; }

.running-badge { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--primary-dark); }
.spinner {
  width: 13px; height: 13px; border: 2px solid var(--primary-soft);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  bottom: 26px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1b1f26; color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all .22s;
  z-index: 999;
  max-width: 560px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }
.toast.ok { background: #12693e; }

/* ---------------- misc ---------------- */
.warn-box {
  background: var(--amber-soft);
  border: 1px solid #f0e0b0;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: #7a5a00;
  margin: 10px 0;
}
.info-box {
  background: var(--primary-soft);
  border: 1px solid #cfe0fa;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--primary-dark);
  margin: 10px 0;
}
.bar-mini { display: inline-block; height: 5px; border-radius: 3px; background: var(--primary); vertical-align: middle; }
code { font-family: var(--mono); background: #f1f4f8; padding: 1px 5px; border-radius: 3px; font-size: 12px; }

/* ---------------- 拆图可信度诊断 ---------------- */
.verdict { border-radius: 10px; border: 1px solid; padding: 16px 18px; margin-bottom: 14px; }
.verdict.reject { background: var(--red-soft); border-color: #f3cccc; }
.verdict.warn { background: var(--amber-soft); border-color: #f0e0b0; }
.verdict h2, .verdict-pop h2 { font-size: 15px; margin: 0; font-weight: 700; line-height: 1.4; }
.verdict.reject h2 { color: var(--red); }
.verdict.warn h2, .verdict-pop h2 { color: #7a5a00; }
.verdict ul, .verdict-pop ul { margin: 10px 0 0; padding-left: 18px; }
.verdict li, .verdict-pop li { font-size: 13px; line-height: 1.7; margin-bottom: 6px; color: var(--text); }
.verdict li .sev, .verdict-pop li .sev { font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 3px; margin-right: 6px; }
.verdict li .sev.reject, .verdict-pop li .sev.reject { background: var(--red); color: #fff; }
.verdict li .sev.warn, .verdict-pop li .sev.warn { background: var(--amber); color: #fff; }
.verdict .facts, .verdict-pop .facts { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.verdict .facts b, .verdict-pop .facts b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.verdict .advice, .verdict-pop .advice { margin-top: 12px; padding-top: 10px; border-top: 1px dashed rgba(0, 0, 0, .14); font-size: 12.5px; color: var(--text-2); line-height: 1.65; }

/* 顶部拆图说明 tip：收起黄色区域，悬停/点击展开 */
.verdict-tip { position: relative; display: inline-block; }
.verdict-tip-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 11px; border-radius: 20px; cursor: pointer;
  font-size: 12px; font-weight: 600; font-family: inherit;
  border: 1px solid #f0dca8; background: var(--amber-soft); color: #7a5a00;
}
.verdict-tip-btn:hover { background: #fbeecb; }
.verdict-tip-btn .vt-ico { font-size: 12px; line-height: 1; }
.verdict-pop {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 60;
  width: 480px; max-width: 86vw;
  background: var(--amber-soft);
  border: 1px solid #f0e0b0; border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 14px 16px;
  display: none;
}
.verdict-pop.show { display: block; }
.hint-row { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }

/* ---------------- 三栏：层级树 / 主视图 / 详情 ---------------- */
.work3 {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) minmax(520px, 1fr);
  gap: 16px;
  align-items: stretch;
  height: calc(100vh - 112px);
}
/* 折叠只缩本栏：树/详情各自收成 42px 窄条（保留展开按钮），中栏自适应剩余宽度 */
.work3.tree-collapsed { grid-template-columns: 42px minmax(0, 1fr) minmax(520px, 1fr); }
.work3.detail-collapsed { grid-template-columns: 232px minmax(0, 1fr) 42px; }
.work3.tree-collapsed.detail-collapsed { grid-template-columns: 42px minmax(0, 1fr) 42px; }
.tree-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.viewer-card { display: flex; flex-direction: column; overflow: hidden; }
.detail-card { display: flex; flex-direction: column; overflow: hidden; }
.viewer-card .viewer-box { height: auto; min-height: 0; flex: 1; }
.detail-card .tab-body { flex: 1; max-height: none; }

/* 树折叠 → 窄条：只保留展开按钮 */
.work3.tree-collapsed .tree-title-text,
.work3.tree-collapsed .tree-search,
.work3.tree-collapsed .tree-actions,
.work3.tree-collapsed .tree-crumb,
.work3.tree-collapsed .tree-body { display: none; }
.work3.tree-collapsed .tree-head { display: flex; justify-content: center; align-items: center; padding: 10px 0; }
.work3.tree-collapsed .tree-title { margin: 0; padding: 0; }
.work3.tree-collapsed .tree-collapse { margin: 0; }

/* 详情折叠 → 窄条：只保留展开按钮 */
.detail-head { display: flex; align-items: stretch; }
.detail-head .tabs { flex: 1; min-width: 0; }
.detail-collapse {
  width: 34px; border: none; border-left: 1px solid var(--border);
  background: var(--panel-2); color: var(--text-2); cursor: pointer;
  font-size: 15px; line-height: 1; font-family: inherit;
}
.detail-collapse:hover { color: var(--primary); background: var(--primary-soft); }
.work3.detail-collapsed .tabs, .work3.detail-collapsed .tab-body { display: none; }
.work3.detail-collapsed .detail-head { display: flex; justify-content: center; align-items: flex-start; padding-top: 10px; }
.work3.detail-collapsed .detail-collapse { width: 28px; border-left: none; border-radius: 6px; }

.tree-head { padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.tree-title { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tree-collapse {
  margin-left: auto; width: 24px; height: 24px;
  border: 1px solid var(--border-strong); background: #fff; border-radius: 6px;
  cursor: pointer; color: var(--text-2); font-size: 13px; line-height: 1;
}
.tree-collapse:hover { color: var(--primary); border-color: var(--primary); }
.tree-search input {
  width: 100%; padding: 6px 9px;
  border: 1px solid var(--border-strong); border-radius: 6px; font-size: 12.5px; outline: none;
}
.tree-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tree-actions { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; margin-left: auto; }
.seg button { border: none; background: #fff; padding: 4px 9px; font-size: 11.5px; cursor: pointer; color: var(--text-2); font-family: inherit; }
.seg button.on { background: var(--primary); color: #fff; }
.tree-crumb { margin-top: 8px; font-size: 12px; display: flex; align-items: center; gap: 8px; min-height: 18px; color: var(--text-2); }
.crumb-clear { border: 1px solid var(--border-strong); background: #fff; border-radius: 5px; padding: 1px 8px; font-size: 11px; cursor: pointer; color: var(--text-2); }
.crumb-clear:hover { color: var(--primary); border-color: var(--primary); }
.tree-body { flex: 1; overflow: auto; padding: 0 4px; }
.cb { width: 14px; height: 14px; accent-color: var(--primary); cursor: pointer; flex: 0 0 auto; }
.tree-row { display: flex; align-items: center; gap: 7px; }
.tree-leaf { align-items: center; }
.tree-leaf .lk { display: flex; align-items: center; gap: 6px; flex: 1; }
.tree-leaf .lk .muted { margin-left: auto; }

@media (max-width: 1320px) {
  .work3 { grid-template-columns: 1fr; height: auto; }
  .tree-panel { max-height: 360px; }
  .viewer-card .viewer-box { height: 520px; flex: none; }
  .detail-card .tab-body { max-height: 520px; }
}

/* ------------------------------------------------ 完整图纸（总图）模式 */
.mode-note {
  margin-top: 10px; padding: 9px 12px; border-radius: var(--radius);
  background: var(--primary-soft); color: var(--text-2); font-size: 12px; line-height: 1.65;
}
.mode-note.warn { background: var(--amber-soft); color: #6b5310; }
.asm-tools { display: flex; align-items: center; gap: 6px; }
.asm-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 12px; color: var(--text-2); }
.asm-meta b { color: var(--text); font-weight: 500; }
.asm-preview {
  height: 600px; overflow: hidden; background: var(--canvas-bg);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: grab; user-select: none;
}
.asm-preview.dragging { cursor: grabbing; }
.asm-preview img { width: 100%; height: 100%; object-fit: contain; transform-origin: center center; }
.asm-cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 14px; }
.asm-table-wrap { max-height: 560px; overflow: auto; }
.asm-tbl thead th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); }
.asm-tbl tbody tr { cursor: pointer; }
.asm-tbl tbody tr:hover { background: var(--primary-soft); }
.asm-tbl tbody tr.hl { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.asm-part-svg {
  height: 330px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.asm-part-svg img { width: 100%; height: 100%; object-fit: contain; }
.asm-part-actions { display: flex; gap: 8px; margin-top: 12px; }
.asm-part-note { margin-top: 12px; font-size: 12px; line-height: 1.75; color: var(--text-2); }
.asm-diag {
  white-space: pre-wrap; font-size: 11px; line-height: 1.6; color: var(--text-2);
  background: var(--panel-2); padding: 12px; border-radius: var(--radius); margin-top: 10px;
}
@media (max-width: 1100px) {
  .asm-cols { grid-template-columns: 1fr; }
  .asm-preview { height: 340px; }
}

/* ------------------------------------------------ 总图：修正闭环 / 层级 BOM / 3D */
.asm-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; }
.asm-tabs button {
  border: 0; background: transparent; padding: 9px 10px; font-size: 12px;
  color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent;
}
.asm-tabs button:hover { color: var(--text); }
.asm-tabs button.on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }
.asm-tbl tbody tr.asm-excluded { opacity: .55; }
.asm-modal {
  position: fixed; inset: 0; z-index: 80; display: flex; align-items: center;
  justify-content: center; padding: 24px; background: rgba(15, 20, 32, .55);
}
.asm-modal-box {
  width: min(1080px, 100%); max-height: 86vh; overflow: auto; padding: 16px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.asm-map-rows { max-height: 52vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.asm-map-rows input, .asm-map-rows select,
#kidBody input, .asm-3d-tools input, .asm-3d-tools select {
  width: 100%; padding: 5px 7px; font-size: 12px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: 4px;
}
#kidBody input[type="checkbox"] { width: auto; }
.asm-3d-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 12px; }
.asm-3d-tools label { display: flex; flex-direction: column; gap: 3px; color: var(--text-2); }
.asm-3d-tools input, .asm-3d-tools select { width: auto; min-width: 92px; }
.asm-3d-frame { height: 420px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); }
.asm-3d-frame iframe { width: 100%; height: 100%; border: 0; background: #0f1320; }
#asmPaneEdit .field, #asmPaneChildren .field { margin: 0; }
#asmPaneEdit .detail-sec h4 { margin: 0 0 8px; }
#asmPaneEdit textarea { min-height: 56px; }
@media (max-width: 1100px) {
  .asm-3d-frame { height: 320px; }
  .asm-tabs button { padding: 9px 6px; }
}

/* 出图校验 / 签核页 */
.rl-f { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-2); }
.rl-f span { width: 78px; flex: none; }
.rl-f input { flex: 1; min-width: 0; padding: 4px 6px; font-size: 12px; }
#tabBody .tbl th, #tabBody .tbl td { padding: 5px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
#tabBody .tbl th { background: var(--bg-2, #f6f8fb); font-weight: 600; }

/* ------------------------------------------------ 通用列表分页（默认每页 15 条） */
.pager {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 8px 14px; padding: 9px 12px; border-top: 1px solid var(--border);
  background: var(--panel-2); border-radius: 0 0 var(--radius) var(--radius);
  font-size: 12px; color: var(--text-2);
}
.pager:first-child { border-top: 0; border-radius: var(--radius); }
.pg-summary b { color: var(--text); font-weight: 600; }
.pg-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.pg-btn, .pg-num {
  min-width: 26px; height: 26px; padding: 0 6px; border: 1px solid var(--border-strong);
  background: var(--panel); color: var(--text-2); border-radius: 5px; cursor: pointer;
  font-size: 12px; line-height: 24px; text-align: center;
}
.pg-btn:hover:not(:disabled), .pg-num:hover:not(.on) { border-color: var(--primary); color: var(--primary); }
.pg-btn:disabled { opacity: .42; cursor: not-allowed; }
.pg-num.on, .pg-num[aria-current="page"] {
  background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; cursor: default;
}
.pg-nums { display: inline-flex; gap: 3px; margin: 0 4px; }
.pg-ellipsis { min-width: 18px; text-align: center; color: var(--text-3); }
.pg-size, .pg-jump { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; white-space: nowrap; }
.pg-size select, .pg-jump input {
  height: 26px; padding: 0 4px; font-size: 12px; color: var(--text);
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: 5px;
}
.pg-jump input { width: 52px; text-align: center; }
.tree-body .pager { position: sticky; bottom: 0; z-index: 2; font-size: 11px; padding: 6px 8px; }
.tree-body .pager .pg-jump { display: none; }
.tab-body .pager, .detail-sec .pager { border-radius: 0; }
@media (max-width: 900px) {
  .pager { flex-direction: column; align-items: flex-start; }
  .pg-nums { flex-wrap: wrap; }
}

/* ---------------- 鉴权 / 登录 ---------------- */
.authbox { display: flex; align-items: center; gap: 8px; }
.authbox .who { font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.authbox .who .role { color: var(--primary); font-weight: 600; margin-left: 4px; }

.modal-mask {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 14vh;
}
.modal {
  width: 380px; max-width: calc(100vw - 40px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .22);
  padding: 22px 22px 18px;
}
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .muted.small { margin: 0 0 16px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-actions .btn { min-width: 84px; }
.err-line {
  margin-top: 4px; padding: 8px 10px; border-radius: 6px;
  background: var(--red-soft); color: var(--red); font-size: 12.5px; font-weight: 600;
}
.login-hint { font-size: 12px; color: var(--text-3); margin-top: -6px; margin-bottom: 12px; }

/* ---------------- 页面标题（系统管理页等） ---------------- */
.page-h {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  margin: 2px 0 16px;
}
.page-h h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: .2px; }

/* 装配制造 BOM 分节标题 */
.asm-sub {
  margin: 14px 0 6px; font-size: 13px; font-weight: 650; color: var(--text-2);
  letter-spacing: .2px;
}
.asm-sub:first-child { margin-top: 0; }

/* ---------------- 导航下拉（系统管理） ---------------- */
.nav-drop { position: relative; }
.nav-drop-btn {
  padding: 6px 14px; border-radius: 6px; border: 0; background: transparent;
  color: var(--text-2); font-size: 13.5px; font-weight: 500; cursor: pointer;
  font-family: inherit;
}
.nav-drop-btn:hover { background: var(--panel-2); color: var(--text); }
.nav-drop.open .nav-drop-btn { background: var(--primary-soft); color: var(--primary-dark); }
.nav-drop .caret { font-size: 10px; opacity: .7; }
.nav-drop-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; min-width: 150px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 60;
}
.nav-drop.open .nav-drop-menu { display: block; }
.nav-drop-menu a {
  display: block; padding: 8px 12px; border-radius: 6px; color: var(--text-2);
  font-size: 13px; font-weight: 500;
}
.nav-drop-menu a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-drop-menu a.active { background: var(--primary-soft); color: var(--primary-dark); }

.authbox .who { display: inline-flex; align-items: center; gap: 6px; }
.authbox .who .role { color: var(--primary); font-weight: 600; }
.authbox .who .role.super { color: var(--accent); }
.tenant-chip {
  font-size: 11px; padding: 1px 7px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-3);
  font-weight: 500;
}

/* ---------------- 系统管理页通用 ---------------- */
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inp {
  height: 30px; padding: 0 10px; border: 1px solid var(--border-strong);
  border-radius: 6px; background: var(--panel); color: var(--text);
  font-size: 13px; font-family: inherit; outline: none;
}
.inp:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.row-acts { display: flex; gap: 4px; flex-wrap: nowrap; align-items: center; white-space: nowrap; }
.danger-text { color: var(--red) !important; }
.text-red { color: var(--red); }
.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.detail-cell {
  max-width: 340px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--text-2);
}
.tbl td.empty, .tbl th.empty { text-align: center; color: var(--text-3); padding: 26px 10px; }

/* ---------------- 角色权限 ---------------- */
.role-layout {
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px;
  align-items: start;
}
@media (max-width: 1100px) { .role-layout { grid-template-columns: 1fr; } }
.role-list { max-height: 620px; overflow: auto; }
.role-item {
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s;
}
.role-item:last-child { border-bottom: 0; }
.role-item:hover { background: var(--panel-2); }
.role-item.on { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.role-name { font-size: 13.5px; font-weight: 650; margin-bottom: 3px; display: flex; gap: 6px; align-items: center; }
.perm-group { margin-bottom: 18px; }
.perm-group:last-child { margin-bottom: 0; }
.perm-group-h {
  font-size: 12px; font-weight: 700; color: var(--text-3);
  letter-spacing: .6px; margin-bottom: 8px;
}
.perm-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px;
}
.perm-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
  font-size: 13px; background: var(--panel);
}
.perm-item:hover { border-color: var(--primary); }
.perm-item.locked { opacity: .65; cursor: not-allowed; }
.perm-item code {
  margin-left: auto; font-size: 10.5px; color: var(--text-3);
  font-family: var(--mono); background: var(--panel-2); padding: 1px 5px; border-radius: 4px;
}
.perm-item input { accent-color: var(--primary); }

/* ---------------- 对话框 ---------------- */
.modal.dlg { width: min(620px, 100%); }
.dlg-body { margin-top: 10px; }
.dlg-body .form-row { margin-bottom: 10px; }
.dlg-body .field label { font-size: 12px; }
.form-col .field { margin-bottom: 10px; }
.modal-mask { z-index: 200; }
