/* TDBFP Sentinel — layout for the standalone 3D view (/3d).
   Colour, type and widget styles come from app.css; only layout and the few
   3D-specific elements (labels, legend, stage tools) live here. */

.three-app{height:100vh;overflow:hidden}
.three-app .topbar{gap:1rem}
.asset-name{font-weight:600;font-size:.9rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* The widget itself: stage on the left, dossier panel on the right. Fills whatever host
   it is mounted in (the standalone page body, or the tab's .three-host box). */
.three-embed{display:grid;grid-template-columns:minmax(0,1fr) 360px;min-height:0;min-width:0}
.three-app .three-embed{flex:1 1 auto}
@media(max-width:900px){
  .three-embed{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) 42vh}
}

/* In-app tab: a bordered panel sized to the remaining viewport height so the model gets a
   proper stage instead of a thin strip; scrolls only inside the dossier panel. */
.three-tab .three-host{height:calc(100vh - var(--topbar-h) - var(--tabs-h) - 8.6rem);min-height:520px;
  overflow:hidden;border-radius:var(--radius)}
.three-tab .three-host .side{border-left:1px solid var(--line)}
.legend .mode-badge{margin-left:.4rem;padding-left:.7rem;border-left:1px solid var(--line);color:var(--ink-3)}

/* Overlay layout: tools top-left, hint top-right, legend bottom-left, camera presets
   bottom-right. Labels stack upward from the model, so the corners stay clear of them. */
.stage-presets{position:absolute;right:.9rem;bottom:.9rem;display:flex;gap:.3rem;flex-wrap:wrap;justify-content:flex-end;
  max-width:55%}
.stage-presets .chip-toggle{padding:.26rem .6rem;font-size:.74rem;backdrop-filter:blur(6px)}

/* ---------- stage ---------- */
.stage{position:relative;min-width:0;min-height:0;background:var(--ground);overflow:hidden;container-type:inline-size}
/* On a narrow stage the toolbars wrap into the hint's space; drop the hint rather than overlap. */
@container (max-width: 980px){.hint{display:none}}
.viewport{position:absolute;inset:0}
.viewport canvas{display:block;outline:none}
.viewport.grab{cursor:grab}
.viewport.pick{cursor:pointer}

/* CSS2D label layer sits above the canvas but lets pointer events through except on chips. */
.labels{position:absolute;inset:0;pointer-events:none;overflow:hidden;z-index:1}
/* UI chrome always sits above the label layer. */
.stage-tools,.stage-presets,.legend,.hint{z-index:2}
/* CSS2DRenderer owns the inline transform (it centres the element on the anchor), so the
   label is shifted upward with a negative margin; --stem is the connector length back to
   the anchor and grows when the de-overlap pass pushes a label higher. */
.lbl{pointer-events:auto;cursor:pointer;display:inline-flex;align-items:center;gap:.4rem;white-space:nowrap;
  font-family:var(--f-mono);font-size:.66rem;letter-spacing:.02em;
  background:color-mix(in srgb,var(--surface) 88%,transparent);color:var(--ink);
  border:1px solid var(--line);border-radius:3px;padding:.2rem .45rem;box-shadow:var(--shadow);
  --stem:16px}
.lbl:hover{border-color:var(--ink-3);background:var(--surface)}
.lbl .dot{width:8px;height:8px;border-radius:50%;background:var(--ink-3);flex:0 0 auto}
.lbl .cnt{font-weight:600;color:var(--ink-3)}
.lbl.sev-ok .dot{background:var(--ok)}
.lbl.sev-info .dot{background:var(--info)}
.lbl.sev-watch .dot,.lbl.sev-watch .cnt{background:var(--watch);color:var(--watch)}
.lbl.sev-watch .cnt{background:none}
.lbl.sev-warning{border-color:var(--copper)}
.lbl.sev-warning .dot{background:var(--copper)}
.lbl.sev-warning .cnt{color:var(--copper)}
.lbl.sev-critical{border-color:var(--crit);box-shadow:0 0 0 3px color-mix(in srgb,var(--crit) 25%,transparent),var(--shadow)}
.lbl.sev-critical .dot{background:var(--crit);animation:pulse 1.2s ease-in-out infinite}
.lbl.sev-critical .cnt{color:var(--crit)}
.lbl.selected{border-color:var(--accent);background:var(--accent-soft)}
.lbl.stem{position:relative}
.lbl.stem::after{content:"";position:absolute;left:50%;top:100%;width:1px;height:var(--stem);background:var(--line);opacity:.8}
@keyframes pulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(1.35)}}

.stage-tools{position:absolute;left:.9rem;top:.9rem;display:flex;gap:.35rem;flex-wrap:wrap;align-items:center;
  max-width:calc(100% - 1.8rem)}
.stage-tools .chip-toggle{padding:.26rem .6rem;font-size:.74rem;backdrop-filter:blur(6px)}
.stage-tools select{padding:.26rem .5rem;font-size:.74rem;background:color-mix(in srgb,var(--surface) 90%,transparent)}

.legend{position:absolute;left:.9rem;bottom:.9rem;display:flex;gap:.9rem;flex-wrap:wrap;max-width:44%;
  background:color-mix(in srgb,var(--surface) 88%,transparent);border:1px solid var(--line);border-radius:var(--radius);
  padding:.4rem .7rem;font-family:var(--f-mono);font-size:.66rem;color:var(--ink-2)}
.legend-item{display:inline-flex;align-items:center;gap:.4rem;white-space:nowrap}
/* Narrow stage: swatches + short words only, so legend and presets share the bottom edge. */
@container (max-width: 1100px){
  .legend{gap:.55rem}
  .legend-item .long{display:none}
  .legend .mode-badge{display:none}
}
.sw{width:11px;height:11px;border-radius:2px;display:inline-block}
.sw-ok{background:var(--ok)} .sw-watch{background:var(--watch)} .sw-warning{background:var(--copper)} .sw-critical{background:var(--crit)}

.hint{position:absolute;right:.9rem;top:.9rem;font-family:var(--f-mono);font-size:.64rem;color:var(--ink-3);
  background:color-mix(in srgb,var(--surface) 80%,transparent);padding:.3rem .55rem;border-radius:3px;
  max-width:38%;text-align:right;transition:opacity .6s}
.hint.fade{opacity:0}

.overlay{position:absolute;inset:0;display:grid;place-items:center;background:color-mix(in srgb,var(--ground) 75%,transparent);z-index:5}
.overlay.hidden{display:none}
.overlay .empty{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);max-width:420px}

/* ---------- side panel ---------- */
.side{border-left:1px solid var(--line);background:var(--surface);overflow-y:auto;min-height:0}
@media(max-width:900px){.side{border-left:0;border-top:1px solid var(--line)}}
.side-head{padding:.85rem .95rem .6rem;border-bottom:1px solid var(--line-soft);display:flex;flex-direction:column;gap:.35rem}
.side-head h2{font-size:1rem;letter-spacing:-.01em;display:flex;align-items:center;gap:.5rem;flex-wrap:wrap}
.side-head p{font-size:.78rem;color:var(--ink-3)}
.side-sec{padding:.75rem .95rem;border-bottom:1px solid var(--line-soft)}
.side-sec h3{font-size:.8rem;margin-bottom:.5rem;display:flex;justify-content:space-between;align-items:center}
.side-sec h3 .muted{font-weight:400;font-size:.7rem}
.side-actions{display:flex;gap:.4rem;flex-wrap:wrap;padding:.7rem .95rem}

.health-big{display:flex;align-items:baseline;gap:.6rem}
.health-big .tile-val{font-size:2.2rem}
.health-big .tile-sub{font-size:.75rem}

.sub-list{display:flex;flex-direction:column;gap:.35rem}
.sub-row{display:grid;grid-template-columns:1fr 46px 70px;gap:.5rem;align-items:center;font-size:.78rem;
  padding:.3rem .45rem;border-radius:3px;cursor:pointer;border:1px solid transparent}
.sub-row:hover{background:var(--surface-2);border-color:var(--line)}
.sub-row .num{text-align:right}
.bar{height:5px;background:var(--surface-3);border-radius:3px;overflow:hidden;grid-column:1 / -1}
.bar i{display:block;height:100%;background:var(--ok)}
.bar.sev-watch i{background:var(--watch)} .bar.sev-warning i{background:var(--copper)} .bar.sev-critical i{background:var(--crit)}

.issue-list{display:flex;flex-direction:column;gap:.35rem}
.issue-row{display:flex;gap:.55rem;align-items:flex-start;padding:.45rem .55rem;border-radius:3px;cursor:pointer;
  border:1px solid var(--line-soft);background:var(--surface)}
.issue-row:hover{background:var(--surface-2);border-color:var(--line)}
.issue-row.sev-critical{border-left:3px solid var(--crit)}
.issue-row.sev-warning{border-left:3px solid var(--copper)}
.issue-row.sev-watch{border-left:3px solid var(--watch)}
.issue-row .t{font-size:.8rem;font-weight:600;line-height:1.3}
.issue-row .d{font-size:.72rem;color:var(--ink-3);line-height:1.35}
.issue-row .pill{flex:0 0 auto;margin-top:.1rem}

.tag-table{width:100%;border-collapse:collapse;font-size:.74rem}
.tag-table th{text-align:left;font-family:var(--f-mono);font-size:.62rem;letter-spacing:.1em;text-transform:uppercase;
  color:var(--ink-3);font-weight:500;padding:.25rem .3rem;border-bottom:1px solid var(--line-soft)}
.tag-table td{padding:.3rem .3rem;border-bottom:1px solid var(--line-soft);vertical-align:top}
.tag-table td.num{text-align:right;white-space:nowrap}
.tag-table tr.sev-critical td:first-child{box-shadow:inset 3px 0 var(--crit)}
.tag-table tr.sev-warning td:first-child{box-shadow:inset 3px 0 var(--copper)}
.tag-table tr.sev-watch td:first-child{box-shadow:inset 3px 0 var(--watch)}
.tag-table .k{font-family:var(--f-mono);font-size:.64rem;color:var(--ink-3);display:block;max-width:190px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tag-table .dim{color:var(--ink-3)}

.prot-row{display:flex;justify-content:space-between;gap:.5rem;font-size:.76rem;padding:.3rem 0;border-bottom:1px solid var(--line-soft)}
.prot-row .m{font-family:var(--f-mono);font-size:.68rem;color:var(--ink-3);white-space:nowrap}
.finding{padding:.45rem .55rem;border-radius:3px;border:1px solid var(--line-soft);margin-bottom:.35rem}
.finding .t{font-size:.78rem;font-weight:600}
.finding .d{font-size:.72rem;color:var(--ink-3);margin-top:.15rem}

.pill-copper{background:var(--copper-soft);color:var(--copper)}
.banner{margin:.7rem .95rem 0;padding:.5rem .7rem;border-radius:var(--radius);font-size:.76rem;
  background:var(--watch-soft);color:var(--watch);border:1px solid color-mix(in srgb,var(--watch) 35%,transparent)}
.banner.info{background:var(--info-soft);color:var(--info);border-color:color-mix(in srgb,var(--info) 35%,transparent)}
