*{box-sizing:border-box}
body{margin:0;font:14px system-ui,sans-serif;color:#23343d;background:#eef1f3}
button,input,select{font:inherit}
button{cursor:pointer;border:1px solid #d1dadd;border-radius:6px;background:white;color:#23343d;padding:9px 12px}
button:hover{background:#EEF3FB}
button.active,.primary{background:#1D4AA0;color:white;border-color:#1D4AA0}
header{height:70px;background:#172e38;color:white;display:flex;align-items:center;padding:0 24px;gap:22px}
header strong{font-size:22px;letter-spacing:1px}
header small{color:#9dc2c7}
header .right{margin-left:auto;display:flex;gap:8px}
.layout{display:grid;grid-template-columns:230px 1fr 290px;height:calc(100vh - 70px)}
aside{background:#fff;padding:18px;overflow:auto;border-right:1px solid #dce3e6}
.props{border-left:1px solid #dce3e6;border-right:0}
h2{font-size:12px;text-transform:uppercase;letter-spacing:1.5px;color:#64818b;margin:4px 0 14px}
h3{font-size:15px;margin:18px 0 10px}
.tools{display:grid;gap:7px}
.preset{display:grid;grid-template-columns:52px 1fr;align-items:center;text-align:left;padding:8px}
.preset svg{width:40px;height:42px}
.muted{color:#71838c;font-size:12px;line-height:1.6}
label{display:block;font-size:12px;color:#647980;margin:12px 0 5px}
input,select{width:100%;padding:8px;border:1px solid #ced9de;border-radius:5px;background:white}
.two{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.check{display:flex;align-items:center;gap:8px;margin:14px 0}
.check input{width:auto}
.workspace{min-width:0;display:flex;flex-direction:column}
.toolbar{padding:10px 15px;display:flex;gap:8px;align-items:center;background:#f8fafb;border-bottom:1px solid #dce3e6}
.toolbar span{margin-left:auto;font-size:12px;color:#607780}
#board{flex:1;min-height:0;position:relative;background-color:#e5ebee;background-image:radial-gradient(#c3cfd5 .8px,transparent .8px);background-size:18px 18px;overflow:hidden}
#canvas{width:100%;height:100%;touch-action:none;user-select:none}
footer{background:white;padding:10px 15px;border-top:1px solid #dce3e6;font-size:12px;display:flex;gap:10px}
#status{flex:1}
.chip{background:#E7ECF4;padding:3px 8px;border-radius:5px;color:#1D4AA0}
.cellbtn{padding:12px 4px;border:1px solid #d8e2e6;border-radius:0;font-size:11px}
.cellbtn.active{background:#E3E9F4;color:#126f6b;border:2px solid #1D4AA0}
#cells{display:grid;margin-top:10px}
#toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%);background:#17333d;color:white;padding:12px 24px;border-radius:8px;display:none;z-index:5}
details{margin-top:20px;font-size:12px;line-height:1.7}
.empty{padding:20px 0}
.list{margin-top:16px;display:grid;gap:5px}
.list button{text-align:left;font-size:12px}
.key{border:1px solid #d7dfe3;padding:1px 4px;border-radius:3px}
.export{width:100%;margin-top:6px}
@media(max-width:1000px){.layout{grid-template-columns:190px 1fr 240px}
aside{padding:12px}
header{padding:12px}
header small{display:none}
}
@media(max-width:760px){.layout{grid-template-columns:160px 1fr;height:calc(100vh - 70px)}
.props{position:absolute;right:0;top:120px;max-height:70vh;width:230px;box-shadow:0 4px 20px #0002;display:none}
.props.shown{display:block}
header strong{font-size:16px}
header button{padding:7px}
.toolbar{flex-wrap:wrap}
.toolbar span{display:none}
}


.layout{grid-template-columns:220px minmax(0,1fr) 430px}
.props{padding:16px}
.props label{margin:8px 0 4px}
.props .check{margin:9px 0}
.props input,.props select{padding:7px}
.props .muted{line-height:1.4}
.props details{border:1px solid #DCE0E7;border-radius:8px;padding:10px 12px;margin:12px 0;font-size:13px}
.props summary{cursor:pointer;font-weight:650;color:#34535c}
.props details[open]>summary{margin-bottom:8px}
.props details h3{margin-top:8px}
.props .list{max-height:180px;overflow:auto;margin-top:8px}
.props .two{gap:10px}
.props #labelFields{display:grid;grid-template-columns:1fr 1fr;gap:0 10px}
.props #labelFields>label:not(.check){display:none}
.props #labelFields .check{font-size:11px}
.props #colWeights,.props #rowWeights{font-variant-numeric:tabular-nums}
.toolbar{flex-wrap:wrap}
.toolbar span{display:none}
.props .actionbar{position:sticky;bottom:-16px;background:#fff;padding:10px 0;border-top:1px solid #DDE1E8;z-index:2}
.series-controls{background:#EEF3FB;border:1px solid #C4CDDD;border-radius:8px;padding:12px;margin:12px 0}
.series-controls h3{margin:0 0 8px}
.series-controls p{margin:8px 0}
.series-controls button{width:100%;margin-top:10px}
.props table{font-size:12px}
 @media(max-width:1100px){.layout{grid-template-columns:180px minmax(0,1fr) 360px}
}
@media(max-width:760px){.layout{grid-template-columns:150px minmax(0,1fr)}
.props{width:min(430px,90vw);max-height:80vh;top:120px}
}

[hidden]{display:none!important}
.props .series-controls{margin:10px 0}
.props .series-controls summary{font-size:14px}
.props .compact-note{font-size:11px;color:#71838c;margin:4px 0}
.toolbar .check{margin:0;font-size:12px;white-space:nowrap}
.catalog{padding:12px}
.catalog .photo-controls{background:#F3F5F9;border-radius:8px;padding:12px;margin-bottom:12px}
.catalog details{margin:8px 0;border:1px solid #DCE0E7;border-radius:7px;padding:9px}
.catalog summary{cursor:pointer;font-weight:650}
.preset-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:9px}
.preset{display:flex;flex-direction:column;justify-content:center;gap:4px;text-align:center;font-size:11px;padding:7px 3px}
.preset svg{height:28px;width:30px}
.layout{grid-template-columns:260px minmax(0,1fr) 430px}
#scaleForm{padding:8px 0}
#scaleForm .two{margin-top:8px}
#scaleStep{font-size:12px;color:#1D4AA0;font-weight:600}
.props details h3{display:none}
@media(max-width:1100px){.layout{grid-template-columns:220px minmax(0,1fr) 360px}
}
@media(max-width:760px){.layout{grid-template-columns:170px minmax(0,1fr)}
}
 #quickAlign{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:9px 15px;background:#E6EBF4;border-bottom:1px solid #B9C4D7}
#quickAlignInfo{font-size:12px;color:#345b59;margin-right:8px}
#quickAlign button{padding:7px 10px}
#quickTop,#quickBottom{border-color:#1D4AA0;color:#126f6b}
.toolbar .check{font-size:12px}
 .quick-name{display:flex;align-items:center;gap:8px;flex-wrap:wrap;border-left:1px solid #B9C4D7;padding-left:12px;margin-left:4px}
.quick-name label{margin:0;font-size:12px}
.quick-name input{width:190px;padding:7px}
.quick-name button{background:#1D4AA0;color:white;border-color:#1D4AA0}
 #saveStatus{font-size:12px;align-self:center;color:#CAD3E3;max-width:230px}
#quickAlign{display:none} /* Obsolete duplicate controls retained only for legacy bindings. */
dialog{max-width:520px;border:1px solid #B9C4D7;border-radius:10px;padding:22px}
dialog::backdrop{background:#172e3866}
dialog button{display:block;width:100%;margin-top:10px}
#renameHint{flex-basis:100%;margin:0}
.list button:disabled{color:#82959a;background:#F2F3F6}

dialog.project-panel{width:min(640px,calc(100vw - 40px));max-width:640px;max-height:85vh;overflow:auto;box-sizing:border-box}
dialog.project-panel input,dialog.project-panel select{max-width:100%}

.cell-stack{display:flex;flex-direction:column;gap:4px}.cell-stack .cellbtn{width:100%;flex:1}

.pane-width-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:6px 0}.pane-width-label{margin:0;padding:8px;border:1px solid #d6e0e4;border-radius:6px;background:#f8fafb}.pane-width-label span{display:block;margin-bottom:5px}.pane-width-label.active,.pane-width-label:focus-within{border-color:#2458BD;background:#EEF2F8}.pane-width-label input{margin:0;width:100%;box-sizing:border-box}
[hidden]{display:none!important}
.project-name{display:flex;align-items:center;gap:6px;margin:0;color:#E2E6EE;font-size:11px}
.project-name input{width:180px;margin:0;padding:6px;background:#fff;color:#18333c}
#paperBadge{font-size:10px;white-space:nowrap;color:#C7CFDD}
.shape-tools{display:flex;gap:5px;margin:7px 0}.shape-tools button{flex:1;font-size:11px}
#polygonActions{padding:6px;background:#E7ECF4}#polygonActions button{width:100%;margin:3px 0}
#liveDimensions{position:absolute;z-index:5;pointer-events:none;background:#17333e;color:white;border-radius:4px;padding:6px 9px;font:600 13px Arial,sans-serif;white-space:nowrap;box-shadow:0 1px 5px #0003}
#shapeStyle{padding:10px;border:1px solid #BEC8D8;border-radius:5px;margin-bottom:12px}
#shapeStyle input[type=color]{height:32px;padding:2px}
#blankDecision{max-width:470px}#blankDecision input,#blankDecision select{width:100%}
/* Right properties pane: quiet sections, generous controls, fixed tab navigation. */
@media(min-width:761px){.layout{grid-template-columns:260px minmax(0,1fr) 360px}}
@media(min-width:761px) and (max-width:1100px){.layout{grid-template-columns:220px minmax(0,1fr) 360px}}
.props{padding:18px;scrollbar-gutter:stable}
.props>h2{font-size:11px;letter-spacing:1px;margin:0 0 16px;color:#789097}
.property-header{position:sticky;top:-18px;z-index:3;background:#fff;padding:14px 0 0}
#propertySummary{padding:0 0 16px;overflow-wrap:anywhere}
#propertyObjectName{display:block;color:#183e48;font-size:18px;line-height:1.35;font-weight:700}
#propertyObjectSize{font-size:14px;color:#42616a;margin-top:6px;font-variant-numeric:tabular-nums}
#propertyObjectPosition{font-size:12px;color:#788b91;margin-top:3px;font-variant-numeric:tabular-nums}
.property-tabs{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:2px;padding:4px;background:#EEF0F4;border-radius:7px}
.property-tabs button{height:40px;min-width:0;padding:0 4px;font-size:13px;border:0;background:transparent;border-radius:4px;color:#526b70}
.property-tabs button[aria-selected=true]{background:#1D4AA0;color:#fff;font-weight:700}
.property-tabs button:disabled{opacity:.38;cursor:default}
.property-tabs button:focus-visible{outline:2px solid #1D4AA0;outline-offset:1px}
.property-panel{padding-top:4px}
.props .property-group{padding:18px 0;border-bottom:1px solid #E7EAEE}
.props .property-group:last-child{border-bottom:0}
.props .property-group>h3,.props #hatchFields>h3,.props #facadeOptions>h3,.props #shapeStyle>h3{display:block;margin:0 0 12px;font-size:11px;font-weight:750;letter-spacing:.7px;color:#496d73;text-transform:uppercase}
.props .property-panel input,.props .property-panel select{height:38px;padding:8px 10px;font-size:13px;border-color:#D4D9E1;border-radius:5px;color:#233f47}
.props .property-panel input:focus,.props .property-panel select:focus{outline:2px solid #1D4AA044;outline-offset:1px;border-color:#1D4AA0}
.props .property-panel label{margin:8px 0 5px;font-size:12px;color:#5d767d}
.props .property-panel .check{gap:8px;margin:10px 0;font-size:13px;color:#36535c}
.props .property-panel .check input{height:16px;width:16px;accent-color:#1D4AA0}
.props .property-panel button{min-height:38px;padding:8px 10px;font-size:12px}
.props .property-panel .compact-note,.props .property-panel .muted{font-size:11px;line-height:1.5;margin:6px 0;color:#7a8d92}
.props .property-panel .two,.props #doorGlassFields>.row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.props #labelFields{grid-template-columns:1fr}
.props #labelFields>label:not(.check){display:block}
.props #labelFields .check{margin-top:0}
.props #cells{margin:0;gap:6px}
.props #cells .cellbtn{min-height:40px;padding:8px 5px;line-height:1.35;border-radius:4px;font-size:12px}
.props #cells .cellbtn.active{background:#E8EDF5;border:2px solid #1D4AA0;font-weight:650}
.props #cells .cell-stack{gap:6px}
.props #cells{display:block;position:relative;background:#F0F2F5;border:1px solid #D5D9E1;min-height:110px;overflow:hidden}
.props .property-group{padding:12px 0}
.props #cells .cellbtn{position:absolute;min-height:0;padding:3px;font-size:11px;overflow:hidden;display:flex;flex-direction:column;justify-content:center;align-items:center;border-radius:0;line-height:1.2}
.props #cells .cellbtn small{display:block;font-size:9px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.division-mode{background:#E3E9F4;border:1px solid #2458BD;border-radius:5px;padding:9px;display:flex;align-items:center;gap:6px;font-size:12px;margin-top:10px}
.division-mode button{margin-left:auto;padding:5px;font-size:11px}
.profile-row{display:flex;gap:5px;margin-bottom:6px}.profile-row button{flex:1;min-width:0;font-size:11px;padding:7px 4px}
.danger-subtle{color:#a03934;border-color:#e4c6c3;background:#fffafa}
.geometry-menu{position:fixed;z-index:10000;background:white;border:1px solid #BFC7D5;border-radius:6px;box-shadow:0 5px 24px #173c3f33;padding:5px;max-height:80vh;overflow:auto;min-width:210px}
.geometry-menu button{display:block;width:100%;border:0;text-align:left;border-radius:3px;padding:9px 12px;background:white;font-size:12px}
.geometry-menu button:hover{background:#E5EBF4;color:#126f6b}
#freeSplits .two button{font-size:12px;padding:10px 5px}#freeRemoveSplit{width:100%;margin-top:8px}
#freeSplits .two{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}#freeSplits button{white-space:normal;min-width:0}
#geometryProperties button{margin:4px 5px 4px 0}#convertFreeFrame{margin:12px 0}
.property-chosen-pane{font-size:13px;font-weight:650;color:#1D4AA0}
.props #localMullion,.props #localTransom{margin:5px 0!important;width:100%}
.props .property-empty{font-size:13px;line-height:1.6;color:#788b91;padding:20px 0;margin:0}
.props #shapeStyle{padding:18px 0;border:0;margin:0}
.props #hatchFields{padding:18px 0}
.props #surfaceFields{padding-top:16px}
.props #paneWidthFields{gap:10px;margin:6px 0 8px}
.props .pane-width-label{padding:0;border:0;background:none;border-radius:0}
.props .pane-width-label.active{background:none;border:0}
.props .pane-width-label.active input{border-color:#1D4AA0;background:#F3F6FA}
.props .property-group .property-group{border-bottom:0;padding-bottom:0}
.props .property-object-list{margin:22px -18px -18px;padding:16px 18px;border:0;border-top:1px solid #DCE0E7;border-radius:0;background:#F6F7F9}
.props .property-object-list summary{font-size:13px;color:#526c73}
.props #selectFrames{min-height:36px;font-size:12px;margin:8px 0 4px;background:#fff}
.props .property-object-list .list{margin-top:8px}

/* Additional contour tools keep the existing editor structure. */
.shape-tools{display:grid;grid-template-columns:1fr 1fr}
.free-frame-tool{padding:10px 0 14px;border-bottom:1px solid #E1E4E9;margin-bottom:10px}.free-frame-tool>button{width:100%;color:#1D4AA0;font-weight:650}.free-frame-tool label{margin-top:8px}.free-frame-tool select{font-size:12px}
/* Local ortho workflow follows the existing compact underlay controls. */
.ortho-panel{margin-top:10px;padding:9px;border:1px solid #D8DDE6;border-radius:6px;background:#fff}
.ortho-panel summary{font-weight:650;cursor:pointer}.ortho-panel button{width:100%;margin:5px 0}.ortho-panel .check{display:flex;gap:5px;align-items:center;margin-top:10px}.ortho-panel .check input{width:auto}.ortho-panel p{line-height:1.5;overflow-wrap:anywhere}

/* Compact CAD controls; geometry remains unobscured. */
.cad-toggles{display:flex;gap:4px;flex-shrink:0}.cad-toggles button{font-size:11px;padding:4px 7px;min-height:26px;border:1px solid #C9CFD9;border-radius:4px;background:#F5F6F8;color:#56666c}.cad-toggles button[aria-pressed="true"]{background:#D6DFEE;border-color:#16847f;color:#173E8C;font-weight:700}.cad-input{position:absolute;z-index:8;pointer-events:none;background:#fffdf1;border:1px solid #bca872;border-radius:4px;padding:6px 9px;color:#304349;font-size:12px;box-shadow:0 2px 8px #153b3b18;max-width:250px;white-space:normal}footer #status{min-width:0;flex:1}footer{gap:8px}.toolbar{gap:5px}.toolbar #cadLine,.toolbar #cadMove,.toolbar #cadCopy,.toolbar #cadOffset{padding:7px 9px}.cad-input[hidden]{display:none}
