/* =========================================================
   空间造物 · 3D 选配模拟器  —  样式表
   ========================================================= */
:root {
  --bg-app: #12151b;
  --bg-panel: #191e27;
  --bg-panel-2: #1f2531;
  --bg-input: #12161d;
  --line: #2b3341;
  --line-soft: #232a36;
  --text: #e7ecf3;
  --text-2: #9aa6b8;
  --text-3: #6b7688;
  --accent: #3d8bff;
  --accent-2: #22d3ee;
  --accent-dim: rgba(61, 139, 255, 0.16);
  --danger: #ff5c5c;
  --ok: #38d39f;
  --radius: 9px;
  --radius-sm: 6px;
  --topbar-h: 54px;
  --status-h: 28px;
  --left-w: 268px;
  --right-w: 272px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg-app);
  color: var(--text);
  font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

h1,
h2,
h3,
h4,
p,
ul {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

code {
  font-family: ui-monospace, Consolas, "SF Mono", Menlo, monospace;
  font-size: 11px;
  background: #0d1117;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
}

kbd {
  display: inline-block;
  min-width: 17px;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #0e1219;
  font-family: inherit;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  color: var(--text);
}

/* ======================= 布局 ======================= */
#app {
  display: grid;
  grid-template-columns: var(--left-w) 1fr var(--right-w);
  grid-template-rows: var(--topbar-h) 1fr var(--status-h);
  height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: linear-gradient(180deg, #1d2330, #171c25);
  border-bottom: 1px solid var(--line);
  z-index: 30;
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar::-webkit-scrollbar {
  display: none;
}

.sidebar {
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar.left {
  border-right: 1px solid var(--line);
}

.sidebar.right {
  border-left: 1px solid var(--line);
}

.stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: #0d1015;
  overflow: hidden;
}

#viewport {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.statusbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: #161a22;
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: 11.5px;
  z-index: 30;
}

.statusbar .sep {
  width: 1px;
  height: 12px;
  background: var(--line);
}

.tb-spacer {
  flex: 1 1 auto;
}

/* ======================= 品牌 ======================= */
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-right: 12px;
  border-right: 1px solid var(--line);
  flex: 0 0 auto;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #dceaff;
  background: linear-gradient(145deg, #2f6fd0, #16407e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-text b {
  font-size: 13.5px;
  letter-spacing: .5px;
}

.brand-text span {
  font-size: 10.5px;
  color: var(--text-3);
}

/* ======================= 工具栏 ======================= */
.tb-group {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 32px;
  border-right: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

.tb-group:last-child {
  border-right: none;
}

.tb-label {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  margin-right: 1px;
}

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #1b212b;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: .14s;
}

.tb-btn:hover {
  background: #232b38;
  color: var(--text);
  border-color: #3a4557;
}

.tb-btn:active {
  transform: translateY(1px);
}

.tb-btn.icon {
  padding: 0 7px;
}

/* 清空：带文字的显眼按钮，hover 才上红，避免误以为危险操作 */
.tb-btn.danger {
  color: #f0b3ab;
  border-color: rgba(217, 87, 79, .4);
}

.tb-btn.danger:hover {
  background: rgba(217, 87, 79, .2);
  border-color: rgba(217, 87, 79, .72);
  color: #ffe0db;
}

.tb-btn.danger:active {
  transform: translateY(1px);
}

.tb-btn.toggle.active {
  background: var(--accent-dim);
  border-color: rgba(61, 139, 255, .55);
  color: #b7d5ff;
  box-shadow: inset 0 0 0 1px rgba(61, 139, 255, .12);
}

.tb-btn.armed {
  background: rgba(34, 211, 238, .18);
  border-color: rgba(34, 211, 238, .6);
  color: #b6f2ff;
}

.tb-select {
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #1b212b;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  outline: none;
}

.tb-select.wide {
  min-width: 116px;
}

.segmented {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #1b212b;
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border: none;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: .14s;
}

.segmented button:last-child {
  border-right: none;
}

.segmented button em {
  font-style: normal;
}

.segmented button:hover {
  background: #232b38;
  color: var(--text);
}

.segmented button.active {
  background: var(--accent);
  color: #fff;
}

/* ======================= 面板通用 ======================= */
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 13px 9px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

.panel-head h2 {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .4px;
  color: #cfd8e6;
}

.panel-head .hint {
  font-size: 11px;
  color: var(--text-3);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ======================= 模型库 ======================= */
.lib-search {
  position: relative;
  margin: 10px 12px 8px;
  flex: 0 0 auto;
}

.lib-search svg {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.lib-search input {
  width: 100%;
  height: 30px;
  padding: 0 8px 0 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  outline: none;
}

.lib-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 139, 255, .13);
}

.lib-tabs {
  display: flex;
  gap: 4px;
  padding: 0 12px 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.lib-tabs button {
  height: 24px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 20px;
  background: #1e2430;
  color: var(--text-2);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: .14s;
}

.lib-tabs button:hover {
  color: var(--text);
  background: #26303e;
}

.lib-tabs button.active {
  background: var(--accent-dim);
  border-color: rgba(61, 139, 255, .5);
  color: #b7d5ff;
}

/* ---- 模型库 / 预设面板顶部的操作按钮 ---- */
.lib-tools {
  display: flex;
  gap: 6px;
  padding: 0 12px 8px;
  flex: 0 0 auto;
}

/* 选中「我的预设」分类时隐藏：那一屏的动作是"存预设"，不是"传模型 / 建分类" */
.lib-tools.hide {
  display: none;
}

.lib-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 27px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1e2430;
  color: var(--text-2);
  font: inherit;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: .14s;
}

.lib-btn:hover {
  color: var(--text);
  background: #26303e;
  border-color: rgba(61, 139, 255, .45);
}

.lib-btn.primary {
  background: var(--accent-dim);
  border-color: rgba(61, 139, 255, .5);
  color: #cfe2ff;
}

.lib-btn.primary:hover {
  background: rgba(61, 139, 255, .26);
  color: #fff;
}

.lib-btn.danger:hover {
  border-color: rgba(255, 123, 123, .55);
  color: #ffb0b0;
}

.lib-btn[disabled] {
  opacity: .42;
  cursor: not-allowed;
}

.lib-btn svg {
  flex: 0 0 auto;
}

/* ---- 选中自定义分类时才出现的操作条 ---- */
.lib-catops {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 12px 8px;
  padding: 4px 4px 4px 9px;
  border: 1px solid rgba(61, 139, 255, .28);
  border-radius: 6px;
  background: rgba(61, 139, 255, .08);
  font-size: 11px;
  color: #a9c4e8;
  flex: 0 0 auto;
}

.lib-catops.hide {
  display: none;
}

.lib-catops .lco-name {
  font-weight: 600;
  color: #cfe2ff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lco-btn {
  border: 0;
  background: transparent;
  color: #9fb6d6;
  font: inherit;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
}

.lco-btn:hover {
  background: rgba(255, 255, 255, .09);
  color: #fff;
}

.lco-btn.del:hover {
  color: #ffb0b0;
}

.lib-grid {
  /* ⚠️ 这一条曾经让模型库整片"塌成一条"：
     `.lib-grid` 是 flex 项（高度确定）+ overflow-y:auto（滚动容器），而这种组合下
     「auto 行高」不会按内容溢出，而是被压缩塞进容器 —— 15 行平分 461px = 每行 22px，
     卡片被 overflow:hidden 裁掉大半，看起来只剩一个小色条。
     修法两件套：① grid-auto-rows:max-content 把行高显式钉成内容高度（让容器正常滚动）；
                ② flex 基数改 0，只吃剩余空间，不再把同栏的场景列表挤没。 */
  flex: 1 1 0;
  min-height: 0;
  grid-auto-rows: max-content;
  overflow-y: auto;
  padding: 4px 12px 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-content: start;
}

.lib-grid::-webkit-scrollbar,
.prop-body::-webkit-scrollbar {
  width: 8px;
}

.lib-grid::-webkit-scrollbar-thumb,
.prop-body::-webkit-scrollbar-thumb {
  background: #2c3442;
  border-radius: 8px;
}

.lib-grid::-webkit-scrollbar-thumb:hover,
.prop-body::-webkit-scrollbar-thumb:hover {
  background: #3a4557;
}

.lib-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #1e242f, #1a1f28);
  padding: 6px 6px 7px;
  cursor: grab;
  transition: .14s;
  overflow: hidden;
}

.lib-card:hover {
  border-color: rgba(61, 139, 255, .6);
  background: linear-gradient(180deg, #232b39, #1d232d);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .34);
}

.lib-card:active {
  cursor: grabbing;
}

.lib-card .thumb {
  height: 62px;
  border-radius: var(--radius-sm);
  background: radial-gradient(120% 90% at 50% 12%, #33415a 0%, #1b2130 72%);
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  overflow: hidden;
}

.lib-card .thumb svg {
  width: 100%;
  height: 100%;
}

.lib-card .nm {
  font-size: 11.5px;
  color: #d3dceb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lib-card .sz {
  font-size: 10px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.lib-card .cat-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

/* 上传的模型：卡片预览是离屏渲染出来的真实缩略图，不是等轴测 SVG */
.lib-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.lib-card.broken {
  opacity: .45;
}

.lib-card.broken .nm::after {
  content: '（读不出来）';
  color: #ff9d9d;
}

/* 自定义模型卡左上角的改名 / 删除 */
.lib-card .lc-acts {
  position: absolute;
  top: 4px;
  left: 4px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: .14s;
  z-index: 2;
}

.lib-card:hover .lc-acts {
  opacity: 1;
}

.lc-acts button {
  width: 20px;
  height: 20px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: rgba(9, 13, 20, .74);
  color: #c3cddc;
  cursor: pointer;
}

.lc-acts button:hover {
  background: rgba(9, 13, 20, .94);
  color: #fff;
}

.lc-acts button.del:hover {
  color: #ff9d9d;
}

/* ---- 我的预设（模型库里的一个分类，卡片外观与模型卡共用 .lib-card）---- */
.lib-card.preset .thumb {
  /* 预设是"一组"，缩略图底色比单件模型略暖一点，扫一眼能区分开 */
  background: radial-gradient(120% 90% at 50% 12%, #3a4a63 0%, #1b2130 72%);
}

/* 缩略图抓失败时的兜底占位（别留一块空灰） */
.lib-card .thumb.noimg {
  font-size: 10px;
  color: var(--text-3);
}

/* 页签上的计数：目前只有「我的预设」用 */
.lib-tabs button .tab-n {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 8px;
  background: rgba(61, 139, 255, .22);
  color: #b7d5ff;
  font-style: normal;
  font-size: 10px;
  line-height: 14px;
  vertical-align: middle;
}

.lib-tabs button.active .tab-n {
  background: rgba(61, 139, 255, .4);
  color: #e6f0ff;
}

/* 预设操作条里的主按钮：.lco-btn 本来是小文字按钮，这一颗是主要动作 */
.lco-btn.primary {
  background: var(--accent-dim);
  color: #cfe2ff;
  font-weight: 600;
}

.lco-btn.primary:hover {
  background: rgba(61, 139, 255, .3);
  color: #fff;
}

.lco-btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
}

.lco-btn[disabled]:hover {
  background: transparent;
  color: #9fb6d6;
}

/* 多选时属性面板顶部的说明条 */
.multi-warn {
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid rgba(61, 139, 255, .3);
  border-left: 3px solid #3d8bff;
  border-radius: 7px;
  background: rgba(61, 139, 255, .1);
  font-size: 11px;
  line-height: 1.7;
  color: #b9d2f2;
}

.multi-warn.hide {
  display: none;
}

.multi-warn b {
  color: #dbe9ff;
}

/* 弹层里的下拉 */
.np-select {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #151a22;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}

.np-select:focus {
  outline: 0;
  border-color: rgba(61, 139, 255, .6);
}

.lib-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.9;
  padding: 26px 8px;
}

.lib-empty b {
  color: #a9c4e8;
}

.lib-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--line-soft);
  padding: 9px 13px 11px;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--text-3);
}

.lib-foot .dim {
  margin-top: 4px;
  color: #596274;
}

/* ======================= 侧栏切换（模型库 / 场景资源库） ======================= */
.side-switch {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 9px 12px 8px;
  border-bottom: 1px solid var(--line-soft);
}

.side-switch button {
  flex: 1 1 0;
  min-width: 0;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #1b212b;
  color: var(--text-2);
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: .14s;
}

/* 三个页签挤在 268px 里：文字可省略、图标在窄屏先让位，
   否则「场景资源 / 我的预设」会把页签撑破 */
.side-switch .sw-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-switch button:hover {
  background: #232b38;
  border-color: #3a4557;
  color: var(--text);
}

.side-switch button.active {
  background: var(--accent-dim);
  border-color: rgba(61, 139, 255, .55);
  color: #b7d5ff;
}

.side-switch button svg {
  flex: 0 0 auto;
  opacity: .82;
}

/* 两个面板共用同一个位置，切换时只显示其中一个 */
.side-pane {
  display: none;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
}

.side-pane.on {
  display: flex;
}

/* ======================= 场景资源库（已添加的模型） ======================= */
.sl-head {
  padding: 10px 13px 9px;
}

.sl-badge {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 15px;
  padding: 0 5px;
  border-radius: 9px;
  border: 1px solid rgba(61, 139, 255, .42);
  background: var(--accent-dim);
  color: #b7d5ff;
  font-size: 10px;
  font-weight: 600;
  font-style: normal;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.sl-badge.zero {
  border-color: var(--line);
  background: #20262f;
  color: var(--text-3);
}

.sl-badge.warn {
  border-color: rgba(255, 184, 77, .45);
  background: rgba(255, 184, 77, .14);
  color: #ffcf87;
}

.sl-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 5px 8px 10px;
}

.sl-body::-webkit-scrollbar {
  width: 8px;
}

.sl-body::-webkit-scrollbar-thumb {
  background: #2c3442;
  border-radius: 8px;
}

.sl-body::-webkit-scrollbar-thumb:hover {
  background: #3a4557;
}

.sl-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--line-soft);
  padding: 9px 13px 11px;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--text-3);
}

.sl-empty {
  padding: 20px 10px;
  text-align: center;
  font-size: 11px;
  line-height: 1.75;
  color: var(--text-3);
}

.sl-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 5px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}

.sl-row:hover {
  background: #212936;
}

.sl-row.on {
  background: var(--accent-dim);
  border-color: rgba(61, 139, 255, .55);
}

/* 多选时：主选中那行照旧，其余被一起选中的行淡一点。
   （interaction 里选中的最后一个才是"主选中"，属性面板显示它的属性） */
.sl-row.on.multi {
  background: rgba(61, 139, 255, .14);
  border-color: rgba(61, 139, 255, .34);
}

.sl-row.locked:hover {
  background: rgba(255, 184, 77, .1);
}

/* 被「近墙自动隐去」的外墙：在场景里看不到，列表里淡一点提示 */
.sl-row.ghost {
  opacity: .52;
}

.sl-thumb {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: radial-gradient(120% 90% at 50% 12%, #33415a 0%, #1b2130 72%);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.sl-thumb svg {
  width: 100%;
  height: 100%;
}

.sl-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sl-nm {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: #d3dceb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sl-row.on .sl-nm {
  color: #fff;
}

.sl-lock {
  flex: 0 0 auto;
  padding: 0 4px;
  border: 1px solid rgba(255, 184, 77, .42);
  border-radius: 4px;
  color: #ffcf87;
  font-size: 9.5px;
  line-height: 15px;
}

.sl-sz {
  font-size: 10px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 需求备注：列表行里的一行摘要（长文本省略，全文在行的 title 里悬停可见） */
.sl-row .sl-note {
  display: none;
  font-size: 10px;
  color: #c9b46a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sl-row.has-note .sl-note {
  display: block;
}

.sl-del {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  opacity: 0;
  transition: .13s;
}

.sl-row:hover .sl-del {
  opacity: 1;
}

.sl-del:hover {
  border-color: rgba(255, 92, 92, .45);
  background: rgba(255, 92, 92, .14);
  color: #ff9b9b;
}

.sl-del:focus-visible {
  opacity: 1;
  outline: 1px solid var(--accent);
}


/* ======================= 视口 HUD ======================= */
.view-hud {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 12;
}

.hud-btn {
  height: 27px;
  min-width: 54px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: var(--radius-sm);
  background: rgba(18, 22, 29, .74);
  backdrop-filter: blur(9px);
  color: #cfd8e6;
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: .14s;
  text-align: center;
}

.hud-btn:hover {
  background: rgba(40, 50, 66, .9);
  color: #fff;
}

.hud-btn.active {
  background: rgba(61, 139, 255, .82);
  border-color: rgba(120, 176, 255, .7);
  color: #fff;
}

.axis-badge {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 5px 10px;
  border-radius: 20px;
  background: rgba(18, 22, 29, .7);
  backdrop-filter: blur(9px);
  border: 1px solid rgba(255, 255, 255, .09);
  color: #97a4b8;
  font-size: 10.5px;
  letter-spacing: .3px;
  pointer-events: none;
  z-index: 12;
}

.tool-tip {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(-14px);
  padding: 8px 15px;
  border-radius: 20px;
  background: rgba(34, 211, 238, .14);
  border: 1px solid rgba(34, 211, 238, .45);
  color: #a9eeff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: .22s;
  z-index: 14;
  white-space: nowrap;
}

.tool-tip.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tool-tip b {
  color: #d9f8ff;
}

/* ---------------- 画墙实时长度标签 ---------------- */
.wall-tip {
  position: absolute;
  left: 0;
  top: 0;
  display: none;
  align-items: baseline;
  gap: 2px;
  padding: 3px 10px 5px;
  border-radius: var(--radius-sm);
  background: rgba(14, 18, 25, .88);
  border: 1px solid rgba(34, 211, 238, .5);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .5);
  color: #eaf6ff;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%, -100%);
  z-index: 15;
}

.wall-tip.show {
  display: flex;
}

.wall-tip b {
  font: 600 17px/1 "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  letter-spacing: .4px;
  color: #7fe6ff;
  font-variant-numeric: tabular-nums;
}

.wall-tip .u {
  color: #8fa0b6;
  font-size: 11px;
}

.wall-tip .ax {
  margin-left: 5px;
  padding-left: 7px;
  border-left: 1px solid rgba(255, 255, 255, .16);
  color: #9aa6b8;
  font-size: 10.5px;
}

.wall-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4.5px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: rgba(14, 18, 25, .88);
  border-right: 1px solid rgba(34, 211, 238, .5);
  border-bottom: 1px solid rgba(34, 211, 238, .5);
  transform: rotate(45deg);
}

.empty-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 13;
  pointer-events: none;
}

/* display:none 而非 opacity:0 —— 彻底避免引导卡拦截画布点击，
   也规避 backdrop-filter 在个别渲染路径下的穿透问题 */
.empty-hint.hide {
  display: none;
}

.eh-card {
  pointer-events: auto;
  width: 340px;
  padding: 22px 24px;
  border-radius: 14px;
  background: rgba(23, 28, 37, .9);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: var(--shadow);
  text-align: center;
  animation: rise .35s ease;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.eh-card h3 {
  font-size: 15px;
  margin-bottom: 8px;
}

.eh-card p {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.7;
}

.eh-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.drop-flash {
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent-2);
  background: rgba(34, 211, 238, .05);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
  z-index: 11;
}

.drop-flash.show {
  opacity: 1;
}

.toast-wrap {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 7px;
  align-items: center;
  z-index: 40;
  pointer-events: none;
}

.toast {
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(24, 30, 40, .94);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--text);
  animation: toastIn .22s ease;
  white-space: nowrap;
}

.toast.ok {
  border-color: rgba(56, 211, 159, .5);
  color: #a9f0d5;
}

.toast.warn {
  border-color: rgba(255, 184, 77, .5);
  color: #ffd79a;
}

.toast.err {
  border-color: rgba(255, 92, 92, .5);
  color: #ffb3b3;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ======================= 属性面板 ======================= */
/* 属性面板「未选中」那一屏：方案需求备注 + 操作提示 */
.prop-empty {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 13px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.7;
}

.prop-empty .pe-sec {
  margin-bottom: 14px;
}

.prop-empty .pe-sec h3 {
  font-size: 11.5px;
  font-weight: 600;
  color: #b9c4d4;
  margin: 0 0 9px;
  letter-spacing: .3px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.prop-empty .pe-sec h3 small {
  font-weight: 400;
  font-size: 10px;
  color: var(--text-3);
}

.prop-empty .pe-hint {
  margin: 6px 0 0;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--text-3);
}

/* 还没绑定方案：把"没地方存"这件事说清楚，别让人白写 */
.prop-empty .pe-hint.warn {
  color: #e2b070;
}

.prop-empty .pe-lead {
  margin: 0 0 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.prop-empty .tips {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  color: var(--text-3);
  font-size: 11.5px;
}

.prop-empty .tips li {
  display: flex;
  gap: 6px;
  align-items: center;
}

.prop-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 13px 14px;
  display: none;
}

.prop-body.on {
  display: block;
}

.prop-empty.off {
  display: none;
}

.prop-sec {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}

.prop-sec:last-child {
  border-bottom: none;
}

.prop-sec h3 {
  font-size: 11.5px;
  font-weight: 600;
  color: #b9c4d4;
  margin-bottom: 9px;
  letter-spacing: .3px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.prop-sec h3 small {
  font-weight: 400;
  font-size: 10px;
  color: var(--text-3);
}

.vec-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

/* 竖向排布：每个参数独占一行，输入框约为整行的三分之一长 */
.vec-row.stack {
  grid-template-columns: 1fr;
  gap: 8px;
  justify-items: start;
}

.vec-row.stack .vec {
  height: 34px;
  width: 33.3%;
  min-width: 132px;
  max-width: 100%;
}

.vec-row.stack .vec span {
  width: 44px;
  font-size: 11.5px;
}

.vec-row.stack .vec input {
  font-size: 13px;
  padding-right: 8px;
}

.vec {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  overflow: hidden;
}

.vec span {
  width: 22px;
  text-align: center;
  font-size: 10.5px;
  color: var(--text-3);
  flex: 0 0 auto;
}

.vec.x span {
  color: #ff7b7b;
}

.vec.y span {
  color: #7ee08a;
}

.vec.z span {
  color: #7bb6ff;
}

.vec input {
  width: 100%;
  min-width: 0;
  height: 29px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 0 4px 0 0;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.vec:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 139, 255, .13);
}

.slider-row {
  display: flex;
  gap: 7px;
  align-items: center;
}

input[type=range] {
  flex: 1 1 auto;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #262f3d;
  border-radius: 4px;
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #0f1420;
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(61, 139, 255, .18);
}

input[type=number].mini {
  width: 58px;
  height: 29px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  text-align: center;
  outline: none;
  font-variant-numeric: tabular-nums;
}

.quick-row,
.op-row {
  display: flex;
  gap: 5px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.quick-row button {
  flex: 1 1 auto;
  height: 25px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #1e2430;
  color: var(--text-2);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: .14s;
}

.quick-row button:hover {
  background: #26303e;
  color: #fff;
  border-color: #3a4557;
}

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--text-2);
  cursor: pointer;
}

.check input {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* 属性面板里的说明条：上传的模型自带贴图时露出来（颜色由贴图决定） */
.prop-note {
  margin: 0 0 9px;
  padding: 6px 8px;
  border: 1px solid rgba(61, 139, 255, .3);
  border-radius: var(--radius-sm);
  background: rgba(61, 139, 255, .09);
  color: #a9c4e8;
  font-size: 10.5px;
  line-height: 1.6;
}

/* 说明性的淡色版本（"随方案保存 / 列表里会标出来"这类补充说明） */
.prop-note.dim {
  border-color: rgba(255, 255, 255, .07);
  background: transparent;
  color: var(--text-3);
}

/* 需求备注：属性面板里的多行输入 */
.note-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 58px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  line-height: 1.65;
  resize: vertical;
  outline: none;
}

.note-input:focus {
  border-color: rgba(61, 139, 255, .6);
  box-shadow: 0 0 0 3px rgba(61, 139, 255, .13);
}

.note-input:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.note-input::placeholder {
  color: var(--text-3);
}

/* 弹层里的多行输入（方案备注）。.np-name 是按单行 input 定的高，这里要放开 */
.np-area {
  height: auto;
  min-height: 96px;
  padding: 8px 11px;
  line-height: 1.7;
  resize: vertical;
  font-family: inherit;
}

/* 单行 / 多行两个输入框由 askText / askMemo 切换显示 */
#promptInput.hide,
#promptArea.hide {
  display: none;
}

input[type=color] {
  width: 42px;
  height: 29px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  cursor: pointer;
}

.btn {
  height: 30px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #1e2430;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: .14s;
}

.btn:hover {
  background: #26303e;
  border-color: #3a4557;
}

.btn.primary {
  background: linear-gradient(180deg, #4d97ff, #2f78e0);
  border-color: #3d8bff;
  color: #fff;
}

.btn.primary:hover {
  background: linear-gradient(180deg, #5ba1ff, #3a83ea);
}

.btn.ghost {
  background: #1a202a;
}

.btn.danger {
  background: rgba(255, 92, 92, .13);
  border-color: rgba(255, 92, 92, .4);
  color: #ff9b9b;
}

.btn.danger:hover {
  background: rgba(255, 92, 92, .22);
}

.btn.tiny {
  height: 29px;
  font-size: 11px;
  flex: 1 1 auto;
}

.op-row .btn {
  flex: 1 1 42%;
}

/* ---------------- 锁定开关（属性面板 · 操作） ---------------- */
.lock-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #1a202a;
}

.lock-btn em {
  font-style: normal;
}

.lock-btn:hover {
  border-color: rgba(255, 184, 77, .55);
  color: #ffd79a;
}

.lock-btn.on {
  border-color: rgba(255, 184, 77, .62);
  background: rgba(255, 184, 77, .16);
  color: #ffcf87;
}

.lock-hint {
  display: none;
  margin-top: 8px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 184, 77, .32);
  background: rgba(255, 184, 77, .08);
  font-size: 10.5px;
  line-height: 1.6;
  color: #e7c58f;
}

.lock-hint.show {
  display: block;
}

/* 锁定后：所有可编辑控件置灰，避免"看起来能改其实改不动" */
.prop-body :disabled {
  opacity: .45;
  cursor: not-allowed;
}

.op-row .btn:disabled,
.lock-btn:disabled {
  cursor: not-allowed;
}

.panel-foot {
  flex: 0 0 auto;
  border-top: 1px solid var(--line-soft);
  padding: 10px 13px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat span {
  font-size: 10px;
  color: var(--text-3);
}

.stat b {
  font-size: 12.5px;
  color: #cfe0f7;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ======================= 弹层 ======================= */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(6, 9, 14, .68);
  backdrop-filter: blur(4px);
  display: none;
  place-items: center;
  z-index: 100;
}

.modal-mask.show {
  display: grid;
}

.modal {
  width: min(880px, 92vw);
  max-height: 82vh;
  border-radius: 14px;
  background: #1a1f29;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: rise .25s ease;
}

.modal header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.modal header h3 {
  font-size: 14px;
}

.modal .close {
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.modal .close:hover {
  color: var(--text);
}

.modal-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 18px 20px 24px;
  overflow-y: auto;
  max-height: calc(82vh - 54px);
}

.help-col h4 {
  font-size: 12px;
  color: var(--accent-2);
  margin-bottom: 10px;
  letter-spacing: .4px;
}

.help-col ul {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.6;
}

.help-col b {
  color: #d8e2f0;
}

/* ======================= 房间生成器 ======================= */
.room-modal {
  width: min(830px, 94vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.room-layout {
  display: grid;
  grid-template-columns: 1fr 306px;
  flex: 1 1 auto;
  min-height: 0;
}

.room-form {
  padding: 4px 20px 16px;
  overflow-y: auto;
  min-height: 0;
}

.room-form::-webkit-scrollbar,
.room-side::-webkit-scrollbar {
  width: 8px;
}

.room-form::-webkit-scrollbar-thumb,
.room-side::-webkit-scrollbar-thumb {
  background: #2c3442;
  border-radius: 8px;
}

.room-form::-webkit-scrollbar-thumb:hover,
.room-side::-webkit-scrollbar-thumb:hover {
  background: #3a4557;
}

.vec-row.mt6 {
  margin-top: 6px;
}

/* ---------------- 场景模式卡片（室内 / 室外） ---------------- */
.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 7px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 12px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-panel-2);
  color: var(--text-2);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .16s, background .16s;
}

.mode-card svg {
  color: var(--text-3);
  margin-bottom: 1px;
}

.mode-card b {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}

.mode-card span {
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--text-3);
}

.mode-card:hover {
  border-color: #3a465a;
  background: #232a37;
}

.mode-card.active {
  border-color: rgba(61, 139, 255, .6);
  background: var(--accent-dim);
}

.mode-card.active b {
  color: #d8e8ff;
}

.mode-card.active svg {
  color: var(--accent);
}

.rm-note {
  margin-top: 10px;
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--text-3);
}

.room-side {
  border-left: 1px solid var(--line-soft);
  background: #161b23;
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.room-side h4 {
  font-size: 11.5px;
  color: var(--accent-2);
  letter-spacing: .4px;
  margin-bottom: 10px;
}

.room-plan {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #10141b;
  padding: 6px;
}

.room-plan svg {
  display: block;
  width: 100%;
  height: auto;
}

.rm-info {
  margin-top: 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.rm-info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-3);
  border-bottom: 1px dashed var(--line-soft);
  padding-bottom: 6px;
}

.rm-info-row b {
  color: #cfe0f7;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.room-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-soft);
  background: #171c24;
}

.rm-hint {
  flex: 1 1 auto;
  font-size: 11px;
  color: var(--text-3);
}

/* ======================= 顶栏：当前项目 ======================= */

.proj-group {
  gap: 5px;
}

.proj-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  max-width: 200px;
  padding: 0 9px 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #1a202a;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: .14s;
}

.proj-chip:hover {
  background: #232b38;
  border-color: #3a4557;
}

.proj-chip b {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proj-chip .pen {
  flex: 0 0 auto;
  color: var(--text-3);
}

.proj-chip:hover .pen {
  color: var(--text-2);
}

/* 只有存在未保存改动时才亮的小圆点 */
.proj-chip .dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
  transition: background .2s;
}

.proj-chip.dirty .dot {
  background: #ffb84d;
}

/* 状态栏右侧的保存态 */
.st-save {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.st-save.dirty {
  color: #d8a95c;
}

.st-save.saving {
  color: var(--accent-2);
}

/* ======================= 项目列表（启动首页） ======================= */
/* display:none 收起（不要用 opacity:0 —— 留着会挡住下面画布的点击）。
   z-index 故意低于 .modal-mask(100)：新建项目 / 操作说明弹层要能盖在它上面。 */
.home {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  grid-template-rows: 56px 1fr 34px;
  background:
    radial-gradient(1200px 520px at 16% -14%, rgba(61, 139, 255, .17), transparent 62%),
    radial-gradient(900px 460px at 94% 4%, rgba(34, 211, 238, .1), transparent 60%),
    #0f131a;
}

.home.show {
  display: grid;
}

.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(23, 28, 37, .74);
}

.home-head .brand {
  border-right: none;
  padding-right: 0;
}

.home-head-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.home-note {
  font-size: 11.5px;
  color: var(--text-3);
}

/* 离线模式（没连上服务器）时这句要说得显眼一点 */
.home-note.warn {
  color: #e0a03e;
}

.home-body {
  min-height: 0;
  overflow-y: auto;
  padding: 34px 30px 26px;
}

.home-hero {
  max-width: 1080px;
  margin: 0 auto 20px;
}

/* 没连上方案服务器时的提示条：说清"刷新就没了"，别让人以为已经存下来了 */
.home-warn {
  max-width: 1080px;
  margin: 0 auto 18px;
  padding: 11px 14px;
  border: 1px solid rgba(224, 160, 62, .38);
  border-left: 3px solid #e0a03e;
  border-radius: 8px;
  background: rgba(224, 160, 62, .1);
  font-size: 12px;
  line-height: 1.75;
  color: #f0d5a4;
}

.home-warn.hide {
  display: none;
}

.home-warn b {
  color: #f7c470;
}

.home-warn code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .28);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: #ffe6bd;
}

.home-hero h1 {
  font-size: 22px;
  letter-spacing: .3px;
  margin-bottom: 6px;
}

.home-hero p {
  font-size: 12.5px;
  color: var(--text-2);
}

.home-grid {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 16px;
  align-content: start;
}

/* ---------------- 项目卡片 ---------------- */
.proj-card {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  overflow: hidden;
  transition: border-color .16s, box-shadow .16s;
}

.proj-card:hover {
  border-color: #3d4a5e;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .32);
}

/* 当前正在编辑的那个项目 */
.proj-card.current {
  border-color: rgba(61, 139, 255, .58);
  box-shadow: inset 0 0 0 1px rgba(61, 139, 255, .2);
}

.pc-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(160deg, #1e2531, #131820);
  overflow: hidden;
  cursor: pointer;          /* 预览图整块就是打开区 */
}

.pc-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 悬停才淡入的「打开方案」提示：缩略图本身不容易看出能点，
   给一句话最省事。pointer-events:none —— 它只是装饰，别挡住卡片自己的点击判定。 */
.pc-open {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  background: rgba(9, 13, 19, .4);
  transition: opacity .16s;
}

.proj-card:hover .pc-open {
  opacity: 1;
}

.pc-open i {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(61, 139, 255, .93);
  color: #fff;
  font-size: 11.5px;
  font-style: normal;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .32);
}

.pc-noimg {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--text-3);
}

.pc-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.6;
  background: rgba(9, 13, 19, .76);
  border: 1px solid var(--line);
  color: var(--text-2);
}

.pc-badge.indoor {
  color: #9fd4ff;
  border-color: rgba(61, 139, 255, .45);
}

.pc-cur {
  position: absolute;
  right: 8px;
  top: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.6;
  background: rgba(61, 139, 255, .9);
  color: #fff;
}

.pc-info {
  padding: 9px 11px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--line-soft);
}

/* 名字 + 紧跟其后的改名铅笔。
   .pc-name 用 flex:0 1 auto（不是 1 1 auto）—— 要的是铅笔**紧贴名字**，
   而不是被推到行尾隔着一大段空白；名字太长时它自己省略号收缩，铅笔位置不受影响。 */
.pc-top {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.pc-name {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-rename {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: #8b98ab;
  cursor: pointer;
  opacity: .72;
  transition: .14s;
}

.proj-card:hover .pc-rename {
  opacity: 1;
}

.pc-rename:hover {
  background: #26303e;
  border-color: #3a4557;
  color: #cfe0f7;
}

.pc-meta,
.pc-time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pc-meta {
  font-size: 11px;
  color: var(--text-2);
}

.pc-time {
  font-size: 10.5px;
  color: var(--text-3);
}

.pc-acts {
  display: flex;
  gap: 4px;
  padding: 0 8px 9px;
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

.pc-acts button {
  flex: 1 1 auto;
  min-width: 0;
  height: 25px;
  padding: 0 4px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #1a202a;
  color: var(--text-2);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: .14s;
}

.pc-acts button:hover {
  background: #26303e;
  border-color: #3a4557;
  color: var(--text);
}

.pc-acts button.del:hover {
  background: rgba(255, 92, 92, .18);
  border-color: rgba(255, 92, 92, .5);
  color: #ffa3a3;
}

/* ---------------- 「新建项目」虚线卡 ---------------- */
.new-card {
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 214px;
  padding: 20px;
  border-style: dashed;
  border-color: #35415a;
  background: rgba(61, 139, 255, .045);
  color: var(--text-2);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: .16s;
}

.new-card:hover {
  border-color: rgba(61, 139, 255, .7);
  background: rgba(61, 139, 255, .1);
  box-shadow: none;
}

.new-card .plus {
  width: 42px;
  height: 42px;
  margin-bottom: 3px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(61, 139, 255, .45);
  background: rgba(61, 139, 255, .13);
  color: #7fb4ff;
}

.new-card b {
  font-size: 13px;
  color: var(--text);
}

.new-card span {
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-3);
}

.home-empty {
  max-width: 1080px;
  margin: 18px auto 0;
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-3);
}

.home-empty.hide {
  display: none;
}

.home-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  border-top: 1px solid var(--line);
  background: rgba(23, 28, 37, .74);
  font-size: 11px;
  color: var(--text-3);
}

.hf-usage {
  font-variant-numeric: tabular-nums;
}

/* ---------------- 新建项目 / 文本输入弹层 ---------------- */
.np-modal {
  width: min(560px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.np-modal.small {
  width: min(430px, 92vw);
}

.np-body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.np-name {
  width: 100%;
  height: 34px;
  margin-top: 7px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.np-name:focus {
  border-color: rgba(61, 139, 255, .6);
  box-shadow: 0 0 0 3px rgba(61, 139, 255, .14);
}

.cf-msg {
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--text-2);
}

.cf-msg b {
  color: #ffb3b3;
  font-weight: 600;
}

.cf-dim {
  font-size: 11.5px;
  color: var(--text-3);
}

/* ======================= 拖拽中 ======================= */
body.dragging-lib {
  cursor: grabbing;
}

@media (max-width: 1180px) {
  :root {
    --left-w: 232px;
    --right-w: 240px;
  }

  .lib-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .room-layout {
    grid-template-columns: 1fr;
  }

  .room-side {
    border-left: none;
    border-top: 1px solid var(--line-soft);
  }
}

/* =========================================================
   工区通用信号机柜 —— 拖拽选配工作台（2D 正视图平面方案）
   · .cab-studio 是一张 3 列 + 底部动作条的网格：
       左「模块卡片库」 | 中「正视图」 | 右「清单与校验」
     grid-template-areas 里的区域名与各子元素上的 grid-area 必须一一对应 ——
     少一个（比如还指着改名前的旧区域名）整张网格就会错位，
     中间那格会塌成几十像素，画布量出来的高度就是 0。
     中列高度必须能被压缩（min-height:0），否则画布会把整个弹层顶高。
   ========================================================= */
.cab-modal {
  width: min(1180px, 96vw);
  /* 给一个确定的高度：中间那块 SVG / WebGL 画布要按容器真实像素定尺寸，
     容器高度塌成 0 的话量出来的就是兜底值，画面会糊 */
  height: min(770px, 90vh);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.cab-host {
  flex: 1 1 auto;
  min-height: 0;
}

.cab-studio {
  display: grid;
  grid-template-columns: 274px 1fr 246px;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "pal view side"
    "foot foot foot";
  height: 100%;
  min-height: 0;
}

.cab-pal {
  grid-area: pal;
  overflow-y: auto;
  min-height: 0;
  padding: 14px 14px 20px;
  border-right: 1px solid var(--line-soft);
}

.cab-view {
  grid-area: view;
  position: relative;      /* 缩放条与"放不下"提示都绝对定位在它里面 */
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 12px 12px 10px;
}

.cab-side {
  grid-area: side;
  overflow-y: auto;
  min-height: 0;
  padding: 14px 14px 20px;
  border-left: 1px solid var(--line-soft);
}

.cab-pal::-webkit-scrollbar,
.cab-side::-webkit-scrollbar {
  width: 8px;
}

.cab-pal::-webkit-scrollbar-thumb,
.cab-side::-webkit-scrollbar-thumb {
  background: #2c3442;
  border-radius: 8px;
}

.cab-foot {
  grid-area: foot;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--line-soft);
  background: #171c24;
}

.cab-foot-hint {
  flex: 1 1 auto;
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.5;
}

.cab-foot-hint .err {
  color: #ff9b9b;
}

/* ---------------- 左：选配表单 ---------------- */
.cab-sec {
  margin-bottom: 15px;
}

.cab-sec h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent-2);
  margin-bottom: 8px;
  letter-spacing: .3px;
}

.cab-sec h4 small {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-3);
}










.cab-ents {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.cab-ent {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: 7px;
  background: #1e2430;
  border: 1px solid var(--line-soft);
}

.cab-ent.bad {
  border-color: rgba(255, 92, 92, .5);
  background: rgba(255, 92, 92, .08);
}

.cab-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-top: 4px;
  flex: 0 0 auto;
}

.cab-ent-body {
  flex: 1 1 auto;
  min-width: 0;
}

.cab-ent-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.cab-ent-top b {
  color: #e3eaf5;
  font-weight: 600;
}

.cab-badge {
  font-style: normal;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #2a3242;
  color: var(--text-2);
  white-space: nowrap;
}

.cab-badge.zpw {
  background: rgba(63, 168, 160, .22);
  color: #7fd6cf;
}

/* 多台时：这一行装在第几台（和"占几层"那个徽标区分开） */
.cab-badge-cab {
  background: rgba(34, 211, 238, .16);
  color: #9fe8f5;
}

.cab-ent-del {
  margin-left: auto;
  width: 18px;
  height: 18px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  border-radius: 4px;
}

.cab-ent-del:hover {
  color: var(--danger);
  background: rgba(255, 92, 92, .12);
}

.cab-ent-sub {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.cab-ent-sub select {
  flex: 1 1 0;
  min-width: 0;
  height: 24px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  padding: 0 4px;
}

.cab-ent-pos {
  margin-top: 6px;
  font-size: 10.5px;
  color: #6fbf9a;
}

.cab-ent-pos .err {
  color: #ff9b9b;
}

.cab-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cab-lb {
  font-size: 11.5px;
  color: var(--text-2);
}

.cab-unit {
  font-size: 11px;
  color: var(--text-3);
}

.cab-row input[type="number"] {
  width: 76px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  padding: 0 8px;
}







.cab-note {
  margin-top: 6px;
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--text-3);
}

.cab-empty {
  font-size: 11px;
  color: var(--text-3);
}

/* ---------------- 中：方案视图 ---------------- */
.cab-view-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}




.cab-view-tip {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--text-3);
}

.cab-canvas {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #141a23;
}

.cab-canvas svg,
.cab-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------------- 图纸上的「故障数量」小填写框 ----------------
   点「故障机笼」那一格弹出来，绝对定位在 .cab-view 里（不能放进 #cabCanvas：
   renderView() 会 canvas.innerHTML = svg 整块重建，浮层会被顺手抹掉）。 */
.cab-fault-pop {
  position: absolute;
  z-index: 6;
  display: none;
  min-width: 168px;
  padding: 8px 10px 9px;
  border-radius: 8px;
  border: 1px solid #2f3a4a;
  background: #1b2230;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .45);
}

.cab-fault-pop.show {
  display: block;
}

.cab-fp-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

.cab-fp-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cab-fp-row input {
  flex: 1 1 auto;
  min-width: 0;
  width: 74px;
  height: 26px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.cab-fp-row input:focus {
  outline: none;
  border-color: #22d3ee;
}

.cab-fp-hint {
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-3);
}

/* 图纸上「故障机笼」那一格：可以点（点开就是那个填写框） */
.cab-canvas svg .cab-band-fault {
  cursor: pointer;
}

.cab-canvas svg .cab-band-fault:hover rect:first-child {
  filter: brightness(1.14);
}

.cab-canvas svg .cab-band-fault:hover .cab-fault-line {
  opacity: 1;
}

/* 清单里那行「故障数量」的只读数值 + 「在图纸上填」按钮 */
.cab-fault-val {
  font-size: 12px;
  color: var(--text);
}

.cab-fault-edit {
  margin-left: auto;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text-2);
  font: inherit;
  font-size: 10.5px;
  cursor: pointer;
}

.cab-fault-edit:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ---------------- 右：清单与校验 ---------------- */
.cab-side h4 {
  font-size: 12px;
  color: var(--accent-2);
  margin-bottom: 8px;
  letter-spacing: .3px;
}

.cab-kv {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 0;
  font-size: 11px;
}
.cab-kv span {
  color: var(--text-3);
  /* 🩸 标签不许被压窄折行：早期「总高」会被挤成"总/高"两行、「区间柜分格」被切成
     "区间柜分/格" —— flex 默认是允许收缩的，这里锁死。 */
  flex: 0 0 auto;
  white-space: nowrap;
}

.cab-kv b {
  color: #dbe4f0;
  font-weight: 500;
  min-width: 0;
}

.cab-kv b.err {
  color: #ff9b9b;
}

.cab-kv b.ok {
  color: #6fbf9a;
}

.cab-hr {
  height: 1px;
  margin: 8px 0;
  background: var(--line-soft);
}







.cab-check {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cab-ck {
  padding: 6px 8px;
  border-radius: 6px;
  border-left: 2px solid #4a5568;
  background: #1e2430;
}

.cab-ck b {
  display: block;
  font-size: 11px;
  color: #9fb0c6;
}

.cab-ck span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--text-3);
}

.cab-ck.ok {
  border-color: var(--ok);
}

.cab-ck.ok b {
  color: #6fbf9a;
}

.cab-ck.bad {
  border-color: var(--danger);
}

.cab-ck.bad b {
  color: #ff9b9b;
}

@media (max-width: 1080px) {
  .cab-studio {
    grid-template-columns: 246px 1fr;
    grid-template-areas:
      "pal view"
      "side side"
      "foot foot";
    grid-template-rows: 1fr auto auto;
  }

  .cab-side {
    border-left: none;
    border-top: 1px solid var(--line-soft);
    max-height: 190px;
  }
}

@media (max-width: 860px) {
  .cab-studio {
    grid-template-columns: 1fr;
    grid-template-areas:
      "view"
      "pal"
      "side"
      "foot";
    grid-template-rows: 300px auto auto auto;
  }

  .cab-pal {
    border-right: none;
    border-top: 1px solid var(--line-soft);
  }
}

/* =========================================================
   工区通用信号机柜 v2 —— 卡片拖拽选配
   · 层号定死（0 层最上 / 自下而上 1→8），视图只保留正视图；
   · 左栏 = 模块库 + 校验；右栏 = 选配清单 + 柜体规格；
   · 左栏的卡片是拖拽把手（整张卡都能抓）；
   · 右栏清单是**只读**的：顺序跟着图纸从上到下实时排，不许拖、
     也不放 ZPW 的互换按钮 —— 删除与互换都在图纸上模块右上角那组小钮。
   ========================================================= */
.cab-pal-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 模块卡片：能拖的东西要做得够大、信息一次看全，才有"可以抓"的感觉 */
.cab-card {
  display: flex;
  align-items: stretch;
  gap: 9px;
  padding: 10px 9px 10px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #1b212b;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: .14s;
}

.cab-card:hover {
  border-color: var(--accent);
  background: #1f2734;
}

.cab-card:active {
  cursor: grabbing;
}

.cab-card-sw {
  flex: 0 0 auto;
  width: 5px;
  border-radius: 3px;
}

.cab-card-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cab-card-main > b {
  font-size: 13px;
  color: #eaf1fa;
}

.cab-card-main > span {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-3);
}

.cab-card-main .cab-dim {
  color: #7f8ea4;
}

.cab-card-main b.cab-plus {
  font-style: normal;
  color: var(--accent-2);
}

.cab-card-main b.hi {
  color: #7dd3c4;
}

.cab-card-grip {
  flex: 0 0 auto;
  align-self: center;
  font-size: 13px;
  color: #55627a;
  letter-spacing: -2px;
}

.cab-card-opts {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}

.cab-card-opts select {
  flex: 1 1 auto;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  padding: 0 4px;
}

.cab-card-badge {
  align-self: flex-start;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  color: #9fd8cd;
  background: rgba(63, 168, 160, .14);
}

/* 跟着指针走的幽灵卡片 */
.cab-ghost {
  position: fixed;
  z-index: 120;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: rgba(23, 28, 36, .96);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
  pointer-events: none;
  font-size: 11.5px;
  color: #eaf1fa;
}

.cab-ghost i {
  width: 5px;
  height: 16px;
  border-radius: 3px;
}

.cab-ghost b {
  font-size: 12px;
}

.cab-ghost span,
.cab-ghost em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-3);
}

.cab-studio.cab-dragging {
  cursor: grabbing;
}

.cab-studio.cab-dragging .cab-canvas {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.cab-view-name {
  font-size: 12px;
  color: var(--accent-2);
}

/* 右栏清单：只读的列表 —— 不能拖（换层序一律在图纸上拖），
   只在悬停/联动高亮时切个 class */
.cab-ent {
  cursor: default;
}

.cab-ent.hl {
  border-color: var(--accent);
  background: #1d2733;
}

/* 每个模块的备注框（替掉了原来那行"占第N层"）：边打边存，不重建清单 */
.cab-ent-note {
  width: 100%;
  height: 24px;
  margin-top: 6px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #171c24;
  color: var(--text-1);
  font: inherit;
  font-size: 11px;
}

.cab-ent-note::placeholder {
  color: #55627a;
}

.cab-ent-note:focus {
  outline: none;
  border-color: var(--accent);
}

/* 清单里钉在最上面的那一行：固定层「故障机笼」（填路数） */
.cab-ent-fixed {
  margin-top: 7px;      /* 挂在清单最下面（固定层的参数跟在选配之后） */
  background: #1a202a;
}

.cab-ent-fixed .cab-ent-sub {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cab-ent-fixed .cab-ent-sub input[type="number"] {
  width: 62px;
}

.cab-ent-fixed .cab-ent-pos {
  line-height: 1.5;
}

/* ---------------------------------------------------------
   画布上的模块操作钮：直接长在正视图的模块格子上（只有 × 移除）
   SVG 里没有 <button>，所以是 <g data-del>，
   点击由 createStudio 的 click 代理接管。
   （「换位」钮已按用户要求去掉，两者是独立条目，直接在图上拖即可。）
   --------------------------------------------------------- */
/* ---------- 图纸：缩放条 + "放不下"提示 ---------- */
/* 画布本身在空白处按住 = 平移图纸 */
.cab-canvas {
  cursor: grab;
}

.cab-canvas.cab-panning {
  cursor: grabbing;
}

.cab-zoom {
  position: absolute;
  right: 20px;
  bottom: 20px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(23, 28, 36, .93);
}

.cab-zbtn {
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #1a202a;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: .14s;
}

.cab-zbtn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: #fff;
}

.cab-zfit {
  font-size: 11px;
}

.cab-zval {
  min-width: 44px;
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* 放不下时在图纸上弹的提示（东西不会加进去） */
.cab-alert {
  position: absolute;
  left: 50%;
  top: 54px;
  z-index: 5;
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid #ff5c5c;
  background: rgba(56, 20, 22, .97);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
  transition: .18s;
}

.cab-alert.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.cab-alert b {
  display: block;
  margin-bottom: 3px;
  font-size: 12.5px;
  color: #ff9b9b;
}

.cab-alert span {
  display: block;
  font-size: 11.5px;
  line-height: 1.6;
  color: #f2dcdc;
}

.cab-canvas svg text {
  -webkit-user-select: none;
  user-select: none;
}

.cab-op {
  cursor: pointer;
}

.cab-op rect {
  transition: .12s;
}

.cab-op:hover rect {
  fill: #26313f;
  stroke: var(--accent);
}

.cab-op:hover text {
  fill: #fff;
}

/* 已放入的模块格子：抓住就能拖去换层序 */
.cab-canvas svg .cab-band-mod {
  cursor: grab;
}

.cab-studio.cab-dragging .cab-canvas svg .cab-band-mod {
  cursor: grabbing;
}

/* 每台都带拖拽钩子（多台时拖到哪台就进哪台）—— 光标统一是抓拖 */

/* ---------- 属性面板里的「编辑 2D 配置」（只在选中信号机柜时才露出） ---------- */
.cab-edit-btn {
  width: 100%;
  margin-top: 2px;
}

.cab-edit-note {
  margin: 7px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-3);
}

/* ---------- 本地「模型库」那一栏（2026-09-22 新增） ---------- */
/* 工具条上只有「刷新」按钮 + 文件夹路径，按钮别把宽度全吃掉 */
#mlTools .lib-btn {
  flex: 0 0 auto;
  padding: 0 10px;
}

.ml-path {
  flex: 1 1 auto;
  min-width: 0;
  align-self: center;
  font-size: 11px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

/* 本地模型的卡片：还没解析好时先占位，别让它能拖（拖出来会是个 1×1×1 的方块） */
.lib-card.local.loading {
  opacity: .55;
  cursor: default;
}

.lib-card.local .thumb {
  background: linear-gradient(160deg, #1d2430, #151a22);
}

/* ---------- 左侧栏底部「场景模型清单」停靠栏 ----------
   2026-09-22 用户要求：从"侧栏里的一个页签"改成可展开 / 折叠的停靠栏。
   折叠时只占一行标题（几乎不占地方），展开时占侧栏下半截、列表内部自己滚 ——
   ⚠️ 高度必须是**固定值**（vh / max-height），不能靠内容撑：侧栏是 flex 列，
   内容一撑就会把上面两个面板挤没。 */
/* 左侧栏要作为定位上下文：展开时停靠栏用 absolute **盖住**上面两栏 */
.sidebar.left {
  position: relative;
}

.side-dock {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--line);
}

/* 展开 = 覆盖整个左栏（只留出上面的 模型库 / 资产库 页签），不是把上面挤小。
   top 由 JS 按页签行的实际高度设（setDockOpen 里设 inline style），
   这样改字号 / 改文案也不会错位。 */
.side-dock.open {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 47px;
  z-index: 6;
  background: var(--bg-panel);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 26px rgba(0, 0, 0, .38);
}

.dock-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 32px;
  padding: 0 12px;
  border: 0;
  background: none;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.dock-head:hover {
  background: rgba(255, 255, 255, .035);
  color: var(--text);
}

.dock-head .dock-ico {
  flex: 0 0 auto;
  opacity: .78;
}

.dock-head .dock-title {
  font-weight: 600;
  letter-spacing: .3px;
}

.dock-head .dock-caret {
  flex: 0 0 auto;
  margin-left: auto;
  opacity: .55;
  transition: transform .18s;
}

.side-dock.open .dock-head .dock-caret {
  transform: rotate(180deg);
}

.dock-body {
  display: none;
}

.side-dock.open .dock-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  border-top: 1px solid var(--line-soft);
}

.dock-body .dock-hint {
  flex: 0 0 auto;
  max-width: none;
  padding: 7px 13px 0;
  font-size: 11px;
  color: var(--text-3);
}

/* 卡片操作按钮的右上角版本（模型库那张「更新」用 —— 用户要求放在右上角） */
.lib-card .lc-acts.right {
  left: auto;
  right: 4px;
}

/* 右上角本来有个分类小圆点：按钮出来的时候让它淡出，别跟按钮叠在一起 */
.lib-card .cat-dot {
  transition: opacity .14s;
}

.lib-card.local:hover .cat-dot {
  opacity: 0;
}

/* 🩸 属性面板里的小节要能被 `.hide` 收起来。
   这个文件里**没有通用的 `.hide` 规则**（只有 .lib-tools.hide / .multi-warn.hide
   这类针对具体元素的几条）—— 少写这一条的话，cabinet.js 注入的 #propCab 会一直露着：
   选中**任何**物体（哪怕是个上传的盒子）都能看到「信号机柜 / 编辑 2D 配置…」。
   用户 2026-09-22 报的就是这个。 */
.prop-sec.hide {
  display: none;
}

/* ---------- 线缆线槽（2026-10-21） ---------- */
/* 属性面板里那一行「线槽长度」：只有选中 'cable' 时才露出来 */
.cable-len {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 9px 0 0;
  padding: 7px 9px;
  border: 1px solid rgba(61, 139, 255, .18);
  border-radius: 6px;
  background: rgba(61, 139, 255, .07);
  font-size: 12px;
  color: var(--text-2);
}

.cable-len b {
  color: #9ec8ff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.cable-len em {
  font-style: normal;
  font-size: 11px;
  color: var(--text-3);
}

/* 🩸 .hide 在这个项目里**不是**全局规则 —— 带 hide 的元素必须自己补一条，
   否则它带着 hide 类照样显示（2026-09-22 在属性面板的机柜节上踩过） */
.cable-len.hide {
  display: none;
}

/* 工具提示气泡里「画墙 / 线槽」两条说明按当前模式切换。
   🩸 还是那条：带 hide 的元素必须自己补 CSS，这里 .hide 不是全局规则 */
.tool-tip .hide {
  display: none;
}

/* ---------- 登录 / 注册屏（2026-10-21 用户体系） ---------- */
.auth {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 520px at 50% 0%, rgba(61, 139, 255, .16), transparent 70%),
    #0b0f15;
}

/* 🩸 老规矩：这个项目里 .hide **不是**全局规则，带 hide 的元素各自补一条 */
.auth.hide,
.auth-err.hide,
.home-sec.hide,
.home-grid.hide {
  display: none;
}

.auth-card {
  width: 370px;
  max-width: 100%;
  padding: 26px 26px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.auth-brand .brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-dim);
  color: #9ec8ff;
}

.auth-brand .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.auth-brand .brand-text b { font-size: 15px; letter-spacing: .4px; }
.auth-brand .brand-text span { font-size: 11px; color: var(--text-3); }

.auth-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  letter-spacing: .3px;
}

.auth-lead {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-2);
}

.auth-field { display: block; margin-bottom: 12px; }

.auth-field span {
  display: block;
  margin-bottom: 5px;
  font-size: 11.5px;
  color: var(--text-3);
}

.auth-field input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0e1319;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.auth-field input:focus {
  outline: none;
  border-color: rgba(61, 139, 255, .62);
  box-shadow: 0 0 0 3px rgba(61, 139, 255, .12);
}

.auth-err {
  margin: 0 0 10px;
  font-size: 12px;
  color: #ff9a9a;
}

.auth-go {
  width: 100%;
  height: 36px;
  margin-top: 4px;
}

.auth-switch {
  margin: 12px 0 0;
  text-align: center;
  font-size: 12px;
}

.auth-switch a {
  color: #9ec8ff;
  text-decoration: none;
}

.auth-switch a:hover { text-decoration: underline; }

.auth-foot {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.65;
  color: var(--text-3);
}

/* ---------- 首页两段：我的方案 / 通用示例 ---------- */
.home-sec {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 20px 0 10px;
  padding: 0 2px;
}

.home-sec h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .3px;
}

.home-sec small {
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-3);
}

/* 卡片上的「通用示例」角标（左上角是场地模式、右上角是"编辑中"，这里放左下） */
.pc-ex {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.6;
  font-weight: 600;
  background: rgba(255, 184, 77, .92);
  color: #2a1d05;
}

/* 顶栏「当前用户」 */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
}

.user-chip b {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}

.user-chip.hide { display: none; }

/* ---------- 管理员界面：账号与账号下的方案（2026-10-21） ----------
   盖在首页之上（首页 z-index 90）—— 关掉就回到方案列表，不用重渲染首页。
   🩸 老规矩：带 hide 的元素各自补规则，这个文件里 .hide 不是全局的。 */
.adm {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  grid-template-rows: 56px 1fr;
  background:
    radial-gradient(1100px 480px at 88% -12%, rgba(34, 211, 238, .10), transparent 62%),
    radial-gradient(900px 460px at 6% -8%, rgba(61, 139, 255, .14), transparent 60%),
    #0f131a;
}

.adm.show {
  display: grid;
}

.adm-entry.hide {
  display: none;
}

.adm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 16, 22, .72);
  backdrop-filter: blur(8px);
}

.adm-body {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 0;
}

/* ---- 左：账号列表 ---- */
.adm-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .012);
}

.adm-side-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 14px 8px;
}

.adm-side-head h3 {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: .4px;
  color: var(--text-2);
}

.adm-side-n {
  font-size: 11px;
  color: var(--text-3);
}

.adm-users {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 10px;
}

.adm-user {
  display: block;
  width: 100%;
  margin-bottom: 3px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.adm-user:hover {
  background: rgba(255, 255, 255, .045);
}

.adm-user.on {
  border-color: rgba(61, 139, 255, .42);
  background: rgba(61, 139, 255, .13);
}

.adm-user .au-name {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 600;
}

.adm-user .au-name b {
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adm-user .au-sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-3);
}

.adm-badge {
  flex: 0 0 auto;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: .2px;
}

.adm-badge.admin {
  background: rgba(255, 184, 77, .18);
  color: #ffc978;
  border: 1px solid rgba(255, 184, 77, .34);
}

.adm-badge.me {
  background: rgba(61, 139, 255, .18);
  color: #9ec8ff;
  border: 1px solid rgba(61, 139, 255, .34);
}

.adm-badge.ex {
  background: rgba(34, 211, 238, .16);
  color: #8fe6f2;
  border: 1px solid rgba(34, 211, 238, .32);
}

.adm-side-foot {
  flex: 0 0 auto;
  margin: 0;
  padding: 9px 14px 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-3);
}

/* ---- 右：选中账号的详情 ---- */
.adm-main {
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 40px;
}

.adm-card {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .022);
}

.adm-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.adm-card-head .ac-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
}

.adm-card-acts {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.adm-card-acts .btn {
  height: 27px;
  padding: 0 10px;
  font-size: 11.5px;
}

.adm-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 26px;
  margin: 11px 0 0;
}

.adm-meta div {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 11.5px;
}

.adm-meta dt {
  color: var(--text-3);
}

.adm-meta dd {
  margin: 0;
  color: var(--text-2);
}

.adm-sub {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 20px 0 9px;
}

.adm-sub h4 {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: .3px;
}

.adm-sub small {
  font-size: 11px;
  color: var(--text-3);
}

.adm-projs {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.adm-prow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .014);
}

.adm-prow:last-child {
  border-bottom: 0;
}

.adm-prow:hover {
  background: rgba(255, 255, 255, .04);
}

.adm-pinfo {
  flex: 1 1 auto;
  min-width: 0;
}

.adm-pinfo .ap-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
}

.adm-pinfo .ap-name b {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adm-pinfo .ap-sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-3);
}

.adm-pacts {
  display: flex;
  gap: 5px;
  flex: 0 0 auto;
}

.adm-pacts button {
  height: 25px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text-2);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.adm-pacts button:hover {
  border-color: rgba(61, 139, 255, .5);
  color: var(--text);
}

.adm-pacts button.del:hover {
  border-color: rgba(255, 90, 90, .6);
  color: #ff9a9a;
}

.adm-empty {
  padding: 26px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

.adm-select {
  height: 34px;
  padding: 0 8px;
}

.adm-err {
  min-height: 16px;
  color: #ff9a9a;
}

.adm-err.hide {
  display: none;
}

/* ---------- 登录屏：忘记密码 / 重置申请（2026-10-21） ---------- */
/* 🩸 老规矩：这个文件里 .hide 不是全局规则，带 hide 的元素各自补一条 */
.auth-field.hide,
.auth-msg.hide,
.auth-switch a.hide,
.auth-switch span.hide {
  display: none;
}

.auth-msg {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.65;
  color: #8ce6b0;
}

.auth-sep {
  margin: 0 3px;
  color: var(--text-3);
}

/* 管理员界面：某个账号申请了重置密码 */
.adm-badge.reset {
  background: rgba(255, 120, 120, .18);
  color: #ff9a9a;
  border: 1px solid rgba(255, 120, 120, .38);
}

.adm-reset {
  margin: 10px 0 0;
  padding: 8px 10px;
  border: 1px solid rgba(255, 120, 120, .28);
  border-radius: 8px;
  background: rgba(255, 120, 120, .08);
  font-size: 11.5px;
  line-height: 1.7;
  color: #ffbdbd;
}

/* ---------- 未选中任何物体时：右侧栏顶部的「场地」信息 ----------
   就是在 #propEmpty 里第一块（尺寸 / 面积 / 模式），选中物体后整块被
   #propBody 顶掉，所以这里不用管显隐。 */
.prop-empty .site-facts {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .022);
}

.sf-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 0;
}

.sf-row .sf-k {
  flex: 0 0 auto;
  width: 30px;
  font-size: 11px;
  color: var(--text-3);
}

.sf-row b {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .2px;
  font-variant-numeric: tabular-nums;
}

.sf-row em {
  font-style: normal;
  font-size: 10.5px;
  color: var(--text-3);
}

/* 面积是这块里最常被问的数，给它一档强调 */
.prop-empty .site-facts .sf-row:nth-child(3) b {
  font-size: 14px;
  color: #9ec8ff;
}

.sf-mode.in {
  color: #8fe6f2;
}
