/* The BIM screen (2026-11-05): 모델 트리 (ui/modeltree.js), 공간 보이기 in
   the 3D chip (ui/view3d.js) and 특성 for an IFC model (ui/bim-inspector.js).
   Tokens only: both themes follow css/tokens.css. */

/* ---- 모델 트리: a floating panel left of the drawing, as the cloud's ---- */
@container app (min-width: 1024px) {
  .overlay-l.modeltree { width: 320px; }
}
#app[data-size="desktop"][data-open~="model"] .dock { --dock-l: calc(var(--safe-l) + var(--rail-w) + 8px + 320px + 2 * var(--gap)); }
@container app (min-width: 1024px) and (max-width: 1599px) {
  #app[data-open~="model"] .dock > .prompt { align-self: flex-end; max-width: calc(100% - 296px); }
}
/* A phone's sheet is the lower part of the screen: the model stays in sight above it. */
@container app (max-width: 1023px) {
  .overlay-l.modeltree { height: 56%; }
  /* The sheet is half a screen: the 3D chip (with 공간 보이기) and the messages
     stay in sight above it, the view cube out of the way. */
  #app[data-open~="model"] .dock { bottom: calc(var(--safe-b) + 88px + 56%); }
  #app[data-open~="model"] .view3d-cube { display: none; }
}
.mt-top { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 10px 10px 6px; }
.mt-find { position: relative; display: flex; align-items: center; }
.mt-find > .ic { position: absolute; left: 9px; color: var(--muted); pointer-events: none; }
.mt-q { width: 100%; height: 34px; padding: 0 56px 0 30px; font-size: 13px; }
.mt-kbd { position: absolute; right: 8px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel2); color: var(--muted); font: 11px var(--mono); pointer-events: none; }
.mt-kbd[hidden] { display: none; }
.mt-clear { position: absolute; right: 3px; }
.mt-clear[hidden] { display: none; }
.mt-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; border-radius: var(--r-input); background: var(--panel2); }
.mt-tab { height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 12.5px; }
.mt-tab:hover { color: var(--text); }
.mt-tab[aria-selected="true"] { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.mt-count { flex: none; padding: 0 14px 6px; font-size: 12px; }
.mt-count[hidden] { display: none; }
.mt-list { position: relative; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--line); scrollbar-width: thin; }
.mt-sizer { position: relative; width: 100%; }
.mt-row { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: 0 10px 0 calc(6px + var(--lv, 0) * 14px); font-size: 13px; color: var(--text); cursor: pointer; user-select: none; }
.mt-row.l0 { --lv: 0; }
.mt-row.l1 { --lv: 1; }
.mt-row.l2 { --lv: 2; }
.mt-row:hover { background: var(--hover); }
.mt-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mt-row.sel { background: var(--tint); color: var(--ink); }
.mt-row.here:not(.sel) { box-shadow: inset 3px 0 0 var(--accent); background: var(--panel2); }
.mt-row.sel .mt-n, .mt-row.sel .mt-s { color: inherit; }
.mt-c { flex: none; width: 18px; height: 18px; display: grid; place-items: center; color: var(--muted); }
.mt-c .ic { transform: rotate(-90deg); transition: transform 0.12s; }
.mt-c.open .ic { transform: none; }
.mt-i { flex: none; color: var(--muted); }
.mt-row.sel .mt-i { color: inherit; }
.mt-l { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 8px; overflow: hidden; }
.mt-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-row.l0:not(.mt-cls) .mt-t { font-weight: 600; }
.mt-s { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.mt-ko { font-weight: 400; color: var(--muted); }
.mt-row.sel .mt-ko { color: inherit; }
.mt-n { flex: none; font: 11.5px var(--mono); color: var(--muted); white-space: nowrap; }
.mt-g { cursor: default; }
.mt-g:hover { background: none; }
.mt-pill { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border: 1px solid var(--line); border-radius: 11px; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.mt-pill .ic { width: 13px; height: 13px; }
.mt-pill:hover { border-color: var(--accent); color: var(--text); }
.mt-pill.on { border-color: transparent; background: var(--tint); color: var(--ink); }
.mt-opts { display: flex; justify-content: flex-end; }
.mt-sw { flex: none; width: 12px; height: 12px; margin: 0 2px; border-radius: 3px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--text) 25%, transparent); }
.mt-cls { position: absolute; }
.mt-cls .mt-bar { position: absolute; left: 10px; bottom: 3px; height: 3px; width: calc((100% - 20px) * var(--w, 0) / 100); border-radius: 2px; background: var(--accent); opacity: 0.55; }
mark { background: color-mix(in srgb, var(--accent) 32%, transparent); color: var(--text); border-radius: 2px; }
.mt-strip { flex: none; display: none; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); }
@container app (max-width: 1023px) {
  .mt-strip:not([hidden]) { display: flex; }
  .mt-row { font-size: 14px; }
  .mt-q { height: 40px; font-size: 16px; }
  .mt-tab { height: 34px; }
}
.mt-strip-t { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-strip-s { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- 공간 보이기: a switch in the 3D chip ---- */
.v3-switch { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px 0 8px; border: 1px solid var(--line); border-radius: 14px; background: transparent; color: var(--text); font-size: 12.5px; white-space: nowrap; }
.v3-switch[hidden] { display: none; }
.v3-switch:hover { border-color: var(--accent); }
.v3-track { position: relative; flex: none; width: 26px; height: 14px; border-radius: 7px; background: var(--line); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--muted) 55%, transparent); transition: background 0.12s; }
.v3-track i { position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); transition: transform 0.12s, background 0.12s; }
.v3-switch[aria-checked="true"] .v3-track { background: var(--accent); }
.v3-switch[aria-checked="true"] .v3-track i { transform: translateX(12px); background: #fff; }
@container app (max-width: 599px) {
  .view3d-chip .v3-label { display: none; }
  .view3d-chip { gap: 6px; padding-left: 8px; }
  .view3d-chip select { max-width: 112px; }
  .v3-switch { padding: 0 8px 0 6px; gap: 6px; }
}

/* ---- 특성 for an IFC model ---- */
.bim-kv { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); align-items: start; }
.bim-kv .k { overflow-wrap: anywhere; line-height: 1.45; }
.bim-v { font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
.bim-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.bim-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; color: var(--text); }
.bim-chip .ic { width: 15px; height: 15px; color: var(--muted); }
.bim-chip.link:hover { border-color: var(--accent); background: var(--tint); }
.bim-guid { padding: 0; border: 0; background: none; color: var(--ink); font-size: 12px; text-align: left; overflow-wrap: anywhere; cursor: copy; }
.bim-guid:hover { text-decoration: underline; }
.bim-guid.done { color: var(--ok); }
.bim-guid.done::after { content: " · 복사함"; font-family: var(--font); }
.bim-note { margin: 8px 0 0; font-size: 12px; line-height: 1.55; }
.bim-sec .bim-group { border-top: 1px solid var(--line); }
.bim-sec .bim-group:first-of-type { border-top: 0; }
.bim-ghead { width: 100%; display: flex; align-items: center; gap: 6px; padding: 8px 0; border: 0; background: none; color: var(--text); font-size: 12.5px; font-weight: 600; text-align: left; }
.bim-ghead:hover { color: var(--ink); }
.bim-gname { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.bim-gchev { flex: none; color: var(--muted); transition: transform 0.12s; }
.bim-ghead[aria-expanded="false"] .bim-gchev { transform: rotate(-90deg); }
.bim-gbody { padding: 0 0 10px 22px; }
.bim-gbody[hidden] { display: none; }
.bim-gbody .kv:first-child { margin-top: 0; }
.bim-calc { margin-left: 6px; padding: 0 4px; border: 1px solid currentColor; border-radius: 4px; color: var(--muted); font-size: 10.5px; font-style: normal; font-weight: 600; line-height: 16px; vertical-align: 1px; }
.bim-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.bim-act { display: inline-flex; align-items: center; gap: 6px; }
.bim-act.waiting { border-style: dashed; color: var(--muted); }
