/* Advanced DBI planner controls; kept separate from the original styling. */
.panel-left .segment{gap:3px;align-items:stretch}
.panel-left .segment button{flex:1 1 0;min-width:0;padding:12px 4px;font-size:11px;line-height:1.25;letter-spacing:.1px}
.config-section{padding:17px 0 18px;border-bottom:1px solid #dbe4ef}
.config-section:first-child{padding-top:0}
.config-section h4{font-size:14px;line-height:1.3;color:#162b4e;margin:0 0 14px}
.config-section .section-number{font-size:10px;letter-spacing:1.5px;color:#476cb3;margin-right:8px}
.config-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px 10px}
.config-grid .span-2{grid-column:1/-1}
.config-grid label{font:700 10px/1.5 Arial,sans-serif;letter-spacing:.6px;color:#60708b;text-transform:uppercase;display:grid;gap:6px}
.config-grid select,.config-grid input,.config-grid textarea{min-width:0;width:100%;border:1px solid #d4e0ee;border-radius:7px;background:#fff;color:#152746;padding:10px 9px;font:600 12px Arial,sans-serif;letter-spacing:0;min-height:39px;box-sizing:border-box}
.config-grid textarea{min-height:80px;line-height:1.5;resize:vertical;font-weight:400}
.config-grid input[type=number]{font-weight:700}
.config-section .finish-options{margin:12px 0 7px}
.config-section .finish-name{margin-bottom:14px;display:block;color:#334c70}
.small-action{border:1px solid #b9cce5;border-radius:7px;background:#f5f8fd;color:#174381;font:700 12px Arial,sans-serif;padding:10px 12px;cursor:pointer}
.small-action:hover,.small-action:focus-visible{background:#e5edfc;outline:2px solid transparent}
.config-checkbox{display:flex!important;flex-direction:row!important;align-items:center;gap:7px!important;font-size:11px!important;letter-spacing:0!important;text-transform:none!important}
.config-checkbox input{width:auto!important;min-height:auto!important;accent-color:#315db1}
.config-help{font-size:11px;line-height:1.65;color:#697c98;margin:10px 0 0}
.wall-colour-swatches{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:16px 0}
.wall-colour-choice{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;min-width:0;padding:11px 5px;background:#fff;border:1px solid #d9e4f1;border-radius:9px;color:#50627c;font-size:10px;font-weight:800;line-height:1.3;text-align:center;overflow-wrap:anywhere;min-height:82px}
.wall-colour-choice:hover{background:#f4f8ff;border-color:#90b0e0}
.wall-colour-choice.active{background:#eef5ff;border-color:#467ac4;box-shadow:inset 0 0 0 1px #467ac4;color:#183e7c}
.wall-colour-chip{display:block;width:35px;height:35px;flex:none;border-radius:50%;border:1px solid #c5ceda;box-shadow:0 2px 6px #10294b1c}
.wall-colour-custom{display:grid;grid-template-columns:45px minmax(0,1fr);gap:8px 11px;align-items:center;background:#f6f9fe;border:1px solid #dce6f2;border-radius:9px;padding:13px;color:#405876}
.wall-colour-custom>span{grid-column:1/-1;font-size:10px;font-weight:800;text-transform:uppercase;letter-spacing:.6px}
.wall-colour-custom input[type=color]{width:45px;height:39px;padding:3px;border:1px solid #bccde3;border-radius:7px;background:white;cursor:pointer}
.wall-colour-custom strong{min-width:0;font-size:11px;font-weight:800;overflow-wrap:anywhere}
.inspector .property-section h4{margin-bottom:13px}
.inspector .property-section details{border-top:1px solid #dce6f1;padding:13px 0}
.inspector .property-section details summary{font:800 12px Arial,sans-serif;color:#1c3f88;cursor:pointer;margin-bottom:11px}
.inspector .property-section details[open] summary{margin-bottom:16px}
.inspector .property-section .field-grid.two{gap:10px}
.inspector .property-section .field-grid.two label{min-width:0}
.inspector .property-section .field-grid.two input,.inspector .property-section .field-grid.two select{width:100%;min-width:0}
.view-switch{display:flex;align-items:center;background:#e5edfa;border:1px solid #d1deee;border-radius:7px;padding:3px;gap:2px}
.view-switch button{border:0;border-radius:5px;background:transparent;color:#455c7d;padding:9px 11px;font:800 12px Arial,sans-serif;cursor:pointer}
.view-switch button.active{background:#2454a1;color:#fff;box-shadow:0 2px 6px #183e7931}
.schedule-toggle{border:1px solid #bdcfe6;background:white;color:#294a7f;border-radius:6px;padding:10px 12px;font:700 12px Arial,sans-serif;cursor:pointer;white-space:nowrap}
.schedule-toggle.active{background:#e6eefc;color:#164584;border-color:#729adf}
#room-3d-svg{position:absolute;inset:0;width:100%;height:100%;touch-action:pan-y;user-select:none;background:linear-gradient(145deg,#f5f8fd,#e8effa)}
.orbit-controls{position:relative;display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 22px;background:#f1f6ff;border-bottom:1px solid #d3dff0}
.orbit-controls>span:first-child{font:800 10px Arial,sans-serif;letter-spacing:1.2px;color:#365c97}
.orbit-controls button{border:1px solid #d7e1ef;background:white;color:#1c4a92;border-radius:5px;padding:6px 10px;cursor:pointer;font-size:16px}
.orbit-controls #angle-value{font:700 12px Arial,sans-serif;min-width:32px;text-align:center}
.orbit-controls small{font:11px Arial,sans-serif;color:#6d7f99}
.product-panel{background:#fff;padding:31px 26px 35px;border-top:1px solid #dbe5f2;color:#152747}
.product-heading{display:flex;justify-content:space-between;align-items:flex-start;flex-wrap:wrap;gap:12px 20px;margin:0 0 24px}
.product-heading h3{font:800 clamp(23px,2.5vw,31px)/1.2 Arial,sans-serif;letter-spacing:-.7px;margin:9px 0 6px;color:#162849}
.product-heading p{font:13px/1.65 Arial,sans-serif;color:#657791;margin:0;max-width:460px}
.product-actions{display:flex;gap:7px;flex-wrap:wrap}
.product-actions .btn{padding:10px 12px;font-size:11px}
.takeoff-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;margin:0 0 25px}
.takeoff-tile{background:#eef3fb;border:1px solid #dfe9f6;border-radius:7px;padding:16px 13px}
.takeoff-tile strong{display:block;font:800 23px Arial,sans-serif;color:#1d488f;margin-bottom:5px}
.takeoff-tile span{font:700 10px/1.4 Arial,sans-serif;color:#516989;text-transform:uppercase;letter-spacing:.5px}
.schedule-scroll{overflow:auto;border:1px solid #dfe6ef;border-radius:8px;max-height:360px}
.product-table{width:100%;border-collapse:collapse;font:12px/1.4 Arial,sans-serif;min-width:620px}
.product-table th{position:sticky;top:0;background:#edf2fa;color:#254679;font-size:10px;letter-spacing:.7px;text-transform:uppercase;text-align:left;padding:13px 10px;white-space:nowrap;z-index:1}
.product-table td{border-top:1px solid #e5ebf4;padding:11px 10px;vertical-align:top;color:#45536a}
.product-table td strong{color:#1b3053}
.product-table tbody tr[data-schedule-id]{cursor:pointer}
.product-table tbody tr[data-schedule-id]:hover{background:#f4f8fe}
.check-heading{font:800 15px Arial,sans-serif;color:#172d50;margin:25px 0 13px}
.check-heading span{font-size:12px;color:#6c7f9d}
.check-list{list-style:none;padding:0;margin:0;display:grid;gap:8px}
.check-list li{font:12px/1.6 Arial,sans-serif;color:#4e5e77;padding:10px 12px 10px 32px;background:#eef4fd;border-left:3px solid #7f9ed0;position:relative}
.check-list li:before{content:'•';position:absolute;left:12px;color:#2455a4;font-size:21px;top:3px}
.check-list li.attention{background:#fff5eb;border-left-color:#c98238}
.check-list li.clear{background:#eef8f1;border-left-color:#4e9c69}
.product-caveat{font:11px/1.75 Arial,sans-serif;color:#78869e;margin:18px 0 0}
.btn-summary.subtle{margin-top:7px;background:transparent;border:1px solid #94afd6;color:#eaf2ff}
.btn-summary.subtle:hover{background:#203c71}
.small-badge{font:700 10px Arial,sans-serif;color:#284d8a;background:#e8eef9;border-radius:4px;padding:4px 6px}
/* Treat the planner as one continuous page. Controls never float on top of the drawing. */
@media(min-width:1231px){
  .workspace{min-height:670px}
  .panel-left,.panel-right{overflow:visible}
  .canvas-panel{min-height:0;height:auto;overflow:visible}
  .product-panel:not([hidden]){max-height:none;overflow:visible;flex:none}
}
@media(min-width:1231px) and (max-width:1700px){
  .stage-toolbar{flex-direction:column;align-items:stretch;gap:12px;padding:15px 20px}
  .stage-title h2{white-space:nowrap}
  .stage-tools{width:100%;justify-content:flex-start}
}
@media(max-width:1160px){.stage-tools{flex-wrap:wrap}.takeoff-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:680px){.config-grid{grid-template-columns:1fr 1fr}.product-panel{padding:22px 15px}.takeoff-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.orbit-controls small{display:none}.stage-tools{gap:6px}.schedule-toggle{padding:9px}.product-heading h3{font-size:23px}}

/* Stable, non-overlapping layout at every viewport and after opening any tab. */
.workspace{width:100%;min-width:0;align-items:start;overflow:visible}
.workspace>.panel,.workspace>.canvas-panel{min-width:0;max-width:100%}
.canvas-panel{height:auto;min-height:0;overflow:visible}
.stage-toolbar{min-width:0;flex-wrap:wrap}
.stage-title,.stage-tools{min-width:0}
.stage-title h2{white-space:normal}
.stage-tools{flex-wrap:wrap;max-width:100%}
.stage{flex:none;height:clamp(520px,70vh,820px);min-height:0;isolation:isolate}
.canvas-bottom-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px;padding:13px 20px;background:#f7faff;border-top:1px solid #dce5f2}
.canvas-bottom-bar .canvas-help{position:static;max-width:none;min-width:0;box-shadow:none;background:transparent;border:0;border-radius:0;padding:0;pointer-events:auto;flex:1 1 215px}
.canvas-bottom-bar .stage-floating-actions{position:static;display:flex;flex:0 0 auto;flex-wrap:wrap;gap:8px}
.canvas-bottom-bar .stage-floating-actions button{white-space:nowrap}
.orbit-controls{max-width:100%;min-width:0}
.orbit-controls small{margin-left:auto}
.segment button,.category-chip,.starter-card,.inspector-actions button{overflow-wrap:anywhere}
.starter-card>span:nth-child(2){min-width:0;flex:1}
.panel-left .segment{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}
.panel-left .segment button{width:100%;min-width:0}
.inspector-actions{flex-wrap:wrap}
.inspector-actions button{min-width:110px}

@media(max-width:1230px){
  .panel-right{display:block}
  .panel-right>.summary-card{margin-top:20px}
}
@media(max-width:900px){
  .panel-left #room-panel{display:block}
  .panel-left #room-panel>.starter-grid,.panel-left #room-panel>.section-label:nth-of-type(2),.panel-left #room-panel>.dimension-card{grid-column:auto;grid-row:auto}
  .stage{height:clamp(440px,65vh,680px)}
}
@media(max-width:650px){
  .stage{height:clamp(370px,58vh,530px)}
  .canvas-bottom-bar{padding:12px 14px}
  .canvas-bottom-bar .stage-floating-actions{width:100%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .canvas-bottom-bar .stage-floating-actions button{min-width:0}
  .orbit-controls{padding:11px 15px;gap:9px}
  .panel-left .segment button{font-size:10px;padding:11px 3px}
  .config-grid{grid-template-columns:minmax(0,1fr)}
}
