/* Compatibility only; the HUAHUI styles are copied without modification. */
.control-row{padding:0;border:0;background:none;border-radius:0;box-shadow:none}.control-card-label{padding:0;border:0}.control-card-label::before{content:none!important}.mode-help{padding:0;border:0;background:none;border-radius:0}
.reference-direction-row.is-t-reference{display:grid;grid-template-columns:minmax(0,1fr) 62px;gap:8px;align-items:center}
#t-reference-selector[hidden]{display:none!important}
.is-t-reference .mode-selector{width:100%;box-sizing:border-box;gap:1px;padding:3px}
.is-t-reference #t-reference-selector .mode-btn{flex:1 1 0;padding:8px 1px;font-size:12px;white-space:nowrap;font-weight:600;overflow:visible}
.is-t-reference #t-reference-selector .mode-btn[data-t-reference="center"]{flex:.65 1 0}
.is-t-reference #direction-selector .mode-btn{padding:8px 1px}
.is-t-reference .mode-btn:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
.capture-host-stage{display:block!important}.capture-toolbar{display:flex!important}
.brand-mark::before,.brand-mark::after,.container::before{display:none}.brand-mark{padding:0;border:0}.brand-mark img{width:42px;height:42px;object-fit:contain}
.filter-row{display:grid}#control-row{width:auto;padding:0;background:none;border:0;border-radius:0}#control-row .control-card-label{display:block}.control-card-label::before{display:none}#control-row input{width:100%}
.settings-panel .input-row>[hidden]{display:none!important}.settings-panel .input-row>.form-group{flex:1 1 0;width:auto;padding:0;border:0;background:none;box-shadow:none}.settings-panel #diamond-inputs{margin-bottom:12px}.settings-panel .glass-data-input-row{margin-top:12px;padding-top:12px;border-top:1px solid var(--border);background:none}.settings-panel .glass-data-input-row .form-group{padding:0;border:0;background:none}
.drawing-panel .diagram-workbench{padding:0;margin:0}.drawing-panel .diagram-stage{position:relative;width:100%;flex:none;overflow:hidden}.diagram-box{position:relative;width:100%;height:100%!important;min-height:0!important;margin:0;border:0;border-radius:0;box-shadow:none;background:var(--surface-soft)}.diagram-box>svg{width:100%;height:100%}
.diagram-stage-footer{margin:0 12px}.capture-toolbar{justify-content:flex-start}.capture-toolbar button{box-shadow:none;transform:none}#capture-toolbar .capture-signature{width:auto;margin-left:auto}
.reference-panel{width:auto;min-width:0;max-width:none;padding:0}#reference-preview{max-width:100%}#reference-panel:not([open]) .reference-content{display:none}.reference-viewer[hidden]{display:none!important}.reference-viewer:not([hidden]){display:flex}.reference-viewer:not([open]):not([hidden]){display:flex}
/* Reserve the reference pane's width before animating; never measure the moving workbench. */
:root{--reference-dock-size:clamp(360px,42vw,760px)}
body.reference-dock-open{padding-right:calc(var(--reference-dock-size) + 24px);justify-content:center}
body.reference-dock-open>.container{max-width:1380px;min-width:0}
body.reference-dock-open #reference-panel{display:none}
.reference-viewer{inset:12px 12px 12px auto;width:var(--reference-dock-size);height:auto;margin:0;padding:0;background:transparent;box-shadow:none}
.reference-viewer:not([hidden]){animation:reference-dock-enter .28s ease both}
.reference-viewer__panel{display:flex;flex-direction:column;min-width:0;min-height:0;padding:44px 8px 8px;border-radius:12px;background:#fff;box-shadow:0 8px 28px #24232218}
.reference-viewer__heading{position:absolute;top:13px;left:14px;color:var(--muted);font-size:12px;line-height:20px}
.reference-viewer__heading small{margin-left:10px;font-size:10px;color:var(--muted-2)}
.reference-viewer__close{top:8px;right:8px;width:28px;height:28px;font-size:20px;box-shadow:none;z-index:1}
.reference-viewer__viewport{flex:1 1 0;min-height:0;width:100%;border-radius:5px;background:#f4f3f1}
.reference-viewer__image{border-radius:0}
@keyframes reference-dock-enter{from{opacity:0;transform:translateX(16px)}to{opacity:1;transform:translateX(0)}}
@media(min-width:961px) and (max-width:1400px){
  body.reference-dock-open .content{padding:12px}
  body.reference-dock-open .workspace-grid{grid-template-columns:220px minmax(0,1fr);gap:12px}
  body.reference-dock-open .settings-panel{padding:12px}
  body.reference-dock-open header{display:flex;flex-wrap:wrap;gap:10px;padding:12px}
  body.reference-dock-open .workspace-mode-bar{padding:10px 12px;gap:8px;flex-wrap:wrap}
  body.reference-dock-open #workspace-mode-caption{display:none}
  body.reference-dock-open .drawing-toolbar{flex-wrap:wrap;gap:6px}
  body.reference-dock-open .drawing-toolbar>div{flex-wrap:wrap}
  body.reference-dock-open .material-summary>div{display:block}
  body.reference-dock-open .material-summary span{display:block;margin-bottom:2px}
  body.reference-dock-open .material-summary strong{font-size:15px}
}
@media(max-width:960px){
  body.reference-dock-open{padding-right:12px}
  body.reference-dock-open #reference-panel{display:block}
  .reference-viewer{inset:8px;width:auto}
}
@media(max-width:800px){body.reference-dock-open{padding-right:0}}
@media(prefers-reduced-motion:reduce){
  body,body>.container{transition:none}
  .reference-viewer:not([hidden]){animation:none}
}
.drawing-panel .result-area{margin:12px}#diagram-view-selector{display:none}.drawing-panel.is-expanded{position:fixed;inset:12px;z-index:5000;background:white;overflow:auto;box-shadow:0 0 0 20px #0008}.drawing-panel.is-expanded .diagram-stage{height:calc(100vh - 160px)!important}.drawing-panel.is-expanded #reference-panel,.drawing-panel.is-expanded #result-area{display:none}.workspace-grid[hidden],#material-mode-panel[hidden]{display:none!important}
@media(max-width:480px){.filter-row{grid-template-columns:1fr 1fr}.filter-row>.form-group:last-child{grid-column:1/-1}.drawing-panel.is-expanded{inset:0}.capture-toolbar{flex-wrap:wrap}.header-actions{flex-wrap:wrap}}

/* Glass preview fills the detail row; full detail remains in the zoom dialog. */
#result-area .details-grid{grid-template-columns:minmax(0,1fr);gap:16px}
#result-area .glass-diagram-frame{min-height:240px}
#glass-diag-frame:has([data-glass-layout="8317-original"]){height:auto;max-height:360px;padding:0}
#glass-diag-frame svg:not(.glass-state-icon){max-height:360px!important}
#glass-diag-frame [data-glass-layout="8317-original"]{width:100%!important;max-width:100%!important;margin:auto}
#glass-diag-frame .glass-state-icon{width:64px;height:48px;max-height:48px!important;flex:none}
/* Other room types use the full row for glass, with a compact size strip above. */
#result-area #glass-diag-frame svg:not(.glass-state-icon){max-width:none;margin:0 auto}
#result-area[data-room-type]:not([data-room-type="diamond"]) .result-grid{grid-template-columns:repeat(var(--glass-columns,3),minmax(0,1fr));gap:8px;margin-bottom:12px}
#result-area[data-room-type]:not([data-room-type="diamond"]) .result-cell{padding:10px 12px;gap:4px;border-radius:4px;text-align:left;min-width:0}
#result-area[data-room-type]:not([data-room-type="diamond"]) .result-cell.door{padding-top:8px}
#result-area[data-room-type]:not([data-room-type="diamond"]) .result-cell .k{font-size:11px}
#result-area[data-room-type]:not([data-room-type="diamond"]) .result-cell .v{font-size:18px;white-space:nowrap}
#result-area[data-room-type]:not([data-room-type="diamond"]) .result-cell .formula{display:flex;flex-direction:column;gap:1px;font-size:10px;line-height:1.5}
@media(max-width:900px){
  #result-area[data-room-type]:not([data-room-type="diamond"]) .result-grid{grid-template-columns:minmax(0,1fr);gap:0;border-top:1px solid var(--border)}
  #result-area[data-room-type]:not([data-room-type="diamond"]) .result-cell{display:grid;grid-template-columns:1fr auto;align-items:center;padding:8px 4px;border:0;border-bottom:1px solid var(--border);border-radius:0;gap:2px 8px}
  #result-area[data-room-type]:not([data-room-type="diamond"]) .result-cell .formula{grid-column:1/-1;flex-direction:row;flex-wrap:wrap;gap:0 12px}
}
#order-glass-preview{padding:18px}
/* Four-pane orders keep all sizes on one compact row, including narrow panels. */
#result-grid:has(> .result-cell:nth-child(4)):not(:has(> .result-cell:nth-child(5))){grid-template-columns:repeat(4,minmax(145px,1fr));gap:8px;margin-bottom:12px;overflow-x:auto;padding-bottom:2px}
#result-grid:has(> .result-cell:nth-child(4)):not(:has(> .result-cell:nth-child(5)))>.result-cell{display:flex;flex-direction:column;justify-content:center;min-width:0;padding:9px 8px;gap:3px;border-radius:6px}
#result-grid:has(> .result-cell:nth-child(4)):not(:has(> .result-cell:nth-child(5)))>.result-cell.door{padding-top:7px}
#result-grid:has(> .result-cell:nth-child(4)):not(:has(> .result-cell:nth-child(5))) .v{font-size:20px;line-height:1.25;white-space:nowrap}
#result-grid:has(> .result-cell:nth-child(4)):not(:has(> .result-cell:nth-child(5))) .formula{font-size:10px;line-height:1.35}
#order-glass-preview img{max-height:none;width:100%}
/* Plain drafting metadata stays above the CAD canvas, including after calculation. */
#style-label,#install-label{z-index:4}
.drawing-panel .diagram-stage{border-radius:4px;background:#fff}
.drawing-panel .diagram-box[data-view="2d"]{background:#fff}
.drawing-panel .view-switcher{border-radius:3px;box-shadow:none;backdrop-filter:none;background:#fff;font-weight:600}
.drawing-panel .view-switcher:hover{transform:none;background:#f3f5f7}
.drawing-panel .view-switcher[data-view="3d"]{background:#263747;border-color:#263747;color:#fff;box-shadow:none}
.diagram-box:has([data-diagram="8317-diamond-cad"]) #main-svg{max-width:none}
/* Screen-space projections must cover the same viewport as the WebGL canvas. */
#three-labels .three-label-layer,#three-door-dimensions{width:100%;height:100%;max-width:none;max-height:none}
/* Without a style, show the site measurements without manufacturing controls/results. */
body[data-measurement-only="true"] :is(#control-row,.glass-data-input-row--inside,.drawing-size-fields,#result-area,.material-summary,#view-switcher,#three-tools,#diagram-toggle-glass,#style-label,.drawing-title small){display:none!important}
.filter-row .installation-fields{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;align-items:start}
.filter-row .installation-fields.has-inward,.filter-row .installation-fields.has-stone-width{grid-template-columns:minmax(0,1fr) 94px}
.installation-fields.has-inward.has-stone-width #stone-center-width-group{grid-column:1/-1;display:grid!important;grid-template-columns:minmax(0,1fr) 94px;gap:10px;align-items:center}
.installation-fields.has-inward.has-stone-width #stone-center-width-group label{margin:0;justify-self:end;text-align:center;line-height:1.25;padding-right:2px}
#stone-center-width-group .stone-width-unit{display:block;font-size:11px;font-weight:400;line-height:1.3}
.installation-fields.has-stone-width:not(.has-inward){align-items:end}
.installation-fields>.form-group{min-width:0;margin:0;padding:0;border:0;background:none;box-shadow:none}
.installation-fields input,.installation-fields select{width:100%;box-sizing:border-box}
.installation-fields #stone-inward-help{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@media(max-width:800px){.filter-row:has(.installation-fields.has-inward),.filter-row:has(.installation-fields.has-stone-width){grid-template-columns:1fr 1fr}.filter-row>.installation-fields.has-inward,.filter-row>.installation-fields.has-stone-width{grid-column:1/-1}}

/* Small pointer ring: fill while holding, remain green while dragging. */
#three-door-feedback{position:absolute;inset:0;z-index:5;overflow:hidden;pointer-events:none;user-select:none}
#three-door-feedback[hidden]{display:none}
#three-door-feedback *{box-sizing:border-box;pointer-events:none}
#three-door-feedback .door-grab-marker{position:absolute;width:28px;height:28px;transform:translate(-50%,-50%)}
#three-door-feedback .door-grab-ring{position:absolute;display:block;inset:0;width:28px;height:28px;min-width:0;min-height:0;max-width:none;max-height:none;margin:0;border:0;border-radius:0;background:none;box-shadow:none;padding:0;fill:none;stroke-width:2;transform:rotate(-90deg);filter:drop-shadow(0 0 1px #fff)}
#three-door-feedback .door-grab-track{stroke:#22887330}
#three-door-feedback .door-grab-progress{stroke:#228873;stroke-linecap:round;stroke-dasharray:100;stroke-dashoffset:0}
#three-door-feedback[data-state="pending"] .door-grab-progress{animation:door-hold-fill var(--door-hold-duration,350ms) linear both}
#three-door-feedback[data-state="dragging"] .door-grab-progress{stroke:#169565;stroke-width:2.5}
@keyframes door-hold-fill{from{stroke-dashoffset:100}to{stroke-dashoffset:0}}

#three-hardware-detail[aria-pressed="true"]{background:var(--accent-soft);color:var(--primary-strong);border-color:var(--primary);font-weight:600}
.diagram-box[data-hardware-detail="true"] :is(#three-labels,#three-door-dimensions){visibility:hidden!important}

.installation-video-dialog{width:min(1040px,calc(100vw - 24px),calc((100dvh - 78px)*16/9));height:fit-content;max-height:calc(100dvh - 24px);margin:auto;overflow:auto;background:#fff}
.installation-video-dialog video{display:block;width:100%;height:auto;aspect-ratio:16/9;object-fit:contain;background:#111}
.installation-video-dialog .dialog-header{flex-wrap:nowrap;gap:12px;padding:8px 12px}
.installation-video-dialog .dialog-header h2{min-width:0;font-size:15px;line-height:1.5}
.installation-video-dialog .dialog-header button{flex:none}
.installation-video-error:not([hidden]){display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;color:var(--muted);font-size:13px}
