/* One CAD stage for orbit, fixed wall views, dimensions and pending cuts. */
.angle-sign-row,.picked-angle-row{display:flex;align-items:center;gap:8px}
.angle-sign-row>input,.picked-angle-row>input{min-width:0;flex:1}
.angle-sign-toggle{flex:none!important;width:54px!important;min-height:44px!important;margin:0!important;padding:8px!important;font-size:17px!important}
.operation-count-link{display:block;font-size:13px;text-decoration:underline;text-underline-offset:3px;padding:6px 0;min-height:36px}
#operationDialog{width:min(1600px,calc(100vw - 36px));max-width:none;max-height:calc(100dvh - 36px);border-radius:20px}
#operationDialog .operation-dialog-header{padding:21px 26px}
#operationDialog .operation-dialog-header h2{font-size:21px;line-height:1.4}
#operationDialog .operation-dialog-body{display:grid;grid-template-columns:minmax(265px,345px) minmax(0,1fr);align-items:start;background:#f5f8fa}
#operationDialog #operationDialogFields{grid-column:1;grid-row:1;background:#fff;border-right:1px solid #dce7ed;padding:23px!important;min-width:0}
#operationDialog #operationDrawingPanel{grid-column:2;grid-row:1;position:sticky;top:0;padding:22px 24px;display:block;min-width:0;background:#f5f8fa}
#operationDrawingPanel h3{font-size:18px;margin:5px 0 9px}
#operationDrawingPanel .eyebrow{font-size:10px;letter-spacing:1.4px}
#operationDrawingPanel .machining-intro{font-size:14px;line-height:1.7;color:#526f7f;margin:0;max-width:76ch}
#operationViewButtons{gap:7px;margin:17px 0 13px}
#operationViewButtons button{border-radius:9px;font-size:14px;padding:10px 15px;min-height:41px;box-shadow:0 2px 6px #153f5105}
#operationViewButtons button[aria-pressed=true]{background:#103f53;border-color:#103f53;color:#fff;box-shadow:0 3px 10px #103f5328}
#operationDrawing{border:1px solid #d5e3eb;border-radius:14px;overflow:hidden;background:#edf2f5}
.machining-stage{position:relative;height:clamp(350px,49vh,600px);min-width:0;isolation:isolate}
.machining-stage canvas{display:block;width:100%;height:100%;cursor:crosshair}
#operationDrawing .machining-overlay{position:absolute;inset:0;display:block;width:100%;height:100%;min-width:0;pointer-events:none;overflow:hidden}
.operation-dialog-body #operationDrawing svg.machining-overlay{min-width:0!important;width:100%;height:100%}
#operationDrawing:after{display:none!important}
.machining-status{position:absolute;bottom:13px;left:15px;right:15px;pointer-events:none;font-size:12px;line-height:1.5;color:#4f6b7c;text-align:center}
.machining-draft{fill-opacity:.38;stroke-width:1.7;vector-effect:non-scaling-stroke;animation:machiningPulse 1.6s ease-in-out infinite}
.machining-draft.single{fill:#e34248;stroke:#c72f3a}.machining-draft.both{fill:#1683db;stroke:#0967b5}
.machining-draft.rear{fill-opacity:.06;stroke-opacity:.5;stroke-dasharray:4 4}
.machining-end{fill:none;stroke:#28b0cf;stroke-width:2;stroke-opacity:.7;vector-effect:non-scaling-stroke;pointer-events:stroke;cursor:pointer;transition:stroke .2s,stroke-width .2s}
.machining-end:hover,.machining-end:focus{stroke:#00c4ef;stroke-width:6;outline:none;filter:drop-shadow(0 0 4px #1bc2e6)}
.machining-end.selected{stroke:#d63d46;stroke-width:3;stroke-opacity:1}
.machining-end-hit{fill:none;stroke:transparent;stroke-width:18;vector-effect:non-scaling-stroke;pointer-events:stroke;cursor:pointer}
.machining-end-hit:hover+.machining-end,.machining-end-hit:focus+.machining-end{stroke:#00bce4;stroke-width:5;filter:drop-shadow(0 0 4px #16b5d9)}
#fields.has-picked-positions [data-miter-field]:not(.miter-process-note):not(.miter-end-choices),#fields.has-picked-positions label:has(#v813HolePositionReference),#fields.has-picked-positions label:has(#v807HolePosition),#fields.has-picked-positions label:has(#v807HoleOffset),#fields.has-picked-positions label:has(#v807HoleFace){display:none!important}
.picked-angle-range,.picked-centre-note{display:block;font-size:11px!important;color:#77909f!important;margin-top:7px;font-weight:400}
#operationPlacements [data-placement-face]{height:39px;font-size:13px;margin-top:10px}
.machining-dimension{fill:none;stroke:#547183;stroke-width:1;pointer-events:none}
.machining-dimension text,.machining-size{font:12px/1.5 Arial,sans-serif;fill:#173f54;stroke:#edf2f5;stroke-width:5;paint-order:stroke;stroke-linejoin:round}
.machining-size{text-anchor:middle;font-size:13px}
.machining-key{display:flex;flex-wrap:wrap;gap:10px 20px;border-top:1px solid #d7e4eb;padding:12px 16px;background:#fff;font-size:12px;color:#486879}
.machining-key span{display:inline-flex;align-items:center;gap:7px}.machining-key span:before{content:'';width:13px;height:3px;border-radius:3px;background:#df3d46}.machining-key .both:before{background:#167acb}.machining-key .pending:before{background:#769eaf;animation:machiningPulse 1.6s infinite}
#operationPlacements{margin-top:23px;padding-top:18px;border-top:1px solid #dce7ed}
.machining-placements-head{display:flex;flex-wrap:wrap;gap:5px;justify-content:space-between;color:#254f64;font-size:13px;margin-bottom:13px}.machining-placements-head span{color:#628194;font-size:12px}
.machining-placement{display:flex;gap:8px;align-items:center;padding:12px;border:1px solid #d6e5ed;border-radius:10px;background:#f7fafc;margin:9px 0}
.machining-placement label{display:block;min-width:0;flex:1;margin:0;font-size:13px;color:#244e62}.machining-placement label>span{display:block;margin-bottom:7px;font-weight:600}
.machining-placement label>div{display:flex;align-items:center;gap:9px}.machining-placement input{max-width:105px;height:40px!important;font-size:15px!important}.machining-placement small{font-size:12px;color:#547183;line-height:1.5}.machining-placement>button{margin:0;padding:6px 8px;background:transparent;color:#a35a60;min-width:30px;font-size:22px}
#operationDialog .v807-op-fields{grid-template-columns:1fr 1fr;gap:14px 12px}
#operationDialog .v807-op-fields>label>span{min-height:0;flex:none;line-height:1.55;font-size:13px}
#operationDialog .v807-op-fields>label:has(#vMiterFace){grid-column:1/-1}
#operationDialog .miter-end-choices{padding:10px 13px;gap:12px}
#operationDialog .miter-end-choices legend{font-size:12px}
#operationDialog .miter-end-choices label{font-size:13px}
#operationDialog .operation-dialog-footer{padding:14px 22px;gap:12px;min-width:0}
@keyframes machiningPulse{0%,100%{opacity:.6}50%{opacity:1}}
@media(prefers-reduced-motion:reduce){.machining-draft,.machining-key .pending:before{animation:none;opacity:.85}}
@media(max-width:1000px){#operationDialog .operation-dialog-body{grid-template-columns:285px minmax(0,1fr)}#operationDialog #operationDrawingPanel{padding:18px 13px}#operationViewButtons button{flex:1;padding:9px 10px}.machining-stage{height:360px}}
@media(max-width:760px){#operationDialog{width:100vw;height:100dvh;max-height:100dvh;margin:0;border-radius:0}#operationDialog .operation-dialog-header{padding:16px}#operationDialog .operation-dialog-header h2{font-size:18px}#operationDialog .operation-dialog-body{display:flex;flex-direction:column}#operationDialog #operationDrawingPanel{order:0;position:static;width:100%;box-sizing:border-box;padding:16px}#operationDialog #operationDialogFields{order:1;width:100%;box-sizing:border-box;border:0;padding:18px!important}.machining-stage{height:320px}.machining-key{font-size:11px;gap:8px 14px;padding:11px}.machining-status{font-size:11px;bottom:8px}#operationDialog .operation-dialog-footer{padding:11px 14px;flex-wrap:wrap}#operationDialog .operation-dialog-footer button{flex:1;min-width:120px;padding:12px;font-size:14px}#operationDialogError{flex-basis:100%;margin:0!important}.machining-dimension text{font-size:11px}}

/* The CAD stage stays inside the viewport; only the desktop form scrolls. */
#operationDialog{height:calc(100dvh - 32px);max-height:calc(100dvh - 32px)}
#operationDialog .operation-dialog-header{padding:12px 20px;gap:12px}
#operationDialog .operation-dialog-header h2{font-size:18px;line-height:1.3}
#operationDialog .operation-dialog-header .eyebrow{font-size:10px;margin-bottom:4px}
#operationDialog .operation-dialog-body{flex:1;overflow:hidden;align-items:stretch}
#operationDialog #operationDialogFields{overflow-y:auto;overscroll-behavior:contain;padding:18px!important}
#operationDialog #operationDrawingPanel{position:static;align-self:stretch;display:flex;flex-direction:column;min-height:0;height:100%;box-sizing:border-box;padding:14px 18px;overflow:hidden}
#operationDrawingPanel>div:first-child>.eyebrow,#operationDrawingTitle{display:none}
#operationDialog #operationDrawingPanel .machining-intro{margin:0;font-size:13px;line-height:1.5;color:#174b62;background:#e7f2f7;border-left:3px solid #0986ae;border-radius:6px;padding:9px 12px}
#operationDialog #operationViewButtons{margin:10px 0;flex:none}
#operationDialog #operationViewButtons button{min-height:35px;padding:7px 12px;font-size:13px}
#operationDialog #operationDrawing{margin:0;flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
#operationDialog .machining-stage{height:auto;flex:1;min-height:0}
#operationDialog .machining-key{flex:none;padding:8px 12px;font-size:11px;gap:6px 14px}
#operationDialog .operation-dialog-footer{padding:10px 18px;flex:none}
.machining-spacing{display:block;background:#edf6fa;border:1px solid #c9e1eb;border-radius:10px;padding:12px;margin-bottom:16px;color:#174b62}
.machining-spacing>span{display:flex!important;align-items:center;gap:9px;font-size:13px;font-weight:600}
#operationDialog .machining-spacing input{width:18px;height:18px;min-height:18px;margin:0;accent-color:#087da3;flex:none}
.machining-spacing small{display:block;font-size:12px;line-height:1.6;margin-top:7px;color:#526f7f}
@media(max-width:760px){
 #operationDialog{height:100dvh;max-height:100dvh}
 #operationDialog .operation-dialog-header{padding:10px 14px}
 #operationDialog .operation-dialog-header h2{font-size:16px}
 #operationDialog .operation-dialog-body{overflow:hidden;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(150px,46%) minmax(0,1fr)}
 #operationDialog #operationDrawingPanel{grid-column:1;grid-row:1;height:100%;padding:8px 12px;overflow:hidden}
 #operationDialog #operationDialogFields{grid-column:1;grid-row:2;overflow-y:auto;border-top:1px solid #bfd5e1;border-right:0;padding:14px!important;box-shadow:0 -4px 12px #153e5009}
 #operationDialog #operationDrawing{flex:1}
 #operationDialog .machining-stage{height:auto;flex:1}
 #operationDialog #operationDrawingPanel .machining-intro,#operationDialog #operationSidePrompt{display:none}
 #operationDialog .machining-key{display:none}
 #operationDialog #operationViewButtons{gap:5px}
 #operationDialog #operationViewButtons button{padding:7px 5px;font-size:12px}
 #operationDialog #operationViewButtons #resetOperationView{font-size:0;padding:7px 8px;flex:0 0 36px}
 #operationDialog #resetOperationView::after{content:'↺';font-size:19px}
 #operationDialog .operation-dialog-footer{padding:9px 12px}
}

.operation-warning{padding:10px 12px;border:1px solid #e4ca8e;border-left:3px solid #bc8b24;border-radius:8px;background:#fff8e7;color:#75551d;font-size:12px;line-height:1.5;margin:10px 0;flex:none}
.operation-warning[hidden]{display:none!important}
.operation-warning[data-invalid=true]{background:#fff0f1;color:#9f2637;border-color:#d8a0aa;border-left-color:#b63243}
#operationDrawingPanel>.operation-warning{max-height:none;overflow:visible}
@media(max-width:760px){#operationDialog .operation-dialog-body:has(.operation-warning[data-invalid=true]:not([hidden])){grid-template-rows:minmax(235px,55%) minmax(0,1fr)}#operationDrawingPanel>.operation-warning{font-size:13px;line-height:1.45}}

.machining-cursor{pointer-events:none;stroke-width:2;fill-opacity:.32;stroke-dasharray:4 2;vector-effect:non-scaling-stroke;animation:machiningPulse 1.1s ease-in-out infinite;filter:drop-shadow(0 0 4px #19b4df80)}
.machining-cursor.single{fill:#ef4b50;stroke:#ca2632}.machining-cursor.both{fill:#268be5;stroke:#0869b8}
@media(prefers-reduced-motion:reduce){.machining-cursor{animation:none}}

.machining-measure-label{pointer-events:none}.machining-measure-label rect{fill:#edf2f5;stroke:none}.machining-measure-label text{font:11px Arial,sans-serif;fill:#173f54;stroke:none}.machining-dimension path{fill:none;stroke:#547183;stroke-width:1}

.machining-measure-label.is-editable{pointer-events:all;cursor:pointer}.machining-measure-label.is-editable rect{fill:#f7fbfd;stroke:#bbd3df;stroke-width:1}.machining-measure-label.is-editable:hover rect,.machining-measure-label.is-editable:focus rect{fill:#e2f4fc;stroke:#0088b5;stroke-width:1.5}.machining-measure-label.is-editable:focus{outline:none}.machining-measure-label text{font-size:11px;pointer-events:none}.machining-dimension path{stroke:#7e99a8;stroke-width:.8}
#dimensionDialog{width:min(430px,94vw);max-width:430px;padding:24px;border:1px solid #d7e6ee;border-radius:18px;box-shadow:0 25px 90px #001b3866}#dimensionDialog::backdrop{background:#061e3280;backdrop-filter:blur(3px)}#dimensionDialog header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0;margin:0 0 22px;color:#153f50;background:none}#dimensionDialog h2{font-size:19px;margin:0;line-height:1.4}#dimensionDialog .eyebrow{font-size:9px;margin:0 0 6px}#dimensionDialog label{font-size:12px}.dimension-value-row{display:flex;align-items:center;gap:13px}.dimension-value-row input{min-width:0;flex:1;font-size:22px;padding:13px;border:2px solid #64b6d5;border-radius:10px}.dimension-value-row span{font-size:13px;color:#527587}#dimensionEditHint{font-size:12px;line-height:1.7;color:#527587;margin:16px 0}#dimensionEditError{font-size:12px;color:#b63b37}#dimensionDialog footer{display:flex;gap:10px;padding:10px 0 0;margin:0;text-align:left}#dimensionDialog footer button{flex:1;margin:0;font-size:12px;padding:12px}

.machining-key .measure-hint{margin-left:auto;color:#087ca6;font-weight:600}.machining-key .measure-hint:before{display:none}

.operation-radius-field{min-width:0}.operation-radius-field>label{display:block;margin:0 0 8px;font-weight:700}.operation-radius-row{display:flex;align-items:center;gap:10px}.operation-radius-row>input{flex:1;min-width:0;margin:0!important}.operation-radius-row .operation-radius-info{position:relative;flex:none;margin:0!important;padding:0!important;border:0!important;background:transparent!important}.operation-radius-row .operation-radius-info summary{display:grid;place-items:center;width:30px;height:30px;border:1px solid #b7d3df;border-radius:50%;color:#1a5f7b;font:italic 700 17px Georgia,serif;cursor:pointer;list-style:none}.operation-radius-row .operation-radius-info summary::-webkit-details-marker{display:none}.operation-radius-row .operation-radius-info p{position:absolute;z-index:5;right:0;top:34px;width:min(260px,65vw);padding:14px;border:1px solid #c8dce6;border-radius:10px;background:#fff;box-shadow:0 8px 25px #12394c20;font-size:13px;line-height:1.7;color:#365d71}
.machining-measure-label.is-editable rect{fill:#edf2f5;stroke:none}.machining-measure-label text{font-size:12px}

/* Aligned fields and one combined position control. */
#fields .v807-op-fields{align-items:start;gap:16px 14px}#fields .operation-field{min-width:0;margin:0}#fields .operation-field-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:6px;min-height:36px;margin-bottom:6px}#fields .operation-field-heading label{margin:0;font-size:12px;line-height:1.4;font-weight:700;color:#153b4a}#fields .operation-field>input,#fields .operation-field>select,.operation-position-row>input,.operation-position-row>select{width:100%;height:46px;min-width:0;margin:0!important;padding:10px;font-size:13px;box-sizing:border-box}#fields .operation-field.wide .operation-field-heading{min-height:24px}.operation-position-row{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:0}.operation-position-row>input{border-radius:9px 0 0 9px!important}.operation-position-row>select{border-radius:0 9px 9px 0!important;border-left:0!important;background:#edf6fa!important}.operation-help-button{display:inline-grid!important;place-items:center;flex:none;width:24px!important;height:24px!important;min-height:24px!important;margin:0!important;padding:0!important;border:1px solid #abcdda!important;border-radius:50%!important;background:#fff!important;color:#17607d!important;font:italic 700 16px Georgia,serif!important;box-shadow:none!important;cursor:pointer}.operation-help-button:hover,.operation-help-button:focus-visible{background:#e5f5fc!important;border-color:#0083ad!important;outline-offset:2px}#fields.has-picked-positions .operation-position-field,#fields.has-picked-positions .operation-field:has(#v807HoleOffset),#fields.has-picked-positions .operation-field:has(#v807HoleFace){display:none!important}.machining-placement .operation-position-row{display:grid!important;gap:0!important}.machining-placement .operation-position-row input,.machining-placement .operation-position-row select{height:43px;margin:0!important;font-size:12px!important}.machining-placement .operation-field-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:9px}.machining-placement .operation-field-heading span{margin:0!important}.editor-controls label>span:has(.operation-help-button){display:flex;justify-content:space-between;align-items:center;gap:8px}
#operationHelpDialog{width:min(500px,calc(100vw - 28px));max-width:500px;max-height:calc(100dvh - 28px);padding:24px;border:1px solid #cbdfe9;border-radius:18px;overflow:auto;background:#fff;color:#153b4a;box-shadow:0 25px 90px #001b3866}#operationHelpDialog::backdrop{background:#061e3280;backdrop-filter:blur(3px)}#operationHelpDialog header{display:flex;justify-content:space-between;align-items:center;gap:15px;margin:0 0 16px;padding:0;background:none}#operationHelpDialog h2{font-size:20px;line-height:1.4;margin:0}#operationHelpDialog header button{padding:8px 10px}#operationHelpDialog>p{font-size:14px;line-height:1.8;color:#496b7c}#operationHelpDialog figure{margin:18px 0;background:#f1f7fa;border:1px solid #d7e5ed;border-radius:12px;padding:14px}#operationHelpDialog svg{display:block;width:100%;height:auto}#operationHelpDialog figcaption{text-align:center;font-size:11px;line-height:1.6;color:#59798a;margin-top:5px}#operationHelpDialog svg text{font:12px Arial,sans-serif;fill:#153b4a;text-anchor:middle}#operationHelpDialog .help-profile{fill:#a3adb4;stroke:#536e7c;stroke-width:1.3}#operationHelpDialog .help-cut{fill:#e3424833;stroke:#d13542;stroke-width:1.6}#operationHelpDialog .help-empty{fill:#f1f7fa;stroke:#536e7c}#operationHelpDialog .help-dimension{fill:none;stroke:#42677b;stroke-width:1}#operationHelpDialog .help-centre{fill:none;stroke:#4c8aa5;stroke-dasharray:4 3}#operationHelpDialog .help-accent{fill:none;stroke:#d13542;stroke-width:2}#operationHelpDialog .help-blue{fill:#1683db;stroke:#0967b5}#operationHelpDialog>button{display:block;margin-left:auto}

.machining-placement .placement-fields{flex:1;min-width:0}.machining-placement{align-items:start;gap:9px}.machining-placement .remove-picked-placement{position:static;align-self:start;margin-top:34px!important;flex:none}.picked-angle-row{display:flex;align-items:center;gap:10px}.picked-angle-row input{flex:1;min-width:0}.machining-placement .operation-field-heading label{margin:0;font-size:12px;line-height:1.5}.machining-spacing>span .operation-help-button{margin-left:auto!important}#operationHelpDialog .help-dimension{stroke-width:1.3}

/* Native help dialogs belong to the viewport, never to a clipped field row. */
#operationHelpDialog{box-sizing:border-box;inset:0;margin:auto;overscroll-behavior:contain}#operationHelpDialog header button{flex:none}@media(max-width:480px){#operationHelpDialog{padding:18px;width:calc(100vw - 24px);max-height:calc(100dvh - 24px)}}

#operationHelpDialog header{flex-direction:row!important;align-items:center!important}#operationHelpDialog h2{min-width:0}@media(max-height:600px){#operationHelpDialog{padding:16px}#operationHelpDialog header{margin-bottom:10px}#operationHelpDialog h2{font-size:18px}#operationHelpDialog>p{font-size:13px;line-height:1.6;margin:10px 0}#operationHelpDialog figure{margin:12px 0;padding:8px}#operationHelpDialog svg{max-height:140px}#operationHelpDialog figcaption{font-size:10px}}
/* Longer edge-reference names remain readable beside their distance input. */
.operation-position-row{grid-template-columns:minmax(80px,.65fr) minmax(0,1.65fr)}
.operation-position-row select{font-size:13px!important;padding-left:10px!important;padding-right:24px!important;min-width:0}

.operation-centre-reset{font-size:12px;padding:7px 10px;margin-top:6px;white-space:normal}.operation-centre-reset[hidden]{display:none!important}

/* Intrinsic canvas dimensions cannot expand the flex stage while zooming or resizing. */
.machining-stage canvas{position:absolute;inset:0;min-width:0;min-height:0;max-width:100%;max-height:100%}
#operationDialog{height:calc(var(--editor-viewport-height,100dvh) - 32px);max-height:calc(var(--editor-viewport-height,100dvh) - 32px);overflow:hidden}
#editDialog{max-height:calc(var(--editor-viewport-height,100dvh) - 24px)}
#resetOperationView{margin-left:auto}
@media(max-width:760px){#operationDialog{height:var(--editor-viewport-height,100dvh);max-height:var(--editor-viewport-height,100dvh)}}

/* Invite an explicit side choice; the selected view also selects the machining face. */
#operationSidePrompt{margin:8px 0 0;padding:0;color:#30667d;font-size:13px;line-height:1.5;flex:none}
#operationSidePrompt[hidden]{display:none!important}
#operationDialog #operationViewButtons.needs-side [data-operation-view]:not([data-operation-view=perspective]){border-color:#84b7ca;background:#edf7fb;color:#15546e;box-shadow:0 0 0 2px #53b9d512,inset 0 1px 0 #fff;animation:operation-side-invite 1.8s ease-in-out 2}
@keyframes operation-side-invite{50%{border-color:#4c9db8;box-shadow:0 0 0 3px #53b9d522,0 3px 13px #3b9bb51b,inset 0 1px 0 #fff}}
@media(prefers-reduced-motion:reduce){#operationDialog #operationViewButtons.needs-side [data-operation-view]{animation:none!important}}

/* Full-width reference names, without squeezing the distance or the removal action. */
#operationDialog .operation-position-row,#operationDialog .machining-placement .operation-position-row{grid-template-columns:minmax(0,1fr)!important;gap:7px!important}
#operationDialog .operation-position-row>input,#operationDialog .operation-position-row>select{border:1px solid #bfd5e1!important;border-radius:9px!important;box-shadow:inset 0 1px 2px #153e5005;width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box;font-size:13px!important;height:44px!important;line-height:1.5;padding:10px 12px!important}
#operationDialog .operation-position-row>select{font-size:12px!important;padding-right:28px!important;background:#edf6fa!important}
#operationDialog .operation-position-row>input:focus,#operationDialog .operation-position-row>select:focus{border-color:#1689ad!important;outline:2px solid #7ac7df44!important;outline-offset:1px}
#operationDialog .machining-placement{display:block;position:relative;padding:15px;border:1px solid #c9dce7;border-radius:13px;background:linear-gradient(145deg,#fbfdff,#eef5f9);box-shadow:inset 0 1px 0 #fff,0 2px 8px #153e5006}
#operationDialog .machining-placement .operation-field-heading{padding-right:34px;min-height:26px;margin-bottom:10px}
#operationDialog .machining-placement .remove-picked-placement{position:absolute;top:14px;right:12px;margin:0!important;padding:4px!important;min-height:28px;width:28px;border-radius:7px;background:#f9ebee;color:#a73e4e}
#operationDialog .machining-placement .picked-centre-note{display:block;line-height:1.6;margin-top:8px;font-size:11px;overflow-wrap:anywhere}
@media(min-width:761px) and (max-width:1000px){#operationDialog #operationDialogFields{padding:16px!important}}

/* A miter shows the actual CAD remainder, never an opaque removed-stock silhouette. */
#operationDrawing[data-cut-preview-state=loading] .machining-stage canvas{opacity:.18}
#operationDrawing[data-cut-preview-state=loading] .machining-overlay{visibility:hidden}
#operationDrawing[data-cut-preview-state=loading] .machining-stage::after{content:"";position:absolute;width:32px;height:32px;left:calc(50% - 16px);top:calc(50% - 16px);border:3px solid #c6dce7;border-top-color:#007da6;border-radius:50%;animation:operation-result-spin .8s linear infinite;pointer-events:none}
@keyframes operation-result-spin{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){#operationDrawing[data-cut-preview-state=loading] .machining-stage::after{animation:none}}

#operationDrawing[data-cut-preview-state=error] .machining-stage canvas{opacity:.18}
#operationDrawing[data-cut-preview-state=error] .machining-overlay{visibility:hidden}
/* Keep zoom guidance legible while leaving the drawing interactive. */
.machining-status{left:50%;right:auto;transform:translateX(-50%);width:max-content;max-width:calc(100% - 32px);box-sizing:border-box;padding:8px 14px;background:rgba(248,252,254,.95);border:1px solid #c6dce7;border-radius:9px;box-shadow:0 2px 8px #153f5010;color:#385d70;font-size:12px;line-height:1.45}
.machining-status strong,.machining-status span{display:block}
.machining-status strong{color:#145779;font-size:13px;font-weight:650}
@media(max-width:760px){.machining-status{max-width:calc(100% - 20px);padding:6px 10px;font-size:11px}.machining-status strong{font-size:12px}}
.machining-saved{vector-effect:non-scaling-stroke;stroke-width:2;fill:transparent;pointer-events:none}
.machining-saved.is-context{stroke:#8b9da8;stroke-opacity:.5}
.machining-saved.is-selectable{pointer-events:all;stroke:#0088b9;fill:#0088b91a;cursor:pointer;filter:drop-shadow(0 0 3px #0088b94d)}
.machining-saved.is-selectable:hover,.machining-saved.is-selectable:focus-visible{stroke:#00759e;stroke-width:3;fill:#19acd950;filter:drop-shadow(0 0 6px #008fc699)}
/* Focus scrolls only the input pane; the model stays in the visible keyboard viewport. */
@media(max-width:760px){
 html:has(#operationDialog[open]),html:has(#operationDialog[open]) body{overflow:hidden;overscroll-behavior:none}
 #operationDialog[open]{position:fixed;top:var(--editor-viewport-top,0px);bottom:auto;left:0;margin:0!important;height:var(--editor-viewport-height,100dvh);max-height:var(--editor-viewport-height,100dvh)}
 #operationDialog #operationDialogFields{overflow-anchor:none;scroll-padding:12px}
 #operationDialog #operationDialogFields input,#operationDialog #operationDialogFields select{font-size:16px!important}
 .editor-keyboard-compact #operationDialog .operation-dialog-header{padding:6px 10px}
 .editor-keyboard-compact #operationDialog .operation-dialog-header .eyebrow{display:none}
 .editor-keyboard-compact #operationDialog .operation-dialog-header h2{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 .editor-keyboard-compact #operationDialog .operation-dialog-body{grid-template-rows:minmax(95px,38%) minmax(80px,1fr)!important}
 .editor-keyboard-compact #operationDialog #operationDrawingPanel{padding:4px 8px}
 .editor-keyboard-compact #operationDialog #operationViewButtons{margin:0 0 4px}
 .editor-keyboard-compact #operationDialog #operationViewButtons button{min-height:26px;padding:3px}
 .editor-keyboard-compact .machining-status{padding:3px 8px;bottom:3px}
 .editor-keyboard-compact .machining-status span{display:none}
 .editor-keyboard-compact .machining-status strong{font-size:10px}
 .editor-keyboard-compact #operationDialog .operation-dialog-footer{padding:6px 10px}
 .editor-keyboard-compact #operationDialog .operation-dialog-footer button{padding:8px;min-height:36px}
 #dimensionDialog{max-height:calc(var(--editor-viewport-height,100dvh) - 16px);overflow:auto}
}

/* Wide transparent pick strokes share the contour hover without changing its visible width. */
.machining-saved-shape{vector-effect:non-scaling-stroke;pointer-events:none}
.machining-saved.is-miter{fill:none!important}
.machining-saved-hit{vector-effect:non-scaling-stroke;stroke:transparent!important;stroke-width:22px!important;fill:none!important;pointer-events:none}
.machining-saved.is-selectable .machining-saved-hit{pointer-events:stroke}
.machining-saved.is-selectable:not(.is-miter) .machining-saved-shape{pointer-events:all}
@media(pointer:coarse){.machining-saved-hit{stroke-width:30px!important}}

/* Explicit draft/apply workflow: primary action stays under the left settings. */
#operationApplyActions{position:sticky;bottom:-18px;background:#fff;padding:14px 0 2px;border-top:1px solid #d6e5ed;margin-top:18px;z-index:2}
#operationApplyActions #addOperation{width:100%;background:#007ca8;color:#fff;border:1px solid #007ca8;border-radius:10px;font-weight:700;min-height:46px}
#operationApplyActions #addOperation:disabled{background:#e5edf1;color:#718795;border-color:#cbdce5;box-shadow:none;cursor:default}

#operationApplyActions #removeSelectedOperation{width:100%;margin-top:10px;border:1px solid #e5b9c1;border-radius:9px;background:#fff5f6;color:#a12b40;min-height:42px;font-size:13px;font-weight:600}
.machining-context-menu{position:fixed;z-index:20;width:202px;padding:6px;background:#fff;border:1px solid #bad4e0;border-radius:12px;box-shadow:0 10px 35px #082b3b33;display:grid;gap:4px}
.machining-context-menu button{margin:0;text-align:left;min-height:40px;border:0;border-radius:7px;background:#f0f7fa;color:#164b62;padding:9px 12px;font-weight:600;cursor:pointer}
.machining-context-menu button:last-child{background:#fff5f6;color:#a12b40}.machining-context-menu button:hover{background:#deedf5}

.machining-invalid-placement{pointer-events:none;stroke:#d62f45;stroke-width:2.7;fill:#fff;filter:drop-shadow(0 1px 4px #082b3b33)}
.machining-invalid-placement path{fill:none}

/* Same operation numbers in the field cards and drawing; focus never starts placement. */
.machining-operation-number{pointer-events:none;color:#164b63}
.machining-operation-number path{fill:none;stroke:#7c9cab;stroke-width:.9}
.machining-operation-number circle{fill:#f9fdff;stroke:#568aa1;stroke-width:1.2}
.machining-operation-number text{fill:#164b63;font:700 11px system-ui,sans-serif}
.machining-operation-number.is-field-active circle{fill:#007ca7;stroke:#5be2ff;stroke-width:2}
.machining-operation-number.is-field-active text{fill:#fff}

#operationDialog .machining-placement.is-field-active{border-color:#008db8;box-shadow:0 0 0 2px #1faddb22;background:#eefaff}
#operationDialog .picked-offset-heading{margin-top:15px}
#operationDialog [data-placement-offset]{width:100%;max-width:none;box-sizing:border-box}
.operation-placement-resume{width:100%;margin:12px 0 0;font-size:13px}

.machining-end-distances{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:8px 12px;background:#f5fafd;border-top:1px solid #d6e6ef}
.machining-end-distances[hidden]{display:none}
#operationDrawing .machining-end-distances button{display:grid;gap:3px;min-height:42px;margin:0;padding:7px 10px;border:1px solid #bcd8e5;border-radius:8px;background:#fff;color:#164b63;box-shadow:none;font-size:12px;text-align:left}
.machining-end-distances button span{font-size:10px;color:#547687}.machining-end-distances button strong{font-weight:650}
#operationDrawing .machining-end-distances button:hover{border-color:#008ab6;background:#edfaff}
@media(max-width:760px){.machining-end-distances{padding:4px 7px;gap:5px}#operationDrawing .machining-end-distances button{min-height:34px;padding:4px 7px;font-size:11px}.editor-keyboard-compact .machining-end-distances button span{font-size:9px}}

@media(max-width:760px){
 .editor-keyboard-compact #operationDialog .operation-dialog-body{grid-template-rows:minmax(130px,43%) minmax(80px,1fr)!important}
 .editor-keyboard-compact .machining-end-distances{padding:3px 5px;gap:4px;flex:none}
 .editor-keyboard-compact #operationDrawing .machining-end-distances button{min-height:25px;padding:2px 5px;gap:0;font-size:10px}
 .editor-keyboard-compact .machining-end-distances button span{font-size:8px}
}

#operationDialog .operation-dialog-header>div{min-width:0;flex:1}
#operationDialog .operation-dialog-header h2{min-width:0}

/* Editable cuts retain their manufacturing color; only their light intensifies. */
#operationDrawing .machining-saved.is-selectable{fill:transparent;filter:none}
#operationDrawing .machining-saved.is-selectable.single{stroke:#cc303c;fill:#e3424810}
#operationDrawing .machining-saved.is-selectable.both{stroke:#1677c8;fill:#1683db10}
#operationDrawing .machining-saved.is-selectable:hover,#operationDrawing .machining-saved.is-selectable:focus-visible,
#operationDrawing .machining-saved.is-field-active,#operationDrawing .machining-draft.is-field-active{stroke-width:3;fill-opacity:.45;animation:none;filter:brightness(1.18) drop-shadow(0 0 3px #fff) drop-shadow(0 0 5px #ffffffbb)}
#operationDialog .operation-dialog-footer{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px;padding:11px 18px;background:linear-gradient(135deg,#f8fcfe,#edf5f9)}
#operationDialogError:empty{display:none}
#operationDialog .operation-dialog-footer button{display:inline-flex;align-items:center;justify-content:center;gap:8px;flex:0 0 auto!important;width:auto!important;min-width:0!important;min-height:44px;padding:11px 17px;border-radius:11px;font-size:13px;line-height:1.3;white-space:nowrap;box-shadow:inset 0 1px 0 #ffffff40,0 3px 9px #143f5112}
#operationDialog .operation-dialog-footer button svg{width:16px;height:16px;flex:none;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
#cancelOperationDialog{background:#174c61;color:#fff;border:1px solid #174c61}
#finishMachining{background:#007ba4;color:#fff;border:1px solid #007ba4}
#operationDialog .operation-dialog-footer button:not(:disabled):hover{filter:brightness(1.09);box-shadow:0 4px 12px #007ba42b}
@media(max-width:760px){#operationDialog .operation-dialog-footer{justify-content:center;gap:7px;padding:8px 10px}#operationDialog .operation-dialog-footer button{font-size:12px;padding:10px 11px;gap:6px;min-height:40px}#operationDialog .operation-dialog-footer button svg{width:14px;height:14px}}

.machining-key .single.full-section:before{background:#1683db}

/* Keep explanations separate from their label, including wrapped mobile labels. */
:is(.material-spec-field>span,.editor-controls label>span,.ready-line-fields label>span):has(>.operation-help-button){display:flex!important;align-items:center;justify-content:flex-start;gap:10px!important;min-width:0;line-height:1.5}
#fields .operation-field-heading,.machining-placement .operation-field-heading{column-gap:10px}
.operation-help-button{flex:0 0 24px!important}

.machining-resize-edge{pointer-events:all;cursor:grab;touch-action:none;fill:#f5fcff;stroke:#90b6c8;stroke-width:1.5}
.machining-resize-hit{stroke:transparent;stroke-width:16;fill:none;pointer-events:stroke}
.machining-resize-line{stroke:transparent;stroke-width:3;fill:none;pointer-events:none}
.machining-resize-edge:hover,.machining-resize-edge:active{stroke:#fff;filter:drop-shadow(0 0 4px #fff)}
.machining-resize-edge:hover .machining-resize-line{stroke:#fff}.machining-resize-edge:active{cursor:grabbing}

/* Fill participates in picking, so the complete hole interior is clickable. */
#operationDrawing .machining-saved.is-selectable:not(.is-miter) .machining-saved-hit{fill:transparent!important;pointer-events:all}
#operationDrawing .machining-saved.is-selectable:hover .machining-saved-shape{fill:#ffffff70;stroke-width:3;filter:drop-shadow(0 0 4px #fff)}

#operationDrawing .machining-saved.is-field-active{cursor:grab}#operationDrawing .machining-saved.is-field-active:active{cursor:grabbing}

#operationDrawing .machining-overlay{touch-action:none}

.corner-wall-fields{padding:14px;border:1px solid #bedce9;border-radius:12px;background:#edf7fc;color:#16465b}.corner-wall-fields>strong{display:block;margin-bottom:12px}.corner-wall-fields output{display:block;font-weight:700;margin:10px 0}.corner-wall-fields small{display:block;font-size:12px;line-height:1.6;color:#42677b}.corner-wall-fields .pair{gap:12px}.corner-wall-fields input{min-width:0;width:100%;box-sizing:border-box}.machining-status[data-invalid=true]{color:#a3293e;background:#fff0f3}

@media(max-width:800px){#operationDialog #operationDrawingPanel .machining-intro[data-placeable=true]{display:block;font-size:12px;line-height:1.4;padding:6px 9px}}

#operationDrawing .machining-saved.is-selectable.is-hovered .machining-saved-shape{fill:#ffffff70;stroke-width:3;filter:drop-shadow(0 0 4px #fff)}
