/* ============================================================================
   CATIA2023 · web/css/app.css —— CATIA V5-6R2023 风格 Windows 经典浅灰 chrome
   纯手写 CSS：无框架、无外链字体、无 CDN。图标全部由本项目自绘 SVG（assets/icons）。
   ========================================================================== */
:root {
  /* chrome：Windows 经典浅灰工具条 */
  --catia-chrome: #e9e7e2;
  --catia-chrome-2: #f2f0ec;
  --catia-chrome-3: #dcd9d3;
  --catia-chrome-4: #cfccc5;
  --catia-groove: #b7b3aa;
  --catia-line: #9a968d;
  --catia-line-soft: #c9c5bc;
  --catia-text: #1d1d1b;
  --catia-text-dim: #55534e;
  --catia-text-mute: #7c7972;
  /* CATIA 蓝：标题栏/选中/对话框标题条 */
  --catia-blue: #2c5f8a;
  --catia-blue-dark: #1e4568;
  --catia-blue-light: #7aa9cd;
  --catia-blue-soft: #cfe2f2;
  --catia-select: #316a99;
  --catia-select-bg: #cfe2f2;
  --catia-hover: #d9e8f5;
  /* 视口背景（深蓝灰渐变，与 three.js scene.background 保持一致） */
  --viewport-top: #3f5a72;
  --viewport-mid: #6d8499;
  --viewport-bottom: #a7b9c8;
  /* 语义色 */
  --ok: #2e7d46;
  --warn: #a86a00;
  --bad: #b3352c;
  --bad-bg: #fbe3e0;
  --warn-bg: #fff3d6;
  --radius: 3px;
  --shadow: 0 6px 22px rgba(0, 0, 0, .28);
  --shadow-dlg: 0 10px 34px rgba(0, 0, 0, .38);
  --font: Tahoma, "Segoe UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: Consolas, "Cascadia Code", "Liberation Mono", monospace;
  --tree-row: 20px;
  --toolbar-h: 30px;
}
* { box-sizing: border-box; }
/* 关键：作者样式会覆盖 UA 对 [hidden] 的处理，这里恢复 hidden 语义。
   （drawing-layer / sketch-layer / marquee / context-menu 都靠 hidden 属性显隐。） */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--catia-chrome-3);
  color: var(--catia-text);
  font: 12px/1.35 var(--font);
  overflow: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input, select, textarea { user-select: text; }
::selection { background: var(--catia-blue-soft); }
::-webkit-scrollbar { width: 15px; height: 15px; }
::-webkit-scrollbar-track { background: #f0eee9; border-left: 1px solid var(--catia-line-soft); }
::-webkit-scrollbar-thumb { background: linear-gradient(#e9e7e2, #c9c5bc); border: 1px solid var(--catia-line); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(#f4f2ee, #d5d1c8); }
:focus-visible { outline: 1px dotted var(--catia-blue); outline-offset: -2px; }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: pre; border: 0; }
.mono { font-family: var(--mono); }
.icon { display: block; flex: none; }

#app { height: 100vh; display: flex; flex-direction: column; min-width: 1024px; background: var(--catia-chrome-3); }

/* ============================================================ 标题栏 */
.titlebar {
  height: 30px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 8px;
  background: linear-gradient(to bottom, #3f7cae 0%, #2c6693 45%, #1e4568 100%);
  border-bottom: 1px solid #14314b; color: #f2f7fc;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35);
}
.brand { display: flex; align-items: center; gap: 7px; min-width: 0; }
.brand-logo { width: 20px; height: 20px; }
.brand-product { font-weight: 700; font-size: 13px; letter-spacing: .3px; text-shadow: 0 1px 0 rgba(0, 0, 0, .45); }
.brand-product em { font-style: normal; color: #bfe0ff; margin-left: 3px; }
.brand-tag { font-size: 10px; border: 1px solid rgba(255, 255, 255, .45); border-radius: 2px; padding: 0 4px; color: #e8f4ff; opacity: .9; }
.brand-unofficial { font-size: 10px; color: #ffe9a8; opacity: .95; white-space: nowrap; }
.title-doc { margin-left: 6px; font-size: 12px; color: #eaf4ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 36vw; }
.title-doc.dirty::after { content: " *"; color: #ffd867; }
.title-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.workbench-chip { font-size: 11px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .4); border-radius: 2px; padding: 1px 8px; color: #fff; }
.edition-chip { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; background: #ffd867; color: #4a3600; border-radius: 2px; padding: 1px 6px; font-weight: 700; }
.edition-chip.dev { background: #8fd3ff; color: #063354; }
.title-btn { width: 24px; height: 21px; border: 1px solid rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .14); color: #fff; border-radius: 2px; line-height: 1; }
.title-btn:hover { background: rgba(255, 255, 255, .3); }

/* ============================================================ 菜单栏 */
.menubar {
  height: 24px; flex: none; display: flex; align-items: stretch; gap: 0; padding: 0 3px;
  background: linear-gradient(to bottom, #f6f5f2, #e7e5e0);
  border-bottom: 1px solid var(--catia-line); position: relative; z-index: 60;
}
.menu { position: relative; display: flex; align-items: stretch; }
.menu > button.menu-label {
  border: 0; background: transparent; color: var(--catia-text); padding: 0 9px; font-size: 12px;
  border-radius: 2px; margin: 1px 0; white-space: nowrap;
}
.menu > button.menu-label:hover, .menu.open > button.menu-label { background: var(--catia-blue-soft); outline: 1px solid var(--catia-blue-light); outline-offset: -1px; }
.menu-popup {
  position: absolute; top: 23px; left: 0; min-width: 244px; background: #f7f6f3;
  border: 1px solid var(--catia-line); border-radius: 2px; box-shadow: var(--shadow);
  padding: 2px; z-index: 1200; display: none; max-height: calc(100vh - 70px); overflow-y: auto; overflow-x: visible;
}
.menu.open > .menu-popup { display: block; }
.menu-item {
  display: flex; align-items: center; gap: 7px; width: 100%; border: 0; background: transparent;
  color: var(--catia-text); text-align: left; padding: 4px 8px 4px 4px; border-radius: 2px; font-size: 12px; white-space: nowrap;
}
.menu-item:hover:not(:disabled) { background: var(--catia-select); color: #fff; }
.menu-item:disabled { color: var(--catia-text-mute); background: transparent; cursor: default; }
.menu-item .mi-check { width: 14px; text-align: center; color: var(--catia-blue); font-size: 11px; flex: none; }
.menu-item:hover:not(:disabled) .mi-check { color: #fff; }
.menu-item .mi-icon { width: 16px; height: 16px; flex: none; display: flex; align-items: center; justify-content: center; }
.menu-item .mi-icon img { width: 16px; height: 16px; }
.menu-item .mi-label { flex: 1 1 auto; }
.menu-item .mi-key { color: var(--catia-text-mute); font-size: 10.5px; padding-left: 22px; }
.menu-item:hover:not(:disabled) .mi-key { color: #dbe9f6; }
.menu-item .mi-arrow { color: var(--catia-text-dim); font-size: 9px; }
.menu-sep { height: 1px; background: var(--catia-line-soft); margin: 3px 6px; }
.menu-group-label { display: flex; align-items: center; gap: 6px; padding: 4px 8px 2px 4px; font-size: 10.5px; color: var(--catia-text-mute); text-transform: uppercase; letter-spacing: .4px; }
.menu-sub { position: relative; }
.menu-sub > .menu-popup { top: -3px; left: 100%; display: none; }
.menu-sub.open > .menu-popup { display: block; }
.menu-sub > .menu-item:hover { background: var(--catia-select); color: #fff; }

/* ============================================================ 工具栏（可停靠/可显隐） */
.toolbars { flex: none; display: flex; flex-direction: column; background: linear-gradient(to bottom, #f0eeea, #e2dfd9); border-bottom: 1px solid var(--catia-line); }
.dock { display: flex; align-items: flex-start; gap: 2px; padding: 2px 4px; min-height: 2px; }
.dock-top { flex-wrap: wrap; }
#toolbars .dock-left, #toolbars .dock-right { position: fixed; top: 96px; bottom: 26px; width: 0; overflow: visible; padding: 0; z-index: 30; }
#toolbars .dock-left { left: 0; }
#toolbars .dock-right { right: 0; }
.toolbar-panel {
  display: flex; align-items: center; gap: 1px; flex-wrap: nowrap; white-space: nowrap;
  background: linear-gradient(to bottom, #f7f6f3, #e6e3dd);
  border: 1px solid var(--catia-line-soft); border-radius: 2px; padding: 1px 3px 1px 1px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .06);
}
.toolbar-panel.vertical { flex-direction: column; }
.toolbar-panel.dragging { opacity: .45; }
.toolbar-panel.drop-target { outline: 2px solid var(--catia-blue-light); outline-offset: -1px; }
.tb-grip {
  width: 8px; align-self: stretch; cursor: grab; flex: none; border-radius: 1px;
  background:
    linear-gradient(to right, transparent 2px, #a9a59c 2px, #a9a59c 3px, transparent 3px) 0 0 / 4px 100% repeat-x,
    linear-gradient(to bottom, transparent 2px, #a9a59c 2px, #a9a59c 3px, transparent 3px) 0 0 / 100% 4px repeat-y;
  background-color: transparent;
}
.tb-grip:active { cursor: grabbing; }
.tb-btn {
  height: 24px; min-width: 24px; padding: 0 2px; border: 1px solid transparent; border-radius: 2px;
  background: transparent; color: var(--catia-text); display: inline-flex; align-items: center; justify-content: center;
  position: relative;
}
.tb-btn:hover { background: linear-gradient(to bottom, #fdfefe, #dcebf7); border-color: var(--catia-blue-light); }
.tb-btn.active, .tb-btn[aria-pressed="true"] { background: linear-gradient(to bottom, #d6e7f6, #b9d4ea); border-color: var(--catia-blue); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .5); }
.tb-btn:disabled { opacity: .4; cursor: default; }
.tb-btn img, .tb-icon { width: 18px; height: 18px; pointer-events: none; }
.tb-btn .tb-fallback { width: 16px; height: 16px; display: block; }
.tb-sep { width: 1px; align-self: stretch; margin: 2px 3px; background: var(--catia-line-soft); box-shadow: 1px 0 0 #fff; }
.toolbar-panel.vertical .tb-sep { width: auto; height: 1px; margin: 2px; }
.tb-collapse { width: 10px; height: 20px; border: 0; background: transparent; color: var(--catia-text-mute); font-size: 8px; padding: 0; }
.toolbar-panel.collapsed .tb-btn, .toolbar-panel.collapsed .tb-sep { display: none; }
.toolbar-panel.collapsed .tb-collapse { transform: rotate(-90deg); }

/* ============================================================ 工作区三栏 */
.workspace { flex: 1 1 auto; display: flex; min-height: 0; background: var(--catia-chrome-3); }
.tree-panel {
  width: 248px; flex: none; display: flex; flex-direction: column; min-height: 0;
  background: #f1efeb; border-right: 1px solid var(--catia-line);
}
.tree-panel.hidden { display: none !important; }
.tree-head {
  height: 22px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 6px;
  background: linear-gradient(to bottom, #e8e6e1, #d7d4cd); border-bottom: 1px solid var(--catia-line-soft);
  font-size: 11px; color: var(--catia-text-dim);
}
.tree-head-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #33322e; }
.tree-head-actions { display: flex; gap: 2px; }
.tree-head-btn { width: 17px; height: 16px; border: 1px solid var(--catia-line-soft); background: #f3f2ee; border-radius: 2px; font-size: 10px; line-height: 1; padding: 0; color: var(--catia-text-dim); }
.tree-head-btn:hover { background: var(--catia-blue-soft); border-color: var(--catia-blue-light); }
.tree-body { flex: 1 1 auto; overflow: auto; padding: 4px 2px 8px 4px; background: #f5f4f0; color: #1d1d1b; }
.tree-root, .tree-children { list-style: none; margin: 0; padding: 0; }
.tree-children { margin-left: 10px; border-left: 1px dotted #a5a197; padding-left: 3px; }
.tree-node { position: relative; }
.tree-row {
  display: flex; align-items: center; gap: 3px; height: var(--tree-row); padding: 0 3px 0 2px;
  border: 1px solid transparent; border-radius: 2px; white-space: nowrap; cursor: default;
  color: #1d1d1b;
}
.tree-row:hover { background: #e6f0f9; }
.tree-row.selected { background: var(--catia-select-bg); border-color: var(--catia-blue-light); }
.tree-row.selected .tree-label { font-weight: 700; }
.tree-row.in-work { font-weight: 700; }
.tree-row.error .tree-label { color: var(--bad); }
.tree-row.suppressed .tree-label { color: var(--catia-text-mute); text-decoration: line-through; }
.tree-row.hidden-geom .tree-label { color: var(--catia-text-mute); font-style: italic; }
.tree-row.drop-before { box-shadow: inset 0 2px 0 var(--catia-blue); }
.tree-row.drop-after { box-shadow: inset 0 -2px 0 var(--catia-blue); }
.tree-arrow { width: 12px; height: 12px; flex: none; text-align: center; line-height: 11px; font-size: 9px; color: #6b6960; cursor: pointer; }
.tree-arrow.leaf { visibility: hidden; }
.tree-icon { width: 16px; height: 16px; min-width: 16px; flex: none; display: block; }
.tree-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; padding-right: 4px; color: #1d1d1b; line-height: 16px; }
.tree-badge { font-size: 9.5px; color: var(--catia-text-mute); flex: none; padding-right: 2px; }
.tree-badge.error { color: #fff; background: var(--bad); border-radius: 2px; padding: 0 3px; }
.tree-eye { width: 15px; height: 15px; flex: none; border: 0; background: transparent; padding: 0; opacity: .28; font-size: 10px; line-height: 15px; }
.tree-row:hover .tree-eye { opacity: .85; }
.tree-eye:hover { background: var(--catia-hover); border-radius: 2px; }
.tree-rename { height: 17px; font-size: 11.5px; border: 1px solid var(--catia-blue); padding: 0 2px; width: 100%; }
.tree-tabs { flex: none; display: flex; gap: 1px; padding: 2px 3px; background: linear-gradient(to bottom, #e5e2dc, #d3d0c9); border-top: 1px solid var(--catia-line-soft); }
.tree-tab {
  border: 1px solid var(--catia-line-soft); border-bottom: 0; background: #e8e6e1; color: #44423c;
  font-size: 10.5px; padding: 1px 8px; border-radius: 2px 2px 0 0;
}
.tree-tab.active { background: #f7f6f3; color: var(--catia-text); font-weight: 700; }

/* ============================================================ 视口 */
.viewport-shell { flex: 1 1 auto; min-width: 0; display: flex; padding: 2px; }
.viewport { position: relative; flex: 1 1 auto; min-width: 0; overflow: hidden; border: 1px solid var(--catia-line); background: var(--viewport-mid); }
#viewport-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; }
.viewport-bg {
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to bottom, var(--viewport-top) 0%, var(--viewport-mid) 52%, var(--viewport-bottom) 100%);
}
.viewport-hud {
  position: absolute; left: 8px; top: 6px; display: flex; gap: 6px; pointer-events: none;
  font-size: 10.5px; color: #eaf3fb; text-shadow: 0 1px 1px rgba(0, 0, 0, .55);
}
.hud-item { background: rgba(20, 40, 60, .34); border: 1px solid rgba(255, 255, 255, .22); border-radius: 2px; padding: 0 5px; }
.compass { position: absolute; right: 12px; top: 10px; width: 116px; height: 116px; cursor: pointer; }
.compass svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); }
.axis-triad { position: absolute; right: 10px; bottom: 8px; width: 96px; height: 96px; pointer-events: none; opacity: .95; }
.selection-hud {
  position: absolute; left: 8px; bottom: 8px; max-width: 62%; max-height: 34%; overflow: auto;
  background: rgba(240, 246, 251, .92); border: 1px solid var(--catia-line); border-radius: 2px;
  padding: 3px 7px; font-size: 11px; color: #183a56; display: flex; flex-direction: column; gap: 2px;
}
.selection-hud .sel-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selection-hud .sel-line b { color: var(--catia-blue-dark); }
.marquee { position: absolute; border: 1px dashed #dff1ff; background: rgba(140, 190, 230, .18); pointer-events: none; }
.tooltip {
  position: absolute; z-index: 1300; max-width: 320px; background: #ffffe1; color: #1d1d1b;
  border: 1px solid #8c8a80; padding: 2px 6px; font-size: 11px; box-shadow: 2px 2px 4px rgba(0, 0, 0, .2); pointer-events: none;
}
.context-menu {
  position: absolute; z-index: 1400; min-width: 210px; background: #f7f6f3; border: 1px solid var(--catia-line);
  box-shadow: var(--shadow); padding: 2px; border-radius: 2px; max-height: 70%; overflow: auto;
}
.context-menu .menu-item { font-size: 11.5px; padding: 3px 8px 3px 4px; }
.context-menu .ctx-title { font-size: 10px; color: var(--catia-text-mute); padding: 3px 8px 1px 6px; border-bottom: 1px solid var(--catia-line-soft); margin-bottom: 2px; }

/* 草图叠加层 */
.sketch-layer { position: absolute; inset: 0; }
#sketch-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.sketch-hud {
  position: absolute; left: 8px; top: 6px; display: flex; gap: 4px; align-items: center;
  background: rgba(240, 246, 251, .92); border: 1px solid var(--catia-line); border-radius: 2px; padding: 2px 6px;
  font-size: 11px; color: #17364f;
}
.sketch-hud .sk-tool { font-weight: 700; color: var(--catia-blue-dark); }
.sketch-hud .sk-hint { color: var(--catia-text-dim); }

/* 工程图预览层 */
.drawing-layer { position: absolute; inset: 0; background: #8d9aa5; display: flex; flex-direction: column; }
.drawing-toolbar { flex: none; display: flex; gap: 4px; padding: 3px 6px; background: linear-gradient(to bottom, #f4f2ee, #e0ddd6); border-bottom: 1px solid var(--catia-line); font-size: 11px; align-items: center; }
.drawing-sheet { flex: 1 1 auto; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 12px; }
.drawing-sheet svg { background: #fff; box-shadow: 0 3px 12px rgba(0, 0, 0, .35); max-width: 100%; height: auto; }

/* ============================================================ 状态栏 */
.statusbar {
  height: 22px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 6px;
  background: linear-gradient(to bottom, #eeebe6, #dcd8d1); border-top: 1px solid var(--catia-line);
  font-size: 11px; color: var(--catia-text-dim);
}
.sb-msg { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--catia-text); }
.sb-msg.warn { color: var(--warn); }
.sb-msg.error { color: var(--bad); }
.sb-right { display: flex; align-items: center; gap: 1px; flex: none; }
.sb-field { border: 1px solid var(--catia-line-soft); background: #f6f5f2; padding: 0 7px; height: 16px; line-height: 14px; white-space: nowrap; }
.sb-field:first-child { border-radius: 2px 0 0 2px; }
.sb-field:last-child { border-radius: 0 2px 2px 0; }
.sb-unit { min-width: 34px; text-align: center; }
.sb-wb { font-weight: 700; color: var(--catia-blue-dark); background: #e7f1fa; }

/* ============================================================ toast */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%) translateY(12px);
  background: #2b2b28; color: #f3f3ef; font-size: 12px; padding: 6px 14px; border-radius: 3px;
  box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; z-index: 2000; max-width: 70vw;
}
.toast.show { opacity: .96; transform: translateX(-50%) translateY(0); }
.toast.warn { background: #6b4c00; }
.toast.error { background: #6e1f18; }

/* ============================================================ 对话框（CATIA 风格） */
.modal-root { position: fixed; inset: 0; z-index: 1500; pointer-events: none; }
.modal-root.has-dialog { pointer-events: auto; }
.dlg-shade { position: absolute; inset: 0; background: rgba(20, 30, 40, .18); }
.dlg {
  position: absolute; min-width: 320px; max-width: min(760px, 92vw); max-height: 86vh;
  display: flex; flex-direction: column; background: #f0eeea; border: 1px solid #6f6b62;
  border-radius: 3px; box-shadow: var(--shadow-dlg); pointer-events: auto; overflow: hidden;
}
.dlg-title {
  height: 24px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 4px 0 7px;
  background: linear-gradient(to bottom, #3d7cae, #1e4568); color: #fff; font-size: 12px; font-weight: 700;
  cursor: move; text-shadow: 0 1px 0 rgba(0, 0, 0, .4);
}
.dlg-title-icon { width: 14px; height: 14px; }
.dlg-title-text { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-close { width: 18px; height: 18px; border: 1px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .14); color: #fff; border-radius: 2px; line-height: 1; font-size: 12px; padding: 0; }
.dlg-close:hover { background: #c0392b; }
.dlg-body { flex: 1 1 auto; overflow: auto; padding: 9px 11px; background: #f7f5f1; }
.dlg-foot {
  flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 9px;
  background: linear-gradient(to bottom, #ece9e4, #dedad3); border-top: 1px solid var(--catia-line-soft);
}
.dlg-foot .foot-msg { flex: 1 1 auto; font-size: 11px; color: var(--catia-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-foot .foot-msg.error { color: var(--bad); }
.dlg-foot .foot-msg.ok { color: var(--ok); }
.btn {
  min-width: 72px; height: 23px; padding: 0 10px; border: 1px solid #8a867d; border-radius: 2px;
  background: linear-gradient(to bottom, #fbfaf8, #e3e0d9); color: var(--catia-text); font-size: 12px;
}
.btn:hover:not(:disabled) { background: linear-gradient(to bottom, #fdfefe, #dcebf7); border-color: var(--catia-blue-light); }
.btn:active:not(:disabled) { background: linear-gradient(to bottom, #d4e4f2, #b9d2e8); }
.btn:disabled { color: var(--catia-text-mute); }
.btn-primary { border-color: var(--catia-blue); background: linear-gradient(to bottom, #e7f2fb, #c3dcf0); font-weight: 700; }
.btn-danger { color: var(--bad); }
.dlg-form { display: flex; flex-direction: column; gap: 5px; }
.form-row { display: flex; align-items: center; gap: 8px; min-height: 23px; }
.form-row > label, .form-row .form-label {
  width: 132px; flex: none; text-align: right; font-size: 11.5px; color: var(--catia-text-dim); padding-right: 2px;
}
.form-row .form-label.required::after { content: " *"; color: var(--bad); }
.form-ctl { flex: 1 1 auto; display: flex; align-items: center; gap: 5px; min-width: 0; }
.form-ctl input[type="text"], .form-ctl input[type="number"], .form-ctl select, .form-ctl textarea {
  flex: 1 1 auto; min-width: 0; height: 21px; border: 1px solid #8a867d; background: #fff; padding: 0 4px; font-size: 12px;
}
.form-ctl textarea { height: 54px; resize: vertical; }
.form-ctl input:focus, .form-ctl select:focus, .form-ctl textarea:focus { border-color: var(--catia-blue); outline: 1px solid var(--catia-blue-light); }
.form-ctl .unit { font-size: 11px; color: var(--catia-text-mute); min-width: 22px; }
.form-ctl input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--catia-blue); }
.spinner { display: flex; align-items: stretch; flex: 1 1 auto; min-width: 0; }
.spinner input { border-right: 0 !important; }
.spin-btns { display: flex; flex-direction: column; border: 1px solid #8a867d; border-left: 0; background: #e9e6e0; }
.spin-btn { width: 16px; height: 10px; border: 0; background: transparent; font-size: 7px; line-height: 10px; padding: 0; color: #444; }
.spin-btn:hover { background: var(--catia-blue-soft); }
.ref-input {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 4px; height: 21px;
  border: 1px solid #8a867d; background: #fff; padding: 0 3px;
}
.ref-input.picked { background: #eef7ff; }
.ref-input .ref-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; color: var(--catia-text-dim); }
.ref-input.picked .ref-label { color: var(--catia-blue-dark); font-weight: 700; }
.ref-btn { height: 17px; min-width: 20px; border: 1px solid var(--catia-line-soft); background: #f0eeea; font-size: 10px; padding: 0 3px; }
.ref-btn:hover { background: var(--catia-blue-soft); }
.ref-list { display: flex; flex-wrap: wrap; gap: 3px; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--catia-blue-light); background: #eaf4fc; border-radius: 2px; padding: 0 5px; font-size: 11px; color: var(--catia-blue-dark); }
.chip .chip-x { border: 0; background: transparent; color: var(--bad); font-size: 10px; padding: 0; }
.form-section { margin: 4px 0 2px; padding: 3px 0 1px; border-top: 1px solid var(--catia-line-soft); font-size: 11px; font-weight: 700; color: var(--catia-blue-dark); }
.form-hint { font-size: 10.5px; color: var(--catia-text-mute); padding-left: 140px; }
.form-error { font-size: 11px; color: var(--bad); background: var(--bad-bg); border: 1px solid #e2b3ae; padding: 3px 6px; border-radius: 2px; margin-top: 3px; }
.dlg-tabs { display: flex; gap: 2px; margin: -9px -11px 8px; padding: 6px 8px 0; background: #e8e5df; border-bottom: 1px solid var(--catia-line-soft); }
.dlg-tab { border: 1px solid var(--catia-line-soft); border-bottom: 0; background: #ddd9d2; padding: 2px 10px; font-size: 11px; border-radius: 2px 2px 0 0; }
.dlg-tab.active { background: #f7f5f1; font-weight: 700; }
.dlg-table { width: 100%; border-collapse: collapse; font-size: 11.5px; background: #fff; }
.dlg-table th { background: #e6e2db; border: 1px solid var(--catia-line-soft); padding: 2px 5px; text-align: left; font-size: 10.5px; color: var(--catia-text-dim); }
.dlg-table td { border: 1px solid #e3e0d9; padding: 2px 5px; }
.dlg-table tr:hover td { background: #eef5fb; }
.dlg-table tr.selected td { background: var(--catia-select-bg); }
.dlg-table .row-actions { white-space: nowrap; }
.dlg-table .mini-btn { height: 17px; border: 1px solid var(--catia-line-soft); background: #f2f0ec; font-size: 10px; padding: 0 5px; margin-right: 3px; }
.dlg-table .mini-btn:hover { background: var(--catia-blue-soft); }
.dlg-info { font-size: 11.5px; line-height: 1.6; }
.dlg-info b { color: var(--catia-blue-dark); }
.dlg-big-value { font-size: 22px; font-weight: 700; color: var(--catia-blue-dark); font-family: var(--mono); }
.dlg-kv { display: grid; grid-template-columns: 132px 1fr; gap: 3px 8px; font-size: 11.5px; align-items: center; }
.dlg-kv .k { text-align: right; color: var(--catia-text-dim); }
.dlg-kv .v { font-family: var(--mono); background: #fff; border: 1px solid var(--catia-line-soft); padding: 1px 5px; }
.dlg-splash { text-align: center; padding: 10px 6px; }
.dlg-splash .splash-title { font-size: 20px; font-weight: 700; color: var(--catia-blue-dark); letter-spacing: 1px; }
.dlg-splash .splash-sub { font-size: 11.5px; color: var(--catia-text-dim); margin-top: 3px; }
.dlg-splash .splash-legal { font-size: 10.5px; color: var(--catia-text-mute); margin-top: 10px; line-height: 1.6; }
.progressbar { height: 14px; border: 1px solid #8a867d; background: #fff; padding: 1px; }
.progressbar i { display: block; height: 100%; background: linear-gradient(to bottom, #8ec3e8, #3f7fb0); width: 0%; transition: width .18s; }
.progressbar.indeterminate i { width: 35%; animation: indeterminate 1.1s linear infinite; }
@keyframes indeterminate { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }

/* ============================================================ 启动画面 / 自检 */
.boot { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 38%, #dfe7ee 0%, #b9c7d3 46%, #7f93a4 100%); }
.boot.done { opacity: 0; pointer-events: none; transition: opacity .35s; }
.boot-card { width: 420px; background: rgba(248, 250, 252, .93); border: 1px solid #7590a6; border-radius: 4px; box-shadow: 0 14px 40px rgba(0, 0, 0, .3); padding: 22px 26px; text-align: center; }
.boot-logo { font-size: 30px; font-weight: 700; letter-spacing: 1px; color: var(--catia-blue-dark); }
.boot-logo span { display: block; font-size: 13px; letter-spacing: 3px; color: var(--catia-blue); margin-top: 2px; }
.boot-sub { margin-top: 8px; font-size: 12px; color: var(--catia-text-dim); }
.boot-bar { height: 10px; margin: 14px 0 10px; border: 1px solid #7f93a4; background: #fff; padding: 1px; }
.boot-bar i { display: block; height: 100%; width: 42%; background: linear-gradient(to bottom, #9ed0f0, #2c5f8a); animation: bootbar 1.5s ease-in-out infinite; }
@keyframes bootbar { 0% { width: 8%; margin-left: 0; } 50% { width: 62%; margin-left: 18%; } 100% { width: 8%; margin-left: 92%; } }
.boot-note { font-size: 11px; color: var(--catia-text-mute); min-height: 15px; }
.boot-legal { margin-top: 10px; font-size: 10px; color: var(--catia-text-mute); }
.selftest-panel {
  position: fixed; right: 12px; bottom: 30px; width: 460px; max-height: 62vh; z-index: 1900;
  background: #f7f6f3; border: 1px solid var(--catia-line); border-radius: 3px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; font-size: 11px;
}
.selftest-panel .st-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 4px 8px; background: linear-gradient(to bottom, #3d7cae, #1e4568); color: #fff; font-weight: 700; }
.selftest-panel .st-head .st-close { margin-left: auto; }
.selftest-panel .st-verdict { padding: 4px 8px; font-weight: 700; }
.selftest-panel .st-verdict.pass { color: var(--ok); background: #e6f4ea; }
.selftest-panel .st-verdict.fail { color: var(--bad); background: var(--bad-bg); }
.selftest-panel .st-list { overflow: auto; padding: 3px 8px 6px; }
.selftest-panel .st-item { display: flex; gap: 6px; padding: 1px 0; border-bottom: 1px dotted #e3e0d9; }
.selftest-panel .st-item .ok { color: var(--ok); font-weight: 700; width: 14px; flex: none; }
.selftest-panel .st-item .fail { color: var(--bad); font-weight: 700; width: 14px; flex: none; }
.selftest-panel .st-item .name { flex: none; width: 178px; font-family: var(--mono); font-size: 10.5px; }
.selftest-panel .st-item .detail { flex: 1 1 auto; color: var(--catia-text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.noscript { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #eee; font-size: 15px; }

/* 窄屏兜底：CATIA 是桌面应用，这里只保证不横向溢出到不可用 */
@media (max-width: 1180px) {
  .brand-unofficial { display: none; }
  .tree-panel { width: 210px; }
  .compass { width: 92px; height: 92px; }
}
