*{box-sizing:border-box}body{margin:0;color:#223d38;background:#eef3f0;font:14px system-ui,sans-serif}button,input,select,textarea,.button{font:inherit;border:1px solid #d3ddd8;border-radius:8px;padding:9px;background:#fff;color:inherit}button,.button{cursor:pointer}button:hover,.button:hover{background:#e1eee6}button:disabled{opacity:.4;cursor:default}button[aria-pressed=true],.primary{background:#1d6555;color:white}button:focus-visible,input:focus-visible,textarea:focus-visible,a:focus-visible{outline:3px solid #2386e8}header{min-height:66px;display:flex;align-items:center;gap:9px;padding:12px 18px;background:white;border-bottom:1px solid #dce5df}header a{color:inherit;text-decoration:none;font-size:22px}header b{font-size:11px;letter-spacing:2px}#title{flex:1;min-width:80px;max-width:320px}main{height:calc(100dvh - 66px);display:grid;grid-template-columns:240px minmax(0,1fr) 300px}aside{overflow:auto;padding:16px;background:#fbfcfb}.library{border-right:1px solid #dce5df}.inspector{border-left:1px solid #dce5df}h2{font-size:17px;margin:0 0 12px}h3{font-size:14px;margin:20px 0 8px}small,.hint{color:#60766e;line-height:1.5}.hint{font-size:12px}input[type=search],select,textarea,.inspector label input{width:100%;margin-bottom:8px}#parts{display:grid;grid-template-columns:1fr 1fr;gap:8px}#parts button{padding:5px;min-width:0;font-size:11px;overflow-wrap:anywhere}#parts img{width:100%;height:82px;object-fit:contain}#parts span{display:block}nav{display:flex;gap:6px;align-items:center;flex-wrap:wrap;padding:10px;background:#f8faf8;border-bottom:1px solid #dce5df}nav button{font-size:12px;padding:7px}nav label{font-size:12px}.workspace{display:flex;flex-direction:column;min-width:0;min-height:0}#viewport{flex:1;min-height:0;touch-action:none}canvas{display:block;width:100%;height:100%}#status{padding:8px 14px;font-size:12px;background:#fff;min-height:34px}#transforms{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-top:10px}#transforms label{font-size:11px}#transforms input{width:100%;padding:6px}#objects,#steps{display:flex;flex-direction:column;gap:5px;margin:10px 0}#objects button{font-size:12px;text-align:left}#steps article{background:#eef3ef;padding:10px;border-radius:10px}#steps article button{padding:5px;margin:3px;font-size:12px}.inspector label{display:block;font-size:12px;margin-top:10px}dialog{border:0;border-radius:16px;padding:25px;max-width:400px}dialog::backdrop{background:#142a2780}#print-guide{display:none}body.hide-library main{grid-template-columns:0 minmax(0,1fr) 300px}body.hide-library .library,body.hide-panel .inspector{display:none}body.hide-panel main{grid-template-columns:240px minmax(0,1fr) 0}body.hide-panel.hide-library main{grid-template-columns:0 minmax(0,1fr) 0}@media(max-width:900px){header{flex-wrap:wrap}header a{font-size:18px}main{height:calc(100dvh - 112px);grid-template-columns:170px minmax(0,1fr) 240px}aside{padding:10px}body.hide-panel main{grid-template-columns:170px minmax(0,1fr) 0}}@media(max-width:650px){main{grid-template-columns:130px minmax(0,1fr) 0}.inspector{display:none}body:not(.hide-panel) .inspector{display:block;position:fixed;right:0;top:112px;bottom:0;width:260px;z-index:5;box-shadow:-5px 0 20px #0002}header button,.button{font-size:12px;padding:6px}#parts{grid-template-columns:1fr}body.hide-panel main{grid-template-columns:130px minmax(0,1fr) 0}}@media print{header,main,dialog{display:none!important}#print-guide{display:block}.guide-page{break-after:page;page-break-after:always;padding:15mm}.guide-page:last-child{break-after:auto}.guide-page img{width:100%;max-height:150mm;object-fit:contain}.guide-page h1{font-size:25px}.guide-page p{white-space:pre-wrap;line-height:1.6}.guide-page li{margin:8px}body{background:white}@page{size:A4;margin:8mm}}

.collision-panel{margin-top:16px}.fit-issue{display:block;width:100%;text-align:left;font-size:11px;margin:5px 0;border-left:4px solid #dc9b36}.fit-issue.penetration{border-left-color:#d94242;background:#fff0ed}.fit-issue.joint{border-left-color:#3782ac;background:#eef6fa}.collision-panel h3{margin-top:10px}

@media print{.guide-page li{display:flex;align-items:center;gap:12px;break-inside:avoid}.guide-page .guide-part-thumbnail{width:22mm;height:18mm;object-fit:contain;flex:none}}
.student-guide{margin:16px 0}.student-guide-step{padding:10px;margin:8px 0;border:1px solid #dce5df;border-radius:10px;background:#f7faf8}.student-guide-open{width:100%;text-align:left;font-weight:650}.student-guide-step p{font-size:12px;line-height:1.45}.guide-added{display:flex;flex-wrap:wrap;gap:7px}.guide-added>span{display:flex;align-items:center;gap:5px;max-width:100%;font-size:11px}.guide-added img{width:34px;height:30px;object-fit:contain}.guide-blocker{padding:8px;border-radius:8px;background:#fff0e8;color:#8b3e1c;font-size:12px}.guide-warning{padding:8px;border-radius:8px;background:#fff8dc;color:#765a16;font-size:12px}.guide-cover>p:first-child{letter-spacing:2px;font-size:12px;color:#1d6555}.guide-inventory ul{columns:2;column-gap:12mm}.guide-inventory li{font-size:10pt}.guide-inventory .guide-part-thumbnail{width:12mm;height:10mm}.guide-page .guide-added-list{display:flex;gap:8px;flex-wrap:wrap}.guide-page .guide-added-card{display:flex;align-items:center;gap:5px;border:1px solid #dce5df;border-radius:8px;padding:5px;font-size:10pt}.guide-page .guide-added-card img{width:18mm;height:14mm;object-fit:contain}.student-guide-step button:disabled{opacity:.5}@media print{.guide-cover{break-after:page}.guide-inventory{break-after:page}.guide-inventory:last-child{break-after:auto}.guide-inventory li{break-inside:avoid}.guide-page .guide-added-card{break-inside:avoid}.guide-page .guide-added-card img{max-height:14mm}}
.collision-panel{max-height:260px;overflow:auto;scrollbar-gutter:stable}
.selection-marquee{position:absolute;z-index:20;border:1px solid #1785e8;background:#298de52b;pointer-events:none;border-radius:2px}.layer-row{display:grid;grid-template-columns:minmax(48px,1fr) minmax(70px,1fr) 34px 34px auto;gap:4px;align-items:center;margin:6px 0}.layer-row button,.layer-row input{min-width:0;padding:5px;font-size:11px}.layer-row .layer-select{text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.layer-row input{width:100%;margin:0}#layer-panel{margin:14px 0;padding:8px;border:1px solid #dce5df;border-radius:10px;background:#f6f9f7}#layer-panel summary{cursor:pointer;font-weight:650}#layer-panel .hint{margin:6px 0;font-size:11px}#groups:empty:after{content:'No groups yet';display:block;color:#60766e;font-size:12px;padding:8px 0}#group,#ungroup{font-size:12px}

/* Size the workspace from the actual header, including wrapped controls. */
html,body{height:100%;overflow:hidden}body{height:100dvh;display:flex;flex-direction:column}header{flex-shrink:0}main{flex:1;height:auto!important;min-height:0}#viewport{position:relative;overflow:hidden}aside{position:relative}.panel-close{float:right;padding:2px 8px;font-size:20px;line-height:1.4}nav button{min-height:34px}#objects button[aria-pressed=true]{border-color:#1d6555}#status{flex-shrink:0;max-height:72px;overflow:auto}#viewport:focus-visible{outline:2px solid #2386e8;outline-offset:-2px}
@media(max-width:900px) and (min-width:651px){main{grid-template-columns:160px minmax(0,1fr) 210px}body.hide-library main{grid-template-columns:0 minmax(0,1fr) 210px}body.hide-panel main{grid-template-columns:160px minmax(0,1fr) 0}}
@media(max-width:650px){header a{width:auto!important}header{min-height:0!important}header #title{min-width:130px}nav{padding:6px}nav button{min-height:36px}aside button{min-height:36px}.assembly-gesture-hint{display:none}body:not(.hide-library) .library,body:not(.hide-panel) .inspector{max-width:85vw;top:var(--panel-top);padding-bottom:20px}body:not(.hide-panel) .inspector{width:280px}}
@media print{html,body{height:auto;overflow:visible;display:block}#status{display:none}}
nav{position:relative;z-index:6}.tool-options{position:relative}.tool-options summary{padding:7px;border:1px solid #d3ddd8;border-radius:8px;cursor:pointer;font-size:12px;background:white;min-height:34px}.tool-options-body{position:absolute;right:0;top:100%;width:240px;padding:12px;background:white;border:1px solid #d3ddd8;border-radius:10px;box-shadow:0 8px 24px #0002;z-index:9}.tool-options-body label{display:block;padding:7px 0}.tool-options summary:focus-visible{outline:3px solid #2386e8}

@media print{
 @page{size:16in 9in;margin:0}
 body>:not(#print-guide){display:none!important}
 html,body{width:16in;height:auto;min-height:0;overflow:visible;display:block;background:#fff}
 header,main,dialog{display:none!important}
 #status{display:none!important}
 #print-guide{display:block;width:16in;margin:0;padding:0;background:#fff}
 #print-guide .guide-page{position:relative;display:flex;flex-direction:column;width:16in;height:9in;min-height:9in;max-height:9in;margin:0;padding:13mm 17mm 12mm;overflow:hidden;background:#fff;color:#151515;break-after:page;page-break-after:always}
 #print-guide .guide-page:last-child{break-after:auto;page-break-after:auto}
 .guide-document-header{display:flex;align-items:center;justify-content:space-between;min-height:18mm}
 .guide-document-title{display:flex;flex:none;align-items:center;gap:3mm;white-space:nowrap;font-size:26pt;font-weight:750;line-height:1;color:#111}
 .guide-document-title>span:last-child{white-space:nowrap}
 .guide-document-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:10mm;height:10mm;color:#ed1c24;font-size:26pt;line-height:1}
 #print-guide .guide-document-logo{display:block;flex:none;width:35mm;height:16mm;max-height:16mm;object-fit:contain}
 .guide-document-rule{position:relative;width:48%;height:1mm;margin-top:1mm;background:#ed1c24;flex:none}
 .guide-document-rule span{position:absolute;right:-2.2mm;top:50%;width:4.4mm;height:4.4mm;border:1mm solid #ed1c24;border-radius:50%;background:#fff;transform:translateY(-50%)}
 .guide-prep>h1{margin:7mm 0 1mm;text-align:center;font-size:21pt;font-weight:650}
 .guide-prep-grid{flex:1;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-rows:minmax(42mm,1fr);align-content:center;justify-items:center;align-items:center;gap:4mm 9mm;padding:3mm 5mm}
 .guide-prep-item{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2mm;min-width:0;width:100%;break-inside:avoid;text-align:center}
 .guide-prep-item img{width:100%;max-width:92mm;height:var(--prep-thumb-height,48mm);object-fit:contain}
 .guide-prep-item span:nth-child(2){font-size:17pt;font-weight:700}
 .guide-prep-item span:nth-child(3){font-size:11pt;color:#333}
 .guide-prep-note{margin:0;text-align:center;font-size:9pt;color:#555}
 .guide-step-title{display:flex;align-items:center;gap:4mm;margin:5mm 0 2mm;font-size:20pt;font-weight:650}
 .guide-step-number{display:inline-flex;align-items:center;justify-content:center;width:11mm;height:11mm;flex:none;border-radius:50%;background:#18823b;color:#fff;font-size:16pt;font-weight:750}
 .guide-step-content{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) 102mm;gap:6mm;margin-top:2mm}
 .guide-main-figure{margin:0;display:flex;flex-direction:column;min-height:0;align-items:center;justify-content:center}
 #print-guide .guide-step-image{display:block;width:100%;height:100%;min-height:0;max-height:none;object-fit:contain;margin:0;background:#fff}
 .guide-step-content figcaption{font-size:10pt;line-height:1.2;color:#52606b;text-align:center;margin-top:1mm}
 .guide-step-side{display:flex;flex-direction:column;min-height:0;border-left:.3mm solid #e4e8eb;padding-left:5mm}
 .guide-needed h3{margin:0 0 3mm;font-size:16pt;font-weight:750;color:#222}
 .guide-needed-part{display:flex;align-items:center;gap:4mm;font-size:14pt;font-weight:650;margin-bottom:3mm;break-inside:avoid}
 #print-guide .guide-needed-part img{flex:none;width:36mm;height:28mm;object-fit:contain;max-height:28mm}
 .guide-detail-figure{display:flex;flex:1;min-height:0;flex-direction:column;margin:2mm 0 0;justify-content:center}
 #print-guide .guide-detail-figure img{width:100%;height:100%;min-height:0;max-height:78mm;object-fit:contain}
 .guide-step-instruction{width:100%;max-width:100%;flex:none;margin:4mm 0 0;padding:3mm 5mm;background:#f4f6f7;border-radius:2mm;text-align:left;font-size:12pt;line-height:1.35;color:#222}
 .guide-page-number{position:absolute;right:17mm;bottom:5mm;font-size:10pt;color:#52606b}
}

.part-layer-row{display:flex;gap:4px;align-items:stretch}.part-layer-row .part-layer-select{flex:1;min-width:0}.part-layer-row .part-layer-lock{flex:0 0 32px;padding:4px;text-align:center}

.guide-path-warning{font-size:13px;line-height:1.4;color:#8a3d00;background:#fff3dc;padding:12px;border:1px solid #e7b86a;border-radius:6px}

@media print{
 .guide-step-content{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8mm}
 .guide-step-content>.guide-main-figure{grid-column:2;grid-row:1}
 .guide-step-content>.guide-step-side{grid-column:1;grid-row:1;border-left:0;border-right:.3mm solid #e4e8eb;padding-left:0;padding-right:5mm;display:flex;flex-direction:column}
 .guide-needed h3{font-size:18pt;margin-bottom:4mm}
 .guide-needed-part{font-size:15pt;gap:4mm;margin-bottom:4mm}
 #print-guide .guide-needed-part img{width:42mm;height:32mm;max-height:32mm}
 .guide-step-side .guide-detail-figure{flex:1;min-height:0;margin:3mm 0 0}
 #print-guide .guide-detail-figure img{width:100%;height:100%;max-height:85mm;object-fit:contain}
}

dialog:has(#wiring-title){width:min(680px,92vw);max-width:680px;max-height:85vh;overflow:auto}#wiring-devices{margin:16px 0}.wiring-row{display:grid;grid-template-columns:48px 1fr 220px;align-items:center;gap:10px;margin:10px 0}.wiring-row img{width:48px;height:44px;object-fit:contain}#wiring-brain{width:100%;margin:8px 0}dialog label{display:block}

.ps-layers{gap:0!important;margin:0!important;background:#292c30;min-height:260px}.ps-layers svg{width:16px;height:16px;stroke-width:1.6;flex-shrink:0}.layers-tools{display:flex;padding:6px;border-bottom:1px solid #191b1f;gap:4px}.layers-help{font-size:10px;color:#a8adb6;padding:8px;margin:0;border-bottom:1px solid #191b1f}.ps-layer{display:flex;align-items:center;min-height:42px;border-bottom:1px solid #202226;gap:0!important}.ps-layer button{border:0!important;border-radius:0!important;background:transparent!important;color:#c5c9d1!important;padding:6px!important}.ps-layer.is-selected{background:#46566e}.ps-layer:hover{background:#373d46}.ps-layer.is-selected:hover{background:#46566e}.ps-layers .layer-icon{width:30px;min-width:30px;display:flex;align-items:center;justify-content:center;border:0;border-radius:3px;background:transparent;color:#aeb5c0;padding:6px}.ps-layers .layer-icon:hover{background:#49505b!important;color:white!important}.ps-layers .part-layer-select,.group-layer-select{display:flex;gap:8px;align-items:center;flex:1;min-width:0;text-align:left;font-size:12px}.ps-layers .part-layer-thumb{width:32px;height:32px;object-fit:contain;background:#e7e9eb;border:1px solid #5d6370;border-radius:2px}.layer-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}.ps-group{background:#30343a}.layer-rename{width:100%;min-width:0;padding:3px!important;margin:0!important;color:white!important;background:#222!important}.drop-target{background:#354d65!important;box-shadow:inset 0 0 0 2px #70aeed}.layers-ungroup-drop{padding:14px;font-size:11px;color:#969eaa;text-align:center;border:1px dashed #505761;margin:8px}.ps-layers:empty:after{content:'Chưa có mảnh ghép'}

@media print{.guide-finished{display:flex;flex-direction:column}.guide-finished h2{font-size:22pt;margin:4mm 0;text-align:center}#print-guide .guide-finished-image{width:100%;flex:1;min-height:0;height:100%;max-height:none;object-fit:contain}.guide-main-figure{overflow:hidden}}

@media print{
.guide-inventory-groups{flex:1;min-height:0;display:flex;flex-direction:column;gap:4mm;padding-top:4mm}
.guide-inventory-group{border:0.3mm solid #dfe4e8;border-radius:2mm;overflow:hidden;break-inside:avoid}
.guide-inventory-group h2{margin:0;padding:2mm 4mm;font-size:13pt;color:#273441;background:#f1f4f6;border-bottom:.3mm solid #dfe4e8}
.guide-inventory-cards{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:2mm;padding:2mm 3mm}
.guide-inventory-card{position:relative;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;height:36mm;padding:1mm 3mm}
#print-guide .guide-inventory-card img{height:25mm;width:100%;max-height:25mm;object-fit:contain}
.inventory-quantity{position:absolute;right:1mm;top:0;font-size:15pt;color:#111;background:#fff;padding:0 1mm}
.guide-inventory-card>span{font-size:10pt;line-height:1.15;color:#273441}
.guide-prep>p{font-size:9pt;text-align:center;color:#65717a;margin:2mm 0}
}

@media print{
.guide-inventory-groups{gap:2mm;padding-top:2mm}
.guide-inventory-group h2{padding:1mm 3mm;font-size:11pt}
.guide-inventory-cards{grid-template-columns:repeat(var(--inventory-columns,5),minmax(0,1fr));gap:1mm;padding:1mm 2mm}
.guide-inventory-card{height:var(--inventory-card-height,36mm);padding:0 2mm}
#print-guide .guide-inventory-card img{height:var(--inventory-image-height,25mm);max-height:var(--inventory-image-height,25mm)}
.inventory-compact .inventory-quantity{font-size:11pt}.inventory-compact .guide-inventory-card>span{font-size:8pt}
}

@media print{
.guide-droplet-inventory{flex:1;min-height:0;display:flex;flex-direction:column;justify-content:center;gap:3mm;padding:2mm 8mm}
.guide-droplet-row{display:flex;justify-content:center;gap:4mm;align-items:center}
.guide-droplet-row:nth-child(even){transform:translateX(3mm)}
.guide-droplet-part{position:relative;flex:0 1 calc(100% / var(--droplet-columns));min-width:0;text-align:center;display:flex;flex-direction:column;align-items:center;gap:1mm;padding:1mm 2mm;border:0;background:none}
#print-guide .guide-droplet-part img{width:100%;height:var(--droplet-image-height,38mm);max-height:none;object-fit:contain}
.droplet-quantity{position:absolute;top:0;right:1mm;display:flex;align-items:center;justify-content:center;min-width:9mm;height:9mm;padding:1mm;background:#f0f3f5;color:#172734;border-radius:55% 55% 55% 12%;font-size:13pt}
.guide-droplet-part>span{font-size:11pt;font-weight:600;line-height:1.15;color:#26323c}
.guide-droplet-part>small{font-size:8pt;color:#75818b;line-height:1.1}
}
