/* BOQ Studio — 3D workspace */
body.ws { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; font-size: 14px; }
.ws-head { height: 60px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 16px; border-bottom: 1px solid var(--ink); background: var(--sheet); }
.ws-head .brand-mark { width: 28px; height: 28px; }
.ws-title { min-width: 0; flex: 1; }
.ws-title .kicker { font-size: 10.5px; letter-spacing: .12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-title .id { color: var(--accent); }
.ws-title h1 { margin: 0; font-family: var(--f-serif); font-size: 19px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-actions { display: flex; gap: 8px; flex: none; }
.ws-actions .btn { gap: 7px; }
@media (max-width: 900px) { .ws-actions .btn span { display: none; } .ws-actions .btn { padding: 0 10px; } .hide-s { display: none !important; } }

.ws-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 400px minmax(0, 1fr) 360px; }
.pane { min-height: 0; display: flex; flex-direction: column; background: var(--sheet); }
.pane-l { border-right: 1px solid var(--ink); }
.pane-r { border-left: 1px solid var(--ink); }
.pane-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); flex: none; }
.ph-row { display: flex; justify-content: space-between; align-items: baseline; }
.pane-head h2 { margin: 0; font-family: var(--f-serif); font-size: 17px; font-weight: 600; }
.pane-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.pane-foot { flex: none; border-top: 1px solid var(--ink); padding: 10px 16px 12px; background: #f7f4ee; font-size: 13px; }
.search { position: relative; margin-top: 10px; }
.search svg { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ink-3); }
.search input { width: 100%; height: 36px; border: 1px solid var(--line-2); background: #fff; padding: 0 10px 0 34px; outline: none; border-radius: var(--r); }
.search input:focus { border-color: var(--ink); }
.chips { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.chip { height: 26px; padding: 0 10px; border: 1px solid var(--line-2); background: transparent; font-size: 12px; cursor: pointer; border-radius: 13px; color: var(--ink-2); }
.chip:hover { border-color: var(--ink); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---- BOQ list */
.sec { border-bottom: 1px solid var(--line); }
.sec-h { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 16px; cursor: pointer; position: sticky; top: 0; background: var(--sheet); z-index: 2; border-bottom: 1px solid transparent; }
.sec.open .sec-h { border-bottom-color: var(--line); }
.sec-h:hover { background: #f4f0e8; }
.sec-h .sw { width: 10px; height: 26px; }
.sec-h .nm { font-weight: 600; font-size: 13.5px; line-height: 1.3; }
.sec-h .nm small { display: block; font-weight: 400; font-size: 11.5px; color: var(--ink-3); font-family: var(--f-mono); letter-spacing: .04em; }
.sec-h .amt { text-align: right; font-family: var(--f-mono); font-size: 12.5px; }
.sec-h .amt small { display: block; color: var(--ink-3); font-size: 11px; }
.sec-b { display: none; }
.sec.open .sec-b { display: block; }
.grp-h { padding: 8px 16px 4px 36px; font-size: 11.5px; color: var(--ink-3); font-style: italic; }
.ln { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 6px 10px; padding: 8px 16px 8px 0; cursor: pointer; border-left: 3px solid transparent; position: relative; }
.ln:hover { background: #f5f2ec; }
.ln.on { background: var(--accent-soft); border-left-color: var(--accent); }
.ln.rel { background: #eef1ee; border-left-color: var(--slate); }
.ln .no { font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); text-align: right; padding-top: 2px; }
.ln .tx { min-width: 0; }
.ln .tx b { font-weight: 500; font-size: 13px; line-height: 1.4; display: block; }
.ln .tx span { display: block; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ln .q { text-align: right; font-family: var(--f-mono); font-size: 12px; white-space: nowrap; }
.ln .q small { display: block; color: var(--ink-3); font-size: 11px; }
.ln .meta { grid-column: 2 / 4; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pill { font-family: var(--f-mono); font-size: 10px; letter-spacing: .04em; padding: 1px 6px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; background: #fff; }
.pill.link { border-color: var(--slate); color: var(--slate); }
.pill.link::before { content: "◉ "; }
.pill.nolink { color: var(--ink-3); border-style: dashed; }
.pill.est { border-color: var(--warn); color: var(--warn); }
.pill.fam { border-color: transparent; background: #efebe3; }
.noresult { padding: 30px 16px; text-align: center; color: var(--ink-3); }
.tot { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
.tot span:nth-child(even) { text-align: right; font-family: var(--f-mono); }
.tot .g { font-weight: 600; font-size: 14.5px; padding-top: 6px; margin-top: 4px; border-top: 1px solid var(--line-2); }
.tot .g + span { font-size: 14.5px; font-weight: 600; padding-top: 6px; margin-top: 4px; border-top: 1px solid var(--line-2); }

/* ---- stage */
.stage { position: relative; min-width: 0; min-height: 0; background: #e9e5dd; overflow: hidden; }
.viewport { position: absolute; inset: 0; }
.viewport canvas { display: block; width: 100%; height: 100%; outline: none; }
.ov { position: absolute; z-index: 5; display: flex; gap: 8px; align-items: center; }
.ov-tl { top: 14px; left: 14px; }
.ov-tr { top: 14px; right: 14px; }
.ov-bl { left: 14px; bottom: 14px; align-items: flex-end; }
.ov-br { right: 14px; bottom: 14px; }
.seg { display: flex; background: var(--sheet); border: 1px solid var(--ink); box-shadow: var(--shadow); }
.seg button { height: 34px; padding: 0 14px; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink); background: #f3efe7; }
.seg button.on { background: var(--ink); color: var(--paper); }
.seg-sm button { height: 32px; padding: 0 10px; font-size: 12px; font-family: var(--f-mono); letter-spacing: .03em; }
.tbtn { width: 34px; height: 34px; display: grid; place-items: center; background: var(--sheet); border: 1px solid var(--ink); cursor: pointer; box-shadow: var(--shadow); }
.tbtn svg { width: 17px; height: 17px; }
.tbtn:hover { background: #f3efe7; }
.tbtn[aria-pressed="false"] { color: var(--ink-3); border-color: var(--line-2); }
.legend { background: rgba(251, 250, 246, .94); border: 1px solid var(--ink); padding: 10px 12px; box-shadow: var(--shadow); max-width: 250px; }
.legend .kicker { font-size: 9.5px; margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; }
.legend .kicker a { color: var(--accent); cursor: pointer; text-decoration: none; letter-spacing: .06em; }
.lg { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 3px 4px; cursor: pointer; font-size: 12px; margin: 0 -4px; }
.lg i { width: 12px; height: 12px; display: block; }
.lg span:last-child { font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); }
.lg:hover { background: #efebe3; }
.lg.off { opacity: .35; }
.lg.on { background: var(--ink); color: var(--paper); }
.lg.on span:last-child { color: var(--line); }
.iso-banner { position: absolute; z-index: 6; top: 60px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; background: var(--sheet); border: 1px solid var(--ink); padding: 8px 8px 8px 12px; box-shadow: var(--shadow); max-width: min(560px, calc(100% - 28px)); }
.iso-banner .sw { width: 10px; height: 30px; flex: none; }
.ib-t { min-width: 0; }
.ib-t b { display: block; font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ib-t span { font-size: 11.5px; color: var(--ink-3); font-family: var(--f-mono); }
.tip { position: absolute; z-index: 7; pointer-events: none; background: var(--ink); color: var(--paper); padding: 6px 9px; font-size: 12px; max-width: 280px; line-height: 1.4; }
.tip small { display: block; color: #c9c2b4; font-family: var(--f-mono); font-size: 10.5px; }
.loader { position: absolute; inset: 0; z-index: 9; display: grid; place-items: center; background: var(--paper);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 32px 32px; transition: opacity .5s; }
.loader.done { opacity: 0; pointer-events: none; }
.ld-card { background: var(--sheet); border: 1px solid var(--ink); padding: 22px 24px; width: min(380px, calc(100% - 32px)); box-shadow: var(--shadow); }
.ld-card h3 { margin: 6px 0 14px; font-family: var(--f-serif); font-size: 19px; font-weight: 600; }
.ld-bar { height: 3px; background: var(--line); position: relative; }
.ld-bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); width: 2%; transition: width .3s; }
.ld-msg { font-size: 11.5px; color: var(--ink-3); margin-top: 10px; min-height: 1.4em; }
.ld-card.err h3 { color: var(--err); }

/* ---- right panel */
.tabs { display: flex; border-bottom: 1px solid var(--ink); flex: none; }
.tabs button { flex: 1; height: 44px; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 13px; color: var(--ink-2); position: relative; }
.tabs button:last-child { border-right: 0; }
.tabs button.on { color: var(--ink); font-weight: 600; }
.tabs button.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; border-bottom: 3px solid var(--accent); }
.tabs button .dot { display: inline-block; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; margin-left: 5px; vertical-align: middle; }
.tabp { padding: 16px; }
.blk { margin-bottom: 22px; }
.blk > h3 { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; margin: 0 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.specs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--ink); container-type: inline-size; }
.specs > div { padding: 10px 10px 9px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.specs > div:nth-child(3n) { border-right: 0; }
.specs > div:nth-last-child(-n+3) { border-bottom: 0; }
.specs b { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 3px; font-family: var(--f-num); font-size: clamp(17px, 6.4cqi, 22px); font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.specs b small { font-family: var(--f-sans); font-size: 11px; font-weight: 400; letter-spacing: 0; color: var(--ink-3); white-space: nowrap; }
.specs span { font-size: 11.5px; color: var(--ink-3); }
.ev { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.ev:last-child { border-bottom: 0; }
.ev-h { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ev-h b { font-weight: 600; font-size: 13.5px; }
.ev-h .v { font-family: var(--f-mono); font-size: 13px; }
.ev p { margin: 3px 0 0; font-size: 12.5px; color: var(--ink-2); }
.conf { font-family: var(--f-mono); font-size: 9.5px; letter-spacing: .08em; padding: 1px 6px; border: 1px solid; text-transform: uppercase; margin-left: 6px; }
.conf.stated { color: var(--ok); }
.conf.derived { color: var(--slate); }
.conf.estimated { color: var(--warn); }
.conf.default { color: var(--ink-3); }
.conf.user { color: var(--accent); }
.ev-refs { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.ev-refs a { font-size: 11.5px; color: var(--ink-3); cursor: pointer; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-refs a:hover { color: var(--accent); }
.ev-refs a::before { content: "↳ "; }
.rooms-l { font-size: 12.5px; }
.rooms-l .lvh { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .1em; color: var(--ink-3); margin: 10px 0 4px; }
.rooms-l .rm { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dotted var(--line); cursor: pointer; }
.rooms-l .rm:hover { color: var(--accent); }
.rooms-l .rm span:last-child { font-family: var(--f-mono); color: var(--ink-2); }
.rooms-l .rm.out { color: var(--ink-3); }
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-r { cursor: pointer; }
.bar-r .bl { display: flex; justify-content: space-between; font-size: 12.5px; gap: 8px; }
.bar-r .bl span:last-child { font-family: var(--f-mono); white-space: nowrap; }
.bar-r .bt { height: 7px; background: #ece8e0; margin-top: 3px; position: relative; }
.bar-r .bt i { position: absolute; inset: 0 auto 0 0; }
.bar-r:hover .bl span:first-child { color: var(--accent); }
.stack { display: flex; height: 16px; border: 1px solid var(--ink); margin: 6px 0 8px; }
.stack i { display: block; height: 100%; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 13px; }
.kv span:nth-child(even) { text-align: right; font-family: var(--f-mono); }
.kv .g { font-weight: 600; border-top: 1px solid var(--ink); padding-top: 6px; margin-top: 4px; }
.kv .g + span { font-weight: 600; border-top: 1px solid var(--ink); padding-top: 6px; margin-top: 4px; }
.note { font-size: 12px; color: var(--ink-3); line-height: 1.55; }
.cmp { width: 100%; border-collapse: collapse; font-size: 12px; }
.cmp th { text-align: left; font-family: var(--f-mono); font-weight: 500; font-size: 9.5px; letter-spacing: .1em; color: var(--ink-3); padding: 0 4px 6px; border-bottom: 1px solid var(--ink); text-transform: uppercase; }
.cmp td { padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cmp .r { text-align: right; font-family: var(--f-mono); white-space: nowrap; }
.cmp tr.sh td { padding-top: 12px; font-weight: 600; font-size: 11.5px; border-bottom: 1px solid var(--line-2); }
.cmp tr.sh i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; }
.cmp tr.cl { cursor: pointer; }
.cmp tr.cl:hover td { background: #f4f0e8; }
.dv { display: inline-block; min-width: 50px; text-align: right; padding: 0 4px; font-size: 11px; }
.dv.ok { color: var(--ok); }
.dv.mid { color: var(--warn); }
.dv.bad { color: var(--err); font-weight: 600; }
.el-card { border: 1px solid var(--ink); }
.el-card .eh { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.el-card .eh .kicker { font-size: 10px; }
.el-card .eh h4 { margin: 4px 0 0; font-size: 15px; font-weight: 600; line-height: 1.4; }
.el-card .kv { padding: 10px 14px; }
.el-empty { padding: 26px 10px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line-2); }
.el-empty svg { width: 42px; height: 42px; margin: 0 auto 10px; stroke: var(--ink-3); fill: none; stroke-width: 1.2; }
.rl { padding: 9px 10px; border: 1px solid var(--line); margin-top: -1px; cursor: pointer; display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.rl:hover { border-color: var(--ink); position: relative; }
.rl i { width: 8px; height: 28px; display: block; }
.rl b { font-weight: 500; font-size: 12.5px; display: block; line-height: 1.35; }
.rl span { font-size: 11px; color: var(--ink-3); font-family: var(--f-mono); }
.rl .q { font-family: var(--f-mono); font-size: 11.5px; text-align: right; }

[hidden] { display: none !important; }

/* ---- stage tabs: 3D model | construction drawings */
.stage { display: flex; flex-direction: column; }
.stabs { height: 42px; flex: none; display: flex; align-items: stretch; background: var(--sheet); border-bottom: 1px solid var(--ink); z-index: 8; }
.stabs button { display: flex; align-items: center; gap: 8px; padding: 0 16px; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 13px; color: var(--ink-2); position: relative; }
.stabs button svg { width: 17px; height: 17px; }
.stabs button.on { color: var(--ink); font-weight: 600; }
.stabs button.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; border-bottom: 3px solid var(--accent); }
.stabs button .mono { font-size: 11px; color: var(--ink-3); font-weight: 400; }
.stabs-note { margin-left: auto; align-self: center; padding: 0 14px; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--f-mono); }
.stabs-note b { color: var(--ok); font-weight: 500; }
.stage-body { position: relative; flex: 1; min-height: 0; }
.dwg { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px minmax(0, 1fr); background: #dcd7cd; }
.dwg-list { overflow: auto; background: var(--sheet); border-right: 1px solid var(--ink); padding: 8px 0; }
.dwg-list .dg { font-family: var(--f-mono); font-size: 10px; letter-spacing: .14em; color: var(--ink-3); padding: 10px 14px 4px; text-transform: uppercase; }
.dwg-list button { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; padding: 7px 14px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); border-left: 3px solid transparent; }
.dwg-list button b { font-family: var(--f-mono); font-weight: 500; color: var(--ink); font-size: 12px; }
.dwg-list button small { display: block; font-size: 10.5px; color: var(--ink-3); font-family: var(--f-mono); }
.dwg-list button:hover { background: #f3efe7; }
.dwg-list button.on { background: var(--accent-soft); border-left-color: var(--accent); }
.dwg-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.dwg-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--sheet); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.dwg-bar b { font-weight: 600; font-size: 13.5px; margin-right: auto; }
.dwg-bar .tbtn { box-shadow: none; width: 32px; height: 32px; color: var(--ink); }
.dwg-view { position: relative; flex: 1; min-height: 0; overflow: hidden; cursor: grab; touch-action: none; }
.dwg-view.drag { cursor: grabbing; }
.dwg-view img { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 10px 40px -10px rgba(0, 0, 0, .45); background: #fff; user-select: none; -webkit-user-drag: none; max-width: none; }
.dwg-wait { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); background: var(--sheet); border: 1px solid var(--ink); padding: 8px 14px; }
@media (max-width: 980px) { .dwg { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); } .dwg-list { display: flex; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--ink); } .dwg-list .dg { display: none; } .dwg-list button { grid-template-columns: auto; white-space: nowrap; width: auto; } .dwg-list button span { display: none; } .stabs-note { display: none; } }

/* drawings need the room: the BOQ list steps aside while the drawing set is open */
@media (min-width: 981px) {
  .ws-main.dwg-mode .pane-l { display: none; }
  .ws-main.dwg-mode { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 1320px) and (min-width: 981px) {
  .ws-main.dwg-mode { grid-template-columns: minmax(0, 1fr); }
  .ws-main.dwg-mode.info-open { grid-template-columns: minmax(0, 1fr) 330px; }
}

/* ---- accuracy (BOQ ↔ model) */
.acc-t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.acc-t td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.acc-t td.r { text-align: right; font-family: var(--f-mono); white-space: nowrap; }
.acc-t small { display: block; color: var(--ink-3); font-size: 11px; }
.acc-t tr.acc-g td { padding: 16px 4px 6px; border-bottom: 1px solid var(--ink); }
.acc-t tr.acc-g b { display: block; font-family: var(--f-serif); font-size: 13.5px; font-weight: 600; }
.acc-t tr.acc-g span { display: block; margin-top: 2px; font-size: 11px; line-height: 1.5; color: var(--ink-3); }
.acc-src { margin-top: 3px; font-size: 11px; color: var(--ink-3); }
.acc-src summary { cursor: pointer; color: var(--accent); width: max-content; }
.acc-src div { padding: 2px 0 0 10px; border-left: 2px solid var(--line-2); margin-top: 3px; line-height: 1.45; word-break: break-word; }
.fitcard p.solver { margin-top: 8px; }
.fitcard p.solver b { color: var(--ink); }
.fitcard p.cands span { display: inline-block; margin: 2px 4px 0 0; padding: 0 6px; border: 1px solid var(--line-2); font-family: var(--f-mono); font-size: 10.5px; }
.fitcard p.cands span.win { border-color: var(--accent); color: var(--accent); }
.st { display: inline-block; font-family: var(--f-mono); font-size: 9.5px; letter-spacing: .06em; padding: 1px 6px; border: 1px solid; white-space: nowrap; }
.st.exact { color: var(--ok); }
.st.close { color: var(--warn); }
.st.diff { color: var(--err); }
.st.info { color: var(--ink-3); }
.fitcard { border: 1px solid var(--ink); padding: 12px 14px; margin-bottom: 12px; background: #fff; }
.fitcard .kicker { font-size: 10px; }
.fitcard b { display: block; font-size: 14px; margin: 3px 0 2px; }
.fitcard p { margin: 4px 0 0; font-size: 12px; color: var(--ink-2); }
/* a design laid out for this BOQ (not from the library) */
.fitcard.gen { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.fitcard.gen .kicker { color: var(--accent); }
.gen-why { margin: 8px 0 0; padding: 0 0 0 16px; font-size: 12px; line-height: 1.55; color: var(--ink-2); }
.gen-why li { margin: 2px 0; }
.gen-why li::marker { color: var(--accent); }

/* ---- medium: info panel becomes a slide-over drawer */
.mtabs { display: none; }
.tbtn-info { display: none; width: auto; padding: 0 10px; gap: 6px; font-size: 12.5px; }
.ws-main { position: relative; }
@media (max-width: 1320px) and (min-width: 981px) {
  .ws-main { grid-template-columns: 330px minmax(0, 1fr); }
  .pane-r { display: none; }
  .ws-main.info-open { grid-template-columns: 330px minmax(0, 1fr) 330px; }
  .ws-main.info-open .pane-r { display: flex; }
  .tbtn-info { display: flex; align-items: center; }
  .ws-main.info-open .tbtn-info { background: var(--ink); color: var(--paper); }
  .ws-main.info-open .ov-tl .seg button { padding: 0 9px; }
  .ws-main.info-open .ov-tr { top: 56px; }
  .ws-main.info-open #views { display: none; }
}
@media (max-width: 980px) {
  .ws-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .pane-l, .pane-r { position: absolute; z-index: 20; inset: 0; border: 0; display: none; }
  .ws-main.m-boq .pane-l, .ws-main.m-info .pane-r { display: flex; }
  .stage { grid-column: 1; grid-row: 1; }
  .mtabs { display: flex; height: 52px; flex: none; border-top: 1px solid var(--ink); background: var(--sheet); }
  .mtabs button { flex: 1; border: 0; border-right: 1px solid var(--line); background: transparent; font-size: 13.5px; cursor: pointer; }
  .mtabs button:last-child { border-right: 0; }
  .mtabs button.on { background: var(--ink); color: var(--paper); }
  .ov-tl { right: 14px; overflow-x: auto; }
  .seg button { padding: 0 10px; }
  .ov-tr { top: 58px; }
  .ov-bl .legend { max-height: 34vh; overflow: auto; }
  .ov-br #views { display: none; }
}
@media (max-width: 520px) { .ws-head { gap: 10px; padding: 0 10px; } .ws-title h1 { font-size: 16px; } .legend { max-width: 190px; } }

/* ---------------------------------------------------------------- construction sequence (build playback) */
.ov-tl { flex-direction: column; align-items: flex-start; gap: 8px; }
.tbtn-play { width: auto; padding: 0 12px 0 9px; gap: 6px; display: inline-flex; align-items: center; height: 34px;
  background: var(--accent); color: #fff; border-color: var(--accent); font-size: 12.5px; font-weight: 500; vertical-align: top; }
.tbtn-play svg { width: 13px; height: 13px; }
.tbtn-play:hover { background: #8a3220; }
.building .tbtn-play { background: var(--sheet); color: var(--ink); border-color: var(--ink); }
.build-hud { position: absolute; left: 50%; bottom: 58px; transform: translateX(-50%); width: min(560px, calc(100% - 32px)); z-index: 6;
  background: rgba(251, 250, 246, .96); border: 1px solid var(--ink); box-shadow: var(--shadow); padding: 12px 16px 14px; backdrop-filter: blur(6px); }
.build-hud[hidden] { display: none; }
.bh-head { display: flex; justify-content: space-between; align-items: center; margin: -4px -8px 6px 0; }
.bh-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: end; }
.bh-step { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.bh-no { font-family: var(--f-num); font-size: 22px; font-weight: 300; letter-spacing: -.02em; color: var(--accent); line-height: 1.1; font-variant-numeric: tabular-nums; }
.bh-step b { display: block; font-family: var(--f-serif); font-size: 17px; font-weight: 600; line-height: 1.3; }
.bh-step small { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.45; }
.bh-cost { text-align: right; }
.bh-cost span, .bh-cost small { display: block; font-size: 10.5px; color: var(--ink-3); }
.bh-cost b { display: block; font-family: var(--f-num); font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums lining-nums; line-height: 1.2; }
.bh-bar { display: flex; gap: 3px; margin: 12px 0 10px; height: 5px; }
.bh-bar i { background: var(--line); position: relative; overflow: hidden; }
.bh-bar i.done { background: var(--ink); }
.bh-bar i.now u { position: absolute; inset: 0; background: var(--accent); animation: bh-grow 1.6s ease-in-out infinite alternate; transform-origin: left; }
@keyframes bh-grow { from { transform: scaleX(.15); } to { transform: scaleX(1); } }
.bh-ctl { display: flex; gap: 8px; }
@media (max-width: 640px) {
  .build-hud { bottom: 12px; padding: 10px 12px 12px; }
  .bh-main { grid-template-columns: 1fr; gap: 8px; }
  .bh-cost { text-align: left; }
  .tbtn-play { height: 30px; }
}
.ws-main.info-open .tbtn-play { width: 34px; padding: 0; justify-content: center; }
.ws-main.info-open .tbtn-play span { display: none; }

/* ---------------------------------------------------------------- design picker */
.dsg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dsg-grid.one { grid-template-columns: minmax(0, 1fr); }
.dsg { border: 1px solid var(--line); background: #fff; padding: 8px 9px 9px; display: grid; gap: 3px; align-content: start; min-width: 0; }
.dsg.cur { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.dsg svg { width: 100%; height: auto; display: block; background: #fbfaf6; border: 1px solid var(--line); margin-bottom: 4px; }
.dsg-grid.one .dsg { grid-template-columns: 150px minmax(0, 1fr); column-gap: 12px; }
.dsg-grid.one .dsg svg { grid-row: span 4; margin: 0; }
.dsg-t { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.dsg-t .mono { font-size: 10.5px; color: var(--ink-3); }
.dsg-t em { font-style: normal; font-size: 10.5px; padding: 0 5px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.dsg b { font-size: 12.5px; line-height: 1.35; font-weight: 600; }
.dsg small { font-size: 11px; line-height: 1.45; color: var(--ink-3); }
.dsg .btn { margin-top: 4px; height: 28px; font-size: 12px; justify-self: start; }
.dsg-on { margin-top: 4px; font-size: 11.5px; color: var(--accent); font-weight: 600; }
.dsg-sub { margin: 12px 0 6px; font-size: 11.5px; letter-spacing: .04em; color: var(--ink-3); }
.dsg-all { margin-top: 10px; width: 100%; }
.dsg-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.dsg-f { display: grid; gap: 3px; font-size: 11px; color: var(--ink-3); }
.dsg-f select { height: 30px; border: 1px solid var(--line-2); background: #fff; font: inherit; font-size: 12px; color: var(--ink); padding: 0 4px; min-width: 0; }
.dsg.far { opacity: .62; }
.dsg.gen:not(.cur) { border-style: dashed; border-color: var(--accent); background: #fffdf8; }
.dsg.gen .dsg-t .mono { color: var(--accent); font-weight: 600; }
.dsg.far em { border-color: #d9b9a8; color: #8a3a22; }
.dsg .btn[disabled] { cursor: not-allowed; color: var(--ink-3); border-color: var(--line-2); }
