/* Selection-driven CAD workspace. The canvas is the default screen; sheets are tasks. */
body.selection-workspace {
 --workspace-header:56px;
 --workspace-nav:60px;
 --workspace-context:90px;
 --workspace-safe:env(safe-area-inset-bottom,0px);
 --mobile-toolbar-height:calc(var(--workspace-nav) + var(--workspace-safe));
 --green:#2563eb;
 padding:0;overflow:hidden;background:#e9eef5;
}
body.selection-workspace #app {height:100dvh;display:flex;flex-direction:column;overflow:hidden}
body.selection-workspace .app-header {
 height:calc(var(--workspace-header) + env(safe-area-inset-top,0px));
 min-height:calc(var(--workspace-header) + env(safe-area-inset-top,0px));
 flex:0 0 auto;gap:10px;padding:env(safe-area-inset-top,0px) 12px 0;
 background:#fff;border-bottom:1px solid #dbe2ed;box-shadow:none;color:#15243a;
}
body.selection-workspace .app-header .brand {display:none}
body.selection-workspace #workspace-back {
 display:block;min-height:44px;min-width:44px;max-width:103px;padding:8px 11px;
 background:#f3f6fb;color:#334961;border:1px solid #dce4ef;border-radius:10px;
 font-size:12px;white-space:nowrap;box-shadow:none;flex-shrink:0;
}
body.selection-workspace .project-status {flex:1;min-width:0;max-width:none;margin:0;text-align:left}
.project-status #project-title {display:block;line-height:1.4;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body.selection-workspace #project-title {color:#1b2d46;font-size:13px}
body.selection-workspace .project-status small {color:#6c7e95;font-size:9px;line-height:1.2;margin:0}
body.selection-workspace .header-actions {gap:6px;flex-shrink:0;display:flex;align-items:center}
body.selection-workspace .header-actions button {min-height:44px;padding:8px 12px;font-size:12px;border-radius:10px;box-shadow:none}
body.selection-workspace #header-export {background:#2563eb;border-color:#2563eb;color:#fff}
body.selection-workspace #mobile-menu {display:flex;align-items:center;justify-content:center;width:44px;min-width:44px;padding:6px;background:#f3f6fb;border:1px solid #dce4ef;color:#334961;font-size:20px;line-height:1}
body.selection-workspace #mobile-menu span {font-size:21px}
body.selection-workspace #editor-screen {
 flex:1;min-height:0;padding:0 0 calc(var(--workspace-nav) + var(--workspace-context) + var(--workspace-safe));
}
body.selection-workspace #editor-content {height:100%;min-height:0;display:flex;flex-direction:column;margin:0;overflow:hidden}
body.selection-workspace #viewport {position:relative;top:auto;flex:1;min-height:140px;height:auto;max-height:none;width:100%;background:#e9eef5;overflow:hidden}
body.selection-workspace #viewport>canvas {display:block;touch-action:none}
body.selection-workspace .scene-title,body.selection-workspace .hint,
body.selection-workspace .scale,body.selection-workspace #selection-chip {display:none!important}
body.selection-workspace #viewport-history {position:absolute;left:12px;top:12px;z-index:4;display:flex;gap:5px}
body.selection-workspace #viewport-history button {min-width:44px;min-height:44px;padding:8px 10px;border:1px solid #d4deec;background:#ffffffef;border-radius:9px;font-size:12px;box-shadow:0 2px 8px #1d36520a;color:#334d71}
body.selection-workspace #viewport-history button:disabled {opacity:.4}
body.selection-workspace .viewtools {position:absolute;right:12px;bottom:12px;top:auto;gap:4px;z-index:4}
body.selection-workspace .viewtools button {min-width:44px;min-height:44px;padding:7px 10px;background:#ffffffed;border:1px solid #d2deec;color:#334d71;font-size:11px;border-radius:9px;box-shadow:0 2px 8px #1d36520a}
body.selection-workspace #selection-choice {top:66px;right:12px;max-width:calc(100% - 24px);max-height:calc(100% - 124px);z-index:8}
body.selection-workspace #viewport-status {top:66px;left:12px;right:12px;width:auto;max-width:420px;background:#ffffffed;color:#365779;border-color:#bfd0e9}
/* Persistent feedback plus only the operations that match the current selection. */
#context-actions {display:none}
body.selection-workspace #context-actions {
 display:flex;flex-direction:column;gap:5px;position:fixed;z-index:32;
 left:0;right:0;bottom:calc(var(--workspace-nav) + var(--workspace-safe));
 height:var(--workspace-context);padding:8px 12px 9px;
 background:#fff;border-top:1px solid #d5dfed;box-shadow:0 -3px 18px #1e38520a;
}
body.selection-workspace #selection-status {
 margin:0;min-height:19px;font-size:12px;line-height:19px;font-weight:650;letter-spacing:0;
 color:#3c5576;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
body.selection-workspace .context-group {display:flex;flex:1;min-height:0;align-items:stretch;gap:7px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:none;padding:0 0 1px}
body.selection-workspace .context-group::-webkit-scrollbar {display:none}
body.selection-workspace .context-group button {
 flex:1 0 78px;min-width:78px;min-height:44px;white-space:nowrap;font-size:12px;padding:9px 13px;
 border:1px solid #d8e2f0;border-radius:9px;background:#f5f8fd;color:#284971;box-shadow:none;
}
body.selection-workspace .context-group[data-context-mode=edge] button {background:#edf3ff;color:#1e56be;border-color:#b8ccf1;font-weight:700}
body.selection-workspace .context-group button:disabled {opacity:.43}
body.selection-workspace .context-group p {font-size:12px;color:#60758f;margin:8px 0;line-height:1.3}
body.selection-workspace #mobile-toolbar {
 position:fixed;z-index:33;display:flex;flex-direction:row;align-items:stretch;gap:6px;
 left:0;right:0;top:auto;bottom:0;width:auto;height:calc(var(--workspace-nav) + var(--workspace-safe));
 padding:4px max(12px,env(safe-area-inset-right,0px)) calc(4px + var(--workspace-safe)) max(12px,env(safe-area-inset-left,0px));
 border:0;border-top:1px solid #e1e7f1;background:#f8fafd;box-shadow:none;
}
body.selection-workspace #mobile-toolbar button {
 position:relative;flex:1;min-width:0;min-height:48px;padding:7px 9px;display:flex;flex-direction:row;
 align-items:center;justify-content:center;gap:7px;background:transparent;color:#546b89;
 border:1px solid transparent;border-radius:9px;font-size:13px;box-shadow:none;font-weight:650;
}
body.selection-workspace #mobile-toolbar button>span {font-size:23px;line-height:1}
body.selection-workspace #mobile-toolbar button.active {background:#e7effd;border-color:#cadaf4;color:#1f58c0}
body.selection-workspace #mobile-toolbar button:focus-visible {outline:3px solid #80aaff;outline-offset:-2px}
/* The drawer has no collapsed placeholder. Close returns the space to the model. */
body.selection-workspace:not(.mobile-sheet-open) #mobile-sheet {display:none!important}
body.selection-workspace.mobile-sheet-open #mobile-sheet {
 display:block;flex:0 0 min(42dvh,380px);height:min(42dvh,380px);min-height:0;
 width:100%;max-width:none;position:relative;top:auto;right:auto;bottom:auto;
 border:1px solid #d6e1ef;border-bottom:0;border-radius:17px 17px 0 0;
 padding:0 16px 18px;margin:0;background:#fff;overflow:auto;overscroll-behavior:contain;
 box-shadow:0 -4px 20px #19314e0a;scroll-padding-top:62px;
}
body.selection-workspace #mobile-sheet>.panel-heading,
body.selection-workspace #mobile-sheet>h2 {display:none}
body.selection-workspace #mobile-sheet .mobile-panel-hidden {display:none!important}
body.selection-workspace #mobile-sheet-toggle {
 display:flex;align-items:center;justify-content:space-between;gap:12px;
 position:sticky;top:0;z-index:10;min-height:52px;width:calc(100% + 32px);
 padding:12px 16px;margin:0 -16px 13px;border:0;border-bottom:1px solid #e3e9f2;
 border-radius:16px 16px 0 0;background:#fff;color:#1d3554;
 font-size:15px;font-weight:700;box-shadow:none;cursor:pointer;opacity:1;
}
body.selection-workspace #mobile-sheet-toggle .sheet-grip {display:none}
body.selection-workspace #mobile-sheet-toggle .sheet-chevron {display:block;font-size:24px;line-height:1;transform:none;color:#567194}
body.selection-workspace #mobile-sheet .section-label {font-size:10px;letter-spacing:1px;margin:18px 0 10px;color:#60748f}
body.selection-workspace #mobile-sheet .section-label:first-child {margin-top:4px}
body.selection-workspace #mobile-sheet input:not([type=color]):not([type=checkbox]),
body.selection-workspace #mobile-sheet select {min-height:46px;font-size:16px}
body.selection-workspace .pick-modes {display:flex;gap:7px;background:none;padding:0;margin:4px 0 14px}
body.selection-workspace .pick-modes button {min-height:52px;flex:1;padding:10px 8px;background:#f5f8fd;border:1px solid #d7e2f1;border-radius:10px;color:#516b8f;font-size:13px;font-weight:650}
body.selection-workspace .pick-modes button.active {background:#e8f0ff;border-color:#86a9ed;color:#1e58bd;box-shadow:inset 0 0 0 1px #a9c2f2}
body.selection-workspace #selection-help {font-size:12px;line-height:1.5;margin:9px 0 14px;color:#5d7392}
body.selection-workspace .edge-picker {background:#f7faff;border:1px solid #dce5f2;padding:10px 12px;border-radius:10px;margin:12px 0}
body.selection-workspace .edge-picker summary {min-height:32px;cursor:pointer;align-content:center;font-size:12px;font-weight:650;color:#41608c}
body.selection-workspace #cad-edge-list {display:flex;flex-direction:column;max-height:240px;overflow:auto;gap:4px}
body.selection-workspace #cad-edge-list label {display:flex;align-items:center;gap:12px;min-height:44px;padding:6px 4px;font-size:12px;border-bottom:1px solid #e7edf5}
body.selection-workspace #cad-edge-list input[type=checkbox] {min-width:22px;width:22px;height:22px;flex-shrink:0}
body.selection-workspace .object {width:100%;min-height:52px;padding:11px 12px;border-radius:10px;border:1px solid #dde6f2;color:#36516f;background:#f8faff;font-size:13px;text-align:left}
body.selection-workspace .object.active {background:#edf3ff;border-color:#91b1ec;color:#2057b3}
body.selection-workspace #property-tabs {display:flex;gap:6px;overflow:auto;padding:0 0 12px;margin:0 0 4px}
body.selection-workspace #property-tabs button {min-height:44px;padding:8px 10px;font-size:12px;border-radius:8px;white-space:nowrap;background:#f4f7fc;color:#5b7395;border-color:#dfe7f3}
body.selection-workspace #property-tabs button.active {background:#e8f0ff;border-color:#9ebaf0;color:#1e56ba}
body.selection-workspace #transform-tools {margin:0 0 15px;background:#f7faff;border-color:#dce5f3;padding:12px;border-radius:10px}
body.selection-workspace #transform-tools button[aria-pressed=true] {background:#e1ebff;border-color:#8baef0;color:#1c54bb}
body.selection-workspace #transform-tools .section-label {display:none}
body.selection-workspace #transform-tools .transform-tabs {margin-bottom:8px}
body.selection-workspace #transform-tools .transform-row>button {min-height:44px;font-size:12px}
body.selection-workspace .mesh-notice {background:#f5f8fd;padding:13px;border-color:#dce5f2;border-radius:10px;margin:12px 0}
body.selection-workspace .mesh-notice>button {min-height:44px;font-size:12px;width:100%;margin:7px 0 0}
body.selection-workspace #cad-status,body.selection-workspace #cad-error {font-size:12px;line-height:1.5;margin:10px 0}
body.selection-workspace #cad-panel {padding:0;margin:0;border:0}
body.selection-workspace .app-nav,body.selection-workspace.mobile-nav-open .app-nav {display:none}
#workspace-project-actions {display:none}
body.selection-workspace.mobile-nav-open #workspace-project-actions {
 display:grid;position:fixed;z-index:55;top:calc(var(--workspace-header) + env(safe-area-inset-top,0px) + 7px);right:10px;
 gap:3px;width:220px;padding:7px;max-height:calc(100dvh - var(--workspace-header) - 16px);overflow:auto;
 border:1px solid #d5e0ef;border-radius:12px;background:#fff;box-shadow:0 15px 45px #12243e2b;
}
#workspace-project-actions button {min-height:44px;padding:8px 12px;border:0;background:#f4f7fc;color:#27456b;font-size:.875rem;text-align:left;box-shadow:none}
#workspace-project-actions button:hover,#workspace-project-actions button:focus-visible {background:#e7effd}
body.selection-workspace #toast {bottom:calc(var(--workspace-nav) + var(--workspace-context) + var(--workspace-safe) + 12px);font-size:12px;background:#193451;z-index:70}
body.selection-workspace .save-error {flex:0 0 auto;max-height:22dvh;overflow:auto;padding:8px 12px;font-size:12px}
/* Exact edge operations retain a visible model preview while adjusting the amount. */
body.selection-workspace #cad-edge-dialog {max-width:480px;padding:22px;border-radius:16px}
body.selection-workspace #cad-edge-dialog h2 {font-size:23px;line-height:1.2;margin-top:0}
body.selection-workspace #cad-edge-dialog input {font-size:20px;min-height:52px}
@media(min-width:851px) and (min-height:501px) {
 body.selection-workspace {--workspace-header:60px;--workspace-nav:62px;--workspace-context:82px}
 body.selection-workspace .app-header {padding-left:20px;padding-right:20px}
 body.selection-workspace .project-status {max-width:none}
 body.selection-workspace #editor-content {display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);margin:0}
 body.selection-workspace.mobile-sheet-open #editor-content {grid-template-columns:minmax(0,1fr) 370px}
 body.selection-workspace #viewport {height:100%;min-height:0;grid-column:1;grid-row:1}
 body.selection-workspace.mobile-sheet-open #mobile-sheet {grid-column:2;grid-row:1;flex:none;width:370px;height:100%;max-height:none;border-radius:0;border-top:0;border-left:1px solid #d8e3f0;padding:0 18px 22px;box-shadow:none}
 body.selection-workspace #mobile-sheet-toggle {width:calc(100% + 36px);margin-left:-18px;margin-right:-18px;padding-left:18px;padding-right:18px;border-radius:0;cursor:pointer}
 body.selection-workspace #context-actions {padding-left:20px;padding-right:20px}
 body.selection-workspace .context-group {justify-content:flex-start;overflow-x:auto}
 body.selection-workspace .context-group button {flex:0 0 auto;min-width:108px}
 body.selection-workspace #mobile-toolbar {justify-content:center;padding-left:20px;padding-right:20px}
 body.selection-workspace #mobile-toolbar button {flex:0 1 180px}
 body.selection-workspace #viewport-history {left:20px;top:18px}
 body.selection-workspace .viewtools {right:18px;bottom:18px}
}
@media(max-width:370px) {
 body.selection-workspace .app-header {gap:6px;padding-left:8px;padding-right:8px}
 body.selection-workspace #workspace-back {max-width:87px;padding-left:7px;padding-right:7px;font-size:11px}
 body.selection-workspace .header-actions {gap:4px}
 body.selection-workspace .header-actions button {padding:8px 9px;font-size:11px}
 body.selection-workspace #mobile-menu {width:40px;min-width:40px}
 body.selection-workspace #project-title {font-size:12px}
 body.selection-workspace #mobile-toolbar button {font-size:12px;gap:5px;padding:7px 5px}
 body.selection-workspace .context-group button {font-size:11px;min-width:75px;padding:9px 10px}
}
@media(max-height:520px) {
 body.selection-workspace {--workspace-header:50px;--workspace-nav:52px;--workspace-context:78px}
 body.selection-workspace #context-actions {padding-top:5px;padding-bottom:5px;gap:3px}
 body.selection-workspace #selection-status {font-size:11px;min-height:17px;line-height:17px}
 body.selection-workspace #mobile-toolbar {padding-top:2px;padding-bottom:calc(2px + var(--workspace-safe))}
 body.selection-workspace #mobile-toolbar button {min-height:46px}
 body.selection-workspace #viewport {min-height:100px}
 body.selection-workspace.mobile-sheet-open #mobile-sheet {flex-basis:max(86px,calc(100dvh - var(--workspace-header) - var(--workspace-nav) - var(--workspace-context) - var(--workspace-safe) - 100px));height:max(86px,calc(100dvh - var(--workspace-header) - var(--workspace-nav) - var(--workspace-context) - var(--workspace-safe) - 100px))}
 body.selection-workspace #mobile-sheet-toggle {min-height:44px;padding-top:9px;padding-bottom:9px;margin-bottom:8px}
 body.selection-workspace #viewport-history {top:8px;left:8px}
 body.selection-workspace .viewtools {right:8px;bottom:8px}
 body.selection-workspace #viewport-status {top:58px}
}
body.selection-workspace #edit-task-heading {display:flex;gap:10px;align-items:center;justify-content:space-between;margin:0 0 12px}
body.selection-workspace #edit-task-title {font-size:17px;line-height:1.25;letter-spacing:-.3px;margin:0;color:#234365}
body.selection-workspace #edit-task-back {font-size:12px;min-height:44px;padding:8px 10px;border-color:#d7e2f1;background:#f5f8fd;color:#49678f}
/* Edge tasks stay beside a live, orbitable model rather than covering it. */
body.selection-workspace.edge-task-open {--edge-task-height:min(42dvh,390px)}
body.selection-workspace.edge-task-open #context-actions,
body.selection-workspace.edge-task-open #mobile-sheet {display:none!important}
body.selection-workspace.edge-task-open #editor-screen {padding-bottom:calc(var(--workspace-nav) + var(--workspace-safe) + var(--edge-task-height) + 16px)}
body.selection-workspace.edge-task-open #cad-edge-dialog {
 position:fixed;inset:auto 12px calc(var(--workspace-nav) + var(--workspace-safe) + 8px);
 width:calc(100% - 24px);max-width:none;max-height:var(--edge-task-height);min-height:0;
 margin:0;padding:18px;border:1px solid #c4d5ee;border-radius:15px;
 background:#fff;box-shadow:0 4px 28px #1a345322;overflow:auto;z-index:45;
}
body.selection-workspace #cad-edge-dialog .actions {display:flex;flex-wrap:wrap;gap:7px}
body.selection-workspace #cad-edge-dialog .actions button {flex:1 1 90px;min-height:44px;padding:9px 10px;font-size:13px}
body.selection-workspace #cad-selected-edges {font-size:12px;margin:8px 0;color:var(--shop-muted,#a6b6cb)}
body.selection-workspace #cad-preview-status {font-size:12px;line-height:1.4;color:var(--shop-muted,#a6b6cb);margin:8px 0;min-height:17px}
body.selection-workspace #cad-edge-preview {background:#eef4ff;color:#205abd;border-color:#b7ccef}
body.selection-workspace #cad-edge-submit {background:#2563eb;color:#fff;border-color:#2563eb}
@media(min-width:851px) and (min-height:501px) {
 body.selection-workspace.edge-task-open #editor-screen {padding-bottom:calc(var(--workspace-nav) + var(--workspace-safe) + 18px)}
 body.selection-workspace.edge-task-open #editor-content {grid-template-columns:minmax(0,1fr) min(440px,40vw)}
 body.selection-workspace.edge-task-open #cad-edge-dialog {inset:calc(var(--workspace-header) + 18px) 18px auto auto;width:calc(min(440px,40vw) - 30px);max-height:calc(100dvh - var(--workspace-header) - var(--workspace-nav) - var(--workspace-safe) - 54px);padding:22px}
}
@media(max-height:520px) {
 body.selection-workspace.edge-task-open {--edge-task-height:max(90px,calc(100dvh - var(--workspace-header) - var(--workspace-nav) - var(--workspace-safe) - 156px))}
 body.selection-workspace.edge-task-open #cad-edge-dialog {padding:12px 16px}
 body.selection-workspace #cad-edge-dialog h2 {font-size:19px;margin-bottom:8px}
}
body.selection-workspace #edit-task-title {display:none}
body.selection-workspace #edit-task-heading:has(#edit-task-back[hidden]) {display:none}
body.selection-workspace #edit-task-heading {margin-bottom:9px;justify-content:flex-start}
/* The complete edge task, including confirmation, fits the mobile drawer. */
body.selection-workspace.edge-task-open {--edge-task-height:min(39dvh,320px)}
body.selection-workspace.edge-task-open #cad-edge-dialog {padding:14px 16px}
body.selection-workspace #cad-edge-form {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:8px}
body.selection-workspace #cad-edge-form>.eyebrow {display:none}
body.selection-workspace #cad-edge-form h2 {grid-column:1/-1;font-size:21px;line-height:1.2;margin:0}
body.selection-workspace #cad-selected-edges {grid-column:1/-1;font-size:11px;line-height:17px;margin:0}
body.selection-workspace #cad-edge-form>.control-label {grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1fr) 100px;align-items:center;gap:12px;margin:0;font-size:12px;line-height:1.3}
body.selection-workspace #cad-edge-form>.control-label input {min-height:48px;margin:0;padding:10px;font-size:20px;width:100%;min-width:0}
body.selection-workspace #cad-preview-status {grid-column:1/-1;margin:0;font-size:12px;line-height:17px;min-height:34px}
body.selection-workspace #cad-edge-preview {grid-column:1/-1;min-height:44px;padding:8px 12px;font-size:13px;margin:0}
body.selection-workspace #cad-edge-form>.actions {grid-column:1/-1;position:sticky;bottom:-14px;z-index:3;background:#fff;padding:6px 0 1px;margin:0;box-shadow:0 -5px 8px #fff}
body.selection-workspace #cad-edge-form>.actions button {min-height:44px;margin:0;font-size:13px}
body.selection-workspace #cad-edge-form>[data-cad-cancel] {grid-column:1/-1;min-height:44px;font-size:12px}
@media(max-height:520px) and (min-width:651px) {
 body.selection-workspace #editor-content {display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr);margin:0}
 body.selection-workspace.mobile-sheet-open #editor-content {grid-template-columns:minmax(0,1fr) 310px}
 body.selection-workspace #viewport {grid-column:1;grid-row:1;height:100%;min-height:130px}
 body.selection-workspace.mobile-sheet-open #mobile-sheet {grid-column:2;grid-row:1;flex:none;width:310px;height:100%;max-height:none;min-height:0;border-radius:0;border-top:0;border-left:1px solid #d6e1ef;padding:0 14px 14px}
 body.selection-workspace #mobile-sheet-toggle {width:calc(100% + 28px);margin-left:-14px;margin-right:-14px;padding-left:14px;padding-right:14px;border-radius:0;min-height:44px}
 body.selection-workspace.edge-task-open {--edge-task-height:140px}
 body.selection-workspace.edge-task-open #editor-content {grid-template-columns:minmax(0,1fr)}
 body.selection-workspace.edge-task-open #cad-edge-dialog {padding:10px 14px}
 body.selection-workspace #cad-edge-form {grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr);gap:5px 10px}
 body.selection-workspace #cad-edge-form h2 {grid-column:1;grid-row:1;font-size:18px}
 body.selection-workspace #cad-selected-edges {grid-column:2/-1;grid-row:1;align-self:center}
 body.selection-workspace #cad-edge-form>.control-label {grid-column:1;grid-row:2;grid-template-columns:minmax(0,1fr) 64px;gap:6px;font-size:11px}
 body.selection-workspace #cad-edge-form>.control-label input {min-height:44px;padding:7px;font-size:17px}
 body.selection-workspace #cad-preview-status {grid-column:2/-1;grid-row:2;font-size:11px;line-height:15px;align-self:center;min-height:0}
 body.selection-workspace #cad-edge-preview {grid-column:1;grid-row:3;min-height:44px;font-size:12px}
 body.selection-workspace #cad-edge-form>.actions {grid-column:2/-1;grid-row:3;padding:0;bottom:-10px}
}
