/* Dedicated workspace, using the current ACT calculator palette and controls. */
body[data-page="pdf-takeoff"] { --navy:#102638; --steel:#31536a; --line:#cbd6de; --lime:#e5ff50; background:#edf2f5; color:var(--navy); height:100dvh; min-width:320px; overflow:hidden; }
.takeoff-app { height:100dvh; display:flex; flex-direction:column; overflow:hidden; }
.takeoff-app *, dialog * { box-sizing:border-box; }
.takeoff-app button,dialog button { min-height:36px; padding:7px 11px; border:1px solid #cbd6de; border-radius:9px; background:#f7f9fa; color:#102638; font:inherit; font-size:.76rem; font-weight:700; white-space:nowrap; cursor:pointer; }
.takeoff-app button:hover:not(:disabled),dialog button:hover { border-color:#31536a; box-shadow:0 3px 9px #10263819; }
.takeoff-app button:disabled { opacity:.42; cursor:not-allowed; }
.takeoff-app button.takeoff-primary,dialog button.takeoff-primary { background:#e5ff50; border-color:#e5ff50; color:#102638; }
.takeoff-app :focus-visible,dialog :focus-visible { outline:3px solid #007eac; outline-offset:2px; }
.takeoff-app input,.takeoff-app select,dialog input,dialog select,dialog textarea { min-width:0; max-width:100%; min-height:36px; padding:7px 9px; border:1px solid #b9c8d2; border-radius:9px; background:#fff; color:#102638; font:inherit; font-size:.8rem; }
.app-header { display:flex; align-items:center; gap:10px; padding:10px 14px; border-bottom:1px solid #27475d; background:#102638; color:#fff; flex-shrink:0; }
.app-brand { display:flex; align-items:center; gap:7px; color:#fff; text-decoration:none; font-size:1rem; letter-spacing:-.04em; }.app-brand span { display:grid; place-items:center; width:30px; height:30px; border:1px solid #547084; border-radius:8px; color:#e5ff50; font-weight:900; }.app-title { padding-left:10px; border-left:1px solid #547084; font-size:.85rem; white-space:nowrap; }.draft-name { flex:1; min-width:70px; max-width:360px; }.draft-name input { width:100%; color:#fff; background:#17364b; border-color:#547084; }.app-header #saveStatus { font-size:.68rem; margin-left:auto; color:#c8d5de; max-width:200px; }.app-header #togglePanel,.app-header #saveDraft { border-color:#547084; background:#17364b; color:#dfe8ee; }
.workspace-toolbar,.view-toolbar { display:flex; align-items:center; gap:10px; flex-shrink:0; padding:8px 12px; background:#dfe8ee; border-bottom:1px solid #cbd6de; }.view-toolbar { background:#f8fafb; padding-top:6px; padding-bottom:6px; }.toolbar-group,.sheet-controls,.view-controls,.active-type { display:flex; gap:5px; align-items:center; min-width:0; }.toolbar-group+.toolbar-group { padding-left:10px; border-left:1px solid #b9c8d2; }.sheet-controls select { width:180px; }.tool-palette button[aria-pressed="true"],.utility-tools button[aria-pressed="true"] { color:#fff; background:#102638; border-color:#102638; }.tool-palette #calibrateTool.needs-scale { background:#e5ff50; border-color:#a9c024; box-shadow:0 0 0 2px #e5ff5050; color:#102638; }.history-tools { margin-left:auto; }.active-type { width:260px; }.active-type select { flex:1; width:0; font-weight:700; }.swatch { display:inline-block; width:12px; height:12px; border-radius:4px; background:var(--type-color,#007eac); flex-shrink:0; border:1px solid #10263825; }.active-type .swatch { width:15px; height:22px; }#scaleLabel { font-size:.7rem; color:#536877; }.view-controls { margin-left:auto; }.view-controls output { display:inline-block; min-width:40px; }
.workspace-center { display:flex; position:relative; flex:1; min-height:0; min-width:0; overflow:hidden; }.drawing-workspace { display:flex; flex-direction:column; flex:1; min-width:0; min-height:0; }.plan-viewport { position:relative; flex:1; min-height:0; overflow:hidden; background:#293d4b; touch-action:none; overscroll-behavior:contain; user-select:none; cursor:default; }.plan-viewport[data-tool="pan"],.plan-viewport.temporary-pan { cursor:grab; }.plan-viewport.is-dragging { cursor:grabbing!important; }.plan-viewport[data-tool="trace"],.plan-viewport[data-tool="calibrate"],.plan-viewport[data-tool="arrow"],.plan-viewport[data-tool="measure"] { cursor:crosshair; }.plan-viewport[data-tool="text"] { cursor:text; }.plan-viewport.dragover { outline:4px solid #e5ff50; outline-offset:-4px; }
#drawing { position:absolute; left:0; top:0; transform-origin:0 0; will-change:transform; background:white; box-shadow:0 10px 40px #0005; }#pdfCanvas { display:block; width:100%; height:100%; }#markup { position:absolute; inset:0; width:100%; height:100%; overflow:visible; pointer-events:none; }.empty-plan { position:absolute; inset:0; display:flex; flex-direction:column; justify-content:center; align-items:center; text-align:center; padding:18px; color:#c8d5de; background:radial-gradient(ellipse at 50% 30%,#3a5264,transparent 65%); }.empty-plan h1 { color:#fff; font-size:clamp(2rem,3.5vw,3.4rem); line-height:1; letter-spacing:-.06em; margin:8px 0 12px; }.empty-plan p { margin:0 0 18px; font-size:.86rem; line-height:1.6; }.empty-plan .section-kicker { margin:16px 0 0; color:#e5ff50; }.empty-plan small { margin-top:15px; font-size:.68rem; }.empty-plan img { width:54px; height:54px; }
.viewer-busy { position:absolute; top:14px; left:50%; transform:translateX(-50%); padding:10px 16px; border-radius:9px; background:#102638; color:white; font-size:.8rem; pointer-events:none; }.scale-prompt { position:absolute; top:16px; left:16px; display:grid; gap:6px; max-width:295px; border:1px solid #547084; border-radius:14px; padding:16px; color:#fff; background:#102638f5; box-shadow:0 8px 24px #0002; }.scale-prompt strong { font-size:.87rem; }.scale-prompt span { font-size:.74rem; color:#c8d5de; line-height:1.5; }.scale-prompt button { justify-self:start; margin-top:4px; }.live-measurement { position:absolute; bottom:14px; left:14px; background:#102638ed; border:1px solid #547084; color:#fff; padding:9px 13px; font-size:.78rem; border-radius:9px; pointer-events:none; }.selection-bar { position:absolute; bottom:12px; left:12px; right:12px; display:flex; align-items:center; gap:6px; max-width:650px; padding:8px; background:#f8fafbf5; border:1px solid #b9c8d2; border-radius:12px; box-shadow:0 4px 18px #0002; }.selection-bar span { flex:1; min-width:0; font-size:.75rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.selection-bar button { min-height:34px; padding:6px 9px; }
.viewer-footer { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:6px 12px; background:#f8fafb; border-top:1px solid #cbd6de; flex-shrink:0; min-height:47px; }.viewer-footer p { font-size:.73rem; line-height:1.4; color:#31536a; margin:0; }.viewer-footer>div { display:flex; gap:6px; flex-shrink:0; }
.takeoff-sidebar { width:285px; flex-shrink:0; padding:16px; background:#dfe8ee; border-left:1px solid #b9c8d2; overflow-y:auto; overscroll-behavior:contain; }.panel-heading,.summary-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; }.section-kicker { font-size:.62rem; letter-spacing:.14em; font-weight:800; color:#31536a; margin:0 0 4px; }.takeoff-sidebar h2 { font-size:1.15rem; letter-spacing:-.035em; margin:0 0 12px; }.panel-help,.empty-note { font-size:.72rem; line-height:1.5; color:#536877; margin:9px 0 14px; }.wide-button { width:100%; }.type-row { display:flex; gap:4px; margin:8px 0; }.type-choice { border-left:5px solid var(--type-color)!important; flex:1; min-width:0; text-align:left; white-space:normal!important; background:#f8fafb!important; padding:10px!important; }.type-choice[aria-pressed="true"] { outline:2px solid #31536a; outline-offset:0; background:#fff!important; }.type-choice strong,.type-choice small { display:block; overflow-wrap:anywhere; }.type-choice small { font-size:.67rem; color:#536877; font-weight:400; margin-top:4px; line-height:1.5; }.type-row .edit-type { padding:7px; font-size:.68rem; }
.summary-panel { margin-top:20px; border-radius:16px; padding:16px; color:#fff; background:#102638; border:1px solid #27475d; box-shadow:0 8px 22px #10263814; }.summary-panel .section-kicker { color:#e5ff50; }.summary-panel h2 { color:#fff; font-size:1rem; }.summary-heading>span { font-size:.65rem; color:#b9cbd7; }.total-length { display:flex; align-items:baseline; gap:8px; }.total-length strong { font-size:2.4rem; letter-spacing:-.05em; }.total-length>span { color:#b9cbd7; font-size:.8rem; }.summary-panel .panel-help,.summary-panel .empty-note { color:#b9cbd7; }.summary-row { display:flex; align-items:center; gap:7px; border-top:1px solid #31536a; padding:9px 0; font-size:.76rem; }.summary-row>span:nth-child(2) { flex:1; overflow-wrap:anywhere; }.summary-row strong { white-space:nowrap; }.summary-panel #calculateMaterials { margin-top:12px; white-space:normal; }.handoff-note { font-size:.68rem; line-height:1.5; color:#b9cbd7; margin:10px 0; }#exportCsv { background:#17364b; color:#dfe8ee; border-color:#547084; font-size:.7rem; }.workspace-help { margin-top:18px; font-size:.72rem; color:#536877; line-height:1.7; }.workspace-help summary { cursor:pointer; font-weight:700; }#modes { display:flex; gap:5px; flex-wrap:wrap; }#modes button { min-height:28px; padding:4px 7px; font-size:.64rem; }#modes small { margin-left:5px; }
.takeoff-tray { flex-shrink:0; border-top:1px solid #b9c8d2; background:#f8fafb; min-width:0; }.tray-header { display:flex; gap:12px; align-items:center; padding:5px 12px; background:#dfe8ee; }.tray-header button { min-height:30px; font-size:.73rem; }.tray-header #toggleTray { border:0; background:transparent; padding-left:0; }.tray-header #clearTakeoff { margin-left:auto; }.tray-hint { font-size:.68rem; color:#536877; }.tray-body { height:clamp(95px,20vh,190px); overflow:auto; overscroll-behavior:contain; }.tray-body table { width:100%; border-collapse:collapse; font-size:.75rem; text-align:left; }.tray-body th { position:sticky; top:0; z-index:1; background:#f0f4f7; color:#536877; font-size:.64rem; text-transform:uppercase; letter-spacing:.06em; }.tray-body th,.tray-body td { padding:8px 14px; border-bottom:1px solid #dfe8ee; }.tray-body tr { cursor:pointer; }.tray-body tr:hover { background:#edf2f5; }.tray-body tr.selected { background:#d9eaf3; box-shadow:inset 4px 0 #007eac; }.tray-body td:nth-child(3)>span { display:inline-flex; align-items:center; gap:7px; }.tray-body td:nth-child(6) { max-width:280px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.tray-body button { min-height:28px; padding:3px 8px; font-size:.68rem; }.tray-body td:nth-child(4),.tray-body td:nth-child(5) { white-space:nowrap; }#emptyTray { font-size:.76rem; color:#647787; text-align:center; margin:22px; }
dialog { color:#102638; border:1px solid #b9c8d2; border-radius:20px; padding:24px; width:min(530px,calc(100% - 24px)); max-height:90dvh; overflow:auto; box-shadow:0 24px 80px #10263855; }dialog::backdrop { background:#102638a6; }dialog h2 { font-size:1.5rem; letter-spacing:-.035em; margin:5px 0 15px; }dialog p { font-size:.8rem; line-height:1.5; }.dialog-heading { display:flex; align-items:start; justify-content:space-between; gap:10px; }.type-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; margin:12px 0 18px; }dialog label { display:grid; gap:6px; font-size:.75rem; font-weight:700; margin-bottom:10px; }.type-form-grid label { margin:0; }dialog textarea { resize:vertical; min-height:75px; }dialog input[type="color"] { padding:4px; width:100%; }.full-field { grid-column:1/-1; }.dialog-actions,.type-management { display:flex; justify-content:flex-end; gap:7px; flex-wrap:wrap; margin-top:18px; }.type-management { justify-content:space-between; border-top:1px solid #cbd6de; padding-top:14px; }.danger-button { color:#a62f2f!important; }dialog #deleteRun { margin-right:auto; }
[hidden] { display:none!important; }.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
@media(max-width:1100px) { .app-brand strong { display:none; }.sheet-controls select { width:135px; }.workspace-toolbar { gap:6px; }.toolbar-group+.toolbar-group { padding-left:6px; }.takeoff-app button { padding:7px 8px; }.takeoff-sidebar { width:265px; }.view-toolbar { gap:8px; }.active-type { width:210px; } }
@media(max-width:850px) { .takeoff-sidebar { position:absolute; right:0; top:0; bottom:0; z-index:5; width:min(310px,90%); box-shadow:-12px 0 30px #10263840; }.app-title { font-size:.78rem; }.app-header { gap:6px; padding:8px; flex-wrap:wrap; }.app-header #saveStatus { max-width:none; font-size:.64rem; }.draft-name { flex:1; max-width:none; }.workspace-toolbar { flex-wrap:wrap; padding:6px 8px; gap:6px; }.sheet-controls { flex:1; }.sheet-controls select { flex:1; width:110px; }.history-tools { margin-left:auto; }.view-toolbar { flex-wrap:wrap; padding:6px 8px; }.active-type { width:220px; flex:1; }#scaleLabel { font-size:.65rem; }.view-controls { width:100%; justify-content:flex-end; }.tray-hint { display:none; }.tray-body { height:140px; }.tray-body th,.tray-body td { padding:7px 10px; }.tray-body table { min-width:630px; }.takeoff-app button { min-height:40px; }.viewer-footer { padding:6px 8px; }.viewer-footer p { font-size:.65rem; }.scale-prompt { top:10px; left:10px; padding:12px; max-width:265px; }.selection-bar { left:6px; right:6px; bottom:6px; }.selection-bar button { font-size:.65rem; }.selection-bar span { font-size:.68rem; } }
@media(max-width:480px) { .app-brand span { width:27px; height:27px; }.app-title { border:0; padding:0; }.app-header .draft-name { order:2; flex-basis:60%; }.app-header #saveStatus { order:3; flex:1; text-align:right; }.app-header #saveDraft { display:none; }.app-header #togglePanel { margin-left:auto; }.toolbar-group+.toolbar-group { padding:0; border:0; }.workspace-toolbar { gap:5px; }.workspace-toolbar button { font-size:.68rem; padding:6px 8px; min-height:36px; }.sheet-controls { flex-basis:100%; }.view-controls button { font-size:.68rem; min-height:32px; }.view-controls { justify-content:space-between; gap:4px; }.active-type { flex-basis:55%; width:180px; }.active-type button,.active-type select { font-size:.7rem; min-height:34px; }.view-toolbar #scaleLabel { max-width:110px; }.viewer-footer #finishRun { min-height:34px; font-size:.69rem; }.viewer-footer p { max-height:32px; overflow:auto; }.empty-plan h1 { font-size:1.85rem; }.empty-plan img,.empty-plan .section-kicker { display:none; }.empty-plan p { font-size:.75rem; margin-bottom:10px; }.empty-plan small { font-size:.62rem; }.tray-header { padding:4px 8px; }.tray-body { height:120px; }.scale-prompt { max-width:235px; padding:10px; }.scale-prompt strong { font-size:.78rem; }.scale-prompt span { font-size:.65rem; }.scale-prompt button { min-height:34px; } }
@media(max-height:650px) { .tray-body { height:95px; }.empty-plan img,.empty-plan .section-kicker { display:none; }.empty-plan h1 { font-size:1.8rem; }.empty-plan p { margin-bottom:8px; }.empty-plan small { display:none; } }
.plan-viewport.temporary-pan { cursor:grab!important; }
.plan-viewport.is-dragging { cursor:grabbing!important; }

/* Small workspace polish: anchored guidance and an isolated tray resize edge. */
.scale-teaching-row { position:absolute; inset:0; pointer-events:none; z-index:2; }
.scale-teaching-row .scale-prompt { position:absolute; pointer-events:auto; top:10px; left:0; width:min(360px,calc(100% - 16px)); max-width:none; margin:0 8px; padding:10px 40px 10px 13px; gap:4px; }
.scale-teaching-row .scale-prompt::before { content:''; position:absolute; left:var(--scale-caret,28px); top:-6px; width:10px; height:10px; transform:rotate(45deg); border-left:1px solid #547084; border-top:1px solid #547084; background:#102638; pointer-events:none; }
.scale-teaching-row .scale-prompt strong { font-size:.8rem; }
.scale-teaching-row .scale-prompt span { font-size:.71rem; line-height:1.4; }
.scale-teaching-row #dismissScalePrompt { position:absolute; right:5px; top:4px; margin:0; min-height:30px; width:30px; padding:0; font-size:1.2rem; color:#dfe8ee; background:transparent; border-color:transparent; }
.tray-resize-handle { height:10px; display:flex; align-items:center; justify-content:center; cursor:ns-resize; touch-action:none; user-select:none; background:#dfe8ee; }
.tray-resize-handle::after { content:''; display:block; height:3px; width:44px; border-radius:3px; background:#8aa0af; transition:background .12s; }
.tray-resize-handle:hover::after,.tray-resize-handle:focus-visible::after,.tray-resize-handle.is-resizing::after { background:#31536a; }
@media(max-width:850px) { .tray-resize-handle { height:16px; }.scale-teaching-row .scale-prompt { padding:9px 40px 9px 12px; } }

.rotate-label { font-size:.68rem; color:#536877; white-space:nowrap; }
#scaleDialog { position:fixed; margin:0; z-index:8; background:#fffffff5; }
#scaleDragHandle { cursor:move; touch-action:none; user-select:none; }
#scaleDragHandle .section-kicker { display:flex; justify-content:space-between; align-items:center; }
#scaleDragHandle .section-kicker span { font-size:1rem; }
@media(max-width:480px) { .view-controls button { padding-left:5px; padding-right:5px; }.rotate-label { font-size:.62rem; } }

/* Appearance settings remain visual-only; the sample uses the existing highlight opacity. */
.takeoff-appearance { margin:0; padding:12px; border:1px solid #cbd6de; border-radius:12px; min-width:0; }
.takeoff-appearance legend { font-size:.76rem; font-weight:700; padding:0 5px; }
.appearance-controls { display:grid; grid-template-columns:90px 1fr; gap:16px; align-items:center; }
.appearance-controls label { position:relative; }
#widthValue { position:absolute; top:0; right:0; color:#536877; }
#highlightWidth { width:100%; padding:0; min-height:44px; accent-color:#31536a; cursor:ew-resize; touch-action:pan-y; }
#appearanceSample { width:100%; height:56px; display:block; margin-top:8px; background:#f0f4f7; border-radius:8px; }
#quickAddType.needs-type { box-shadow:0 0 0 2px #007eac44; border-color:#007eac; }
#nextStep { white-space:normal; max-width:130px; color:#31536a; font-size:.7rem; }
.viewer-footer p { min-width:0; }
@media(max-width:480px) { #nextStep { max-width:100px; padding:4px 6px; font-size:.64rem; }.app-title { font-size:.72rem; } }

.trade-section { margin:10px 0; border:1px solid #cbd6de; border-radius:12px; padding:12px; }
.trade-toggle { display:flex; align-items:center; gap:9px; margin:0; }
.trade-toggle input,.type-form-grid input[type=checkbox] { min-height:24px; width:24px; }
#calculatorReviews { display:grid; gap:7px; margin-top:10px; }
#calculatorReviews button { white-space:normal; }
#addAllToProject { margin:10px 0; }
#takeoffProjectLink { display:block; margin-top:12px; }
#takeoffFamily { max-width:112px; font-weight:700; }
#assemblyFields label,#drywallFields label { min-width:0; }
.type-form-grid select { width:100%; }
@media(max-width:1100px) { .workspace-toolbar { flex-wrap:wrap; } }

/* Drawing cursor is armed immediately, including over the PDF canvas. */
.plan-viewport[data-tool="polygon"] { cursor:crosshair; }
#drawing,#pdfCanvas { cursor:inherit; }
#highlightOpacity { width:100%; padding:0; min-height:44px; accent-color:#31536a; touch-action:pan-y; }
#drywallFields { display:block; }
.drywall-side { margin:12px 0; padding:12px; border:1px solid #b9c8d2; border-radius:10px; background:#edf3f7; }
.drywall-side legend { padding:0 8px; font-weight:800; color:#17364b; letter-spacing:.08em; }
.drywall-side .type-form-grid { margin:8px 0; }
.drywall-options { margin-top:12px; padding-top:10px; border-top:1px solid #cbd6de; }
.drywall-options summary { font-size:.75rem; font-weight:700; cursor:pointer; }

.appearance-controls #opacityField { grid-column:1/-1; grid-template-columns:1fr auto; }
#opacityField input { grid-column:1/-1; }
#opacityValue { font-weight:400; color:#31536a; }
