/* Stage-scoped styles: no global form, admin or business-layout overrides. */
.viewer-stage,.viewer-page-fullscreen,.viewer-stage:fullscreen{background:var(--viewer-background,#000)!important}
.lung-structure-dock{display:none;position:absolute;z-index:15;inset:auto 0 0;flex-direction:column;color:#182331;background:rgba(233,238,243,.97);border-top:1px solid #c7d2dc;border-radius:12px 12px 0 0;padding-bottom:env(safe-area-inset-bottom,0px);font-size:14px;line-height:1.3;text-align:left;box-shadow:0 -3px 18px #0002}
.lung-structure-dock *{box-sizing:border-box}
.lung-structure-dock button{font:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
.lung-structure-dock button:focus-visible,.lung-dock-row:focus-visible{outline:2px solid #047fca;outline-offset:-3px}
.lung-dock-bar{display:flex;align-items:center;gap:6px;min-height:34px;padding:0 8px;border-bottom:1px solid #ccd5dd}
.lung-dock-title{min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:12px;font-weight:650}
.lung-dock-hint{flex:1;white-space:nowrap;text-align:right;color:#5b6b79;font-size:11px;margin-right:4px}
.lung-dock-action,.lung-dock-back{min-height:34px;padding:4px 8px;border:0;background:transparent;color:#075f9c;border-radius:5px;white-space:nowrap}
.lung-dock-back{min-width:32px;font-size:26px!important;line-height:1}
.lung-dock-levels{min-width:0}
.lung-dock-row{display:flex;max-width:100%;overflow-x:auto;overflow-y:hidden;overscroll-behavior:contain;touch-action:pan-x;scrollbar-width:thin;scrollbar-color:#8da5b9 transparent;padding:0 5px;background:#edf1f5}
.lung-dock-row[data-level="0"]{background:#dce4eb}
.lung-dock-row+.lung-dock-row{border-top:1px solid #bdcad6}
.lung-dock-node{display:flex;align-items:stretch;flex:0 0 auto;position:relative;min-height:49px;border-right:1px solid #c1cdd7}
.lung-dock-node:last-child{border-right:0}
.lung-node-label,.lung-node-visibility{display:flex;align-items:center;justify-content:center;gap:7px;min-height:46px;min-width:44px;padding:6px 9px;border:0;color:#172a3b;background:transparent}
.lung-node-label{font-weight:550!important;white-space:nowrap}
.lung-node-visibility{padding:8px}
.lung-node-visibility svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.lung-node-visibility[aria-pressed="mixed"]{color:#1268a8;background:#d1e9f8}
.lung-node-visibility[aria-pressed="false"]{color:#687885}
.lung-node-visibility .lung-eye-slash{display:none}
.lung-node-visibility[aria-pressed="false"] .lung-eye-slash{display:block}
.lung-node-color{display:block;width:12px;height:12px;flex:0 0 auto;border:1px solid #425c7240;border-radius:4px;background:#8faecc}
.lung-node-chevron{display:flex;color:#5b6b79}
.lung-node-chevron svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8}
.lung-dock-node.is-selected{background:#c1e4fb;box-shadow:inset 0 3px #038acb}
.lung-dock-node.is-selected .lung-node-chevron{transform:rotate(180deg)}
.lung-dock-settings{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 10px;border-bottom:1px solid #ccd5dd;min-height:39px;background:#f4f6f8}
.lung-dock-opacity{display:flex;align-items:center;gap:10px;flex:1;min-width:0;font-size:12px;white-space:nowrap}
.lung-dock-opacity input{width:100%;min-width:50px;max-width:240px;height:32px;accent-color:#0486c8;touch-action:pan-x}
.lung-structure-dock [hidden]{display:none!important}
.has-mobile-structures.viewer-page-fullscreen .lung-structure-dock,.has-mobile-structures:fullscreen .lung-structure-dock{display:flex}
.has-mobile-structures.viewer-page-fullscreen .three-canvas,.has-mobile-structures:fullscreen .three-canvas{bottom:var(--structure-dock-height,84px)!important}
.has-mobile-structures.viewer-page-fullscreen .lung-dock-more,.has-mobile-structures:fullscreen .lung-dock-more{display:none}
.has-mobile-structures.viewer-page-fullscreen .viewer-toolbar,.has-mobile-structures:fullscreen .viewer-toolbar{inset:70px 10px auto auto!important;transform:none!important;flex-direction:column;width:46px;max-width:46px;background:#112638c9;border:1px solid #b5d5eb45;padding:2px;border-radius:24px;gap:2px}
.has-mobile-structures.viewer-page-fullscreen .viewer-toolbar button,.has-mobile-structures:fullscreen .viewer-toolbar button{min-width:40px;min-height:40px;padding:8px;border-radius:50%;color:#e5f5ff}
.has-mobile-structures.viewer-page-fullscreen .viewer-toolbar button span,.has-mobile-structures:fullscreen .viewer-toolbar button span{display:none}
@media(max-width:720px), (pointer:coarse) and (max-width:1100px){
 .has-mobile-structures .lung-structure-dock{display:flex}
 .has-mobile-structures .three-canvas{bottom:var(--structure-dock-height,84px)!important}
 .viewer-mobile-workspace.lung-mobile-controls{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);gap:0}
 .viewer-mobile-workspace.lung-mobile-controls>.model-control-scroll{display:none}
 .viewer-mobile-workspace.lung-mobile-controls.lung-details-open{grid-template-rows:minmax(0,60fr) minmax(0,40fr);gap:8px}
 .viewer-mobile-workspace.lung-mobile-controls.lung-details-open>.model-control-scroll{display:flex}
 .has-mobile-structures .viewer-toolbar{inset:65px 8px auto auto!important;transform:none!important;flex-direction:column;width:44px;max-width:44px;background:#102738d9;border:1px solid #b5d5eb45;padding:2px;border-radius:24px;gap:2px}
 .has-mobile-structures .viewer-toolbar button{min-width:38px;min-height:40px;padding:8px;border-radius:50%;color:#e5f5ff}
 .has-mobile-structures .viewer-toolbar button.active{color:#fff;background:#078cdd}
 .has-mobile-structures .viewer-toolbar button span{display:none}
 .has-mobile-structures .viewer-tabs{left:8px;top:8px;right:60px;gap:0;justify-content:flex-start}
 .has-mobile-structures .viewer-tabs button{padding:7px 8px;font-size:11px}
 .has-mobile-structures .orientation-widget{left:10px!important;right:auto!important;top:64px!important;opacity:.95;transform:scale(.78);transform-origin:top left}
 .lung-dock-title{max-width:155px}
}
@media(max-height:480px){
 .lung-dock-bar{min-height:28px}.lung-dock-action{min-height:28px}.lung-dock-settings{min-height:32px}
 .lung-dock-node{min-height:42px}.lung-node-label,.lung-node-visibility{min-height:42px}.lung-dock-row{scrollbar-width:none}
 .has-mobile-structures .viewer-toolbar{top:52px!important;flex-direction:row!important;width:auto!important;max-width:none!important}
}

@media(pointer:coarse) and (min-width:721px) and (max-width:1100px){
 body.model-workspace-active{height:100vh;height:100dvh;overflow:hidden}
 .model-workspace-active #app{height:100%;display:flex;flex-direction:column;min-height:0}
 .model-workspace-active .topbar{flex:0 0 44px;height:44px}
 .model-workspace-active .page-container{display:flex;flex-direction:column;flex:1;min-height:0;width:100%;padding:6px 8px max(6px,env(safe-area-inset-bottom));margin:0}
 .model-workspace-active .page-container>.page-hero,.model-workspace-active .page-container>.notice,.model-workspace-active .page-container>.section-heading,.model-workspace-active .model-mobile-actions,.model-workspace-active .page-footer{display:none}
 .viewer-mobile-workspace.lung-mobile-controls{display:grid;min-height:0;flex:1;width:100%}
 .viewer-mobile-workspace.lung-mobile-controls>.viewer-stage{height:100%;min-height:0;width:100%;margin:0}
 .viewer-mobile-workspace.lung-mobile-controls>.model-control-scroll{flex-direction:column;align-items:stretch;overflow-y:auto;overflow-x:hidden;min-height:0;margin:0;padding:0;gap:10px;overscroll-behavior-y:contain;touch-action:pan-y}
 .model-control-scroll>*{flex:0 0 auto;min-width:0;width:100%}
}

/* V3: model background palette. The control is scoped to the existing viewer stage. */
.lung-background-button{position:absolute;z-index:18;top:10px;right:10px;display:flex;align-items:center;justify-content:center;width:46px;height:46px;padding:0;border:1px solid #8fd1ff70;border-radius:50%;background:#078cdd;color:#fff;font-size:13px;font-weight:750;letter-spacing:.02em;box-shadow:0 3px 10px #00182c66;cursor:pointer;touch-action:manipulation;user-select:none}
.lung-background-button:hover,.lung-background-button:focus-visible{background:#0ba3ff}
.lung-background-button:focus-visible{outline:2px solid #fff;outline-offset:2px}
.orientation-widget{left:14px!important;right:auto!important;top:62px!important;display:flex;align-items:center;justify-content:center;width:46px;height:78px;color:#eaf6ff;font-size:10px;pointer-events:none;text-shadow:0 1px 2px #00182caa;perspective:240px}.orientation-human3d-canvas{display:block;width:40px;height:72px;overflow:visible;filter:drop-shadow(3px 4px 3px #00182cbb);transform-origin:50% 50%;transition:filter .12s ease}.viewer-stage[data-background-tone="light"] .orientation-widget{color:#2d668b;text-shadow:0 1px 0 #fff,0 0 2px #fff}.viewer-stage[data-background-tone="light"] .orientation-human3d-canvas{filter:drop-shadow(1px 2px 2px #24495a99)}
@media(max-width:720px),(pointer:coarse) and (max-width:1100px){
 .lung-background-button{top:9px;right:9px;width:46px;height:46px}
}
@media(max-height:480px){
 .lung-background-button{top:6px;right:6px;width:40px;height:40px;font-size:11px}
}

.orientation-widget svg{transform-origin:50% 50%;transition:transform .12s ease}
@media(max-width:720px),(pointer:coarse) and (max-width:1100px){
 .has-mobile-structures .viewer-toolbar{top:auto!important;bottom:calc(var(--structure-dock-height,84px) + 8px)!important}
 .has-mobile-structures.viewer-page-fullscreen .viewer-toolbar,.has-mobile-structures:fullscreen .viewer-toolbar{top:auto!important;bottom:calc(var(--structure-dock-height,84px) + 8px)!important}
}

/* Keep all four view tabs visible on narrow screens. The old strip clipped the sagittal tab. */
.viewer-tabs button[data-section="x"]{display:flex!important}
@media(max-width:720px),(pointer:coarse) and (max-width:1100px){
 .has-mobile-structures .viewer-tabs{right:52px!important;max-width:none!important;overflow:visible!important}
 .has-mobile-structures .viewer-tabs button{flex:0 0 auto!important;min-width:0!important;padding:6px 5px!important;font-size:10px!important;white-space:nowrap}
}
