/*
 * 测试页样式：对齐 xeokit-bim-viewer 的观感（深藏青面板 + 白色描边按钮 + Roboto 14px）。
 *
 * 这里的所有数值都是**量出来**的（截图量宽度、取色器取色）：面板 360px/358px、
 * 背景 #03103F、悬停 #477dca、空态 #f2f2f2、tab 选中 3px #CFCFCF 下划线、
 * 树的圆钮 #eee 1.5em 圆、表格行线 #81819a。样式是照着看的，不是拷来的。
 */

html, body {
  height: 100%;
  margin: 0;
  background: #ffffff;
  font-family: Roboto, 'Helvetica Neue', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  touch-action: none;
}

/* ------------------------------------------------------------------ 3D 视图 */

#viewer {
  position: absolute;
  --left: 0;
  --right: 0;
  top: 0;
  bottom: 0;
  left: var(--left);
  right: var(--right);
  width: auto;
  transition: all 300ms ease-in-out;
  z-index: 10000;
}

#canvas { display: block; width: 100%; height: 100%; background: #ffffff; }

/* 导航立方：参照页那个方块约 110px，浮在画布上（没有自己的底色），
   所以这里背景透明，只留右下角一点边距。 */
#navcube {
  position: absolute;
  width: 160px;
  height: 160px;
  bottom: 54px;
  right: 12px;
  z-index: 200000;
  background: transparent;
}

/* viewcube.css 把 .navcube-host 放在 fixed + top:72px（主查看器那个角落）；
   这里把它摆进右下角方块正中。 */
#viewer .navcube-host {
  position: absolute;
  top: auto;
  left: auto;
  right: 6px;
  bottom: 6px;
  width: 148px;
  height: 148px;
}

.document-preview {
  position: absolute;
  inset: 66px 10px 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border: 1px solid #29303a;
  border-radius: 5px;
  background: #f7f8fa;
  color: #152033;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .34);
  overflow: hidden;
  z-index: 300000;
}

.document-preview[hidden] { display: none; }

.document-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 0 8px 0 12px;
  border-bottom: 1px solid #cfd5dd;
  background: #fff;
}

.document-preview-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.document-preview-title strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-preview-title span,
.document-preview-status {
  color: #617087;
  font-size: 11px;
}

.document-preview-actions { display: flex; gap: 5px; }

.document-preview-actions button {
  min-width: 28px;
  padding: 3px 9px;
  border: 1px solid #aeb7c3;
  border-radius: 4px;
  background: #fff;
  color: #26364d;
  font: inherit;
  cursor: pointer;
}

.document-preview-actions button:hover { border-color: #287eaf; color: #12608b; }

.document-preview-status {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-bottom: 1px solid #dde2e8;
  background: #eef3f7;
}
.document-preview-status:empty { display: none; }

.document-preview-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background:
    linear-gradient(45deg, #eceff3 25%, transparent 25%),
    linear-gradient(-45deg, #eceff3 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eceff3 75%),
    linear-gradient(-45deg, transparent 75%, #eceff3 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

#document-preview-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

#document-preview-image[hidden] { display: none; }

.document-preview-cad {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 320px;
  background: #000;
  transition: grid-template-columns 140ms ease;
}

.document-preview-cad[hidden] { display: none; }

#document-preview-cad.cad-layers-open {
  grid-template-columns: 178px minmax(0, 1fr);
}

#document-preview-cad-layers {
  position: relative;
  width: 28px;
  overflow: auto;
  padding: 7px 3px;
  border-right: 1px solid #cfd5dd;
  background: #f0f3f6;
  font-size: 11px;
  transition: width 140ms ease, padding 140ms ease;
}

#document-preview-cad-layers::before {
  content: "图层";
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #26364d;
  font-weight: 600;
  letter-spacing: 1px;
  writing-mode: vertical-rl;
}

#document-preview-cad-layers > * {
  opacity: 0;
  pointer-events: none;
}

#document-preview-cad.cad-layers-open #document-preview-cad-layers {
  width: 178px;
  padding: 7px;
}

#document-preview-cad.cad-layers-open #document-preview-cad-layers::before {
  display: none;
}

#document-preview-cad.cad-layers-open #document-preview-cad-layers > * {
  opacity: 1;
  pointer-events: auto;
}

#document-preview-cad-layers:empty::before {
  content: "读取 CAD 图层…";
  color: #617087;
}

#document-preview-cad-layers label {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  padding: 2px 3px;
  border-radius: 3px;
  cursor: pointer;
}

#document-preview-cad-layers label:hover { background: #e1e8ef; }

#document-preview-cad-layers .cad-layer-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#document-preview-cad-canvas {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #000;
}

#document-preview-cad-canvas canvas { display: block; }

.document-preview-table {
  min-width: 100%;
  padding: 10px;
  box-sizing: border-box;
  background: #fff;
}

.document-preview-table[hidden] { display: none; }

.document-preview-table .meta {
  margin-bottom: 7px;
  color: #617087;
  font-size: 11px;
}

.document-preview-table table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 11px;
}

.document-preview-table th,
.document-preview-table td {
  max-width: 420px;
  padding: 4px 7px;
  border: 1px solid #cfd5dd;
  color: #1d2a3d;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.document-preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2f6;
  font-weight: 600;
}

/* 测试页要对齐参照页的 NavCube；那个 "?" 提示是主查看器那边加的。 */
#navcube .navcube-help { display: none; }

/* -------------------------------------------------------- 两侧面板与开关 */

#explorer_toggle, #inspector_toggle { display: none; }

.toggle_label {
  position: absolute;
  top: 10px;
  color: #03103F;
  background-color: #fff;
  text-align: center;
  border: 2px solid #1d2453;
  padding: .375rem .75rem;
  border-radius: .25rem;
  box-sizing: border-box;
  z-index: 100000;
  transition: all 300ms ease-in-out;
}

.toggle_label:hover { cursor: pointer; color: #477dca; border-color: #477dca; }
.explorer_toggle_label { left: 20px; }
.inspector_toggle_label { right: 20px; }

#explorer_toggle:checked + .explorer_toggle_label,
#inspector_toggle:checked + .inspector_toggle_label {
  color: #fff;
  background-color: #03103F;
  border-color: #03103F;
}

/* 面板打开时开关跟着挪，别压在面板/tab 上（参照页就是这么做的）。 */
#explorer_toggle:checked + .explorer_toggle_label { left: 380px; }
#inspector_toggle:checked + .inspector_toggle_label { right: 380px; }

#explorer {
  position: fixed;
  top: 0;
  left: -360px;
  width: 360px;
  height: calc(100% - 46px);
  padding: 0 0 16px 15px;
  box-sizing: border-box;
  color: #fff;
  background: #03103F;
  border-right: 2px solid #212529;
  overflow: hidden;
  user-select: none;
  z-index: 10;
  transition: all 300ms ease-in-out;
}

#explorer_toggle:checked ~ #explorer { left: 0; }
#explorer_toggle:checked ~ #viewer { --left: 360px; }
#explorer_toggle:checked ~ #toolbar { left: 455px; }

#inspector {
  position: absolute;
  top: 0;
  right: -360px;
  width: 358px;
  height: calc(100% - 46px);
  color: #fff;
  background: #03103F;
  border-left: 2px solid #212529;
  overflow: auto;
  z-index: 40;
  transition: all 300ms ease-in-out;
  display: flex;
  flex-direction: column;
}

#inspector_toggle:checked ~ #inspector { right: 0; }
#inspector_toggle:checked ~ #viewer { --right: 358px; }
/* 属性面板打开时工具栏让出右侧，否则第三个按钮组会钻到面板下面。 */
#inspector_toggle:checked ~ #toolbar { right: 378px; }

/* 属性面板里的分页：属性 / 剖切 / 碰撞 / 净高 / 批注 / 书签 / 帮助 */
.inspector-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 8px 8px 0;
  border-bottom: 1px solid #212529;
  flex: 0 0 auto;
}

.inspector-tab {
  font-family: inherit;
  font-size: 13px;
  color: #CFCFCF;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 5px 7px;
  cursor: pointer;
}

.inspector-tab:hover { color: #477dca; }
.inspector-tab.active { color: #fff; border-bottom-color: #CFCFCF; }

.inspector-body {
  display: none;
  padding: 10px 10px 24px;
  overflow: auto;
  flex: 1 1 auto;
}

.inspector-body.active { display: block; }

.inspector-body .field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13px;
}

.inspector-body .field > label { min-width: 64px; color: #CFCFCF; }
.inspector-body .field input[type="number"] { width: 84px; }
.inspector-body .field input[type="search"] { flex: 1 1 auto; min-width: 0; }
.inspector-body .field input[type="range"] { flex: 1 1 auto; }
.inspector-body .field select { flex: 1 1 auto; }
.inspector-body .field .value,
.inspector-body .field .unit { color: #cfcfcf; font-variant-numeric: tabular-nums; }
.inspector-body .check { display: flex; gap: 6px; align-items: center; }

.inspector-body .row-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.inspector-body .analysis-primary-actions .primary {
  flex: 1 1 150px;
  color: #fff;
  border-color: #3d87ad;
  background: linear-gradient(180deg, #2c6e8d, #24566f);
  font-weight: 600;
}
.inspector-body .analysis-primary-actions .primary:hover {
  border-color: #67b8dc;
  background: linear-gradient(180deg, #347d9e, #29647f);
}
.inspector-body .analysis-advanced {
  margin-top: 10px;
  border: 1px solid #2a323c;
  border-radius: 7px;
  background: rgba(15, 20, 26, 0.34);
}
.inspector-body .analysis-advanced > summary {
  cursor: pointer;
  padding: 7px 9px;
  color: #b9c6d1;
  font-size: 12px;
  user-select: none;
}
.inspector-body .analysis-advanced[open] > summary {
  border-bottom: 1px solid #2a323c;
  color: #e6ebf1;
}
.inspector-body .analysis-advanced > :not(summary) {
  margin-left: 9px;
  margin-right: 9px;
}
.inspector-body .hint { color: #99A4AD; font-size: 12px; margin: 6px 0; }
.inspector-body .xeokit-btn {
  padding: 5px 11px;
  border: 1px solid #2a323c;
  border-radius: 6px;
  background: #1e242c;
  color: #e6ebf1;
  font-size: 12px;
  line-height: 18px;
}
.inspector-body .xeokit-btn:hover {
  color: #fff;
  border-color: #4aa8d8;
}
.inspector-body .xeokit-btn.active {
  color: #fff;
  border-color: #4aa8d8;
  background: #23465a;
}

.headroom-person-presets {
  padding: 6px;
  border: 1px solid #2a323c;
  border-radius: 7px;
  background: rgba(25, 31, 39, 0.72);
}

.headroom-person-presets .xeokit-btn {
  flex: 1 1 calc(50% - 6px);
  min-width: 112px;
}

.result-list { margin-top: 8px; }

.result-item {
  border-top: 1px solid #81819a;
  padding: 7px 4px;
  font-size: 13px;
  cursor: pointer;
}

.result-item:hover { background: rgba(255, 255, 255, 0.08); }
.result-item.selected {
  background: rgba(60, 151, 188, 0.18);
  box-shadow: inset 3px 0 0 #55b9df;
}
.result-item.active-slice {
  background: rgba(71, 125, 202, 0.32);
  border-left: 3px solid #477dca;
  padding-left: 6px;
}
.result-item.revit-view-active {
  background: rgba(76, 175, 110, 0.16);
  border-left: 3px solid #4caf6e;
  padding-left: 6px;
}
.result-item .meta { color: #99A4AD; font-size: 12px; }
.result-item .actions { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.result-item textarea,
.result-item .actions input,
.result-item .actions select {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
  font: inherit;
}
.result-item textarea {
  width: 100%;
  margin-top: 6px;
  resize: vertical;
}
.parameter-row > td { padding: 0; }
.parameter-group { margin: 4px 0; }
.parameter-group > summary {
  cursor: pointer;
  color: #CFCFCF;
  font-weight: 600;
  padding: 5px 4px;
}
.parameter-group .xeokit-table { width: 100%; }
.result-item button {
  font-family: inherit;
  font-size: 12px;
  color: #e6ebf1;
  background: #1e242c;
  border: 1px solid #2a323c;
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
}
.result-item button:hover { border-color: #4aa8d8; color: #fff; }

/* ------------------------------------------------------------------- tabs */

.xeokit-tabs { padding-top: 10px; height: 78px; }
.xeokit-tab { display: inline; list-style: none; }

.xeokit-tab-btn {
  display: inline-block;
  font-size: 20px;
  color: #CFCFCF;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 0.5em 10px 0.5em 0;
  font-family: inherit;
  cursor: pointer;
}

.xeokit-tab-btn:hover { color: #477dca; }
.xeokit-tab.active .xeokit-tab-btn { border-bottom-color: #CFCFCF; color: #fff; }

.xeokit-tab-content { display: none; height: calc(100% - 120px); }
.xeokit-tab-content.active { display: block; }
.xeokit-tab-content[data-body="loads"].active {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.load-tree-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 4px 8px;
}
.load-tree-tools .display-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #c5d0db;
  font-size: 12px;
}
.load-tree-tools input {
  accent-color: #4aa8d8;
}
.load-tree-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 0 4px 8px;
}
.load-tree-filter-grid .display-control {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
  color: #9aa7b5;
  font-size: 11px;
}
.load-tree-filter-grid select {
  min-width: 0;
  width: 100%;
  height: 24px;
  border: 1px solid #33414f;
  border-radius: 5px;
  background: #18212a;
  color: #e6edf4;
  font-size: 11px;
}
.xeokit-tab-content[data-body="loads"] #tree-loads {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}
.xeokit-tab-content .xeokit-btn-group {
  gap: 5px;
  margin: 0 0 6px;
  flex-wrap: wrap;
}
.xeokit-tab-content .xeokit-btn {
  padding: 4px 10px;
  border: 1px solid #2a323c;
  border-radius: 6px;
  background: #1e242c;
  color: #e6ebf1;
  font-size: 12px;
  line-height: 18px;
}
.xeokit-tab-content .xeokit-btn:hover {
  color: #fff;
  border-color: #4aa8d8;
}
.xeokit-tab-content .xeokit-btn.active {
  background: #23465a;
  border-color: #4aa8d8;
}

/* ------------------------------------------------------- 按钮（含工具栏） */

#toolbar {
  position: fixed;
  top: 0;
  left: 95px;
  min-width: 400px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  pointer-events: none;
  z-index: 100000;
  transition: all 300ms ease-in-out;
}

.xeokit-btn-group { display: inline-flex; margin: 0 1.2rem 3px 0; pointer-events: none; }

.xeokit-btn {
  font-size: 14px;
  color: #03103F;
  background-color: #fff;
  border: 2px solid #1d2453;
  border-radius: .25rem;
  padding: .375rem .75rem;
  margin: 0 2px 0 0;
  cursor: pointer;
  pointer-events: all;
  transition: color .15s ease-in-out, background-color .15s ease-in-out,
    border-color .15s ease-in-out, box-shadow .15s ease-in-out;
}

.xeokit-btn.fa-2x, .xeokit-btn.fas.fa-2x, .xeokit-btn.far.fa-2x, .xeokit-btn.fab.fa-2x {
  padding: .375rem .6rem;
  line-height: 1;
}
/* 图标按钮的字体族来自 FontAwesome 的 .fa/.fas 规则，所以 `.xeokit-btn` 里
   **不能**再声明 font-family —— 本文件在 all.min.css 之后，一声明就把图标字体
   盖成继承字体，按钮里只剩豆腐块。文字按钮（tab）自己写 inherit。 */

.xeokit-btn:hover { color: #477dca; border-color: #477dca; }
.xeokit-btn.active { color: #fff; background-color: #03103F; border-color: #03103F; }
.xeokit-btn.active:hover { background: #477dca; border-color: #477dca; }
.xeokit-btn.disabled { opacity: .55; color: #99A4AD; border-color: #6c757d; pointer-events: none; }

.xeokit-btn .count { margin-left: 4px; }

/* 量距 / 量角读数：固定覆盖整屏，但坐标是在 `measure.update()` 里按画布矩形
   加上 left/top 的，所以左右面板打开时标签仍贴在被量的点上。 */
#labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200000;
}

#grid-labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200001;
}

/* The 3D datum labels live above the document-preview panel because they use
   a fixed overlay. A drawing preview owns its own model-space grid labels. */
body.document-preview-open #grid-labels,
body.document-preview-open #revit-text-labels,
body.document-preview-open #labels {
  visibility: hidden !important;
}

#revit-text-labels {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.revit-text-label {
  position: absolute;
  left: 0;
  top: 0;
  padding: 1px 3px;
  color: #17232d;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 2px;
  font-size: 11px;
  line-height: 1.25;
  max-width: 168px;
  max-height: 3.75em;
  overflow: hidden;
  white-space: pre-line;
  text-shadow: 0 0 2px #fff;
  box-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
  transform-origin: 50% 50%;
}

#labels.clip-interacting > * {
  visibility: hidden;
}

.grid-label {
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid #37474f;
  background: #ffffff;
  color: #263238;
  font-size: 13px;
  font-weight: 500;
  line-height: 27px;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
  cursor: pointer;
}

.load-progress {
  position: fixed;
  inset: 0;
  z-index: 500000;
  display: grid;
  place-items: center;
  background: rgba(3, 16, 63, .18);
  backdrop-filter: blur(2px);
}

.load-progress[hidden] { display: none; }

.load-progress-card {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 290px;
  padding: 20px 24px;
  border: 1px solid rgba(3, 16, 63, .16);
  border-radius: 12px;
  background: #fff;
  color: #03103F;
  box-shadow: 0 16px 48px rgba(3, 16, 63, .24);
}

.load-progress-dial {
  --progress: 0;
  position: relative;
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  border-radius: 50%;
  background:
    conic-gradient(from -90deg, #2cc8e5 calc(var(--progress) * 1%), #dce3eb 0);
  box-shadow: inset 0 0 0 1px rgba(3, 16, 63, .08);
}

.load-progress-dial::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from -90deg,
    rgba(3, 16, 63, .28) 0deg 1.2deg,
    transparent 1.2deg 30deg
  );
  mask: radial-gradient(circle, transparent 0 39px, #000 40px 47px, transparent 48px);
}

.load-progress-dial::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #fff;
}

.load-progress-value {
  position: absolute;
  inset: 10px;
  display: grid;
  place-items: center;
  z-index: 1;
  color: #03103F;
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.load-progress-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.load-progress-copy strong {
  max-width: 310px;
  overflow: hidden;
  color: #03103F;
  font-size: 16px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.load-progress-copy span {
  color: #52657d;
  font-size: 13px;
}

.load-progress.is-error .load-progress-dial {
  background: conic-gradient(#d64545 calc(var(--progress) * 1%), #dce3eb 0);
}

.measure-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 176, 32, 0.94);
  color: #3a2703;
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.structural-load-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--load-color) 72%, #ffffff);
  border-radius: 4px;
  background: color-mix(in srgb, var(--load-color) 88%, #ffffff);
  color: #071a2b;
  box-shadow: 0 2px 8px rgba(3, 16, 63, 0.16);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

.headroom-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(229, 72, 61, 0.92);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.headroom-failure-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 3px 7px;
  border: 1px solid rgba(255, 233, 229, 0.96);
  border-radius: 5px;
  background: rgba(190, 35, 28, 0.96);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 9px rgba(58, 0, 0, 0.35);
  pointer-events: none;
}

.headroom-person-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

.headroom-person-label.pass { background: rgba(29, 139, 88, 0.94); }
.headroom-person-label.fail { background: rgba(196, 55, 47, 0.95); }
.headroom-fill-label {
  position: absolute;
  top: 0;
  left: 0;
  padding: 3px 7px;
  border: 1px solid rgba(211, 239, 255, 0.92);
  border-radius: 5px;
  background: rgba(17, 105, 170, 0.94);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}
.result-item.headroom-person-pass { border-left: 3px solid #36b37e; padding-left: 7px; }
.result-item.headroom-person-fail { border-left: 3px solid #e45757; padding-left: 7px; }
.result-item.room-headroom-pass { border-left: 3px solid #2fbf71; padding-left: 7px; }
.result-item.room-headroom-fail { border-left: 3px solid #e45757; padding-left: 7px; }
.result-item.room-headroom-unknown { border-left: 3px solid #e6a23c; padding-left: 7px; }
.result-item.preprocess-ready { border-left: 3px solid #2fbf71; padding-left: 7px; }
.result-item.preprocess-missing { border-left: 3px solid #e6a23c; padding-left: 7px; }
.result-item.preprocess-ready .meta,
.result-item.preprocess-missing .meta { white-space: pre-line; }

.analysis-label {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 72px;
  max-width: 280px;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  background: rgba(185, 28, 28, 0.92);
  color: #fff;
  font-size: 11px;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 2px 9px rgba(50, 0, 0, 0.34);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.28);
}

.display-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 220000;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  box-sizing: border-box;
  padding: 0 12px;
  border-top: 1px solid #2a323c;
  border-radius: 10px 10px 0 0;
  background: rgba(23, 27, 33, 0.94);
  color: #e6ebf1;
  font: 13px/19.5px -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  backdrop-filter: blur(6px);
}

.display-bar .bar-grp {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
}
.display-bar .bar-label {
  flex: 0 0 auto;
  color: #8b97a6;
  font-size: 10px;
  line-height: 15px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.display-bar .bar-sep {
  flex: 0 0 auto;
  width: 1px;
  height: 22px;
  background: #2a323c;
}
.display-bar button {
  min-height: 29px;
  box-sizing: border-box;
  padding: 5px 12px;
  border: 1px solid #2a323c;
  border-radius: 6px;
  background: #1e242c;
  color: #e6ebf1;
  font: 12px Arial, sans-serif;
  cursor: pointer;
}
.display-bar button:hover { color: #fff; border-color: #4aa8d8; }
.display-bar button.active { color: #fff; border-color: #4aa8d8; background: #23465a; }
.display-bar button.is-error { color: #ffd8d4; border-color: #a44b45; background: #4a2525; }
.display-bar button:disabled { opacity: .45; cursor: not-allowed; }
.display-bar .precision-control select { min-width: 118px; max-width: 150px; }
.display-bar .precision-control select.is-error { color: #ffd8d4; border-color: #a44b45; background: #4a2525; }
.display-bar .precision-control select:disabled { opacity: .55; cursor: wait; }
.display-bar .display-control {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  color: #8b97a6;
  font: 12px/18px -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}
.display-bar select {
  height: 22px;
  max-width: 96px;
  padding: 2px 4px;
  border: 1px solid #2a323c;
  border-radius: 6px;
  background: #1e242c;
  color: #e6ebf1;
  font: 12px Arial, sans-serif;
}
.display-bar .display-select { gap: 5px; }
#load-storey-filter { max-width: 128px; }
#load-case-filter { max-width: 150px; }
.display-bar input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
  accent-color: #4aa8d8;
}
.display-bar .exposure-control { min-width: 100px; }
.display-bar input[type="range"] {
  width: 92px;
  margin: 2px;
  accent-color: #4aa8d8;
}

#perf-hud {
  position: fixed;
  left: 12px;
  bottom: 58px;
  z-index: 350000;
  padding: 7px 10px;
  border-radius: 4px;
  background: rgba(3, 16, 63, 0.9);
  color: #fff;
  font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre;
  pointer-events: none;
}
#perf-hud[hidden] { display: none; }

/* 剖切按钮：右下角一个小三角（打开切片菜单），数字是刀数。 */
.section-button { position: relative; padding-right: 1.1rem; }

.section-button .count {
  display: inline-block;
  min-width: .9em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.section-button .menu-arrow {
  position: absolute;
  right: 0;
  bottom: 0;
  /* 看得见的是个小三角，但可点区域给 18×18 —— 参照页那个箭头也只有几个像素宽，
     真去点的时候很难瞄。 */
  width: 18px;
  height: 18px;
}

.section-button .menu-arrow::before {
  content: '';
  position: absolute;
  right: 4px;
  bottom: 4px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}

.context-menu {
  position: fixed;
  z-index: 300000;
  min-width: 190px;
  padding: 4px;
  background: #fff;
  color: #03103F;
  border: 1px solid #1d2453;
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  font-size: 13px;
}

.context-menu .menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
}

.context-menu .menu-row:hover { background: #e7eef8; }
.context-menu button { font-family: inherit; font-size: 12px; cursor: pointer; }

/* 层级菜单：和参照页一样按 group 分组，item 右侧再挂二级菜单。 */
.context-menu .menu-group + .menu-group {
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px solid #9aa3b5;
}

.context-menu .menu-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 170px;
  padding: 4px 20px 4px 7px;
  cursor: pointer;
  user-select: none;
}

.context-menu .menu-item:hover,
.context-menu .menu-item.open { background: #e7eef8; }
.context-menu .menu-item.disabled { color: #9aa3b5; cursor: default; background: transparent; }
.context-menu .menu-label { white-space: nowrap; }
.context-menu .submenu-arrow { color: #4a5568; font-size: 11px; }

.context-submenu {
  position: absolute;
  left: 100%;
  top: -4px;
  display: block;
  min-width: 150px;
}

.context-submenu[hidden] { display: none; }

/* 切片按钮右下的小三角：菜单打开时翻转，和 xeokit 的 arrow-up 一样。 */
.section-button .menu-arrow.open::before {
  border-top-color: transparent;
  border-bottom: 5px solid currentColor;
  bottom: 3px;
}

/* tippy 风格的悬停提示：白底深色字，贴在按钮下沿。 */
.xeokit-tooltip {
  position: fixed;
  z-index: 500000;
  padding: 4px 8px;
  background: #03103F;
  color: #fff;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  display: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.xeokit-tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  top: -5px;
  margin-left: -5px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid #03103F;
}

/* 相机旋转枢轴：照 xeokit-bim-viewer 的 .xeokit-camera-pivot-marker。 */
#pivot-marker {
  position: fixed;
  left: 0;
  top: 0;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 2px solid #ebebeb;
  background: radial-gradient(circle, #fff 0 2px, #000 2.5px 100%);
  box-shadow: 5px 5px 15px 1px #000;
  z-index: 250000;
  pointer-events: none;
  display: none;
  transform: translate(-50%, -50%);
}

.xeokit-tree-panel li span.tree-highlight {
  color: #03103F;
  background: #ffe082;
  border-radius: 3px;
}

/* ---------------------------------------------------------------- 树与表格 */

.xeokit-tree-panel { height: calc(100% - 60px); overflow: auto; }

.xeokit-tree-panel ul { list-style: none; padding-left: 1.75em; margin: 0; }
.xeokit-tree-panel ul.root { padding-left: 0.25em; }

.xeokit-tree-panel li {
  position: relative;
  margin: 2px 0;
  line-height: 3ex;
  white-space: nowrap;
}

.xeokit-tree-panel li a.switch {
  position: absolute;
  left: -1.35em;
  top: 50%;
  width: 14px;
  height: 18px;
  margin-top: -9px;
  background: transparent;
  color: #8b97a6;
  border-radius: 0;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  font-size: 10px;
  line-height: 18px;
  transition: transform .15s ease, color .15s ease;
}
.xeokit-tree-panel li a.switch::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 5px;
  width: 0;
  height: 0;
  border-left: 6px solid #aeb9c6;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}
.xeokit-tree-panel li:not(.collapsed) > a.switch {
  transform: rotate(90deg);
}
.xeokit-tree-panel li a.switch:hover {
  color: #fff;
  background: transparent;
}
.xeokit-tree-panel li a.switch:hover::before {
  border-left-color: #fff;
}

.xeokit-tree-panel li input { vertical-align: middle; accent-color: #4aa8d8; }

.xeokit-tree-panel li span {
  display: inline-block;
  width: calc(100% - 50px);
  padding-left: 2px;
  vertical-align: middle;
  cursor: pointer;
}
.xeokit-tree-panel li > span.tree-title {
  width: auto;
  max-width: calc(100% - 62px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.xeokit-tree-panel li:has(> span.tree-meta) > span.tree-title {
  max-width: calc(100% - 150px);
}
.xeokit-tree-panel li[data-level] > span.tree-title {
  max-width: calc(100% - 132px);
}

.xeokit-tree-panel li span:hover { color: #fff; background: rgba(255, 255, 255, 0.2); }
.xeokit-tree-panel li.collapsed > ul { display: none; }
.xeokit-tree-panel li.hidden-node > span { color: #99A4AD; }
.xeokit-tree-panel li[data-document-status="unavailable"] > span.tree-title {
  color: #e6b566;
}
.xeokit-tree-panel li[data-document-status="unavailable"] > span.tree-title::before {
  content: '!';
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  margin-right: 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 9px;
  line-height: 1;
}
.xeokit-tree-panel li[data-kind^="revit-view:"] > span.tree-title {
  color: #bfe8ff;
}
.xeokit-tree-panel li[data-kind^="document-category:"] > span.tree-title {
  font-weight: 600;
}
.xeokit-tree-panel li.active-document > span.tree-title {
  color: #8ff5c2;
  background: rgba(76, 175, 110, 0.16);
}
.xeokit-tree-panel li.active-floor > span:not(.tree-count) {
  color: #b9e77e;
  font-weight: 600;
}
.xeokit-tree-panel li.active-load-filter > span.tree-title {
  color: #fff;
  background: rgba(74, 168, 216, 0.4);
  border-radius: 3px;
}
.xeokit-tree-panel .tree-actions { padding: 6px 0 10px 4px; }
.xeokit-tree-panel .tree-count {
  display: inline-block;
  width: auto;
  min-width: 1.6em;
  margin-left: 5px;
  padding: 0 4px 0 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: #cfd8e3;
  font-size: 10px;
  line-height: 1.55;
  text-align: center;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
  cursor: default;
}
.xeokit-tree-panel .tree-meta {
  display: inline-block;
  width: auto;
  margin-left: 6px;
  padding: 0;
  color: #9cc7df;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  cursor: default;
  max-width: 108px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.xeokit-tree-panel .tree-meta:hover {
  color: #9cc7df;
  background: transparent;
}

#clipbox-editor {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #81819a;
  font-size: 12px;
}
#clipbox-editor:empty { display: none; }
.clipbox-grid {
  display: grid;
  grid-template-columns: 58px repeat(3, minmax(0, 1fr));
  gap: 5px 7px;
  align-items: center;
  margin-top: 6px;
}
.clipbox-grid .clipbox-head { color: #99a4ad; font-size: 11px; }
.clipbox-grid label { color: #cfcfcf; white-space: nowrap; }
.clipbox-grid input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: #fff;
  color: #03103f;
  border: 1px solid #1d2453;
  border-radius: 3px;
  padding: 2px 4px;
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.walk-stop {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.walk-stop .walk-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #00d6a3;
  color: #03103f;
  font-weight: 700;
}

.xeokit-table { width: 100%; display: table; box-sizing: border-box; }
.xeokit-table .td1, .xeokit-table th {
  padding: .6em;
  vertical-align: top;
  border-top: 1px solid #81819a;
  border-right: 1px solid #81819a;
  white-space: nowrap;
  font-weight: bold;
  width: 150px;
  max-width: 150px;
}

.xeokit-table .td2 { padding: .5em; vertical-align: top; border-top: 1px solid #81819a; }
.xeokit-table .section td { padding-top: 1.2em; font-weight: bold; color: #CFCFCF; border-top: 0; }
.xeokit-table .empty { padding: 1em .6em; color: #CFCFCF; }

/* --------------------------------------------------------------- navcube  */

#navcube .vc-host { position: absolute; inset: 0; }

/* --------------------------------------------------------------- 拖放提示  */

#drop {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(3, 16, 63, 0.35);
  color: #fff;
  font-size: 20px;
  z-index: 300000;
}

#drop.show { display: flex; }
