:root {
  --bg: #121417;
  --panel: #1a1d21;
  --panel-2: #20242a;
  --line: #2b3038;
  --line-2: #363c45;
  --text: #e7e9ec;
  --muted: #9aa2ad;
  --faint: #6b737e;
  --accent: #3d8bff;
  --accent-2: #8fb9ff;
  --good: #3ecf8e;
  --warn: #f2b84b;
  --bad: #ff6b6b;
  --gold: #e3b865;
  --radius: 8px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --left: 300px;
  --right: 380px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 var(--sans); overflow: hidden; }
button { font: inherit; color: inherit; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd { font-family: var(--mono); font-size: 12px; }
kbd { background: var(--panel-2); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }

/* ---- header ---------------------------------------------------------------------------------- */
header.top { height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 12px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: 0.1px; white-space: nowrap; }
.logo { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent); box-shadow: inset 0 0 0 4px var(--panel), inset 0 0 0 9px #c5c8cc; }
.repo { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.repo b { color: var(--text); font-weight: 600; }
.repo .mod { color: var(--warn); }
.spacer { flex: 1; }
.live { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); padding: 4px 10px; border: 1px solid var(--line);
  border-radius: 999px; white-space: nowrap; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.live.live .dot { background: var(--good); box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.6); animation: pulse 2.4s infinite; }
.live.offline .dot { background: var(--bad); }
.live.deployed .dot { background: var(--accent); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0.5); } 70% { box-shadow: 0 0 0 7px rgba(62, 207, 142, 0); } 100% { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0); } }
.icon-btn { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; font-weight: 700; }
.icon-btn:hover { border-color: var(--line-2); background: #262b32; }
.only-narrow { display: none; }

/* ---- layout ---------------------------------------------------------------------------------- */
main { position: absolute; inset: 44px 0 0 0; display: grid; grid-template-columns: var(--left) 1fr var(--right); }
.panel { background: var(--panel); min-height: 0; display: flex; flex-direction: column; }
.panel.left { border-right: 1px solid var(--line); }
.panel.right { border-left: 1px solid var(--line); overflow: hidden; }
.panel-head { padding: 10px; border-bottom: 1px solid var(--line); }
.panel-foot { padding: 8px 12px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11.5px; }
#search { width: 100%; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
  padding: 0 10px; outline: none; font: inherit; }
#search:focus { border-color: var(--accent); }

/* ---- tree ------------------------------------------------------------------------------------ */
.tree { flex: 1; overflow: auto; padding: 6px 0 16px; user-select: none; }
.tree .row { display: flex; align-items: center; height: 26px; padding-right: 8px; cursor: pointer; border-radius: 0; position: relative; white-space: nowrap; }
.tree .row:hover { background: #22272e; }
.tree .row.focus { background: rgba(61, 139, 255, 0.18); box-shadow: inset 2px 0 0 var(--accent); }
.tree .row.out { opacity: 0.45; }
.tree .row.hidden .name { text-decoration: line-through; color: var(--faint); }
.tree .caret { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border: 0; background: none; cursor: pointer;
  color: var(--faint); padding: 0; }
.tree .caret svg { width: 10px; height: 10px; transition: transform 0.15s; fill: currentColor; }
.tree .row.open > .caret svg { transform: rotate(90deg); }
.tree .caret.none { visibility: hidden; }
.tree .kind { width: 16px; height: 16px; flex: none; margin-right: 6px; border-radius: 4px; display: grid; place-items: center; font-size: 9px;
  font-weight: 700; color: #0e1013; }
.kind.assembly { background: #7f8b99; }
.kind.part { background: #b9c2cc; }
.kind.board { background: #2f9e62; color: #fff; }
.kind.group { background: #4a525d; color: #ddd; }
.kind.layer { background: #c27a4e; color: #fff; }
.kind.component { background: var(--gold); }
.tree .name { overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.tree .state { width: 14px; flex: none; margin-left: 4px; }
.tree .state.loading::after { content: ''; display: block; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-2);
  border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
.tree .state.error::after { content: '!'; color: var(--bad); font-weight: 800; }
@keyframes spin { to { transform: rotate(360deg); } }
.tree .cost { font: 11px var(--mono); color: var(--muted); margin-left: 8px; }
.tree .eye { width: 22px; height: 22px; border: 0; background: none; color: var(--faint); cursor: pointer; opacity: 0; padding: 0; margin-left: 2px; }
.tree .row:hover .eye, .tree .row.hidden .eye { opacity: 1; }
.tree .eye svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.tree .kids { display: none; }
.tree .open + .kids { display: block; }
.tree .row.match .name { color: var(--accent-2); }

/* ---- viewport ---------------------------------------------------------------------------------- */
.viewport { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; outline: none; touch-action: none; }
/* the WebGPU ray tracer's canvas (scene/rt-webgpu.js), over the real-time one once it has an image: it
   fades in, and goes at once when the view moves */
.rt-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; opacity: 0; }
.rt-canvas.on { opacity: 1; transition: opacity 0.25s; }
#canvas.picking { cursor: crosshair; }
/* the lens finish (ui/studio.js LensFinish; keep VIGNETTE and GRAIN there in step): a vignette and film grain over
   the canvases. No z-index: the grain's blend must reach the canvases under it. */
.finish { position: absolute; inset: 0; pointer-events: none; display: none;
  background: radial-gradient(circle farthest-corner at 50% 50%, rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, 0.12) 100%); }
.finish.on { display: block; }
.finish::after { content: ''; position: absolute; inset: 0; background-image: var(--grain); background-size: 192px 192px;
  mix-blend-mode: overlay; opacity: 0.07; }
.crumbs { position: absolute; left: 14px; top: 12px; right: 92px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center;
  pointer-events: none; }
.crumbs button { pointer-events: auto; border: 1px solid rgba(0, 0, 0, 0.08); background: rgba(255, 255, 255, 0.82); color: #1b1e22;
  padding: 3px 10px; border-radius: 999px; cursor: pointer; font-size: 12px; backdrop-filter: blur(6px); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.crumbs button:hover { background: #fff; }
.crumbs button.cur { background: #1b1e22; color: #fff; border-color: #1b1e22; }
.crumbs .sep { color: #7b828c; font-size: 11px; }
body.dark-stage .crumbs button { background: rgba(32, 36, 42, 0.85); color: var(--text); border-color: var(--line-2); }
body.dark-stage .crumbs button.cur { background: var(--accent); border-color: var(--accent); }
.progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; opacity: 0; transition: opacity 0.4s; }
.progress.on { opacity: 1; }
.progress .bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #79b1ff); transition: width 0.3s; }
.progress .label { position: absolute; top: 40px; left: 14px; font-size: 12px; color: #3b4048; background: rgba(255, 255, 255, 0.8);
  padding: 3px 9px; border-radius: 6px; }
body.dark-stage .progress .label { background: rgba(20, 22, 26, 0.8); color: var(--muted); }
/* Motion studies (js/ui/motions.js): the badge over a part that can be worked, and the line under the view
   naming the study and the move under way. Amber, so a live part reads apart from the blue hover outline. */
.hotspot { position: absolute; transform: translate(-50%, -140%); z-index: 7; display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px 0 9px; border-radius: 16px; cursor: pointer; white-space: nowrap;
  background: rgba(24, 19, 10, 0.92); color: #ffd18a; border: 1px solid rgba(255, 180, 61, 0.65);
  font: 600 12px/1 var(--sans); box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45); animation: hotspot-in 140ms ease-out; }
.hotspot:hover { background: rgba(255, 180, 61, 0.92); color: #19130a; border-color: #ffb43d; }
.hotspot[hidden] { display: none; }
.hotspot svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round;
  stroke-linejoin: round; flex: none; }
.hotspot.away { color: var(--muted); border-color: var(--line-2); background: rgba(18, 20, 23, 0.92); }
.hotspot.away:hover { color: #fff; border-color: #6b747f; background: #2a2f36; }
@keyframes hotspot-in { from { opacity: 0; transform: translate(-50%, -115%); } }
.motion-status { position: absolute; left: 14px; bottom: 66px; z-index: 4; display: none; max-width: 34%;
  padding: 6px 11px 7px; border-radius: 8px; font-size: 11.5px; line-height: 1.45;
  background: rgba(18, 20, 23, 0.92); border: 1px solid rgba(255, 180, 61, 0.35); color: var(--muted); }
.motion-status.on { display: block; }
.motion-status b { color: #ffd18a; font-weight: 600; }
.motion-status span { color: var(--muted); }
.mpop { width: min(440px, calc(100% - 24px)); max-height: min(62vh, calc(100% - 100px)); overflow-y: auto; }
.mpop .mrow { padding: 7px 0; }
.mpop .mhead { display: flex; align-items: center; gap: 8px; }
.mpop .mhead .vlabel { flex: 1; margin: 0; }
.mpop .mico { display: flex; color: #ffb43d; }
.mpop .mico svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round;
  stroke-linejoin: round; }
.mpop .vfoot { display: flex; align-items: center; gap: 10px; position: sticky; bottom: -10px; z-index: 1;
  background: #181b1f; border-top: 1px solid var(--line); margin: 0 -12px -10px; padding: 8px 12px 10px; }
.mpop .vfoot .chip { white-space: nowrap; font-family: var(--sans); }
.mpop .vfoot span { color: var(--faint); }
.mpop .chip[disabled] { opacity: 0.4; cursor: default; }

/* The view cube (js/ui/viewcube.js): a cube in CSS 3D over the view, at the top right. It turns with the camera
   (.vcube-box's transform) and each face carries a 3 x 3 grid of buttons: the middle cell looks square at the
   face, the others at the edge or corner they reach. The size comes from the module (--vcube-size), which also
   has it in the faces' transforms, and whose `perspective` is the camera's lens (ViewCube.sync). The wrapper
   lets the pointer through: only the cells take it, for a click on one or a drag that turns the view. */
.vcube { position: absolute; right: 14px; top: 12px; width: calc(var(--vcube-size) * 2); height: calc(var(--vcube-size) * 2);
  z-index: 6; pointer-events: none; user-select: none; }
.vcube-box { position: absolute; left: 50%; top: 50%; width: var(--vcube-size); height: var(--vcube-size);
  margin: calc(var(--vcube-size) / -2) 0 0 calc(var(--vcube-size) / -2); transform-style: preserve-3d; }
.vcube-face { position: absolute; inset: 0; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  backface-visibility: hidden; background: rgba(255, 255, 255, 0.78); border: 1px solid rgba(0, 0, 0, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5); }
/* a little shading, so the cube reads as a solid rather than three flat panels */
.vcube-face[data-face="top"] { background: rgba(255, 255, 255, 0.88); }
.vcube-face[data-face="bottom"] { background: rgba(228, 230, 233, 0.78); }
.vcube-face[data-face="left"], .vcube-face[data-face="right"] { background: rgba(236, 238, 241, 0.78); }
.vcube-label { position: absolute; inset: 0; display: grid; place-items: center; font: 650 7px/1 var(--sans);
  letter-spacing: 0.05em; text-transform: uppercase; color: #3b4048; pointer-events: none; }
.vcube-cell { border: 0; background: none; padding: 0; margin: 0; cursor: pointer; pointer-events: auto; touch-action: none; }
.vcube.dragging .vcube-cell { cursor: grabbing; }
.vcube.dragging .vcube-cell:hover { background: none; }
.vcube-cell:hover { background: rgba(61, 139, 255, 0.5); }
.vcube-cell.on { background: rgba(61, 139, 255, 0.26); box-shadow: inset 0 0 0 1px rgba(61, 139, 255, 0.75); }
.vcube-cell:focus-visible { outline: 1px solid var(--accent); outline-offset: -2px; }
.vcube-name { position: absolute; left: -24px; right: -24px; top: 100%; text-align: center; font-size: 10px;
  color: #3b4048; opacity: 0; transition: opacity 0.12s; }
.vcube-name.on { opacity: 1; }
body.dark-stage .vcube-face { background: rgba(32, 36, 42, 0.82); border-color: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05); }
body.dark-stage .vcube-face[data-face="top"] { background: rgba(44, 49, 57, 0.86); }
body.dark-stage .vcube-face[data-face="bottom"] { background: rgba(24, 27, 32, 0.82); }
body.dark-stage .vcube-face[data-face="left"], body.dark-stage .vcube-face[data-face="right"] { background: rgba(28, 32, 38, 0.82); }
body.dark-stage .vcube-label { color: #c9ced6; }
body.dark-stage .vcube-name { color: var(--muted); }

.hover-tip { position: absolute; pointer-events: none; background: rgba(18, 20, 23, 0.92); color: var(--text); padding: 5px 9px; border-radius: 7px;
  font-size: 12px; display: none; transform: translate(14px, 14px); max-width: 320px; box-shadow: 0 4px 16px rgba(0,0,0,0.25); border: 1px solid var(--line-2); }
.hover-tip .sub { color: var(--muted); font-size: 11px; }
.hover-tip .hint { color: var(--faint); font-size: 10.5px; margin-top: 2px; }

.toolbar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 6px; padding: 6px;
  background: rgba(24, 27, 31, 0.9); border: 1px solid var(--line-2); border-radius: 12px; backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28); max-width: calc(100% - 24px); overflow-x: auto; }
.toolbar .group { display: flex; align-items: center; gap: 3px; padding: 0 4px; border-left: 1px solid var(--line); }
.toolbar .group:first-child { border-left: 0; }
.tool { height: 30px; min-width: 30px; padding: 0 9px; border-radius: 7px; border: 1px solid transparent; background: none; color: var(--muted);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.tool:hover { background: #2a2f36; color: var(--text); }
.tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; flex: none; }
.tool.on { color: #fff; background: rgba(61, 139, 255, 0.22); border-color: rgba(61, 139, 255, 0.45); }
.tool[hidden], .toolbar .group[hidden] { display: none; }
.tool:disabled, .tool:disabled:hover { opacity: 0.4; cursor: default; background: none; color: var(--muted); }
.tool .vval { color: var(--faint); font-size: 11px; }
.tool.on .vval { color: var(--accent-2); }

/* ray-traced mode status (scene/raytrace.js) */
.rt-status { position: absolute; right: 14px; bottom: 66px; z-index: 4; display: none; padding: 6px 11px 7px; border-radius: 8px;
  background: rgba(24, 27, 31, 0.86); border: 1px solid var(--line-2); color: var(--text); font-size: 12px; backdrop-filter: blur(8px);
  overflow: hidden; max-width: min(420px, calc(100% - 28px)); }
.rt-status.on { display: block; }
.rt-status .bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); transition: width 0.3s; }
.rt-status .by { margin-left: 6px; padding: 0 5px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--muted); font-size: 10.5px; }

/* variants popover (ui/variants.js): above the toolbar */
.vpop { position: absolute; left: 50%; bottom: 66px; transform: translateX(-50%); width: min(400px, calc(100% - 24px)); z-index: 6;
  background: rgba(24, 27, 31, 0.96); border: 1px solid var(--line-2); border-radius: 12px; backdrop-filter: blur(10px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35); padding: 10px 12px 10px; }
.vpop[hidden] { display: none; }
.vhead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.vhead b { font-size: 13px; }
.vx { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.vx:hover { color: var(--text); }
.vfams { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.chip { height: 26px; padding: 0 11px; border-radius: 13px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--muted);
  cursor: pointer; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.chip:hover { color: var(--text); border-color: #4a525d; }
.chip.on { color: #fff; background: rgba(61, 139, 255, 0.25); border-color: rgba(61, 139, 255, 0.6); }
.vsw { padding: 7px 0; border-top: 1px solid var(--line); }
.vlabel { color: var(--muted); font-size: 11.5px; margin-bottom: 5px; }
.vlabel span { color: var(--faint); }
.vopts { display: flex; flex-wrap: wrap; gap: 4px; }
.seg { height: 26px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line-2); background: none; color: var(--muted);
  cursor: pointer; font-size: 12px; }
.seg:hover { color: var(--text); background: #262b32; }
.seg.on { color: #fff; background: rgba(61, 139, 255, 0.22); border-color: rgba(61, 139, 255, 0.55); }
.seg i, .vfoot i { color: var(--accent-2); font-style: normal; margin-left: 2px; }
.vnote { color: var(--faint); font-size: 11px; margin-top: 5px; line-height: 1.4; }
.vfoot { color: var(--faint); font-size: 10.5px; padding-top: 6px; border-top: 1px solid var(--line); }
.vpop .lens { width: 100%; accent-color: var(--accent); margin: 2px 0 7px; }
.vsw.dim { opacity: 0.45; }
.vopts.dofpick { margin-top: 5px; }
/* The Materials menu (js/ui/looks.js): over the parts tree, so nothing of the view it changes is covered (on a
   narrow screen, where the tree is a drawer, at the view's left above the toolbar). Each part's name carries a dot
   of its colour now and a mark when it is not as designed. */
.lpop { left: 8px; bottom: 8px; transform: none; width: calc(var(--left) - 16px); max-height: calc(100% - 16px); overflow-y: auto;
  z-index: 12; background: #181b1f; }
@media (max-width: 960px) {
  .lpop { left: 12px; bottom: 60px; width: min(340px, calc(100% - 24px)); max-height: calc(100% - 120px); }
}
.lpop .lrow { display: flex; align-items: center; justify-content: space-between; }
.lpop .lscope { margin: 0 0 6px; padding: 5px 8px; border-radius: 6px; background: rgba(61, 139, 255, 0.1); color: var(--muted); }
.lpop .lscope b { color: var(--text); }
.lpop .lall { border: 0; background: none; color: var(--accent-2); font-size: 11px; cursor: pointer; padding: 0 2px; }
.lpop .lall:hover { text-decoration: underline; }
.lpop .lslot { display: inline-flex; align-items: center; gap: 6px; padding: 0 9px 0 7px; }
.lpop .ldot { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.28); flex: none; }
.lpop .lmark { display: none; width: 5px; height: 5px; border-radius: 50%; background: #ffb43d; margin-left: 1px; }
.lpop .lslot.changed .lmark { display: block; }
.lswatches { display: flex; flex-wrap: wrap; gap: 5px; }
.lsw { width: 24px; height: 24px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.22); padding: 0; cursor: pointer;
  position: relative; overflow: hidden; }
.lsw:hover { border-color: #fff; }
.lsw.on { box-shadow: 0 0 0 2px #181b1f, 0 0 0 4px var(--accent); }
.lsw.lcustom { background: conic-gradient(#f66, #fc6, #9e6, #6ec, #69f, #c6f, #f66); }
.lsw.lcustom input { position: absolute; inset: -6px; width: 40px; height: 40px; opacity: 0; cursor: pointer; padding: 0; border: 0; }
.lpop .vnote b { color: var(--muted); font-weight: 600; }
.lpop .vfoot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.lpop .vfoot .chip { white-space: nowrap; font-family: var(--sans); cursor: pointer; height: 24px; }
.lpop .vfoot .chip[disabled] { opacity: 0.4; cursor: default; }
.lpop .vfoot span { color: var(--faint); }

.toasts { position: fixed; right: calc(var(--right) + 16px); bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 20; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); color: var(--text); padding: 8px 12px;
  border-radius: 8px; font-size: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); max-width: 380px; animation: tin 0.25s ease-out; }
.toast.bad { border-left-color: var(--bad); }
.toast .p { color: var(--muted); font-family: var(--mono); font-size: 11px; word-break: break-all; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* ---- inspector ---------------------------------------------------------------------------------- */
.inspector { overflow: auto; height: 100%; padding: 0 0 40px; }
.insp-head { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.insp-head .kind-line { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; }
.insp-head h1 { font-size: 17px; margin: 4px 0 0; font-weight: 650; line-height: 1.3; word-break: break-word; }
.insp-head .status { margin-top: 8px; font-size: 12px; color: var(--muted); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line-2); color: var(--muted); }
.pill.warn { color: var(--warn); border-color: rgba(242, 184, 75, 0.4); }
.pill.bad { color: var(--bad); border-color: rgba(255, 107, 107, 0.4); }
.pill.good { color: var(--good); border-color: rgba(62, 207, 142, 0.4); }
.sec { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sec h2 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--faint); margin: 0 0 8px; font-weight: 650;
  display: flex; align-items: center; gap: 8px; }
.sec h2 .count { color: var(--faint); font-weight: 500; letter-spacing: 0; text-transform: none; }
.sec p { margin: 0 0 6px; color: #c9ced6; }
.about { white-space: pre-line; }
table.kv { width: 100%; border-collapse: collapse; }
table.kv td { padding: 3px 0; vertical-align: top; }
table.kv td:first-child { color: var(--muted); width: 38%; padding-right: 10px; }
table.kv td.num, .num { font-family: var(--mono); font-size: 12px; }
.cost-big { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.cost-big .v { font: 600 22px var(--mono); color: #fff; }
.cost-big .sub { color: var(--muted); font-size: 12px; }
.basis { color: var(--faint); font-size: 11.5px; margin: 4px 0 8px; }
.bars { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.bar-row { display: grid; grid-template-columns: 1fr 80px 64px; gap: 8px; align-items: center; font-size: 12px; cursor: pointer; }
.bar-row:hover .label { color: #fff; }
.bar-row .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c9ced6; }
.bar-row .track { height: 6px; background: #262b31; border-radius: 3px; overflow: hidden; }
.bar-row .fill { height: 100%; background: linear-gradient(90deg, var(--accent), #7fb2ff); border-radius: 3px; }
.bar-row .val { text-align: right; font-family: var(--mono); color: var(--muted); }
table.grid { width: 100%; border-collapse: collapse; font-size: 12px; }
table.grid th { text-align: left; color: var(--faint); font-weight: 600; font-size: 11px; padding: 4px 6px 4px 0; border-bottom: 1px solid var(--line); }
table.grid td { padding: 4px 6px 4px 0; border-bottom: 1px solid #23272d; vertical-align: top; }
table.grid td.r, table.grid th.r { text-align: right; font-family: var(--mono); }
table.grid tr.total td { border-bottom: 0; font-weight: 650; color: #fff; padding-top: 7px; }
table.grid tr.sub td { color: var(--muted); }
.refs { color: var(--faint); font-size: 11px; font-family: var(--mono); }
.links { display: flex; flex-direction: column; gap: 2px; }
.link { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 5px 6px; border-radius: 6px; }
.link:hover { background: #22272e; }
.link .ico { width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; font-size: 9.5px; font-weight: 750; color: #0d0f12; }
.link .t { min-width: 0; }
.link .t a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.link .meta { color: var(--faint); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link .gh { font-size: 11px; color: var(--muted); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; }
.link.missing .t a { color: var(--faint); text-decoration: line-through; }
.ico.cad { background: #b9c2cc; } .ico.ecad { background: #2f9e62; color: #fff; } .ico.drawing { background: #8fb9ff; }
.ico.doc { background: #e7e9ec; } .ico.code { background: #c792ea; } .ico.fab { background: var(--gold); } .ico.data { background: #7f8b99; }
.ico.web { background: #ffb38a; } .ico.file { background: #6b737e; } .ico.datasheet { background: #ff8f8f; }
.params td:first-child { font-family: var(--mono); font-size: 12px; color: #c9ced6; width: auto; }
.params .pv { font-family: var(--mono); font-size: 12px; color: #fff; white-space: nowrap; }
.params .pc { color: var(--faint); font-size: 11.5px; }
.params tr td { border-bottom: 1px solid #23272d; padding: 5px 6px 5px 0; }
.notes li { margin: 0 0 5px; color: #c9ced6; }
.notes { padding-left: 18px; margin: 0; }
.warnbox { background: rgba(242, 184, 75, 0.08); border: 1px solid rgba(242, 184, 75, 0.3); border-radius: 7px; padding: 8px 10px; color: #e9d3a6; font-size: 12px; }
.errbox { background: rgba(255, 107, 107, 0.08); border: 1px solid rgba(255, 107, 107, 0.3); border-radius: 7px; padding: 8px 10px; color: #ffc9c9;
  font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; border: 1px solid rgba(255,255,255,0.15); }
details > summary { cursor: pointer; color: var(--muted); font-size: 12px; margin: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11px; border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; color: var(--muted); font-family: var(--mono); }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 12px; max-width: 520px; padding: 18px 22px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog h2 { margin: 0 0 12px; font-size: 16px; }
dialog td { padding: 4px 14px 4px 0; vertical-align: top; }
dialog td:first-child { color: var(--muted); white-space: nowrap; }
dialog p { color: var(--muted); }
dialog button { margin-top: 6px; background: var(--accent); border: 0; color: #fff; border-radius: 7px; padding: 6px 16px; cursor: pointer; }

.boot { position: absolute; inset: 0; display: grid; place-items: center; color: #4a515b; font-size: 13px; pointer-events: none; }

/* ---- narrow screens: panels become drawers ------------------------------------------------------ */
@media (max-width: 960px) {
  :root { --left: 0px; --right: 0px; }
  .only-narrow { display: inline-block; }
  .repo { display: none; }
  main { grid-template-columns: 1fr; }
  .panel { position: absolute; top: 0; bottom: 0; width: min(88vw, 380px); z-index: 10; box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s; }
  .panel.left { left: 0; transform: translateX(-102%); }
  .panel.right { right: 0; transform: translateX(102%); }
  body.show-tree .panel.left, body.show-info .panel.right { transform: none; }
  .viewport { grid-column: 1; }
  .toolbar { bottom: 10px; }
  .toasts { right: 12px; }
}
