/* Active tools, canvas and principal actions share one viewport. */
body.workspace-shell {
  height: 100dvh;
  min-height: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.workspace-shell .app-header { height: 50px; min-height: 50px; flex: 0 0 50px; padding: 0 16px; gap: 18px; }
.workspace-shell .identity img { width: 26px; height: 26px; }
.workspace-shell .brand { font-size: 18px; }
.workspace-shell .brand > span { font-size: 6px; }
.workspace-shell .product-heading h1 { font-size: 13px; }
.workspace-shell .product-heading .build-tag { display: none; }
.workspace-shell .module-nav { min-height: 42px; height: 42px; flex: 0 0 42px; padding: 0 16px; }
.workspace-shell .module-tabs > button { min-height: 42px; padding: 7px 17px; font-size: 12px; }
.workspace-shell .module-tabs .icon { width: 17px; height: 17px; }
.workspace-shell .module-note { font-size: 9px; }
.workspace-shell #cutpathPanel,
.workspace-shell #cadPanel,
.workspace-shell #optimizerPanel { flex: 1 1 0; min-height: 0; width: 100%; max-width: none; margin: 0; overflow: hidden; }
.workspace-shell #cutpathPanel { display: flex; flex-direction: column; }
.workspace-shell .session-strip { height: 27px; min-height: 27px; flex: 0 0 27px; padding-inline: 16px; font-size: 10px; }
.workspace-shell #cutpathPanel .studio-layout { flex: 1 1 0; height: auto; min-height: 0; display: grid; grid-template-columns: 306px minmax(0,1fr); gap: 12px; padding: 12px 16px; }
.workspace-shell #cutpathPanel .controls { height: 100%; min-height: 0; max-height: none; overflow: hidden; align-self: stretch; }
.workspace-shell #cutpathPanel .controls-heading { padding: 12px 14px; flex: 0 0 auto; }
.workspace-shell #cutpathPanel .controls-heading h2 { margin: 0; font-size: 15px; letter-spacing: 0; }
.workspace-shell .work-toolbox { display: flex; flex-direction: column; align-items: stretch; min-width: 0; min-height: 0; overflow: hidden; }
.work-panel-tabs { display: flex; flex: 0 0 auto; min-height: 38px; padding: 0 6px; gap: 2px; background: #191e22; border-top: 1px solid #394249; border-bottom: 1px solid #47515a; }
.work-panel-tab { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex: 1 1 0; min-width: 0; min-height: 38px; padding: 8px 4px; color: #bac5cd; background: transparent; border: 0; border-radius: 0; font-size: 11px; font-weight: 550; box-shadow: none; white-space: nowrap; }
.work-panel-tab:enabled:hover { color: #fff; background: #252d33; }
.work-panel-tab[aria-selected=true] { color: #fff; background: #262e34; box-shadow: inset 0 -2px #d95c65; }
.work-step-number { font-size: 10px; font-weight: 500; font-variant-numeric: tabular-nums; opacity: .75; }
.work-panel-tab[aria-selected=true] .work-step-number { color: #ef9ca4; opacity: 1; }
.work-panel-body { flex: 1 1 0; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #626e78 #181d21; }
.work-tool-panel { min-width: 0; min-height: 0; outline-offset: -3px; }
.work-tool-panel[hidden] { display: none !important; }
.work-step-actions { display: flex; flex: 0 0 auto; gap: 8px; padding: 4px 10px; border-top: 1px solid #394249; background: #1c2328; }
.workspace-shell .work-step-actions > button { flex: 1 1 0; width: auto; min-width: 0; min-height: 30px; margin: 0; padding: 5px 8px; border: 1px solid #45515a; border-radius: 4px; font-size: 10px; font-weight: 500; line-height: 1.4; }
.workspace-shell .work-step-actions > button[hidden] { display: none !important; }
.workspace-shell .work-step-actions .work-step-back { text-align: left; }
.workspace-shell .work-step-actions .work-step-next { text-align: right; }
.workspace-shell .work-tool-panel > :first-child { border-top: 0; }
.workspace-shell #cutpathPanel .control-section { padding: 12px 14px; min-width: 0; }
.workspace-shell #cutpathPanel .section-heading { min-height: 22px; margin-bottom: 8px; }
.workspace-shell #cutpathPanel label { margin-top: 8px; font-size: 11px; }
.workspace-shell #cutpathPanel input:not([type=checkbox],[type=range],[type=file]),
.workspace-shell #cutpathPanel select { height: 35px; min-height: 35px; font-size: 12px; padding: 7px 9px; }
.workspace-shell #cutpathPanel .upload { min-height: 58px; padding: 11px; }
.workspace-shell #cutpathPanel .source-info,
.workspace-shell #cutpathPanel .simple-note { font-size: 10.5px; line-height: 1.55; }
.work-edit-tools { padding: 0 14px 14px; }
.workspace-shell #cutpathPanel #advancedTools { margin: 0 0 10px; }
.workspace-shell #cutpathPanel #geometryInspector { margin: 0; padding: 10px; }
.workspace-shell #geometryInspector .inspector-heading { flex-wrap: wrap; gap: 8px; }
.workspace-shell #geometryInspector .inspector-heading > div { flex-wrap: wrap; }
.workspace-shell #geometryInspector .inspector-heading h3 { display: block; }
.workspace-shell #geometryInspector .selection-controls,
.workspace-shell #geometryInspector .editbar,
.workspace-shell #geometryInspector .correction-controls { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.workspace-shell #geometryInspector .edithelp { margin: 8px 0 0; max-width: 100%; }
.workspace-shell #geometryInspector #apply,
.workspace-shell #geometryInspector #pin { grid-column: auto; grid-row: auto; }
.work-action-dock { flex: 0 0 auto; min-width: 0; background: #22292f; border-top: 1px solid #4a565f; padding: 10px 12px; }
.workspace-shell #cutpathPanel .generate-dock { position: static; margin: 0 0 7px; padding: 0; background: transparent; }
.workspace-shell #cutpathPanel #generate { min-height: 37px; font-size: 12px; padding: 9px 10px; }
.workspace-shell #cutpathPanel #cancel { min-height: 33px; }
.workspace-shell #cutpathPanel .export-pair { gap: 7px; }
.workspace-shell #cutpathPanel .export-pair button { min-width: 0; min-height: 36px; padding: 8px 10px; font-size: 12px; }
.workspace-shell #cutpathPanel .export-pair button span strong { font-size: inherit; }
.workspace-shell #cutpathPanel .export-pair .icon:last-child { display: none; }
.workspace-shell #cutpathPanel .workspace { height: 100%; min-height: 0; align-self: stretch; gap: 8px; overflow: hidden; }
.workspace-shell #cutpathPanel .workspace-toolbar { min-height: 33px; flex: 0 0 auto; }
.workspace-shell .workspace-heading h2 { font-size: 13px; }
.workspace-shell .workspace-heading p { font-size: 10px; }
.workspace-shell #cutpathPanel .canvas-wrap,
.workspace-shell:not(.has-image) #cutpathPanel #drop,
.workspace-shell.cutpath-advanced #cutpathPanel .canvas-wrap { flex: 1 1 0; height: auto; min-height: 0; max-height: none; }
.workspace-shell #cutpathPanel .workspace-bottom { flex: 0 0 auto; gap: 7px; max-height: 25%; overflow: auto; }
.workspace-shell .status-panel { padding: 7px 10px; min-height: 30px; }
.workspace-shell #status { font-size: 10.5px; }
.workspace-shell #empty { padding: 25px; background-image: none; }
.workspace-shell #cutpathPanel #empty .workspace-art,
.workspace-shell .cad-study { display: none; }
.workspace-shell #empty .workspace-start,
.workspace-shell #cutpathPanel #empty .workspace-start { width: min(100%,430px); max-width: 430px; height: auto; padding: 0; display: block; }
.workspace-shell #empty .workspace-start h3,
.workspace-shell .cad-empty h3 { font-size: 22px; font-weight: 550; letter-spacing: -.025em; }
.workspace-shell #empty .workspace-start-copy > p { font-size: 12px; }
.workspace-shell #empty .empty-footnote { font-size: 9px; }
.workspace-shell #empty .empty-actions > button { min-height: 38px; }

/* CAD: the drawing consumes the stage; inspectors live in the tool panel. */
.workspace-shell #cadPanel { display: flex; flex-direction: column; padding: 10px 16px 12px; }
.workspace-shell .cad-heading { flex: 0 0 auto; min-height: 43px; gap: 12px; margin: 0 0 8px; }
.workspace-shell .cad-heading .eyebrow,
.workspace-shell .opt-heading .eyebrow { display: none; }
.workspace-shell .cad-heading h2,
.workspace-shell .opt-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.workspace-shell .cad-heading p,
.workspace-shell .opt-heading p { font-size: 10.5px; line-height: 1.5; margin: 3px 0 0; }
.workspace-shell .cad-file-actions button,
.workspace-shell .opt-actions button { min-height: 33px; padding: 8px 10px; font-size: 10px; }
.workspace-shell .cad-source-bar { flex: 0 0 auto; min-height: 28px; padding: 5px 9px; font-size: 10px; }
.workspace-shell .cad-source-bar .cad-privacy { display: none; }
.workspace-shell .cad-layout { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 12px; padding-top: 9px; align-items: stretch; }
.workspace-shell .cad-stage { min-height: 0; height: 100%; overflow: hidden; gap: 7px; }
.workspace-shell .cad-toolbar { min-height: 34px; flex: 0 0 auto; gap: 8px; }
.workspace-shell .cad-toolbar h3 { font-size: 12px; }
.workspace-shell .cad-view-actions { gap: 4px; }
.workspace-shell .cad-view-actions button { min-height: 31px; padding: 6px 8px; font-size: 10px; }
.workspace-shell .cad-view-actions .icon-button { width: 31px; }
.workspace-shell .cad-pdf-controls { flex: 0 0 auto; padding: 5px 8px; gap: 6px 12px; }
.workspace-shell .cad-pdf-controls select { min-height: 29px; height: 29px; width: 112px; padding: 5px 8px; font-size: 10px; }
.workspace-shell .cad-canvas,
.workspace-shell .cad-panel[data-loaded=true] .cad-canvas { flex: 1 1 0; height: auto; min-height: 0; }
.workspace-shell .cad-empty { padding: 24px; }
.workspace-shell .cad-empty .workspace-start { max-width: 380px; }
.workspace-shell .cad-empty p { font-size: 12px; }
.workspace-shell .cad-empty-actions button { min-height: 37px; }
.workspace-shell .cad-empty-note { font-size: 9px; }
.workspace-shell .cad-canvas-help { flex: 0 0 auto; min-height: 25px; font-size: 9px; }
.workspace-shell #cadOriginal { min-height: 25px; padding: 4px 7px; font-size: 9px; }
.workspace-shell .cad-status { flex: 0 0 auto; padding: 7px 10px; min-height: 31px; max-height: 64px; overflow: auto; }
.workspace-shell #cadStatus { font-size: 10.5px; line-height: 1.45; }
.workspace-shell .cad-sidebar { max-height: none; height: 100%; min-height: 0; position: static; padding: 0; }
.workspace-shell .cad-side-section,
.workspace-shell .cad-inspector { padding: 12px 14px; min-width: 0; border-radius: 0; }
.workspace-shell .cad-inspector { border-right: 0; border-left: 0; background: transparent; }
.workspace-shell .cad-layer-list { max-height: none; overflow: visible; }
.workspace-shell .cad-layer-row { grid-template-columns: 17px 9px minmax(0,1fr) auto; }
.workspace-shell .cad-small-note { font-size: 10px; line-height: 1.55; }
.workspace-shell .cad-side-section label,
.workspace-shell .cad-inspector label { font-size: 10.5px; }
.workspace-shell .cad-side-section input:not([type=checkbox]),
.workspace-shell .cad-side-section select,
.workspace-shell .cad-inspector input:not([type=checkbox]),
.workspace-shell .cad-inspector select { min-height: 35px; height: 35px; font-size: 12px; padding: 7px 9px; width: 100%; }
.workspace-shell .cad-pair { gap: 9px; }
.workspace-shell .cad-pair button { min-height: 35px; font-size: 10px; padding: 8px; }
.workspace-shell .cad-select-row,
.workspace-shell .cad-edit-row { display: grid; grid-template-columns: minmax(0,1fr); }
.workspace-shell .cad-inclusion-row { align-items: stretch; flex-direction: column; }
.workspace-shell .cad-inclusion-row button { min-height: 34px; font-size: 10px; }
.workspace-shell .cad-section-head { gap: 8px; }
.workspace-shell .cad-section-head h3 { font-size: 12px; }
.workspace-shell .cad-section-head .eyebrow { font-size: 8px; }
.workspace-shell .cad-export-summary { font-size: 10px; }
.workspace-shell .cad-outline-card { min-width: 0; overflow-wrap: anywhere; }
.workspace-shell #cadOutlineTools > button { width: 100%; margin-top: 7px; min-height: 35px; font-size: 10.5px; }
.workspace-shell .work-outline-placeholder { padding: 13px 14px; }
.workspace-shell .work-cut-setup .work-outline-placeholder { padding: 0; margin: 8px 0 0; }
.workspace-shell .cad-action-dock { padding: 7px 12px 10px; }
.work-review-shortcut { width: 100%; min-height: 26px; margin: 0 0 6px; padding: 4px 6px; font-size: 10px; }
.workspace-shell .cad-action-dock .cad-export-buttons { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 0; }
.workspace-shell .cad-export-button { min-height: 41px; height: auto; padding: 8px 10px; }
.workspace-shell .cad-export-button strong { font-size: 12px; }
.workspace-shell .cad-export-button small { font-size: 9px; line-height: 1.3; }
.workspace-shell .cad-side-details { padding: 0 14px; }
.workspace-shell .cad-side-details > summary { min-height: 38px; font-size: 10.5px; }
.workspace-shell .cad-side-details .cad-detail-body { padding-inline: 0; max-height: none; overflow: visible; }

/* Optimizer: the comparison resizes; review details have their own tab. */
.workspace-shell #optimizerPanel { display: flex; flex-direction: column; padding: 10px 16px 12px; }
.workspace-shell .opt-heading { flex: 0 0 auto; margin: 0 0 7px; gap: 12px; min-height: 43px; }
.workspace-shell #optSourceInfo { flex: 0 0 auto; margin: 0; font-size: 10px; line-height: 1.5; }
.workspace-shell .opt-layout { flex: 1 1 0; min-height: 0; margin-top: 9px; grid-template-columns: 306px minmax(0,1fr); gap: 12px; align-items: stretch; }
.workspace-shell .opt-controls { max-height: none; min-height: 0; height: 100%; padding: 0; }
.workspace-shell .opt-controls > h3 { flex: 0 0 auto; margin: 0; padding: 12px 14px; font-size: 14px; }
.workspace-shell .opt-controls .work-tool-panel { padding: 0 14px 12px; }
.workspace-shell .opt-controls label { margin: 11px 0; font-size: 11px; }
.workspace-shell .opt-controls .check { min-height: 26px; margin: 7px 0; line-height: 1.5; }
.workspace-shell .opt-controls input:not([type=checkbox]),
.workspace-shell .opt-controls select { min-height: 35px; height: 35px; font-size: 12px; padding: 7px 9px; }
.workspace-shell .opt-controls .work-panel-tab { width: auto; margin: 0; }
.workspace-shell .opt-controls details { padding: 0; border: 0; margin: 12px 0 0; }
.workspace-shell .opt-controls details > summary { font-size: 11px; }
.workspace-shell .opt-controls details[open] > summary { padding-bottom: 8px; }
.workspace-shell .opt-note { font-size: 10px; }
.workspace-shell .opt-controls .opt-result { font-size: 11px; line-height: 1.55; padding: 10px; margin-top: 12px; }
.workspace-shell .opt-controls #optChanges { font-size: 10px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: none; }
.workspace-shell .opt-action-dock button { min-height: 37px; margin: 0; font-size: 11px; }
.workspace-shell .opt-action-dock #optCancel:not(:disabled) { margin-top: 6px; }
.workspace-shell .opt-action-dock #optCancel:disabled { display: none; }
.workspace-shell .opt-stage { display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 0; overflow: hidden; position: static; }
.workspace-shell #optPageLabel { flex: 0 0 auto; margin: 0; font-size: 10px; }
.workspace-shell #optPage { min-height: 29px; padding: 4px 8px; }
.workspace-shell .opt-compare { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.workspace-shell .opt-compare > div { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.workspace-shell .opt-compare h3 { flex: 0 0 auto; padding: 9px 12px; font-size: 11px; }
.workspace-shell .opt-frame { flex: 1 1 0; height: auto; min-height: 0; }
.workspace-shell .opt-frame:empty { background-image: none; }
.workspace-shell .opt-frame:empty::before { padding: 20px; background: none; font-size: 11px; color: #536270; }
.workspace-shell .opt-status { flex: 0 0 auto; margin: 0; padding: 7px 10px; min-height: 30px; max-height: 60px; overflow: auto; font-size: 10.5px; }
.work-export-bar { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 15px; padding: 9px 12px; border: 1px solid #495762; border-radius: 5px; background: #20282f; }
.workspace-shell .work-export-bar > .check { min-height: 32px; margin: 0; font-size: 10.5px; }
.workspace-shell .work-export-bar .opt-export-buttons { display: flex; gap: 8px; margin: 0; flex: 0 0 auto; }
.workspace-shell .work-export-bar .opt-export-buttons button { width: auto; min-height: 36px; margin: 0; padding: 8px 12px; font-size: 10.5px; }

/* Troubleshooting expands as a bounded drawer, leaving the active module intact. */
.workspace-shell .processing-log { flex: 0 0 auto; margin: 0; border: 0; border-top: 1px solid #3d474f; border-radius: 0; padding: 6px 16px; max-height: min(42dvh,330px); overflow: auto; }
.workspace-shell .processing-log > summary { font-size: 10px; line-height: 1.6; }
.workspace-shell .processing-log[open] { flex-basis: min(42dvh,330px); }
.workspace-shell .processing-log label { margin-top: 7px; font-size: 10px; }
.workspace-shell .processing-log textarea { max-height: 120px; resize: vertical; }
.workspace-shell.focus-mode #cutpathPanel .controls { display: none; }
.workspace-shell.focus-mode #cutpathPanel .studio-layout { grid-template-columns: minmax(0,1fr); }
.workspace-shell.focus-mode #cutpathPanel .workspace { padding: 0; }

@media (min-width:1600px) {
  .workspace-shell #cutpathPanel .studio-layout,
  .workspace-shell .opt-layout { grid-template-columns: 330px minmax(0,1fr); }
  .workspace-shell .cad-layout { grid-template-columns: minmax(0,1fr) 356px; }
}
@media (min-width:960px) and (max-width:1250px) {
  .workspace-shell .product-heading { display: none; }
  .workspace-shell #cutpathPanel .studio-layout,
  .workspace-shell .opt-layout { grid-template-columns: 282px minmax(0,1fr); }
  .workspace-shell .cad-layout { grid-template-columns: minmax(0,1fr) 304px; }
  .workspace-shell .cad-view-actions #cadPrevious { width: 31px; padding: 6px; font-size: 0; }
  .workspace-shell .work-export-bar { flex-wrap: wrap; gap: 5px; }
}
@media (max-width:959px) {
  .workspace-shell .product-heading,
  .workspace-shell .module-note { display: none; }
  .workspace-shell .header-actions button > span,
  .workspace-shell .asset-catalog-link > span { display: none; }
  .workspace-shell .app-header { padding-inline: 12px; }
  .workspace-shell .module-nav { padding-inline: 8px; }
  .workspace-shell .module-tabs { width: 100%; justify-content: stretch; gap: 2px; }
  .workspace-shell .module-tabs > button { flex: 1 1 0; justify-content: center; min-width: 0; padding: 6px 5px; font-size: 10.5px; flex-direction: row; white-space: normal; }
  .workspace-shell .session-strip { padding-inline: 10px; }
  .workspace-shell #cutpathPanel .studio-layout { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(336px,1fr) minmax(320px,.78fr); gap: 8px; padding: 8px 10px; overflow: auto; }
  .workspace-shell.cutpath-advanced #cutpathPanel .studio-layout { grid-template-rows: minmax(384px,1fr) minmax(320px,.6fr); }
  .workspace-shell #cutpathPanel #drop.canvas-wrap { min-height: 252px; }
  .workspace-shell #cutpathPanel .workspace { order: 0; padding: 0; }
  .workspace-shell #cutpathPanel .controls { order: 1; width: 100%; max-height: none !important; overflow: hidden !important; }
  .workspace-shell #cutpathPanel .controls-heading { display: none; }
  .workspace-shell #cutpathPanel .work-action-dock { padding: 7px 10px; display: flex; align-items: flex-start; gap: 8px; }
  .workspace-shell #cutpathPanel .generate-dock { flex: 1 1 0; margin: 0; min-width: 0; }
  .workspace-shell #cutpathPanel .export-pair { flex: 1 1 0; min-width: 0; }
  .workspace-shell #cutpathPanel .export-pair button { min-height: 37px; }
  .workspace-shell #cutpathPanel .work-tool-panel .control-section { display: block !important; padding: 10px 12px; border-right: 0; }
  .workspace-shell #cutpathPanel .work-tool-panel .simple-offset-row { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .workspace-shell #cutpathPanel .work-tool-panel .expert-only { display: none !important; }
  .workspace-shell.cutpath-advanced #cutpathPanel .work-tool-panel .expert-only { display: revert !important; }
  .workspace-shell .workspace-toolbar { min-height: 30px; flex-wrap: nowrap; }
  .workspace-shell .workspace-heading h2 { font-size: 12px; }
  .workspace-shell .workspace-heading p { max-width: 48vw; font-size: 9px; }
  .workspace-shell #empty { padding: 16px; }
  .workspace-shell #empty .workspace-start h3 { font-size: 19px; }
  .workspace-shell #empty .workspace-start-copy > p { margin: 7px 0 12px; font-size: 11px; }
  .workspace-shell #empty .empty-footnote { display: none; }
  .workspace-shell #empty .empty-actions > button { min-height: 34px; font-size: 10px; }
  .workspace-shell #cutpathPanel .workspace-bottom { max-height: 34%; }
  .workspace-shell #cadPanel,
  .workspace-shell #optimizerPanel { padding: 8px 10px; }
  .workspace-shell .cad-heading,
  .workspace-shell .opt-heading { align-items: center; flex-direction: row; min-height: 34px; gap: 8px; margin-bottom: 7px; }
  .workspace-shell .cad-heading h2,
  .workspace-shell .opt-heading h2 { font-size: 16px; }
  .workspace-shell .cad-heading p,
  .workspace-shell .opt-heading p { display: none; }
  .workspace-shell .cad-file-actions,
  .workspace-shell .opt-actions { display: flex; width: auto; flex-wrap: wrap; gap: 5px; }
  .workspace-shell .cad-file-actions #cadOpen { grid-column: auto; width: auto; }
  .workspace-shell .cad-file-actions button,
  .workspace-shell .opt-actions button { min-height: 31px; padding: 7px 8px; font-size: 9px; }
  .workspace-shell .cad-layout { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(408px,1fr) minmax(320px,.62fr); gap: 8px; padding-top: 8px; overflow: auto; }
  .workspace-shell .cad-layout:has(#cadPdfControls:not([hidden])) { grid-template-rows: minmax(446px,1fr) minmax(320px,.5fr); }
  .workspace-shell #cadPanel #cadDrop { min-height: 302px; }
  .workspace-shell .cad-pdf-controls #cadPdfPageNote { display: none; }
  .workspace-shell .cad-pdf-controls select { width: 90px; }
  .workspace-shell .cad-stage { min-height: 0; gap: 5px; }
  .workspace-shell .cad-toolbar > div:first-child { display: none; }
  .workspace-shell .cad-toolbar { min-height: 31px; }
  .workspace-shell .cad-view-actions { flex: 1; flex-wrap: nowrap; min-width: 0; justify-content: flex-end; }
  .workspace-shell .cad-view-actions #cadPrevious { margin-right: auto; max-width: 34%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .workspace-shell .cad-view-actions button { font-size: 9px; padding: 5px 6px; }
  .workspace-shell .cad-canvas-help { justify-content: flex-end; min-height: 25px; }
  .workspace-shell .cad-canvas-help > span { display: none; }
  .workspace-shell .cad-canvas-help > button { max-width: 100%; }
  .workspace-shell .cad-empty { padding: 24px 15px 14px; }
  .workspace-shell .cad-empty h3 { font-size: 18px; }
  .workspace-shell .cad-empty p { display: none; }
  .workspace-shell .cad-empty-actions { margin-top: 12px; }
  .workspace-shell .cad-empty-actions button { min-height: 32px; font-size: 10px; }
  .workspace-shell .cad-empty-note { display: none; }
  .workspace-shell .cad-canvas-top { top: 8px; left: 10px; font-size: 8px; }
  .workspace-shell .cad-view-bottom { bottom: 7px; left: 10px; right: 7px; }
  .workspace-shell .cad-zoom .icon-button { min-height: 25px; width: 25px; }
  .workspace-shell .cad-action-dock { display: flex; align-items: center; gap: 8px; padding: 7px 10px; }
  .workspace-shell .work-review-shortcut { width: auto; margin: 0; min-height: 36px; flex: 1 1 0; font-size: 9px; }
  .workspace-shell .cad-action-dock .cad-export-buttons { flex: 2 1 0; }
  .workspace-shell .cad-export-button { min-height: 36px; padding: 7px 10px; }
  .workspace-shell .cad-export-button small { display: none; }
  .workspace-shell .opt-layout { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(190px,1fr) minmax(320px,.85fr); gap: 8px; margin-top: 7px; overflow: auto; }
  .workspace-shell .opt-stage { grid-row: 1; gap: 6px; }
  .workspace-shell .opt-controls { grid-row: 2; }
  .workspace-shell .opt-controls > h3 { display: none; }
  .workspace-shell .opt-compare { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
  .workspace-shell .opt-compare h3 { padding: 7px 9px; font-size: 10px; }
  .workspace-shell .opt-frame:empty::before { padding: 15px; font-size: 10px; }
  .workspace-shell .opt-controls .work-tool-panel { padding-inline: 12px; }
  .workspace-shell .opt-action-dock { padding: 7px 10px; display: flex; gap: 8px; }
  .workspace-shell .opt-action-dock button { min-height: 35px; }
  .workspace-shell .opt-action-dock #optCancel:not(:disabled) { margin: 0; }
  .workspace-shell .work-export-bar { flex-wrap: wrap; padding: 7px 9px; gap: 5px; }
  .workspace-shell .work-export-bar > .check { min-height: 23px; width: 100%; font-size: 9.5px; }
  .workspace-shell .work-export-bar .opt-export-buttons { width: 100%; }
  .workspace-shell .work-export-bar .opt-export-buttons button { flex: 1; min-height: 31px; padding: 7px 8px; font-size: 9.5px; }
  .workspace-shell .processing-log { padding: 5px 10px; }
  .workspace-shell.focus-mode #cutpathPanel .studio-layout { grid-template-rows: minmax(0,1fr); }
}
@media (max-width:500px) {
  .workspace-shell .app-header { height: 45px; min-height: 45px; flex-basis: 45px; }
  .workspace-shell .brand { font-size: 16px; }
  .workspace-shell .identity img { width: 24px; height: 24px; }
  .workspace-shell .header-actions button,
  .workspace-shell .header-actions .asset-catalog-link { width: 29px; min-height: 30px; padding: 6px; }
  .workspace-shell .header-divider { display: none; }
  .workspace-shell .module-tabs > button { font-size: 10px; gap: 4px; }
  .workspace-shell .module-tabs .icon { width: 14px; height: 14px; }
  .workspace-shell .privacy-note > span { display: none; }
  .workspace-shell .cad-heading,
  .workspace-shell .opt-heading { flex-wrap: wrap; }
  .workspace-shell .cad-file-actions,
  .workspace-shell .opt-actions { width: 100%; }
  .workspace-shell .cad-file-actions button,
  .workspace-shell .opt-actions button { flex: 1; }
  .workspace-shell .cad-source-bar #cadSourceSummary { display: none; }
  .workspace-shell .cad-source-bar strong { max-width: 75vw; }
  .workspace-shell .cad-view-actions #cadPrevious { display: inline-flex; width: 31px; min-width: 31px; max-width: 31px; padding: 5px; margin: 0; }
  .workspace-shell .cad-view-actions #cadPrevious > span { display: none; }
  .workspace-shell .cad-view-actions { justify-content: flex-start; flex-wrap: wrap; }
  .workspace-shell .cad-side-section input:not([type=checkbox]),
  .workspace-shell .cad-side-section select,
  .workspace-shell .cad-inspector input:not([type=checkbox]),
  .workspace-shell .cad-inspector select,
  .workspace-shell .opt-controls input:not([type=checkbox]),
  .workspace-shell .opt-controls select,
  .workspace-shell #cutpathPanel input:not([type=checkbox],[type=range],[type=file]),
  .workspace-shell #cutpathPanel select { font-size: 16px; min-height: 37px; height: 37px; }
  .workspace-shell #cutpathPanel #generate { font-size: 10px; }
  .workspace-shell #cutpathPanel .export-pair button { padding-inline: 6px; font-size: 10.5px; }
  .workspace-shell .cut-action-dock .generate-icon { display: none; }
}
@media (max-height:620px) and (max-width:959px) {
  /* Short landscape screens and an open software keyboard may scroll the page. */
  body.workspace-shell { overflow: auto; height: auto; min-height: 100dvh; }
  .workspace-shell #cutpathPanel,
  .workspace-shell #cadPanel,
  .workspace-shell #optimizerPanel { min-height: 550px; flex: 0 0 550px; }
  .workspace-shell #cutpathPanel { min-height: 650px; flex-basis: 650px; }
  .workspace-shell #cadPanel { min-height: 790px; flex-basis: 790px; }
}
@media (max-width:500px) and (max-height:800px) {
  /* Preserve a useful drawing area on short phones without stranding controls. */
  body.workspace-shell[data-module=cad] { height: auto; min-height: 100dvh; overflow: auto; }
  .workspace-shell[data-module=cad] #cadPanel { height: 790px; min-height: 790px; flex: 0 0 790px; }
}
@media (max-width:500px) and (max-height:720px) {
  body.workspace-shell[data-module=cutpath] { height: auto; min-height: 100dvh; overflow: auto; }
  .workspace-shell[data-module=cutpath] #cutpathPanel { min-height: 650px; flex: 0 0 650px; }
}
@media (max-width:360px) {
  .workspace-shell .cad-layout { grid-template-rows: minmax(448px,1fr) minmax(320px,.62fr); }
  .workspace-shell .cad-layout:has(#cadPdfControls:not([hidden])) { grid-template-rows: minmax(486px,1fr) minmax(320px,.5fr); }
}

.workspace-shell #marklockPanel{flex:1 1 0;min-height:0;width:100%;max-width:none;margin:0;overflow:hidden}

/* One instruction per stage; keep the drawing and primary actions in view. */
.workspace-shell .work-step-brief {
  margin: 0;
  padding: 10px 14px;
  border-bottom: 1px solid #354958;
  border-left: 3px solid #6bbacb;
  background: linear-gradient(110deg, #172b36, #1c252d);
  color: #d6e9f1;
  font-size: 11px;
  line-height: 1.55;
  text-wrap: pretty;
}
.workspace-shell .work-output-summary {
  margin: 9px 0 0;
  padding: 9px 10px;
  border: 1px solid #405564;
  border-radius: 5px;
  color: #d6e9f1;
  background: #17232c;
  font-size: 10.5px;
  line-height: 1.55;
}
.workspace-shell #marklockPanel .work-action-dock {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 7px;
}
.workspace-shell #marklockPanel .work-action-dock > button {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  margin: 0;
  padding: 8px;
  white-space: normal;
  line-height: 1.4;
}
.workspace-shell #marklockPanel .work-continue-action {
  grid-column: 1 / -1;
  border-color: #527c8b;
  background: #203b49;
}
.workspace-shell #marklockPanel .work-transfer-note {
  grid-column: 1 / -1;
  margin: 0;
  color: #bdcdd8;
  font-size: 10px;
  line-height: 1.45;
}
.workspace-shell .work-panel-tab:focus-visible,
.workspace-shell .work-step-actions > button:focus-visible {
  outline: 2px solid #98e3f2;
  outline-offset: -3px;
}
@media (max-width:959px) {
  .workspace-shell .work-step-brief { padding: 8px 12px; font-size: 10.5px; }
  .workspace-shell #marklockPanel .work-transfer-note { font-size: 9.5px; }
}
@media (max-width:850px) and (min-height:680px) {
  .workspace-shell #marklockPanel .ml-grid {
    grid-template-rows: minmax(240px,.40fr) minmax(350px,.60fr) !important;
  }
}
@media (max-width:850px) and (max-height:800px) {
  body.workspace-shell[data-module=marklock] { height: auto; min-height: 100dvh; overflow: auto; }
  .workspace-shell[data-module=marklock] #marklockPanel { min-height: 780px; flex: 0 0 780px; }
}
