/* StructaCAD workspace UI. Loaded last to retire the accumulated menu skins.
   Keep geometry, drawing previews and hidden/disabled states owned by the app. */
:root { --sidebar-width: 200px; --properties-dock-width: 320px; }

/* Printing sheets: project browser, paper workspace and sheet properties. */
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-content {
  width: 100vw !important; max-width: none !important; height: 100dvh !important; max-height: none !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important;
  display: grid; grid-template-columns: 250px minmax(0, 1fr) 260px;
  grid-template-rows: auto minmax(0, 1fr); background: var(--ui-bg); color: var(--ui-text);
}
body#structacad-workspace #sheet-organizer-overlay .sheet-workspace-header {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 20px; background: var(--ui-surface); border-bottom: 1px solid var(--ui-line);
}
body#structacad-workspace #sheet-organizer-overlay h2 { margin: 2px 0 0; font-size: 19px; color: var(--ui-text); }
body#structacad-workspace #sheet-organizer-overlay :is(h3, .sheet-organizer-sheets-title) { color: var(--ui-text); }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-kicker { font-size: 10px; color: var(--ui-muted); letter-spacing: .08em; }
body#structacad-workspace #sheet-organizer-overlay :is(.sheet-organizer-sidebar, .sheet-organizer-main) { background: var(--ui-surface); color: var(--ui-text); min-width: 0; }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-main { grid-template-rows: auto auto minmax(0, 1fr) auto auto; background: var(--ui-bg); }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-library { display: grid; grid-template-rows: minmax(170px, .8fr) auto auto minmax(60px, 1fr) auto; padding: 14px; gap: 10px; }
body#structacad-workspace #sheet-organizer-overlay .sheet-project-browser { display: flex; flex-direction: column; gap: 10px; min-height: 0; max-height: none; padding-bottom: 10px; border-bottom: 1px solid var(--ui-line); }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-sheets-list { display: flex; flex: 1; min-height: 0; flex-direction: column; gap: 6px; overflow: auto; }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-sheet-tab { width: 100%; min-width: 0; min-height: 70px; grid-template-columns: 28px minmax(0, 1fr); flex-shrink: 0; background: var(--ui-input); color: var(--ui-text); border-color: var(--ui-line); }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-sheet-tab.is-active { background: var(--ui-selected); border-color: var(--ui-accent); box-shadow: inset 3px 0 var(--ui-accent); }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-sheet-tab-thumb { height: 34px; position: relative; }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-sheet-tab-thumb::after { content: ""; position: absolute; inset: 4px; border: 1px solid #aeb8bf; }
body#structacad-workspace #sheet-organizer-overlay :is(.sheet-organizer-sheet-tab-name, .sheet-organizer-sheet-tab-code) { color: var(--ui-text); overflow-wrap: anywhere; }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-sheet-tab-meta { color: var(--ui-muted); font-size: 10px; margin-top: 3px; }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-new-sheet-card { display: block; min-height: 32px; flex-shrink: 0; }
body#structacad-workspace #sheet-organizer-overlay :is(input:not([type="checkbox"]), select) { width: 100%; box-sizing: border-box; min-width: 0; min-height: 32px; background: var(--ui-input); color: var(--ui-text); border: 1px solid var(--ui-line); border-radius: 3px; padding: 6px 8px; }
body#structacad-workspace #sheet-organizer-overlay input::placeholder { color: var(--ui-muted); }
body#structacad-workspace #sheet-organizer-overlay :is(.sheet-organizer-field span, .sheet-organizer-field-group span, .sheet-organizer-field-group p, .sheet-organizer-current-title, .sheet-organizer-current-title strong, .sheet-organizer-zoom-label, .sheet-organizer-library-card-title, .sheet-organizer-category-title) { color: var(--ui-text); }
body#structacad-workspace #sheet-organizer-overlay :is(.sheet-organizer-library-card-subtitle, .field-note) { color: var(--ui-muted); }
body#structacad-workspace #sheet-organizer-overlay button { width: auto; margin: 0; background: var(--ui-input); color: var(--ui-text); border: 1px solid var(--ui-line); border-radius: 3px; }
body#structacad-workspace #sheet-organizer-overlay .sheet-workspace-header > div { flex: 1; }
body#structacad-workspace #sheet-organizer-overlay #sheet-organizer-back-btn { flex: 0 0 auto; }
body#structacad-workspace #sheet-organizer-overlay button:hover:not(:disabled) { background: var(--ui-hover); border-color: var(--ui-accent); }
body#structacad-workspace #sheet-organizer-overlay button:disabled { opacity: .4; cursor: default; }
body#structacad-workspace #sheet-organizer-overlay button.is-active { background: var(--ui-selected); border-color: var(--ui-accent); }
body#structacad-workspace #sheet-organizer-overlay :is(.primary-btn, #sheet-organizer-back-btn) { background: var(--ui-action-bg); color: var(--ui-action-text); border-color: var(--ui-action-border); padding: 8px 12px; }
body#structacad-workspace #sheet-organizer-overlay .sheet-management-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 0 0 18px; }
body#structacad-workspace #sheet-organizer-overlay .sheet-management-actions button { min-height: 32px; padding: 5px; font-size: 11px; }
body#structacad-workspace #sheet-organizer-overlay .sheet-workspace-hint { color: var(--ui-muted); font-size: 11px; line-height: 1.7; }
body#structacad-workspace #sheet-organizer-overlay .sheet-code-error { color: #f87171; font-size: 11px; margin: -6px 0 14px; }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-toolbar { padding: 10px 14px; gap: 8px; flex-wrap: wrap; }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-main-header { padding: 10px 16px; }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-current-title { flex-wrap: wrap; overflow-wrap: anywhere; }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-canvas-shell { margin: 0 14px; background: var(--ui-bg); border: 1px solid var(--ui-line); }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-canvas { box-sizing: border-box; width: max-content; }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-canvas-info { transform: none; margin: 8px 0 0; background: var(--ui-surface); color: var(--ui-muted); border: 0; padding: 3px 10px; }
body#structacad-workspace #sheet-organizer-overlay .sheet-workspace-status { margin: 0; padding: 7px 14px 10px; color: var(--ui-muted); font-size: 11px; }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-actions { position: static; background: var(--ui-surface); }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-sheet { touch-action: none; background: #fff; background-image: none; }
body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-drop-empty { inset: 30% 20%; padding: 16px; line-height: 1.7; }
@media (max-width: 1050px) {
  body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-content { grid-template-columns: 210px minmax(0, 1fr) 230px; }
  body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-toolbar { gap: 5px; }
}
@media (max-width: 760px) {
  body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-content { grid-template-columns: 180px minmax(0, 1fr); grid-template-rows: auto minmax(300px, 1fr) auto; overflow-y: auto; }
  body#structacad-workspace #sheet-organizer-overlay .sheet-workspace-header { padding: 10px; }
  body#structacad-workspace #sheet-organizer-overlay h2 { font-size: 16px; }
  body#structacad-workspace #sheet-organizer-overlay .sheet-organizer-config { grid-column: 1 / -1; max-height: 42vh; border-top: 1px solid var(--ui-line); }
}
body#structacad-workspace.cad-workspace {
  --sidebar-width: inherit;
  --properties-dock-width: min(320px, calc(100vw - 64px));
  --top-panel-height: 88px;
  --ui-font: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --ui-bg: #1b2125;
  --ui-surface: #20262a;
  --ui-raised: #272e33;
  --ui-input: #2a3237;
  --ui-hover: #323a3f;
  --ui-line: #3b454c;
  --ui-line-soft: #303a40;
  --ui-text: #e4e8eb;
  --ui-muted: #aeb8bf;
  --ui-accent: #91b8e6;
  --ui-selected: #293c50;
  --ui-focus: #9cc5f4;
  --ui-color-scheme: dark;
  --ui-radius: 2px;
  --ui-control-height: 28px;
  --ui-action-bg: #315a83;
  --ui-action-hover: #3d6a97;
  --ui-action-border: #527da8;
  --ui-action-text: #f3f7fc;
  --ui-popover-shadow: 0 4px 14px #0003;
  --ui-dialog-shadow: 0 10px 32px #0004;
  font-family: var(--ui-font) !important;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}

body#structacad-workspace.cad-workspace *, body#structacad-workspace.cad-workspace *::before, body#structacad-workspace.cad-workspace *::after {
  font-family: var(--ui-font) !important;
  text-shadow: none !important;
}
body#structacad-workspace.cad-workspace :is(button, input, select, textarea):not(:where(#survey-overlay *)) { font-weight: 400 !important; }
body#structacad-workspace.cad-workspace :is(button, summary, a, input, select, textarea):not(:where(#survey-overlay *)):focus-visible {
  outline: 1px solid var(--ui-focus) !important;
  outline-offset: 2px;
}
body#structacad-workspace.cad-workspace :is(button, summary, a) { -webkit-tap-highlight-color: transparent; }
body#structacad-workspace.cad-workspace :is(button, summary):hover { transform: none !important; }
body#structacad-workspace.cad-workspace :is(button, summary, input, select, textarea) {
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
body#structacad-workspace.cad-workspace :is(#sidebar, #properties-dock, [role="dialog"], dialog, .modal-content) {
  scrollbar-width: thin;
  scrollbar-color: var(--ui-line) transparent;
  overscroll-behavior: contain;
}

/* First-visit appearance choice: keep both real workspace previews side by side. */
body#structacad-workspace.cad-workspace #workspace-theme-dialog {
  box-sizing: border-box;
  width: min(1000px, calc(100vw - 40px));
  max-width: none;
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: clamp(20px, 3vw, 36px) !important;
  overflow: auto;
  border: 1px solid var(--ui-line) !important;
  border-radius: 12px !important;
  background: var(--ui-surface) !important;
  color: var(--ui-text) !important;
  box-shadow: 0 24px 90px #0005 !important;
  text-align: left;
  color-scheme: var(--ui-color-scheme);

  &:not([open]) { display: none !important; }
  &::backdrop { background: #080f19b8; backdrop-filter: blur(6px); }
  & .workspace-theme-heading { margin-bottom: 24px; }
  & .workspace-theme-kicker { margin: 0 0 10px; color: var(--ui-accent); font-size: 12px; font-weight: 600; letter-spacing: .06em; }
  & #workspace-theme-title { margin: 0 0 10px; color: var(--ui-text); font-size: clamp(22px, 2.4vw, 30px) !important; line-height: 1.2; letter-spacing: -.02em; font-weight: 600 !important; }
  & #workspace-theme-title:focus { outline: none; }
  & #workspace-theme-copy { margin: 0; color: var(--ui-muted); font-size: 14px; line-height: 1.5; }
  & .workspace-theme-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  & .workspace-theme-choice {
    display: flex; flex-direction: column; gap: 0; min-width: 0; margin: 0; padding: 0;
    overflow: hidden; border: 1px solid var(--ui-line) !important; border-radius: 8px !important;
    background: var(--ui-raised) !important; color: var(--ui-text) !important; text-align: left;
    box-shadow: none !important; cursor: pointer; white-space: normal;
  }
  & .workspace-theme-choice:hover { border-color: var(--ui-accent) !important; background: var(--ui-selected) !important; }
  & .workspace-theme-choice:focus-visible { outline: 3px solid var(--ui-focus) !important; outline-offset: 3px; }
  & .workspace-theme-choice img { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 780; object-fit: contain; border-bottom: 1px solid var(--ui-line); }
  & .workspace-theme-choice-caption { display: flex; flex-direction: column; gap: 7px; width: 100%; box-sizing: border-box; padding: 18px; }
  & .workspace-theme-choice-title { display: flex; align-items: center; gap: 10px; font-size: 17px; line-height: 1.3; font-weight: 600; }
  & .workspace-theme-choice-title svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--ui-accent); }
  & .workspace-theme-choice-arrow { margin-left: auto; color: var(--ui-accent); }
  & .workspace-theme-choice-copy { color: var(--ui-muted); font-size: 13px; line-height: 1.5; }
  & #workspace-theme-note { margin: 22px 0 0; color: var(--ui-muted); font-size: 12px; line-height: 1.6; text-align: center; }
}
@media (max-width: 600px) {
  body#structacad-workspace.cad-workspace #workspace-theme-dialog {
    width: calc(100vw - 24px); max-height: calc(100dvh - 24px); padding: 20px 14px !important;
    & .workspace-theme-heading { margin-bottom: 20px; }
    & .workspace-theme-choices { gap: 10px; }
    & .workspace-theme-choice-caption { padding: 12px 10px; gap: 6px; }
    & .workspace-theme-choice-title { flex-wrap: wrap; gap: 6px; font-size: 14px; }
    & .workspace-theme-choice-title svg { width: 18px; height: 18px; }
    & .workspace-theme-choice-arrow { display: none; }
    & .workspace-theme-choice-copy { font-size: 12px; }
    & #workspace-theme-note { margin-top: 18px; }
  }
}

/* DXF downloads keep the header and close action visible while the body scrolls. */
body#structacad-workspace.cad-workspace #app-dialog-overlay[data-purpose="dxf-download"] {
  padding: 20px;
  --download-success: #8ad7ac;
  --download-error: #ffaaaa;

  & .app-dialog-content {
    display: flex;
    flex-direction: column;
    width: min(760px, 100%);
    max-height: calc(100dvh - 40px) !important;
    padding: 0 !important;
    overflow: hidden !important;
    text-align: left;
  }
  & .overlay-header {
    position: relative;
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 18px 26px 16px !important;
    border-bottom: 1px solid var(--ui-line-soft) !important;
    text-align: left;
  }
  & .overlay-kicker { margin: 0 0 5px; }
  & .modal-title { margin: 0 !important; padding-right: 36px; font-size: 18px !important; }
  & .app-dialog-header-actions { position: absolute; top: 22px; right: 22px; margin: 0; }
  & .split-dxf-close {
    display: grid; place-items: center; width: 32px; height: 32px; min-width: 0; padding: 0;
    border: 0 !important; background: transparent !important; color: var(--ui-muted) !important;
  }
  & .split-dxf-close:hover { background: var(--ui-hover) !important; color: var(--ui-text) !important; }
  & .app-dialog-body {
    display: flex; flex-direction: column; gap: 12px; min-height: 0;
    margin: 0; padding: 16px 26px 18px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: var(--ui-line) transparent;
  }
  & .app-dialog-body > * { flex-shrink: 0; }
  & .app-dialog-actions {
    flex: 0 0 auto; display: flex !important; flex-direction: row !important; justify-content: flex-end;
    margin: 0 !important; padding: 12px 26px !important; border-top: 1px solid var(--ui-line-soft) !important;
  }
  & #app-dialog-confirm-btn {
    flex: 0 0 auto; width: auto; min-width: 88px; margin: 0; padding: 7px 18px;
    background: var(--ui-raised) !important; border: 1px solid var(--ui-line) !important; color: var(--ui-text) !important;
  }
  & [hidden] { display: none !important; }
  & .split-dxf-export-overview { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ui-muted); font-size: 12px; }
  & .split-dxf-export-format { padding: 3px 8px; border: 1px solid var(--ui-line); border-radius: var(--ui-radius); white-space: nowrap; font-size: 11px; }
  & .split-dxf-export-progress {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; justify-items: stretch; align-items: center;
    gap: 10px 14px; margin: 0; padding: 14px; border: 1px solid var(--ui-line); border-radius: var(--ui-radius);
    background: var(--ui-input); text-align: left;
  }
  & .split-dxf-export-download-animation { width: 40px; height: 40px; }
  & .split-dxf-export-download-ring { width: 40px; height: 40px; border: 0; border-radius: var(--ui-radius); background: var(--ui-selected); animation: none; }
  & .split-dxf-export-download-arrow { top: 2px; color: var(--ui-accent); font-size: 26px; }
  & .split-dxf-export-download-tray { bottom: 7px; width: 19px; height: 6px; border-width: 1.5px; border-color: var(--ui-accent); border-radius: 0 0 3px 3px; }
  & .split-dxf-export-progress-copy { min-width: 0; justify-items: start; gap: 4px; }
  & .split-dxf-export-progress-copy strong { color: var(--ui-text); font-size: 14px; font-weight: 600; line-height: 1.4; }
  & .split-dxf-export-progress-copy span { color: var(--ui-muted); font-size: 12px; overflow-wrap: anywhere; }
  & .split-dxf-export-progress-copy .split-dxf-export-progress-elapsed { font-size: 11px; font-variant-numeric: tabular-nums; }
  & .split-dxf-export-progress.is-running .split-dxf-export-progress-elapsed::before {
    content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%;
    background: var(--ui-accent); animation: split-dxf-activity 1.5s ease-in-out infinite;
  }
  @media (prefers-reduced-motion: reduce) {
    & .split-dxf-export-progress.is-running .split-dxf-export-progress-elapsed::before { animation: none; }
  }
  & .split-dxf-export-progress-count { color: var(--ui-accent); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
  & .split-dxf-export-progress-track { grid-column: 2 / -1; width: 100%; height: 4px; background: var(--ui-line); }
  & .split-dxf-export-progress-track:not(.is-running):not(.is-determinate):not(.is-success):not(.is-error) { display: none; }
  & .split-dxf-export-progress-fill { color: var(--ui-accent); }
  & .split-dxf-export-progress-track.is-success .split-dxf-export-progress-fill { color: var(--download-success); }
  & .split-dxf-export-progress-track.is-error .split-dxf-export-progress-fill { color: var(--download-error); }
  & .split-dxf-smart-rename-control { justify-content: space-between; gap: 10px; margin: 0; }
  & .split-dxf-smart-labeling { color: var(--ui-text); font-size: 12px; }
  & .split-dxf-smart-labeling input { width: 16px; height: 16px; accent-color: var(--ui-accent); }
  & .split-dxf-export-full-option {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 16px; border: 1px solid var(--ui-line); border-radius: var(--ui-radius); background: var(--ui-raised);
  }
  & :is(.split-dxf-export-full-option, .split-dxf-export-batch-heading) strong { color: var(--ui-text); font-size: 12px; font-weight: 600; }
  & :is(.split-dxf-export-full-option, .split-dxf-export-batch-heading) p { margin: 4px 0 0; max-width: none; color: var(--ui-muted); font-size: 12px; line-height: 1.45; }
  & .split-dxf-full-download {
    flex: 0 0 auto; width: auto; min-height: 36px; margin: 0; padding: 8px 14px;
    background: var(--ui-action-bg) !important; border: 1px solid var(--ui-action-border) !important; color: var(--ui-action-text) !important; font-size: 12px; white-space: normal;
  }
  & .split-dxf-full-download:hover:not(:disabled) { background: var(--ui-action-hover) !important; }
  & .split-dxf-export-fallback-note { margin: 0; padding: 10px 12px; text-align: left; color: var(--ui-muted); }
  & .split-dxf-export-batch { display: grid; gap: 12px; padding: 0; border: 0; background: transparent; justify-items: stretch; }
  & .split-dxf-export-batch-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  & .split-dxf-export-batch-button { min-width: 0; width: auto; min-height: 34px; padding: 6px 12px; background: transparent !important; border-color: var(--ui-line) !important; color: var(--ui-text) !important; font-size: 12px; white-space: nowrap; }
  & .split-dxf-export-completed { flex-shrink: 0; color: var(--download-success); font-size: 11px; }
  & .split-dxf-export-group-list { gap: 0; margin: 0; border: 1px solid var(--ui-line); border-radius: var(--ui-radius); overflow: hidden; }
  & .split-dxf-export-group-row {
    grid-template-columns: 30px minmax(0, 1fr) auto auto; gap: 12px; min-height: 52px; padding: 8px 14px;
    border: 0; border-bottom: 1px solid var(--ui-line-soft); border-radius: 0; background: transparent; text-align: left;
    transition: background-color 150ms ease;
  }
  & .split-dxf-export-group-row:last-child { border-bottom: 0; }
  & .split-dxf-export-group-row:hover { background: var(--ui-raised); }
  & .split-dxf-export-group-row[data-status="running"] { background: var(--ui-selected); box-shadow: inset 3px 0 var(--ui-accent); }
  & .split-dxf-export-group-icon { display: grid; place-items: center; color: var(--ui-muted); }
  & .split-dxf-export-group-icon svg { width: 23px; height: 23px; }
  & .split-dxf-export-group-copy { gap: 2px; }
  & .split-dxf-export-group-copy strong { color: var(--ui-text); font-size: 12px; font-weight: 500; overflow-wrap: anywhere; }
  & .split-dxf-export-group-copy span { color: var(--ui-muted); font-size: 11px; }
  & .split-dxf-export-group-state { font-size: 11px; color: var(--ui-accent); white-space: nowrap; }
  & .split-dxf-export-group-row[data-status="success"] .split-dxf-export-group-state { color: var(--download-success); }
  & .split-dxf-export-group-row[data-status="success"] .split-dxf-export-group-state::before { content: "✓ "; }
  & .split-dxf-export-group-row[data-status="error"] .split-dxf-export-group-state { color: var(--download-error); }
  & .split-dxf-export-group-download {
    width: auto !important; min-width: 92px !important; min-height: 32px; padding: 6px 10px;
    border: 1px solid var(--ui-line) !important; border-radius: var(--ui-radius); background: transparent !important; color: var(--ui-text) !important; font-size: 12px;
  }
  & .split-dxf-export-group-download:hover:not(:disabled) { background: var(--ui-selected) !important; border-color: var(--ui-accent) !important; color: var(--ui-accent) !important; }
  & .split-dxf-export-group-actions { border-radius: var(--ui-radius) !important; overflow: hidden; }
  & .split-dxf-export-group-actions button { margin: 0 !important; }
  & .split-dxf-export-group-actions .split-dxf-export-group-download { border: 0 !important; border-radius: var(--ui-radius) 0 0 4px !important; }
  & .split-dxf-export-group-toggle { border-radius: 0 var(--ui-radius) var(--ui-radius) 0 !important; }
  & .split-dxf-export-selection-option { margin: 0 !important; border-radius: 0 !important; }
  & .split-dxf-export-group-download:disabled { opacity: .45; cursor: default; }
  & .split-dxf-export-group-download[aria-busy="true"] { opacity: 1; color: var(--ui-accent) !important; border-color: var(--ui-accent) !important; }
  & .split-dxf-export-status { padding: 0 2px; color: var(--ui-muted); }
  & .split-dxf-export-status.is-success { color: var(--download-success); }
  & .split-dxf-export-status.is-error { color: var(--download-error); }
  @media (max-width: 560px) {
    padding: 10px;
    & .app-dialog-content { max-height: calc(100dvh - 20px) !important; }
    & .overlay-header { padding: 18px 16px 14px !important; }
    & .app-dialog-header-actions { top: 16px; right: 14px; }
    & .app-dialog-body { padding: 14px 16px 18px; gap: 16px; }
    & .app-dialog-actions { padding: 10px 16px !important; }
    & .split-dxf-export-progress { grid-template-columns: 32px minmax(0, 1fr) auto; padding: 12px; gap: 10px; }
    & .split-dxf-export-download-animation { width: 32px; }
    & .split-dxf-export-download-ring { width: 32px; }
    & .split-dxf-export-full-option { align-items: stretch; flex-direction: column; gap: 12px; }
    & .split-dxf-export-batch-heading { flex-wrap: wrap; }
    & .split-dxf-export-group-row { grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px 10px; padding: 10px; }
    & .split-dxf-export-group-state { grid-column: 2; grid-row: 2; }
    & .split-dxf-export-group-state:empty { display: none; }
    & .split-dxf-export-group-download { min-width: 72px !important; }
    & .split-dxf-export-group-actions { grid-column: 3; grid-row: 1; }
    & .split-dxf-export-group-row[data-status] .split-dxf-export-group-actions { grid-row: 1 / 3; }
    & .split-dxf-export-group-toggle { flex-basis: 34px; width: 34px; min-height: 38px; }
  }
  @media (prefers-reduced-motion: reduce) {
    & :is(.split-dxf-export-download-arrow, .split-dxf-export-progress-fill) { animation: none; transition: none; }
  }
}
body#structacad-workspace.cad-workspace[data-ui-theme="light"] #app-dialog-overlay[data-purpose="dxf-download"] {
  --download-success: #236344;
  --download-error: #a12d3d;
}

/* Navigation is a quiet rail, with a single selected module. */
body#structacad-workspace.cad-workspace #mode-dock {
  background: var(--ui-bg) !important;
  border-right-color: var(--ui-line-soft) !important;
  gap: 2px !important;
  padding-top: 8px !important;
}
body#structacad-workspace.cad-workspace #mode-dock .dock-button {
  min-height: 54px !important;
  flex-basis: 54px !important;
  gap: 7px !important;
  color: var(--ui-muted) !important;
  font-size: 10px !important;
  font-weight: 400 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}
body#structacad-workspace.cad-workspace #mode-dock .dock-button::before { width: 21px !important; height: 21px !important; }
body#structacad-workspace.cad-workspace #mode-dock .dock-button:hover { background: var(--ui-raised) !important; color: var(--ui-text) !important; }
body#structacad-workspace.cad-workspace #mode-dock .dock-button.is-active {
  background: var(--ui-selected) !important;
  color: var(--ui-text) !important;
  box-shadow: inset 2px 0 var(--ui-accent) !important;
}
body#structacad-workspace.cad-workspace #mode-dock #sidebar-mode-manage {
  min-height: 48px !important;
  flex-basis: 48px !important;
  font-size: 0 !important;
  border-top: 1px solid var(--ui-line-soft) !important;
}
body#structacad-workspace.cad-workspace #mode-dock #sidebar-mode-design {
  order: 8 !important;
  margin-top: auto !important;
}
body#structacad-workspace.cad-workspace #mode-dock #sidebar-mode-export {
  display: flex !important;
  margin-top: 0 !important;
}
body#structacad-workspace.cad-workspace #sidebar {
  width: var(--sidebar-width) !important;
  max-width: min(360px, calc(100vw - 64px)) !important;
  background: var(--ui-surface) !important;
  border-right-color: var(--ui-line) !important;
  box-shadow: none !important;
}
body#structacad-workspace.cad-workspace #properties-dock {
  background: var(--ui-surface) !important;
  border-left-color: var(--ui-line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
body#structacad-workspace.cad-workspace :is(.cad-panel-header, .properties-dock-header) {
  min-height: 38px !important;
  flex-basis: 38px !important;
  padding: 5px 12px !important;
  background: var(--ui-surface) !important;
  border-bottom: 1px solid var(--ui-line) !important;
  color: var(--ui-text) !important;
  font-size: 14px !important;
  font-weight: 600 !important;
}
body#structacad-workspace.cad-workspace .properties-dock-title { font-size: 14px !important; font-weight: 600 !important; text-transform: none !important; }
/* Let long module titles wrap without escaping the header's divider. */
body#structacad-workspace.cad-workspace #sidebar > .cad-panel-header {
  flex: 0 0 auto !important;
  min-height: 48px !important;
  padding: 10px 12px !important;
}
body#structacad-workspace.cad-workspace #cad-sidebar-title {
  flex: 1;
  min-width: 0;
  line-height: 20px;
  overflow-wrap: anywhere;
}
body#structacad-workspace.cad-workspace #cad-sidebar-close {
  flex: 0 0 28px;
  min-height: 28px;
  height: 28px;
  margin: 0;
  line-height: 1;
}
body#structacad-workspace.cad-workspace .cad-panel-close { color: var(--ui-muted) !important; }
body#structacad-workspace.cad-workspace .cad-panel-close:hover { background: var(--ui-hover) !important; color: var(--ui-text) !important; }
body#structacad-workspace.cad-workspace #sidebar .sidebar-shell { padding: 0 12px 16px !important; }
body#structacad-workspace.cad-workspace #sidebar :is(.menu-section, .sidebar-dropdown-shell, .sidebar-dropdown-menu, .sidebar-dropdown-stack) {
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  gap: 0 !important;
}
body#structacad-workspace.cad-workspace #sidebar .sidebar-dropdown-summary {
  min-height: 36px !important;
  padding: 8px 0 !important;
  border-bottom: 1px solid var(--ui-line-soft) !important;
  color: var(--ui-text) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}
body#structacad-workspace.cad-workspace #sidebar .sidebar-dropdown-summary:hover { color: var(--ui-accent) !important; }
body#structacad-workspace.cad-workspace #sidebar .sidebar-dropdown-summary { text-align: left !important; justify-content: flex-start !important; }
body#structacad-workspace.cad-workspace #sidebar .sidebar-dropdown-summary::after { margin-left: auto !important; }
body#structacad-workspace.cad-workspace #sidebar .ui-vector-icon::before { color: var(--ui-muted) !important; }
body#structacad-workspace.cad-workspace #sidebar details[open] > .sidebar-dropdown-summary { color: var(--ui-text) !important; }
body#structacad-workspace.cad-workspace #sidebar .sidebar-dropdown-body { padding: 10px 0 16px !important; }
body#structacad-workspace.cad-workspace #sidebar :is(.sidebar-dropdown-badge, .menu-chip) { display: none !important; }
body#structacad-workspace.cad-workspace #sidebar .menu-heading { margin: 0 !important; padding: 16px 0 10px !important; }
body#structacad-workspace.cad-workspace #sidebar .menu-header {
  color: var(--ui-muted) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
}
body#structacad-workspace.cad-workspace #sidebar :is(.connections-dock-heading, .export-dock-heading) { display: none !important; }

/* Menus use rows; borders are reserved for editable controls. */
body#structacad-workspace.cad-workspace #sidebar :is(.grid-system-launch, .cad-module-steel button, .project-unit-system-button, .project-action-button, .btn-preview, .btn-export) {
  min-height: 36px !important;
  height: auto !important;
  width: 100%;
  margin: 0 !important;
  padding: 8px 10px !important;
  border: 1px solid transparent !important;
  border-radius: var(--ui-radius) !important;
  background: transparent !important;
  color: var(--ui-text) !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  text-align: left !important;
  justify-content: flex-start !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  white-space: normal !important;
}
body#structacad-workspace.cad-workspace #sidebar :is(.grid-system-launch, .cad-module-steel button, .project-unit-system-button, .project-action-button, .btn-preview, .btn-export):hover:not(:disabled) {
  background: var(--ui-hover) !important;
  color: #fff !important;
}
body#structacad-workspace.cad-workspace #sidebar :is(.import-action-wrap, .export-dock-save-wrap) { margin: 0 !important; gap: 3px !important; }
body#structacad-workspace.cad-workspace #sidebar .cad-module-steel { border-top-color: var(--ui-line-soft) !important; padding: 12px 0 !important; gap: 3px !important; }
body#structacad-workspace.cad-workspace #sidebar .cad-module-steel button { display: flex; align-items: center; gap: 12px; }
body#structacad-workspace.cad-workspace #sidebar :is(.primary-btn, #export-dock-run-btn) {
  background: var(--ui-selected) !important;
  border-color: var(--ui-line) !important;
  color: var(--ui-text) !important;
  font-weight: 500 !important;
}
body#structacad-workspace.cad-workspace #sidebar .project-actions { display: grid; grid-template-columns: 1fr 1fr 34px; gap: 4px; }
body#structacad-workspace.cad-workspace #sidebar .project-actions .project-action-button { padding-inline: 7px !important; text-align: center !important; }
body#structacad-workspace.cad-workspace #sidebar .project-pref-group { border: 0 !important; background: transparent !important; margin: 0 0 16px !important; padding: 0 !important; }
body#structacad-workspace.cad-workspace #sidebar .project-pref-group.is-disabled { display: none !important; }
body#structacad-workspace.cad-workspace #sidebar .project-color-list { gap: 0 !important; }
body#structacad-workspace.cad-workspace #sidebar .project-color-row { border: 0 !important; border-bottom: 1px solid var(--ui-line-soft) !important; border-radius: 0 !important; background: transparent !important; }
body#structacad-workspace.cad-workspace #sidebar .project-picker-item { border: 0 !important; border-bottom: 1px solid var(--ui-line) !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
/* Icon-only actions must not inherit the padding of full-width menu rows. */
body#structacad-workspace.cad-workspace #sidebar .project-picker-actions .project-action-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  height: 32px !important;
  min-height: 32px !important;
  flex: 0 0 32px !important;
  padding: 0 !important;
  line-height: 1 !important;
}
body#structacad-workspace.cad-workspace #sidebar .project-picker-actions .project-action-button svg {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  flex: 0 0 18px !important;
}
body#structacad-workspace.cad-workspace #sidebar .project-picker-actions .project-action-button:focus-visible { outline: 1px solid var(--ui-focus); outline-offset: 1px; }
body#structacad-workspace.cad-workspace #sidebar .project-picker-actions .project-action-button-danger:hover:not(:disabled) { color: #f2a4a4 !important; background: #f2a4a414 !important; }

/* Tool rows show their names and use the same vector drawing as the toolbar. */
body#structacad-workspace.cad-workspace #sidebar .tool-grid { display: grid !important; grid-template-columns: 1fr !important; gap: 3px !important; padding: 0 0 12px !important; }
body#structacad-workspace.cad-workspace #sidebar .tool-grid button {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  width: 100% !important;
  height: auto !important;
  min-height: 32px !important;
  padding: 6px 8px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: var(--ui-muted) !important;
  box-shadow: none !important;
}
body#structacad-workspace.cad-workspace #sidebar .tool-grid button::after {
  content: attr(data-ui-label) !important;
  display: block !important;
  position: static !important;
  inset: auto !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: none !important;
  font-size: 12px !important;
  line-height: 1.4 !important;
  color: var(--ui-text) !important;
  font-weight: 400 !important;
  white-space: normal !important;
  text-align: left !important;
}
body#structacad-workspace.cad-workspace #sidebar .tool-grid button:hover { background: var(--ui-hover) !important; }
body#structacad-workspace.cad-workspace #sidebar .tool-grid button.active-tool { background: var(--ui-selected) !important; color: var(--ui-text) !important; border-color: color-mix(in srgb, var(--ui-accent) 45%, transparent) !important; }
body#structacad-workspace.cad-workspace .ui-vector-icon::before {
  content: "" !important;
  display: block !important;
  position: static !important;
  flex: 0 0 19px !important;
  width: 19px !important;
  height: 19px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: currentColor !important;
  mask: var(--ui-icon) center / contain no-repeat !important;
  -webkit-mask: var(--ui-icon) center / contain no-repeat !important;
  transform: none !important;
  opacity: 1 !important;
}
body#structacad-workspace.cad-workspace #mode-dock .ui-vector-icon::before { mask-image: var(--ui-icon) !important; -webkit-mask-image: var(--ui-icon) !important; }
body#structacad-workspace.cad-workspace .ui-vector-icon > :is(img, svg, .tool-symbol, .import-provider-card-icon) { display: none !important; }
/* Wall insertion uses the reference artwork, including its colored end faces. */
body#structacad-workspace.cad-workspace :is(#workspace-tool-wall-shortcut, #tool-wall).ui-vector-icon::before {
  background: url("/assets/wall_icon.svg") center / contain no-repeat !important;
  mask: none !important;
  -webkit-mask: none !important;
}
body#structacad-workspace.cad-workspace #sidebar .grid-system-launch:is(.ui-vector-icon, .ui-program-icon) { display: flex; align-items: center; gap: 12px; }
body#structacad-workspace.cad-workspace :is(.ui-vector-icon, .ui-program-icon):disabled { opacity: .4 !important; cursor: not-allowed !important; }
/* Import providers retain their native artwork in both workspace themes. */
body#structacad-workspace.cad-workspace .ui-program-icon::before {
  content: "" !important;
  display: block !important;
  position: static !important;
  flex: 0 0 24px !important;
  width: 24px !important;
  height: 24px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 3px !important;
  background: transparent var(--ui-program-icon) center / contain no-repeat !important;
  mask: none !important;
  -webkit-mask: none !important;
  box-shadow: none !important;
  transform: none !important;
  opacity: 1 !important;
}
body#structacad-workspace.cad-workspace #import-idea-connection-sidebar-btn.ui-program-icon::before {
  background-size: cover !important;
}

/* Inspector and technical forms: readable labels, stable rows, tabular numbers. */
body#structacad-workspace.cad-workspace :is(#sidebar, #properties-dock, .modal-content, [role="dialog"], dialog, .steel-assignment-scheme-quick-editor, .workspace-light-menu, .top-panel-options-popover) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea) {
  min-width: 0;
  min-height: var(--ui-control-height) !important;
  padding: 5px 8px !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius) !important;
  background: var(--ui-input) !important;
  color: var(--ui-text) !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  color-scheme: var(--ui-color-scheme);
}
/* Older menu components consume the same palette through their original tokens.
   Scope these aliases to interface surfaces, leaving the model canvas alone. */
body#structacad-workspace.cad-workspace :is(#sidebar, #properties-dock, #top-panel, .modal-content, .app-dialog-content, [role="dialog"], dialog, .steel-assignment-scheme-quick-editor, .workspace-light-menu, .top-panel-options-popover, .context-menu, .workspace-context-menu, .cad-help-menu, .workspace-overlap-picker) {
  --panel: var(--ui-surface);
  --panel-soft: var(--ui-raised);
  --surface: var(--ui-surface);
  --surface-raised: var(--ui-raised);
  --bg-control: var(--ui-input);
  --bg-control-hover: var(--ui-hover);
  --bg-panel: var(--ui-surface);
  --bg-card: var(--ui-raised);
  --text: var(--ui-text);
  --text-primary: var(--ui-text);
  --text-secondary: var(--ui-muted);
  --text-soft: var(--ui-muted);
  --text-muted: var(--ui-muted);
  --border: var(--ui-line);
  --border-strong: var(--ui-line);
  --border-soft: var(--ui-line-soft);
  --accent: var(--ui-accent);
  --accent-soft: var(--ui-selected);
  --radius-shell: var(--ui-radius);
  --radius-panel: var(--ui-radius);
  --radius-card: var(--ui-radius);
  --radius-control: var(--ui-radius);
  --radius-pill: var(--ui-radius);
  --radius-small: var(--ui-radius);

  & :is(button, select, textarea, input:not([type="radio"]):not([type="checkbox"]):not([type="range"]):not([type="color"])):not(:where(#survey-overlay *)) {
    border-radius: var(--ui-radius) !important;
  }
}
body#structacad-workspace.cad-workspace :is(#sidebar, .modal-content, [role="dialog"], dialog, .steel-assignment-scheme-quick-editor) :is(input, select, textarea):hover:not(:disabled):not([readonly]) {
  border-color: var(--ui-muted) !important;
}
body#structacad-workspace.cad-workspace :is(#sidebar, .modal-content, [role="dialog"], dialog, .steel-assignment-scheme-quick-editor) :is(input, select, textarea):focus-visible {
  border-color: var(--ui-focus) !important;
}
body#structacad-workspace.cad-workspace :is(.modal-actions, .app-dialog-actions) button {
  background: var(--ui-raised) !important;
  border: 1px solid var(--ui-line) !important;
  color: var(--ui-text) !important;
}
body#structacad-workspace.cad-workspace :is(.modal-actions, .app-dialog-actions) :is(.primary-btn, #app-dialog-confirm-btn) {
  background: var(--ui-action-bg) !important;
  border-color: var(--ui-action-border) !important;
  color: var(--ui-action-text) !important;
}
body#structacad-workspace.cad-workspace :is(.modal-actions, .app-dialog-actions) button:hover:not(:disabled) { background: var(--ui-hover) !important; }
body#structacad-workspace.cad-workspace :is(.modal-actions, .app-dialog-actions) :is(.primary-btn, #app-dialog-confirm-btn):hover:not(:disabled) { background: var(--ui-action-hover) !important; }
body#structacad-workspace.cad-workspace :is(#sidebar, .modal-content, .app-dialog-content, [role="dialog"], dialog) :is(.primary-btn, .secondary-btn, .import-help-toggle, .grid-axis-mode-button) {
  border: 1px solid var(--ui-line) !important;
  background: var(--ui-raised) !important;
  color: var(--ui-text) !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 400 !important;
}
body#structacad-workspace.cad-workspace :is(#sidebar, .modal-content, .app-dialog-content, [role="dialog"], dialog) .primary-btn {
  background: var(--ui-action-bg) !important;
  border-color: var(--ui-action-border) !important;
  color: var(--ui-action-text) !important;
}
body#structacad-workspace.cad-workspace :is(#sidebar, .modal-content, .app-dialog-content, [role="dialog"], dialog) :is(.primary-btn, .secondary-btn, .import-help-toggle, .grid-axis-mode-button):hover:not(:disabled) { background: var(--ui-hover) !important; }
body#structacad-workspace.cad-workspace :is(#sidebar, .modal-content, .app-dialog-content, [role="dialog"], dialog) .primary-btn:hover:not(:disabled) { background: var(--ui-action-hover) !important; }
body#structacad-workspace.cad-workspace :is(#sidebar, .system-modal-content) .grid-axis-mode-button.is-active { background: var(--ui-selected) !important; border-color: var(--ui-accent) !important; color: var(--ui-accent) !important; }
body#structacad-workspace.cad-workspace :is(.workspace-light-menu, .top-panel-options-popover, .context-menu, .workspace-context-menu, .cad-help-menu, .workspace-overlap-picker) {
  & :is(button, a, label) { font-size: 12px !important; font-weight: 400 !important; }
  & :is(button, a):hover:not(:disabled) { background: var(--ui-hover) !important; color: var(--ui-text) !important; }
  & .workspace-level-picker-entry { border-radius: var(--ui-radius) !important; }
  & .workspace-level-picker-entry.is-active { border-color: var(--ui-line) !important; background: var(--ui-selected) !important; }
  & .workspace-level-picker-option-name { font-weight: 500; }
}
body#structacad-workspace.cad-workspace :is(#workspace-level-switch, #workspace-main-frame-control, .workspace-canvas-controls, .top-panel-options-trigger) {
  background: var(--ui-surface) !important;
  border-color: var(--ui-line) !important;
  border-radius: var(--ui-radius) !important;
  color: var(--ui-text) !important;
  box-shadow: none !important;
  & button { background: transparent !important; border-color: var(--ui-line) !important; border-radius: var(--ui-radius) !important; color: var(--ui-text) !important; }
  & button:hover:not(:disabled) { background: var(--ui-hover) !important; }
}
body#structacad-workspace.cad-workspace #canvas-stage .workspace-canvas-control-btn:is(.is-active, [aria-pressed="true"]) {
  background: var(--ui-selected) !important;
  color: var(--ui-accent) !important;
}
body#structacad-workspace.cad-workspace #workspace-normative-btn {
  position: absolute;
  right: 52px;
  bottom: 54px;
  z-index: 10000;
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 9px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  color: var(--ui-text);
  box-shadow: none;
  cursor: pointer;
}
body#structacad-workspace.cad-workspace #workspace-normative-btn:hover {
  background: var(--ui-hover);
}
body#structacad-workspace.cad-workspace #workspace-normative-btn:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 2px;
}
body#structacad-workspace.cad-workspace #workspace-normative-btn svg {
  width: 26px;
  height: 26px;
}
body#structacad-workspace.cad-workspace #canvas-stage.has-reinforcement-tray #workspace-normative-btn {
  bottom: calc(54px + var(--active-reinforcement-tray-height));
}
/* A dedicated detailing toolbox, with geometry cues for each parameter. */
body#structacad-workspace.cad-workspace #app-dialog-overlay[data-purpose="normative-menu"] {
  padding: 24px;

  & .app-dialog-content {
    --ui-radius: 8px;
    display: flex;
    flex-direction: column;
    width: min(820px, 100%);
    max-width: 100%;
    max-height: calc(100dvh - 48px) !important;
    padding: 0 !important;
    overflow: hidden !important;
    border-radius: 12px !important;
    box-shadow: 0 24px 80px #0005 !important;
    text-align: left;
  }
  & .overlay-header {
    position: relative;
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 28px 32px 0 !important;
    border: 0 !important;
    text-align: left;
  }
  & .overlay-kicker {
    margin: 0 48px 7px 0;
    color: var(--ui-accent) !important;
    font-size: 10px !important;
    font-weight: 600;
    letter-spacing: .13em;
  }
  & .modal-title {
    margin: 0 !important;
    padding-right: 40px;
    font-size: 28px !important;
    font-weight: 600 !important;
    line-height: 1.2;
    letter-spacing: -.025em;
  }
  & .app-dialog-header-actions { position: absolute; top: 24px; right: 24px; margin: 0; }
  & .normative-menu-close {
    display: grid; place-items: center; width: 36px; height: 36px; min-width: 0; margin: 0; padding: 8px;
    background: transparent !important; border: 1px solid transparent !important;
    border-radius: 6px !important; color: var(--ui-muted) !important;
  }
  & .normative-menu-close svg { width: 20px; height: 20px; }
  & .normative-menu-close:hover { background: var(--ui-hover) !important; color: var(--ui-text) !important; }
  & .app-dialog-message {
    flex: 0 0 auto; margin: 10px 0 0; padding: 0 32px;
    color: var(--ui-muted); font-size: 13px; line-height: 1.5; text-align: left;
  }
  & .app-dialog-body {
    min-height: 0; margin: 0; padding: 28px 32px 32px; overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: var(--ui-line) transparent;
  }
  & .normative-modal-menu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  & .normative-menu-group { min-width: 0; }
  & .normative-menu-group-title {
    margin: 0 0 12px; color: var(--ui-muted); font-size: 11px; font-weight: 600; line-height: 1.5;
    letter-spacing: .06em; text-transform: uppercase;
  }
  & .normative-menu-options { display: grid; gap: 10px; }
  & .normative-modal-action {
    display: grid; grid-template-columns: 52px minmax(0, 1fr) 16px; align-items: center; gap: 12px;
    width: 100%; min-width: 0; min-height: 110px; margin: 0; padding: 16px 14px;
    border: 1px solid var(--ui-line-soft) !important; border-radius: 8px !important;
    background: var(--ui-raised) !important; color: var(--ui-text) !important;
    text-align: left; white-space: normal; cursor: pointer; box-shadow: none !important;
  }
  & .normative-modal-action:hover:not(:disabled) {
    background: var(--ui-selected) !important; border-color: var(--ui-accent) !important;
  }
  & .normative-modal-action:focus-visible { outline: 2px solid var(--ui-focus) !important; outline-offset: 3px; }
  & .normative-modal-action:disabled { opacity: .45; cursor: not-allowed; }
  & .normative-menu-diagram {
    display: grid; place-items: center; width: 52px; height: 56px; color: var(--ui-accent);
  }
  & .normative-menu-diagram svg { display: block; width: 52px; height: 52px; }
  & .normative-diagram-context { stroke: var(--ui-muted); opacity: .5; stroke-width: 1; }
  & .normative-diagram-dimension { stroke-width: 1; opacity: .8; }
  & .normative-menu-copy { display: grid; gap: 6px; min-width: 0; }
  & .normative-menu-label { color: var(--ui-text); font-size: 13px; font-weight: 600; line-height: 1.4; }
  & .normative-menu-description { color: var(--ui-muted); font-size: 11px; font-weight: 400; line-height: 1.5; }
  & .normative-menu-arrow { width: 16px; height: 16px; color: var(--ui-muted); }
  & .normative-modal-action:hover .normative-menu-arrow { color: var(--ui-accent); }
  & .app-dialog-actions {
    flex: 0 0 auto; display: flex !important; flex-direction: row !important; justify-content: flex-end;
    margin: 0 !important; padding: 14px 32px !important;
    border-top: 1px solid var(--ui-line-soft) !important; border-radius: 0 !important; background: var(--ui-bg);
  }
  & #app-dialog-confirm-btn {
    flex: 0 0 auto; width: auto; min-width: 88px; min-height: 36px; margin: 0; padding: 7px 20px;
    border: 1px solid var(--ui-line) !important; border-radius: 6px !important;
    background: transparent !important; color: var(--ui-text) !important; font-size: 12px;
  }
  & #app-dialog-confirm-btn:hover { background: var(--ui-hover) !important; }
  & [hidden] { display: none !important; }

  @media (max-width: 680px) {
    padding: 12px;
    & .app-dialog-content { max-height: calc(100dvh - 24px) !important; }
    & .overlay-header { padding: 22px 20px 0 !important; }
    & .modal-title { font-size: 24px !important; }
    & .app-dialog-header-actions { top: 16px; right: 14px; }
    & .app-dialog-message { padding-inline: 20px; font-size: 12px; }
    & .app-dialog-body { padding: 22px 20px; }
    & .normative-modal-menu { grid-template-columns: minmax(0, 1fr); gap: 24px; }
    & .normative-modal-action { min-height: 90px; padding-block: 12px; }
    & .app-dialog-actions { padding: 12px 20px !important; }
  }
}
body#structacad-workspace.cad-workspace #workspace-main-frame-select {
  background: var(--ui-surface) !important;
  border: 0 !important;
  border-radius: var(--ui-radius) !important;
  color: var(--ui-text) !important;
  box-shadow: none !important;
}
/* View shortcuts sit beside the canvas view menu and level/frame picker. */
body#structacad-workspace.cad-workspace .workspace-corner-controls {
  --workspace-corner-control-height: 32px;
  max-width: calc(100% - 32px);
  flex-wrap: wrap;
}
body#structacad-workspace.cad-workspace:not(.properties-dock-empty) #canvas-stage .workspace-corner-controls {
  --workspace-corner-control-height: 30px;
  max-width: calc(100% - var(--properties-dock-safe-right) - 16px);
}
body#structacad-workspace.cad-workspace .workspace-corner-view-group {
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  height: var(--workspace-corner-control-height);
  box-sizing: border-box;
  gap: 6px;
  padding: 0 6px;
  border: 1px solid var(--ui-line);
  border-radius: var(--ui-radius) !important;
  background: var(--ui-surface);
}
body#structacad-workspace.cad-workspace .workspace-corner-view-group .top-tool-button-row {
  gap: 4px !important;
}
body#structacad-workspace.cad-workspace .workspace-corner-view-group .workspace-history-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  width: 32px !important;
  min-width: 32px !important;
  max-width: 32px !important;
  height: calc(var(--workspace-corner-control-height) - 4px) !important;
  min-height: calc(var(--workspace-corner-control-height) - 4px) !important;
  max-height: calc(var(--workspace-corner-control-height) - 4px) !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--ui-muted) !important;
  box-shadow: none !important;
}
body#structacad-workspace.cad-workspace .workspace-corner-view-group .workspace-history-button:hover:not(:disabled) {
  background: var(--ui-hover) !important;
  color: var(--ui-text) !important;
}
body#structacad-workspace.cad-workspace .workspace-corner-view-group .workspace-history-button.is-active {
  color: var(--ui-accent) !important;
  box-shadow: inset 0 -2px var(--ui-accent) !important;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-icon-button {
  border-color: var(--ui-line) !important;
  background: transparent !important;
  color: var(--ui-muted) !important;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-icon-button.is-active { background: var(--ui-selected) !important; color: var(--ui-text) !important; }
body#structacad-workspace.cad-workspace #top-panel .top-panel-icon-button:hover:not(:disabled) { background: var(--ui-hover) !important; }
body#structacad-workspace[data-ui-theme="dark"] #workspace-theme-toggle .workspace-theme-moon,
body#structacad-workspace[data-ui-theme="light"] #workspace-theme-toggle .workspace-theme-sun { display: none; }
body#structacad-workspace.cad-workspace #workspace-bottom-bar { background: var(--ui-bg) !important; border-color: var(--ui-line) !important; color: var(--ui-muted) !important; }
body#structacad-workspace.cad-workspace #cad-help-toggle { background: var(--ui-surface) !important; border-color: var(--ui-line) !important; border-radius: var(--ui-radius) !important; color: var(--ui-text) !important; }
body#structacad-workspace.cad-workspace :is(#sidebar, #properties-dock, .modal-content, [role="dialog"], dialog) :is(input, textarea)::placeholder { color: var(--ui-muted) !important; opacity: 1; }
body#structacad-workspace.cad-workspace :is(input[type="checkbox"], input[type="radio"], input[type="range"]) { accent-color: var(--ui-accent); }
body#structacad-workspace.cad-workspace :is(#sidebar, #properties-dock, .modal-content, [role="dialog"], dialog) :is(.field-label, label:not([class]), .insert-property-label) {
  color: var(--ui-muted) !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.45 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}
body#structacad-workspace.cad-workspace :is(#sidebar, #properties-dock, .modal-content, [role="dialog"], dialog) :is(.field-note, .workspace-note) {
  color: var(--ui-muted) !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  font-style: normal !important;
  text-align: left !important;
}
body#structacad-workspace.cad-workspace #properties-dock .properties-dock-body { padding: 0 16px 20px !important; }
/* Keep paired inputs aligned when one label wraps onto another line. */
body#structacad-workspace.cad-workspace #properties-dock .insert-properties-inline-grid > .insert-properties-field {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}
body#structacad-workspace.cad-workspace #properties-dock :is(.insert-properties-section, .insert-properties-group, .workspace-card, .workspace-selection-card) {
  border: 0 !important;
  border-bottom: 1px solid var(--ui-line-soft) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body#structacad-workspace.cad-workspace #properties-dock :is(.insert-properties-title, .workspace-card-title, .insert-properties-section-title) {
  font-size: 12px !important;
  font-weight: 500 !important;
  text-transform: none !important;
  color: var(--ui-text) !important;
}

/* Technical properties inspector: neutral surfaces, compact property rows.
   Keep native controls, application visibility and the existing tab order. */
body#structacad-workspace.cad-workspace #properties-dock {
  box-shadow: none !important;
  border-left-color: var(--ui-line) !important;

  & .properties-dock-header {
    min-height: 38px !important;
    flex-basis: 38px !important;
    padding: 5px 12px !important;
    border-bottom-color: var(--ui-line) !important;
  }
  & .properties-dock-title { font-size: 12px !important; font-weight: 600 !important; }
  & .properties-dock-icon { display: none !important; }
  & .properties-dock-heading-copy { flex: 1; min-width: 0; }
  & .cad-panel-close { width: 24px; height: 24px; border-radius: 2px !important; font-size: 18px; }
  & .properties-dock-body {
    padding: 0 12px 16px !important;
    scrollbar-width: thin;
    scrollbar-color: var(--ui-line) transparent;
  }
  & #insert-properties-dock {
    padding: 14px 0 12px !important;
    gap: 0 !important;
    border-bottom-color: var(--ui-line) !important;
  }
  & .insert-properties-title {
    margin: 0 0 10px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    letter-spacing: 0;
    line-height: 1.3 !important;
  }
  & .insert-properties-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px !important;
    margin-top: 0 !important;
  }
  & .insert-properties-block { padding: 0 !important; }
  & .insert-properties-dock label { margin-top: 0 !important; }
  & .insert-properties-field { min-width: 0; }
  & #insert-properties-fields .insert-properties-field > span {
    color: var(--ui-muted) !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    line-height: 1.35;
  }
  & .insert-properties-inline-grid { gap: 6px 10px !important; }
  & #insert-properties-fields :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select, textarea) {
    box-sizing: border-box;
    min-height: 28px;
    margin-top: 0 !important;
    padding: 5px 8px !important;
    border: 1px solid var(--ui-line) !important;
    border-radius: 2px !important;
    background-color: var(--ui-input) !important;
    font-size: 12px !important;
    line-height: 1.3;
  }
  & #insert-properties-fields select {
    appearance: none;
    padding-right: 23px !important;
    background-image: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12"%3E%3Cpath d="m3 4.5 3 3 3-3" fill="none" stroke="%23a5a8ab" stroke-width="1.2"/%3E%3C/svg%3E') !important;
    background-position: right 7px center !important;
    background-size: 12px 12px !important;
    background-repeat: no-repeat !important;
  }
  & #insert-properties-fields :is(input, select, textarea):hover:not(:disabled):not([readonly]) { border-color: var(--ui-muted) !important; }
  & #insert-properties-fields :is(input, select, textarea):focus-visible {
    outline: 1px solid var(--ui-focus) !important;
    outline-offset: 0;
    border-color: var(--ui-focus) !important;
  }
  & #insert-properties-fields :is(input, select, textarea):disabled { opacity: .5; cursor: not-allowed; }

  & .properties-priority-material { padding-bottom: 12px !important; border-bottom: 1px solid var(--ui-line-soft); }
  & .materials-panel-flat-title {
    margin: 0 0 10px;
    color: var(--ui-text);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: .06em;
  }
  & .materials-panel .modal-subsection { display: grid; gap: 6px; }
  & .materials-strength-grid { grid-template-columns: minmax(0, 1fr); }
  & #insert-properties-fields :is(.materials-panel .insert-properties-field, .insert-element-type-block > .insert-properties-field, label[for="insert-name"], label[for="insert-col-cardinal-point"], label[for="insert-col-rotation"]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: center;
    gap: 10px;
  }
  & #insert-properties-fields label[for="insert-col-cardinal-point"] > span { text-transform: lowercase !important; }
  & #insert-properties-fields label[for="insert-col-cardinal-point"] > span::first-letter { text-transform: uppercase; }
  & .insert-element-type-block { padding: 0 !important; }
  & #insert-properties-fields #insert-element-type-display {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--ui-text) !important;
  }
  & .reinforcement-tray-launch-panel { padding: 2px 0 6px !important; }
  & #insert-reinforcement-tray-launch {
    min-height: 30px !important;
    height: auto !important;
    padding: 6px 8px !important;
    border: 1px solid var(--ui-line) !important;
    border-radius: 2px !important;
    background: var(--ui-raised) !important;
    color: var(--ui-text) !important;
    box-shadow: none !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    line-height: 1.4 !important;
  }
  & #insert-reinforcement-tray-launch::before { display: none !important; }
  & #insert-reinforcement-tray-launch::after {
    width: 5px !important;
    height: 5px !important;
    flex: 0 0 5px !important;
    margin: 0 3px 0 auto;
    border: 0;
    border-top: 1px solid currentColor;
    border-right: 1px solid currentColor;
    border-radius: 0 !important;
    background: transparent;
    mask: none;
    -webkit-mask: none;
    transform: rotate(45deg) !important;
  }
  & #insert-reinforcement-tray-launch:hover:not(:disabled) { background: var(--ui-hover) !important; }

  & [data-concrete-section-dimensions-fields] {
    display: grid;
    gap: 8px;
    margin-top: 4px;
    padding-top: 12px !important;
    border-top: 1px solid var(--ui-line-soft);
  }
  & .column-shape-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: center;
    gap: 10px;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
  }
  & .column-shape-section > label {
    color: var(--ui-muted) !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    text-transform: lowercase !important;
  }
  & .column-shape-section > label::first-letter { text-transform: uppercase; }
  & #insert-properties-fields .insert-properties-inline-grid:not(.materials-strength-grid) > .insert-properties-field { gap: 5px; }
  & .element-elevation-properties { margin-top: 4px; padding-top: 12px !important; border-top: 1px solid var(--ui-line-soft); }
  & .element-elevation-properties > .insert-properties-field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: center;
    gap: 6px 10px;
  }
  & .element-elevation-properties .insert-properties-field > .inline-row:not(label) { margin: 0; justify-self: start; padding-left: 8px; }
  & .element-elevation-properties .inline-row > span { font-size: 10px; color: var(--ui-muted); }
  & .element-elevation-properties strong { color: var(--ui-text); font-size: 11px; font-weight: 400; }
  & .element-elevation-properties label { grid-column: 1 / -1; }
  & #workspace-section-preview-card { border-bottom: 0 !important; }
  & .workspace-section-preview-header { border-color: var(--ui-line-soft) !important; border-radius: 0 !important; }
  & .workspace-section-preview-header .workspace-title { font-size: 12px !important; font-weight: 500 !important; color: var(--ui-muted) !important; }
  & .section-preview-figure-shell { border: 1px solid var(--ui-line-soft) !important; border-radius: 2px !important; background: var(--ui-surface) !important; }
}

/* Element inspectors follow the reading order: material, section, location.
   These are the original form controls and the original live section figure. */
body#structacad-workspace.cad-workspace #properties-dock {
  & .insert-properties-subtitle { margin: -4px 0 14px; color: var(--ui-muted); font-size: 11px; line-height: 1.4; }
  & #insert-properties-note:not([hidden]) { margin: 0 0 12px !important; font-size: 11px !important; }
  & .is-organized-inspector .insert-properties-note { color: var(--ui-muted); font-size: 11px; line-height: 1.5; font-weight: 400; }
  & .is-organized-inspector .insert-properties-note strong { font-size: inherit; font-weight: 500; }
  & .insert-properties-fields.is-organized-inspector {
    gap: 0 !important;
    & > .insert-properties-block:empty { display: none; }
    & > .properties-priority-material { padding-bottom: 12px !important; }
    & :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select) {
      height: 24px !important; min-height: 24px !important; padding-block: 3px !important;
      font-size: 11px !important; font-variant-numeric: tabular-nums;
    }
    & .materials-panel-flat-title { font-weight: 500; margin-bottom: 8px; letter-spacing: .02em; }
    & .materials-panel .modal-subsection { gap: 5px; }
    & .materials-strength-grid { gap: 5px !important; }
    & [data-concrete-section-dimensions-fields] { margin: 0; padding: 0 !important; border: 0; gap: 6px; }
    & .element-elevation-properties { border: 0; margin: 0; padding: 0 !important; }
    & .element-elevation-properties .insert-properties-field { gap: 3px 10px; }
    & .element-elevation-properties label { margin: 0 !important; }
    & :is(.beam-geometry-properties, .slab-geometry-properties) {
      border: 0 !important; margin: 0 !important; padding: 0 !important; gap: 6px !important; background: transparent !important;
    }
    & :is(.beam-geometry-properties, .slab-geometry-properties) > p { margin: 2px 0; color: var(--ui-muted); font-size: 11px; line-height: 1.4; }
    & .reinforcement-tray-launch-panel { order: 0; padding: 0 !important; }
    & #insert-reinforcement-tray-launch { min-height: 26px !important; padding: 3px 8px !important; }
  }
  & .inspector-section { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 10px 0; border-radius: 0 !important; }
  & .inspector-section > * { order: 0 !important; }
  & .inspector-section :is(.insert-properties-field-wide, label[for="insert-beam-section-shape"], label[for="insert-beam-plan-justification"], label[for="insert-beam-offset"]) {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: center; gap: 10px;
  }
  & #insert-properties-fields .inspector-section .insert-properties-inline-grid > label[for="insert-name"] { display: flex; flex-direction: column; align-items: stretch; gap: 5px; }
  & .is-organized-inspector .properties-priority-element-type:not(label) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: center; gap: 10px; }
  & .inspector-section .insert-properties-block:has(> #insert-beam-drawing-depth-extra) {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: center; gap: 6px 10px;
    & .checkbox-row { grid-column: 1 / -1; display: flex !important; align-items: center; gap: 6px; }
    & .checkbox-row input { flex: 0 0 auto; width: 13px !important; height: 13px !important; margin: 0 !important; }
    & .checkbox-row span { color: var(--ui-text); font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; }
    & .insert-properties-note { grid-column: 1 / -1; margin: 0; color: var(--ui-muted); font-size: 11px; line-height: 1.4; }
  }
  & .inspector-section-options {
    min-width: 0; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important;
    & summary { padding: 5px 0; color: var(--ui-muted); font-size: 11px; cursor: pointer; }
    & summary:hover { color: var(--ui-accent); }
    & > .insert-properties-block { margin-top: 8px; }
  }
  & .inspector-section + .inspector-section { border-top: 1px solid var(--ui-line-soft); }
  & .inspector-section-heading { margin: 0 0 2px; font-size: 10px; font-weight: 500; line-height: 1.4; text-transform: uppercase; letter-spacing: .02em; color: var(--ui-text); }
  & .inspector-section-preview-slot {
    & #workspace-section-preview-card { padding: 0 !important; margin: 0 !important; }
    & :is(.workspace-section-preview-header:not(:has([data-section-preview-action])), .section-preview-summary) { display: none !important; }
    & .workspace-section-preview-header:has([data-section-preview-action]) { padding: 0; border: 0 !important; }
    & .workspace-section-preview-header:has([data-section-preview-action]) .workspace-section-preview-copy { display: none; }
    & .section-preview-figure-shell { border: 0 !important; box-shadow: none !important; background: transparent !important; padding: 0 !important; margin: 0 !important; }
    & .section-preview-figure { min-height: 0 !important; height: 144px; padding: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; background: transparent !important; }
    & .section-preview-figure svg { width: 100%; height: 100%; }
  }
  & [data-inspector-type="col"] .inspector-section-preview-slot .section-preview-figure { height: 112px; }
  & .inspector-help {
    padding: 4px 0 0; border: 0 !important; border-radius: 0 !important; background: transparent !important; color: var(--ui-muted);
    & summary { cursor: pointer; padding: 3px 0; font-size: 11px; color: var(--ui-muted); }
    & summary:hover { color: var(--ui-accent); }
    & p { margin: 6px 0 0; font-size: 11px; line-height: 1.5; }
  }
  & .section-preview-diagram-concrete { fill: #b8bec2; stroke: #e2e6e8; }
  & .section-preview-diagram-bar { fill: #151b1e; stroke: #151b1e; }
  & .section-preview-diagram-tie { stroke: #333d44; }
  & .section-preview-diagram-dim { stroke: var(--ui-muted); }
  & :is(.section-preview-diagram-text, .section-preview-diagram-note) { fill: var(--ui-muted); font-weight: 400; }
}

/* Reinforcement is an inspector, not a compressed spreadsheet. */
body#structacad-workspace.cad-workspace #properties-dock {
  &.is-reinforcement-tab .properties-dock-body { padding: 0 !important; }
  /* Share the live section preview with the reinforcement view and keep it
     visible while the reinforcement controls scroll independently above it. */
  &.is-reinforcement-tab #workspace-reinforcement-tray { height: auto !important; }
  &.is-reinforcement-tab #workspace-section-preview-card:not([hidden]) {
    display: block !important;
    flex: 0 0 auto;
    padding: 10px 14px 14px !important;
    border-top: 1px solid var(--ui-line) !important;
    background: var(--ui-surface) !important;
  }
  &.is-reinforcement-tab #workspace-section-preview-card {
    & :is(.workspace-section-preview-header, .section-preview-summary) { display: none !important; }
    & .section-preview-figure-shell { margin: 0 !important; }
    & .section-preview-figure {
      height: clamp(140px, 25dvh, 220px);
      min-height: 0 !important;
    }
    & .section-preview-figure svg { width: 100%; height: 100%; }
  }
  /* Slab controls and their preview share one scroll area. A fixed preview
     must not squeeze the rib controls out of a short inspector. */
  &.is-reinforcement-tab:has(.workspace-slab-reinforcement-shell--stacked) {
    & .properties-dock-body { overflow-y: auto !important; }
    & #workspace-reinforcement-tray { flex: 0 0 auto !important; }
    & #workspace-reinforcement-tray-body {
      flex: 0 0 auto !important;
      overflow: visible !important;
    }
  }
  & .slab-cassette-properties > h4 { margin: 0 0 10px; }
  & #workspace-reinforcement-tray { background: var(--ui-surface) !important; }
  & #workspace-reinforcement-tray-body {
    padding: 0 14px 20px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    scrollbar-width: thin;
    scrollbar-color: var(--ui-line) transparent;
  }
  & #workspace-reinforcement-tray {
    & :is(.workspace-reinforcement-table-shell, .workspace-reinforcement-table-wrap, .workspace-reinforcement-tray-generic, .workspace-wall-reinforcement-stack, .workspace-slab-reinforcement-section, .workspace-reinforcement-tray-ported-body) {
      width: 100% !important; min-width: 0 !important; max-width: 100% !important;
      height: auto !important; min-height: 0 !important; max-height: none !important;
      margin: 0 !important; padding: 0 !important; overflow: visible !important;
      border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important;
    }
    & :is(label, th, td, legend, strong, h4) { text-transform: none !important; letter-spacing: normal !important; }
    & .workspace-reinforcement-table { width: 100% !important; min-width: 0 !important; max-width: 100% !important; table-layout: fixed !important; border-collapse: collapse; border: 0 !important; background: transparent !important; }
    & .workspace-stacked-reinforcement-table :is(tbody, tr)[hidden] { display: none !important; }
    & :is(th, td) { height: auto !important; min-width: 0 !important; overflow: visible !important; padding: 6px 3px !important; border: 0 !important; border-bottom: 1px solid var(--ui-line-soft) !important; border-radius: 0 !important; background: transparent !important; color: var(--ui-text) !important; font-size: 12px !important; font-weight: 400 !important; line-height: 1.4 !important; vertical-align: middle; white-space: normal !important; }
    & th { text-align: left !important; color: var(--ui-muted) !important; }
    & :is(select, input[type="number"]) { box-sizing: border-box; width: 100% !important; min-width: 0 !important; max-width: 100% !important; height: var(--ui-control-height) !important; min-height: var(--ui-control-height) !important; margin: 0 !important; padding: 5px 6px !important; border: 1px solid var(--ui-line) !important; border-radius: var(--ui-radius) !important; background-color: var(--ui-input) !important; color: var(--ui-text) !important; font-size: 12px !important; line-height: 1.4 !important; font-weight: 400 !important; text-align: left !important; }
    & input[type="number"] { appearance: textfield; }
    & input[type="number"]::-webkit-inner-spin-button { appearance: none; margin: 0; }
    & :is(select, input):disabled { opacity: .5; }
    & :is(input[type="checkbox"], input[type="radio"]) { width: 16px !important; height: 16px !important; min-height: 16px !important; flex: 0 0 16px; margin: 0 !important; }
    & .workspace-reinforcement-cell-controls { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: 100% !important; min-width: 0 !important; gap: 6px !important; align-items: center !important; }
    & :is(.workspace-beam-section-header-row, .workspace-stacked-reinforcement-section-header) th,
    & :is(.ui-rebar-section h4, .workspace-wall-reinforcement-section-title, .workspace-reinforcement-tray-section-title) { margin: 0 !important; padding: 18px 0 10px !important; height: auto !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; color: var(--ui-text) !important; font-size: 12px !important; font-weight: 600 !important; line-height: 1.4 !important; text-align: left !important; }
    & .workspace-beam-section-subheader-row th { font-size: 10px !important; line-height: 1.4 !important; padding: 6px 3px !important; }
    /* Main and additional bars share the same column and control widths. */
    & .workspace-beam-reinforcement-table col.workspace-beam-section-col-zone { width: 24%; }
    & .workspace-beam-reinforcement-table col.workspace-beam-section-col-additional { width: 42%; }
    & .workspace-beam-reinforcement-table col.workspace-beam-section-col-required { width: 34%; }
    & :is(.workspace-beam-main-row, .workspace-beam-longitudinal-row) .workspace-reinforcement-cell-controls { grid-template-columns: 38px minmax(0, 1fr); gap: 4px !important; max-width: none; margin: 0; }
    & .workspace-beam-reinforcement-table .workspace-reinforcement-heading-stack { align-items: flex-start; line-height: 1.4; white-space: normal; }
    & .workspace-beam-reinforcement-table .workspace-beam-data-row > th { white-space: nowrap !important; }
    & .workspace-beam-longitudinal-row > :is(th, td) { vertical-align: bottom; }
    & .workspace-beam-longitudinal-row > th { line-height: var(--ui-control-height) !important; }
    & .workspace-beam-longitudinal-demand-check { display: grid; grid-template-columns: minmax(0, 1fr) 14px; align-items: end; gap: 5px; min-width: 0; padding: 0; }
    & .workspace-beam-longitudinal-demand-values { display: grid; gap: 3px; flex: 1; min-width: 0; }
    & .workspace-beam-longitudinal-demand-values strong { font-size: 12px; font-weight: 500; color: var(--ui-text); line-height: 1.4; }
    & .workspace-beam-demand-status-icon { width: 14px; height: var(--ui-control-height); font-size: 15px; }
    & .workspace-beam-transverse-controls { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 4px !important; }
    & .workspace-beam-transverse-spacing-field { display: block; min-width: 0; position: relative; }
    & .workspace-beam-transverse-spacing-unit { display: flex; position: absolute; inset: 0 5px 0 auto; min-width: 0; padding: 0; font-size: 10px; color: var(--ui-muted); }
    & .workspace-beam-transverse-spacing-field .beam-transverse-spacing-input { padding-right: 22px !important; }
    & .workspace-beam-transverse-row .workspace-reinforcement-demand-cell { padding-right: 19px; box-sizing: border-box; }
    & .workspace-reinforcement-demand-cell { display: block; min-width: 0; }
    & .workspace-reinforcement-skin-cell { display: grid; gap: 4px; padding: 4px 0; text-align: left; }
    & .workspace-beam-skin-row .workspace-reinforcement-skin-cell { justify-content: start; }
    & .workspace-reinforcement-skin-cell strong { font-size: 12px; font-weight: 500; }
    & .workspace-reinforcement-skin-cell small { font-size: 11px; font-weight: 400; color: var(--ui-muted); }
    & .ui-rebar-section { margin: 0 !important; padding: 0 0 16px !important; border: 0 !important; border-bottom: 1px solid var(--ui-line) !important; border-radius: 0 !important; background: transparent !important; }
    & :is(.workspace-column-rebar-edit-grid, .ui-rebar-column-labels) { display: grid !important; grid-template-columns: 46px minmax(0, 1fr) minmax(0, 1fr) !important; grid-template-rows: none !important; width: 100% !important; gap: 8px !important; align-items: center; margin-left: 0 !important; padding: 0 !important; }
    & .ui-rebar-column-labels { margin-bottom: 6px; color: var(--ui-muted); font-size: 11px; }
    & .workspace-column-rebar-field-label { font-size: 12px; color: var(--ui-muted); font-weight: 400; border: 0 !important; background: transparent !important; border-radius: 0 !important; }
    & .workspace-column-corner-controls { display: grid !important; grid-template-columns: minmax(0, 1fr) 92px !important; grid-template-rows: none !important; width: 100% !important; max-width: none !important; align-items: center; gap: 8px !important; margin: 12px 0 0 !important; padding: 0 !important; }
    & :is(.workspace-column-corner-toggle, .workspace-column-central-toggle) { display: flex !important; justify-content: flex-start !important; align-items: center; gap: 8px; width: auto !important; margin: 0 !important; padding: 0 !important; min-width: 0; font-size: 12px; font-weight: 400; color: var(--ui-text); background: transparent !important; border: 0 !important; }
    & .workspace-column-corner-toggle > span { position: static !important; width: auto !important; font-size: 12px; line-height: 1.4; }
    & .ui-rebar-metrics { display: grid; gap: 10px; margin: 16px 0 0; }
    & .ui-rebar-metrics > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
    & .ui-rebar-metrics dt { margin: 0; color: var(--ui-muted); font-size: 12px; line-height: 1.4; }
    & .ui-rebar-metrics dd { margin: 0; font-size: 12px; font-weight: 500; text-align: right; white-space: nowrap; }
    & .workspace-column-ratio-result { display: flex; gap: 6px; align-items: center; justify-content: end; font-size: 12px; }
    & .workspace-column-ratio-value { font-size: 12px; font-weight: 500; }
    & .ui-rebar-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
    & :is(.ui-rebar-fields label, .ui-rebar-control-label) { display: grid !important; grid-template-columns: 1fr !important; gap: 6px; width: 100% !important; max-width: none !important; min-width: 0 !important; height: auto !important; margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; }
    & :is(.ui-rebar-fields label > span, .ui-rebar-control-label > span) { color: var(--ui-muted); font-size: 11px; line-height: 1.4; font-weight: 400; text-align: left; }
    & :is(.workspace-column-central-toggle, .workspace-column-central-controls) { grid-column: 1 / -1; }
    & .ui-rebar-fields > .workspace-column-central-toggle { display: flex !important; }
    & .workspace-column-central-controls { padding: 0 !important; border: 0 !important; background: transparent !important; }
    /* Slab and footing rows keep the direction, fields and area checks together. */
    & :is(.workspace-stacked-reinforcement-table, .workspace-foundation-reinforcement-table),
    & :is(.workspace-stacked-reinforcement-table, .workspace-foundation-reinforcement-table) tbody { display: block; }
    & .workspace-foundation-reinforcement-table thead,
    & .workspace-stacked-reinforcement-subheader { position: absolute; width: 1px !important; height: 1px !important; overflow: hidden; clip-path: inset(50%); }
    & :is(.workspace-stacked-reinforcement-table, .workspace-foundation-reinforcement-table) tbody > tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--ui-line-soft); border-radius: 0 !important; background: transparent !important; }
    & :is(.workspace-stacked-reinforcement-table, .workspace-foundation-reinforcement-table) :is(th, td) { display: block; width: auto !important; min-width: 0 !important; padding: 0 !important; border: 0 !important; }
    & :is(.workspace-stacked-reinforcement-table, .workspace-foundation-reinforcement-table) tbody > tr > th { grid-column: 1 / -1; font-weight: 500 !important; color: var(--ui-text) !important; }
    & .workspace-stacked-reinforcement-table td:not(.workspace-slab-area-cell) { grid-column: 1 / -1; }
    & .workspace-stacked-reinforcement-table .workspace-stacked-reinforcement-section-header { padding: 0; border: 0; }
    & .workspace-stacked-reinforcement-table .workspace-stacked-reinforcement-section-header th { padding: 18px 0 0 !important; }
    & [data-ui-label]::before { content: attr(data-ui-label); display: block; margin-bottom: 4px; color: var(--ui-muted); font-size: 11px; font-weight: 400; text-align: left; }
    & td[data-ui-label] { display: grid !important; align-content: start; }
    & .workspace-slab-area-cell { font-size: 12px !important; text-align: left !important; white-space: normal !important; }
    & .workspace-foundation-reinforcement-table .workspace-reinforcement-cell-controls { grid-template-columns: 1fr !important; height: auto !important; max-height: none !important; gap: 10px !important; }
    & .workspace-foundation-cover-row { margin-top: 14px; }
    & .workspace-wall-reinforcement-section { margin: 0 !important; padding: 0 0 16px !important; border: 0 !important; border-bottom: 1px solid var(--ui-line) !important; border-radius: 0 !important; background: transparent !important; }
    & .workspace-wall-reinforcement-section-body { padding: 0 !important; }
    & :is(.wall-beam-rebar-inline, .wall-beam-rebar-aux-grid, .insert-properties-inline-grid) { display: grid !important; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important; gap: 10px !important; }
    & :is(.wall-rebar-mode-row, .wall-rebar-group-row) { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 0; margin: 0; background: transparent; }
    & :is(.wall-rebar-amount-wrap, .insert-properties-field) { min-width: 0 !important; }
    & .wall-beam-rebar-hooks { margin-top: 12px; }
    & .workspace-reinforcement-tray-generic .modal-subsection { border: 0 !important; border-radius: 0 !important; background: transparent !important; padding: 0 !important; }
    & .workspace-reinforcement-tray-generic .reinforcement-panel { border: 0 !important; border-bottom: 1px solid var(--ui-line) !important; border-radius: 0 !important; background: transparent !important; margin: 14px 0 !important; box-shadow: none !important; }
    & .workspace-reinforcement-tray-generic .reinforcement-panel-summary { padding: 12px 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; color: var(--ui-text) !important; font-size: 12px !important; font-weight: 500 !important; }
    & .workspace-reinforcement-tray-generic .reinforcement-panel-body { padding: 0 0 12px !important; background: transparent !important; }
    & .workspace-reinforcement-tray-generic :is(.beam-main-rebar-grid, .beam-additional-grid, .beam-transverse-rebar-grid) { gap: 12px !important; }
    & :is(.wall-beam-rebar-hooks, .wall-beam-rebar-note, .wall-beam-rebar-aux-grid) { border-radius: 0 !important; background: transparent !important; }
    & :is(.wall-beam-rebar-hooks, .wall-beam-rebar-note, .wall-beam-rebar-aux-grid) :is(label, span) { border-radius: 0 !important; background: transparent !important; }
    & [hidden][hidden][hidden][hidden] { display: none !important; }
  }
}

/* Keep the corner actions on the same centerline, including account controls. */
body#structacad-workspace.cad-workspace #top-panel .top-panel-right {
  --top-panel-action-size: 38px;
  align-items: center !important;
  gap: 8px !important;
  padding: 0 !important;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-right > * {
  align-self: center !important;
  margin: 0 !important;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-right :is(button, a, .top-panel-separator) {
  height: var(--top-panel-action-size) !important;
  min-height: var(--top-panel-action-size) !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-right > .top-panel-icon-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: var(--top-panel-action-size) !important;
  min-width: var(--top-panel-action-size) !important;
  flex: 0 0 var(--top-panel-action-size) !important;
  padding: 0 !important;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-account-avatar {
  display: block;
  width: calc(var(--top-panel-action-size) - 8px);
  height: calc(var(--top-panel-action-size) - 8px);
  border-radius: 50%;
  object-fit: cover;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-account-link.has-account-avatar {
  border-radius: 50% !important;
}
body#structacad-workspace.cad-workspace #top-panel .has-account-avatar > .top-panel-icon-button-svg {
  display: none !important;
}

body#structacad-workspace.cad-workspace #top-panel #top-panel-profile-menu {
  position: fixed; z-index: 1000;
  top: var(--profile-menu-top, 48px); right: var(--profile-menu-right, 14px);
  width: min(280px, calc(100vw - 24px)); max-height: calc(100dvh - var(--profile-menu-top, 48px) - 12px);
  margin: 0 !important; padding: 6px; box-sizing: border-box; overflow-y: auto;
  background: var(--ui-surface); color: var(--ui-text);
  border: 1px solid var(--ui-line); border-radius: 8px;
  box-shadow: var(--ui-popover-shadow); text-align: left;
}
body#structacad-workspace.cad-workspace #top-panel #top-panel-profile-menu[hidden] { display: none !important; }
body#structacad-workspace.cad-workspace #top-panel .profile-menu-identity {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--ui-line-soft);
}
body#structacad-workspace.cad-workspace #top-panel .profile-menu-initials {
  display: grid; place-items: center; flex: 0 0 36px; height: 36px;
  background: var(--ui-selected); color: var(--ui-accent); border-radius: 50%; font-size: 13px; font-weight: 600;
}
body#structacad-workspace.cad-workspace #top-panel .profile-menu-user { display: grid; gap: 3px; min-width: 0; }
body#structacad-workspace.cad-workspace #top-panel .profile-menu-user strong { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
body#structacad-workspace.cad-workspace #top-panel #profile-menu-email { color: var(--ui-muted); font-size: 12px; overflow-wrap: anywhere; }
body#structacad-workspace.cad-workspace #top-panel #top-panel-profile-menu .profile-menu-item {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  width: 100% !important; min-width: 0 !important; max-width: none !important; flex: none !important;
  height: auto !important; min-height: 38px !important;
  margin: 0 !important; padding: 9px 10px !important; box-sizing: border-box;
  border: 0 !important; border-radius: 4px !important; box-shadow: none !important;
  background: transparent !important; color: var(--ui-text) !important;
  font-size: 12px !important; font-weight: 400 !important; line-height: 1.4; text-align: left;
  text-decoration: none; white-space: normal; cursor: pointer;
}
body#structacad-workspace.cad-workspace #top-panel #top-panel-profile-menu .profile-menu-item:is(:hover, :focus-visible):not(:disabled) {
  background: var(--ui-hover) !important;
}
body#structacad-workspace.cad-workspace #top-panel .profile-menu-item svg {
  width: 17px; height: 17px; flex: 0 0 17px; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; color: var(--ui-muted);
}
body#structacad-workspace.cad-workspace #top-panel .profile-menu-divider { height: 1px; margin: 6px 4px; background: var(--ui-line-soft); }
body#structacad-workspace.cad-workspace #top-panel #top-panel-profile-menu .profile-menu-logout { color: var(--danger, #f0a1a1) !important; }
body#structacad-workspace.cad-workspace #top-panel .profile-menu-logout svg { color: inherit; }
body#structacad-workspace.cad-workspace #top-panel .profile-menu-item:disabled { opacity: .55; cursor: wait; }
body#structacad-workspace.cad-workspace #top-panel #top-panel-profile-menu .profile-menu-item[hidden] { display: none !important; }
body#structacad-workspace.cad-workspace #top-panel #top-panel-account-link[aria-expanded="true"] { background: var(--ui-selected) !important; }

/* Top toolbar and floating menus. */
body#structacad-workspace.cad-workspace #top-panel {
  grid-template-columns: minmax(0, 1fr) auto !important;
  grid-template-rows: 48px 54px !important;
  padding: 0 !important;
  gap: 0 !important;
  background: var(--ui-bg) !important;
  border: 0 !important;
  border-bottom: 1px solid var(--ui-line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-left { grid-column: 1; grid-row: 1; padding-left: 14px; min-width: 0; }
body#structacad-workspace.cad-workspace #top-panel .top-panel-right { grid-column: 2; grid-row: 1; padding-right: 14px !important; gap: 8px !important; }
body#structacad-workspace.cad-workspace #top-panel .top-panel-center {
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: stretch;
  display: flex !important;
  align-items: center;
  width: 100% !important;
  max-width: none !important;
  padding: 3px 14px 3px 76px !important;
  border-top: 1px solid var(--ui-line-soft);
  border-radius: 0 !important;
}
body#structacad-workspace.cad-workspace #top-panel .workspace-quick-tools { gap: 18px !important; }
/* The toolbar is one continuous strip. Group labels and separators provide
   structure without enclosing individual tools in cards. Keep the logo intact. */
body#structacad-workspace.cad-workspace #top-panel :is(.top-panel-left, .top-panel-identity, .top-panel-identity-heading, .workspace-quick-tools-overlay, .workspace-quick-tools, .top-tool-group, .top-tool-button-row) {
  border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important;
}
body#structacad-workspace.cad-workspace #top-panel .top-tool-group { gap: 2px !important; }
body#structacad-workspace.cad-workspace #top-panel .top-tool-group + .top-tool-group { border-left: 1px solid var(--ui-line-soft) !important; padding-left: 18px; }
body#structacad-workspace.cad-workspace #top-panel :is(.workspace-tool-shortcut, .workspace-history-button, .top-panel-icon-button) {
  width: 32px !important; min-width: 32px !important; flex-basis: 32px !important;
  height: 28px !important; min-height: 28px !important;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-right .top-panel-icon-button { border-color: transparent !important; }
body#structacad-workspace.cad-workspace #top-panel .workspace-view-mode-button.is-active {
  color: var(--ui-accent) !important; background: transparent !important;
  border-radius: 0 !important; box-shadow: inset 0 -2px var(--ui-accent) !important;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-export-pair { display: flex; flex-direction: row-reverse; gap: 8px; }
body#structacad-workspace.cad-workspace #top-panel #workspace-export-combined-btn {
  width: max-content !important; min-width: 0 !important; flex: 0 0 auto !important;
  height: 30px !important; min-height: 30px !important;
  padding: 0 12px !important; gap: 8px !important;
  border-radius: 4px !important;
  box-shadow: 0 1px 2px #0003, inset 0 1px 0 #ffffff14 !important;
  background: var(--ui-action-bg) !important; border-color: var(--ui-action-border) !important; color: var(--ui-action-text) !important;
}
body#structacad-workspace.cad-workspace #top-panel #workspace-export-combined-btn:hover:not(:disabled) { background: var(--ui-action-hover) !important; }
body#structacad-workspace.cad-workspace #top-panel .top-panel-export-download-icon {
  display: block; width: 16px; height: 16px; flex: 0 0 16px;
}
body#structacad-workspace.cad-workspace #top-panel #workspace-export-combined-label {
  font-weight: 600 !important; line-height: 1 !important;
}
body#structacad-workspace.cad-workspace #top-panel #workspace-spreadsheet-download-btn {
  min-height: 30px !important; height: 30px !important; padding: 0 10px !important;
  background: transparent !important; border: 1px solid var(--ui-line) !important; color: var(--ui-text) !important;
}
body#structacad-workspace.cad-workspace .top-panel-project-name {
  min-width: 0; max-width: 260px; margin-left: 8px; padding-left: 20px;
  border-left: 1px solid var(--ui-line); border-radius: 0 !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ui-text); font-size: 12px;
}
body#structacad-workspace.cad-workspace #top-panel-project-name {
  display: block; width: 100%; min-width: 0; height: 22px; padding: 0;
  border: 0 !important; border-radius: 0 !important; outline: none !important;
  background: transparent !important; box-shadow: none !important;
  color: inherit; font: inherit; text-overflow: ellipsis;
}
body#structacad-workspace.cad-workspace #top-panel-project-name:hover,
body#structacad-workspace.cad-workspace #top-panel-project-name:focus {
  box-shadow: inset 0 -1px var(--ui-accent) !important;
}
body#structacad-workspace.cad-workspace #top-panel-project-name[aria-invalid="true"] {
  box-shadow: inset 0 -1px #e77979 !important;
}
body#structacad-workspace.cad-workspace #tool-display.is-tool-active { color: var(--ui-accent) !important; }
@media (max-width: 900px) {
  body#structacad-workspace.cad-workspace .top-panel-project-name { display: none; }
}
/* Keep the logo beside both lines, with the plan attached to the wordmark. */
body#structacad-workspace.cad-workspace #top-panel .top-panel-left {
  display: flex !important;
  align-items: center !important;
  gap: 11px !important;
}
body#structacad-workspace.cad-workspace #top-panel .cad-brand-mark {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 6px;
  border-radius: var(--ui-radius);
  box-shadow: 0 2px 6px #0002, inset 0 1px 0 #fff;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-identity {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  min-width: 0;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-identity-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-brand {
  font-size: 18px !important;
  font-weight: 650 !important;
  letter-spacing: -.45px !important;
  line-height: 20px !important;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-plan-badge {
  color: var(--ui-accent) !important;
  font-size: 10px !important;
  letter-spacing: .07em;
  text-shadow: none;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-plan-badge-label:not(.is-upgrade) {
  display: inline-flex;
  align-items: center;
  min-height: 19px;
  padding: 0 2px;
  box-sizing: border-box;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--ui-accent) !important;
  font-weight: 500;
  opacity: 1;
}
/* Keep the upgrade action compact despite the shared toolbar button resets. */
body#structacad-workspace.cad-workspace #top-panel #top-panel-plan-badge-label.is-upgrade {
  --pro-button-bg: #ecd49c;
  --pro-button-hover: #f5dfac;
  --pro-button-active: #dfc287;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: auto !important;
  min-width: 0 !important;
  height: 28px !important;
  min-height: 28px !important;
  margin: 0 !important;
  padding: 0 11px !important;
  box-sizing: border-box;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  background: var(--pro-button-bg) !important;
  color: #35290f !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
  text-transform: none;
  text-shadow: none;
  white-space: nowrap;
  cursor: pointer;
  transform: none !important;
  transition: background-color .15s ease;
}
body#structacad-workspace.cad-workspace #top-panel #top-panel-plan-badge-label.is-upgrade::after {
  content: "";
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8h10M9 4l4 4-4 4' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
body#structacad-workspace.cad-workspace #top-panel #top-panel-plan-badge-label.is-upgrade:hover:not(:disabled) {
  background: var(--pro-button-hover) !important;
}
body#structacad-workspace.cad-workspace #top-panel #top-panel-plan-badge-label.is-upgrade:active:not(:disabled) {
  background: var(--pro-button-active) !important;
}
body#structacad-workspace.cad-workspace #top-panel #top-panel-plan-badge-label.is-upgrade:focus-visible {
  outline: 2px solid var(--ui-focus) !important;
  outline-offset: 3px;
}
body#structacad-workspace.cad-workspace[data-ui-theme="light"] #top-panel #top-panel-plan-badge-label.is-upgrade {
  --pro-button-bg: #f4e6c5;
  --pro-button-hover: #eed7a4;
  --pro-button-active: #e7c787;
}
@media (prefers-reduced-motion: reduce) {
  body#structacad-workspace.cad-workspace #top-panel #top-panel-plan-badge-label.is-upgrade { transition: none; }
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-project-quota {
  color: var(--ui-muted);
  font-size: 11px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 14px;
}
body#structacad-workspace.cad-workspace .top-tool-group-label { color: var(--ui-muted) !important; font-size: 10px !important; font-weight: 500 !important; letter-spacing: .04em !important; }
body#structacad-workspace.cad-workspace #top-panel :is(.workspace-tool-shortcut, .workspace-history-button, .top-panel-link, .workspace-3d-toggle) {
  background: transparent !important;
  border-color: transparent !important;
  color: var(--ui-muted) !important;
  box-shadow: none !important;
  border-radius: var(--ui-radius) !important;
}
body#structacad-workspace.cad-workspace #top-panel :is(.workspace-tool-shortcut, .workspace-history-button, .top-panel-link, .workspace-3d-toggle):hover:not(:disabled) { background: var(--ui-hover) !important; color: var(--ui-text) !important; }
body#structacad-workspace.cad-workspace #top-panel .workspace-tool-shortcut:is(.active-tool, .is-active) {
  background: transparent !important; border-color: transparent !important;
  color: var(--ui-accent) !important; border-radius: 0 !important;
  box-shadow: inset 0 -2px var(--ui-accent) !important;
}
body#structacad-workspace.cad-workspace #top-panel :is(.top-panel-dxf-button, .top-panel-excel-button) { font-size: 12px !important; font-weight: 500 !important; box-shadow: none !important; }
body#structacad-workspace.cad-workspace :is(.top-panel-options-popover, .workspace-light-menu, .workspace-overlap-picker, .cad-help-menu, .context-menu, .workspace-context-menu, .etabs-help-popover) {
  background: var(--ui-surface) !important;
  color: var(--ui-text) !important;
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius) !important;
  box-shadow: var(--ui-popover-shadow) !important;
  padding: 8px !important;
  max-width: calc(100vw - 24px);
}
body#structacad-workspace.cad-workspace :is(.top-panel-options-popover, .workspace-light-menu, .cad-help-menu, .workspace-overlap-picker) :is(button, a, label) {
  color: var(--ui-text) !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  text-transform: none !important;
}
body#structacad-workspace.cad-workspace :is(.workspace-level-picker-option, .workspace-light-menu-item, .cad-help-menu-item):hover { background: var(--ui-hover) !important; }
body#structacad-workspace.cad-workspace :is(.cad-status-bar, .workspace-status-bar) { background: var(--ui-bg) !important; border-top-color: var(--ui-line) !important; }

/* Shared dialog shell. Technical drawings retain their own preview surfaces. */
body#structacad-workspace.cad-workspace :is(.modal-content, .app-dialog-content, .workspace-entry-card, .workspace-guide-card, .import-provider-dialog, .export-dock-modal-content) {
  border: 1px solid var(--ui-line) !important;
  border-radius: var(--ui-radius) !important;
  background: var(--ui-surface) !important;
  color: var(--ui-text) !important;
  box-shadow: var(--ui-dialog-shadow) !important;
  max-height: calc(100dvh - 40px) !important;
}
body#structacad-workspace.cad-workspace :is(.modal-title, .app-dialog-title) {
  margin-top: 0 !important;
  color: var(--ui-text) !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 1.3 !important;
  text-transform: none !important;
  letter-spacing: -.35px !important;
}
body#structacad-workspace.cad-workspace .overlay-kicker { color: var(--ui-muted) !important; font-size: 11px !important; font-weight: 500 !important; letter-spacing: .07em !important; }
body#structacad-workspace.cad-workspace :is(.modal-actions, .app-dialog-actions) { gap: 8px !important; border-color: var(--ui-line) !important; }
body#structacad-workspace.cad-workspace :is(.modal-actions, .app-dialog-actions) button { min-height: 36px; border-radius: var(--ui-radius) !important; box-shadow: none !important; font-size: 12px !important; font-weight: 500 !important; }
body#structacad-workspace.cad-workspace :is(.system-modal-tabs, .export-dock-modal-tabs) { border: 0 !important; border-bottom: 1px solid var(--ui-line) !important; border-radius: 0 !important; background: transparent !important; padding: 0 !important; gap: 16px !important; }
body#structacad-workspace.cad-workspace :is(.system-modal-tabs, .export-dock-modal-tabs) button { border-radius: 0 !important; background: transparent !important; border: 0 !important; color: var(--ui-muted) !important; padding: 10px 4px !important; }
body#structacad-workspace.cad-workspace :is(.system-modal-tabs, .export-dock-modal-tabs) button:is(.is-active, [aria-selected="true"]) { color: var(--ui-accent) !important; box-shadow: inset 0 -2px var(--ui-accent) !important; }
body#structacad-workspace.cad-workspace :is(.system-modal-content, .export-dock-modal-content, .app-dialog-content) :is(.menu-section, .reinforcement-panel, .export-dock-panel, .etabs-import-settings-section, .etabs-import-settings-card, .beam-skin-normative-card) {
  border: 0 !important;
  border-bottom: 1px solid var(--ui-line) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* Skin reinforcement uses a quiet settings form within the shared dialog. */
body#structacad-workspace.cad-workspace #app-dialog-overlay:has(.beam-skin-normative-modal) {
  & .app-dialog-content { padding: 24px; overflow-y: auto; }
  & .overlay-header { padding: 0 0 8px !important; margin: 0 !important; border: 0 !important; }
  & .overlay-kicker { margin: 0 0 5px; font-size: 12px !important; letter-spacing: 0 !important; text-transform: none; }
  & .modal-title { padding: 0; font-size: 16px !important; letter-spacing: -.2px !important; }
  & .app-dialog-body { margin-top: 8px; }
  & :is(.beam-skin-normative-row, .beam-skin-normative-exclude) { border-radius: 0 !important; }
  & .beam-skin-normative-label { color: var(--ui-text); font-size: 14px; font-weight: 500; }
  & .beam-skin-normative-note { max-width: none; font-size: 12px; font-weight: 400; }
  & .beam-skin-normative-exclude { font-size: 12px; font-weight: 400; color: var(--ui-text); }
  & .beam-skin-normative-exclude span { font-size: inherit; font-weight: inherit; color: inherit; }
  & .beam-skin-normative-control { margin: 0; font-size: 14px !important; }
  & .app-dialog-actions { justify-content: flex-end; margin-top: 24px; }
  & #app-dialog-confirm-btn {
    width: auto; flex: 0 0 auto; min-width: 84px; padding: 8px 18px;
    border: 1px solid var(--ui-line) !important; background: var(--ui-raised) !important; color: var(--ui-text) !important;
  }
  & #app-dialog-confirm-btn:hover { background: var(--ui-hover) !important; }
}

/* A spacious start panel, with one complete action per card. */
body#structacad-workspace.cad-workspace #workspace-entry-overlay {
  padding: 24px !important;
  background: #080f1bb3 !important;
  backdrop-filter: blur(8px) !important;
  & .workspace-entry-card {
    width: min(800px, 100%) !important;
    padding: 28px !important;
    max-height: calc(100dvh - 48px) !important;
    overflow-y: auto !important;
    border: 1px solid color-mix(in srgb, var(--ui-text) 16%, var(--ui-surface)) !important;
    border-radius: 24px !important;
    background: var(--ui-surface) !important;
    box-shadow: 0 32px 100px #0005, 0 8px 24px #0003 !important;
  }
  & .workspace-entry-header { display: block !important; margin: 0 0 20px !important; text-align: left !important; }
  & .workspace-entry-brand-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
  & .workspace-entry-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ui-text); font-size: 14px; font-weight: 650; letter-spacing: -.3px; }
  & .workspace-entry-brand img { display: block; width: 34px; height: 38px; object-fit: contain; border-radius: 0 !important; }
  & .workspace-entry-brand .workspace-entry-brand-light { display: none; }
  & .workspace-entry-header .overlay-kicker {
    margin: 0 !important; padding: 5px 9px; border: 1px solid var(--ui-line-soft); border-radius: 6px !important;
    font-size: 10px !important; letter-spacing: .08em !important; line-height: 1.4; text-align: right;
  }
  & .workspace-entry-header .modal-title { margin: 0 !important; font-size: 30px !important; font-weight: 650 !important; letter-spacing: -.9px !important; text-align: left !important; }
  & .workspace-entry-copy { margin: 10px 0 0 !important; max-width: none !important; text-align: left !important; color: var(--ui-muted) !important; font-size: 14px !important; line-height: 1.6 !important; }
  & .workspace-entry-grid { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px !important; }
  & .workspace-entry-option {
    --ui-radius: 14px;
    --entry-accent: var(--ui-accent);
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 44px auto 1fr auto !important;
    align-items: start !important;
    justify-items: start;
    gap: 10px !important;
    min-width: 0;
    min-height: 202px !important;
    margin: 0 !important;
    padding: 20px !important;
    border: 1px solid var(--ui-line-soft) !important;
    border-radius: 14px !important;
    background: color-mix(in srgb, var(--ui-raised) 48%, var(--ui-surface)) !important;
    box-shadow: none !important;
    text-align: left !important;
    filter: none !important;
    transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
  }
  & .workspace-entry-option-scratch { border-color: color-mix(in srgb, var(--entry-accent) 45%, var(--ui-line-soft)) !important; background: color-mix(in srgb, var(--entry-accent) 7%, var(--ui-surface)) !important; }
  & .workspace-entry-option-midas { --entry-accent: #70c8bb; }
  & .workspace-entry-option-engsolutions { --entry-accent: #d9b37b; }
  & .workspace-entry-option:hover { border-color: var(--entry-accent) !important; background: color-mix(in srgb, var(--entry-accent) 10%, var(--ui-surface)) !important; box-shadow: 0 4px 16px #0001 !important; }
  & .workspace-entry-option:focus-visible { outline: 2px solid var(--ui-focus) !important; outline-offset: 3px; }
  & .workspace-entry-option::before, & .workspace-entry-option::after, & .workspace-entry-option-badge { display: none !important; }
  & .workspace-entry-option-media {
    display: grid !important; place-items: center; width: 64px !important; height: 44px !important; min-height: 0; margin: 0;
    border: 1px solid #dce3eb; border-radius: 9px !important;
    background: #fff !important;
  }
  & .workspace-entry-option-media img { display: block; width: auto; height: 36px; max-width: 56px; object-fit: contain; object-position: center; padding: 0; filter: none; border-radius: 0 !important; }
  & .workspace-entry-option-media-engsolutions { width: 156px !important; }
  & .workspace-entry-option-media-engsolutions img { width: 140px; max-width: 140px; height: 26px; }
  & .workspace-entry-option-title { margin: 0 !important; font-size: 16px !important; line-height: 1.4 !important; font-weight: 600 !important; letter-spacing: -.25px; color: var(--ui-text) !important; }
  & .workspace-entry-option-copy { margin: 0 !important; max-width: none !important; font-size: 13px !important; line-height: 1.55 !important; font-weight: 400 !important; color: var(--ui-muted) !important; }
  & .workspace-entry-option-action {
    display: inline-flex !important; align-items: center; gap: 8px; min-height: 0; margin: 4px 0 0; padding: 0;
    border: 0 !important; border-radius: 0; background: transparent !important; color: var(--entry-accent) !important; font-size: 12px; font-weight: 600; line-height: 1.5;
  }
  & .workspace-entry-option-action::after { content: ""; width: 14px; height: 14px; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h16m-6-6 6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat; }
  & .workspace-entry-footer { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--ui-line-soft); border-radius: 0 !important; }
  & .workspace-entry-footnote { flex: 1; max-width: 48ch !important; margin: 0 !important; color: var(--ui-muted) !important; font-size: 11px !important; line-height: 1.6; text-align: left !important; font-style: normal !important; }
  & #workspace-entry-skip-btn { --ui-radius: 8px; flex: 0 0 auto; width: auto; min-height: 40px; margin: 0; padding: 8px 12px; border: 1px solid transparent !important; border-radius: 8px !important; background: transparent !important; color: var(--ui-text) !important; font-size: 12px; font-weight: 500 !important; }
  & #workspace-entry-skip-btn:hover { border-color: var(--ui-line) !important; background: var(--ui-raised) !important; }
}
body#structacad-workspace.cad-workspace[data-ui-theme="light"] #workspace-entry-overlay {
  & .workspace-entry-brand .workspace-entry-brand-dark { display: none; }
  & .workspace-entry-brand .workspace-entry-brand-light { display: block; }
  & .workspace-entry-option-midas { --entry-accent: #227d70; }
  & .workspace-entry-option-engsolutions { --entry-accent: #926423; }
}
@media (max-width: 600px) {
  body#structacad-workspace.cad-workspace #workspace-entry-overlay {
    padding: 12px !important;
    & .workspace-entry-card { padding: 22px !important; max-height: calc(100dvh - 24px) !important; border-radius: 18px !important; }
    & .workspace-entry-brand-row { gap: 10px; margin-bottom: 20px; }
    & .workspace-entry-header .modal-title { font-size: 25px !important; }
    & .workspace-entry-copy { font-size: 13px !important; }
    & .workspace-entry-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 10px !important; }
    & .workspace-entry-option { grid-template-columns: 52px minmax(0, 1fr) !important; grid-template-rows: auto auto auto !important; column-gap: 14px !important; row-gap: 6px !important; min-height: 0 !important; padding: 16px !important; }
    & .workspace-entry-option-media { grid-column: 1; grid-row: 1 / 4; width: 52px !important; height: 44px !important; }
    & .workspace-entry-option-media img { max-width: 44px; }
    & .workspace-entry-option-engsolutions { grid-template-rows: 44px auto auto auto !important; }
    & .workspace-entry-option-media-engsolutions { grid-column: 1 / -1; grid-row: 1; width: 156px !important; }
    & .workspace-entry-option-media-engsolutions img { max-width: 140px; }
    & :is(.workspace-entry-option-title, .workspace-entry-option-copy, .workspace-entry-option-action) { grid-column: 2; }
    & .workspace-entry-option-engsolutions :is(.workspace-entry-option-title, .workspace-entry-option-copy, .workspace-entry-option-action) { grid-column: 1 / -1; }
    & .workspace-entry-option-title { font-size: 15px !important; }
    & .workspace-entry-option-copy { font-size: 12px !important; }
    & .workspace-entry-option-action { margin-top: 2px; }
    & .workspace-entry-footer { flex-direction: column-reverse; gap: 12px; margin-top: 18px; padding-top: 14px; }
    & #workspace-entry-skip-btn { width: 100%; border-color: var(--ui-line-soft) !important; }
    & .workspace-entry-footnote { text-align: center !important; }
  }
}

/* Quick start: clear progress and a recoverable exit, in both workspace themes. */
body#structacad-workspace.cad-workspace {
  & #workspace-guide-overlay { align-items: center; justify-content: center; padding: 20px; }
  & :is(.workspace-entry-card, .workspace-guide-card) { max-height: calc(100dvh - 40px); }
  & .workspace-guide-card { width: min(640px, 100%); padding: 28px; }
  & .workspace-entry-footer { display: grid; gap: 14px; }
  & #workspace-entry-skip-btn { width: 100%; min-height: 44px; margin: 0; }
  & .workspace-guide-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
  & .workspace-guide-header .overlay-kicker { margin: 0; }
  & #workspace-guide-change-btn { width: auto; min-height: 36px; margin: 0; padding: 6px 10px; background: transparent; color: var(--ui-accent); }
  & #workspace-guide-change-btn[hidden] { display: none !important; }
  & .workspace-guide-progress { display: flex; gap: 6px; list-style: none; margin: 12px 0 24px; padding: 0; }
  & .workspace-guide-progress li { flex: 1; min-width: 0; }
  & .workspace-guide-progress button {
    display: flex; align-items: center; justify-content: flex-start; gap: 6px;
    width: 100%; min-width: 0; min-height: 44px; margin: 0; padding: 8px;
    border: 1px solid var(--ui-line); background: var(--ui-raised); color: var(--ui-muted); font-size: 12px;
  }
  & .workspace-guide-progress button[aria-current="step"] { border-color: var(--ui-accent) !important; background: var(--ui-selected) !important; color: var(--ui-text) !important; }
  & .workspace-guide-progress button span { display: grid; place-items: center; flex: none; width: 20px; min-width: 20px; height: 20px; border: 1px solid currentColor; border-radius: 50%; font-size: 11px; }
  & #workspace-guide-title { margin: 0; font-size: 22px !important; line-height: 1.3; }
  & :is(#workspace-entry-title, #workspace-guide-title):focus { outline: none; }
  & .workspace-guide-intro { padding: 0; border: 0; background: transparent; color: var(--ui-text); font-size: 14px; font-weight: 400 !important; line-height: 1.7; }
  & .workspace-guide-hint { margin: 20px 0 0; color: var(--ui-muted); font-size: 12px; line-height: 1.5; }
  & .workspace-guide-actions { border-top: 1px solid var(--ui-line); border-radius: 0; padding-top: 16px; }
  & .workspace-guide-actions button { min-height: 44px; padding: 8px 14px; }
  & #workspace-guide-skip-btn { margin-right: auto; }
  & #cad-help-menu { width: 230px; }
}
@media (max-width: 520px) {
  body#structacad-workspace.cad-workspace {
    & :is(#workspace-entry-overlay, #workspace-guide-overlay) { padding: 12px !important; }
    & :is(.workspace-entry-card, .workspace-guide-card) { max-height: calc(100dvh - 24px); padding: 18px !important; }
    & .workspace-guide-progress { gap: 4px; }
    & .workspace-guide-progress button { flex-direction: column; gap: 5px; padding: 8px 2px; font-size: 10px; }
    & .workspace-guide-actions { gap: 8px; }
    & #workspace-guide-skip-btn { flex-basis: 100%; }
    & :is(#workspace-guide-prev-btn, #workspace-guide-next-btn) { flex: 1; }
  }
}
@media (prefers-reduced-motion: reduce) {
  body#structacad-workspace.cad-workspace :is(#workspace-entry-overlay, #workspace-guide-overlay) * { transition: none !important; animation: none !important; }
}

/* Import providers: a list of operations and a separate connection action. */
body#structacad-workspace.cad-workspace .import-provider-dialog { width: min(620px, calc(100vw - 32px)) !important; padding: 0 !important; overflow: auto !important; }
body#structacad-workspace.cad-workspace .import-provider-dialog-shell { padding: 24px !important; background: transparent !important; }
body#structacad-workspace.cad-workspace .import-provider-dialog-header { padding: 0 0 18px !important; margin: 0 !important; border-bottom: 1px solid var(--ui-line) !important; align-items: flex-start !important; }
body#structacad-workspace.cad-workspace .import-provider-dialog-header .overlay-kicker { display: none !important; }
body#structacad-workspace.cad-workspace .import-provider-dialog-note { margin: 8px 0 0 !important; color: var(--ui-muted) !important; }
body#structacad-workspace.cad-workspace .import-provider-dialog-close { min-width: 30px !important; width: 30px !important; height: 30px !important; border: 0 !important; border-radius: var(--ui-radius) !important; background: transparent !important; color: var(--ui-muted) !important; font-size: 24px !important; box-shadow: none !important; }
body#structacad-workspace.cad-workspace .import-provider-dialog-options { display: grid !important; grid-template-columns: 1fr !important; gap: 0 !important; margin: 10px 0 0 !important; }
body#structacad-workspace.cad-workspace .import-provider-card-wrap { display: grid !important; grid-template-columns: minmax(0, 1fr) 30px !important; align-items: center; gap: 4px; border-bottom: 1px solid var(--ui-line-soft) !important; }
body#structacad-workspace.cad-workspace .import-provider-dialog .grid-system-launch {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  min-height: 68px !important;
  margin: 0 !important;
  padding: 14px 8px !important;
  border: 0 !important;
  border-radius: var(--ui-radius) !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--ui-text) !important;
  text-transform: none !important;
  font-size: 14px !important;
  text-align: left !important;
}
body#structacad-workspace.cad-workspace .import-provider-dialog .grid-system-launch:hover:enabled { background: var(--ui-hover) !important; }
body#structacad-workspace.cad-workspace .import-provider-card-title { font-size: 14px !important; font-weight: 500 !important; line-height: 1.4 !important; color: var(--ui-text) !important; }
body#structacad-workspace.cad-workspace .import-provider-card-description { margin-top: 4px; font-size: 12px !important; font-weight: 400 !important; line-height: 1.5 !important; color: var(--ui-muted) !important; }
body#structacad-workspace.cad-workspace .import-provider-card-help { position: static !important; width: 26px !important; height: 26px !important; border: 1px solid var(--ui-line) !important; background: transparent !important; color: var(--ui-muted) !important; box-shadow: none !important; }
body#structacad-workspace.cad-workspace .import-provider-bridge-panel { padding: 18px 0 0 !important; margin: 6px 0 0 !important; border: 0 !important; border-top: 1px solid var(--ui-line) !important; border-radius: 0 !important; background: transparent !important; }
body#structacad-workspace.cad-workspace .import-provider-bridge-circle {
  display: flex !important; flex-direction: row !important; align-items: center !important; justify-content: center !important; gap: 12px !important;
  width: 100% !important; height: auto !important; min-height: 42px !important; padding: 10px 16px !important;
  border: 1px solid var(--ui-line) !important; border-radius: var(--ui-radius) !important; background: var(--ui-selected) !important; color: var(--ui-text) !important; box-shadow: none !important;
}
body#structacad-workspace.cad-workspace .import-provider-bridge-label { font-size: 12px !important; font-weight: 500 !important; }
body#structacad-workspace.cad-workspace :is(.import-provider-card-title, .import-provider-bridge-label) { text-transform: none !important; letter-spacing: 0 !important; }
body#structacad-workspace.cad-workspace .import-provider-dialog-note { width: auto !important; max-width: none !important; }
body#structacad-workspace.cad-workspace .import-provider-dialog-header { border-radius: 0 !important; }
body#structacad-workspace.cad-workspace .import-provider-card-wrap { border-radius: 0 !important; }
body#structacad-workspace.cad-workspace #top-panel .top-panel-spreadsheet-button {
  background: transparent !important; border: 1px solid var(--ui-line) !important;
  color: var(--ui-text) !important; font-size: 12px !important; border-radius: var(--ui-radius) !important; box-shadow: none !important;
}
body#structacad-workspace.cad-workspace #top-panel .top-panel-export-button {
  background: var(--ui-action-bg) !important; border: 1px solid var(--ui-action-border) !important;
  color: var(--ui-action-text) !important; font-size: 12px !important; border-radius: var(--ui-radius) !important; box-shadow: none !important;
}
body#structacad-workspace.cad-workspace #top-panel :is(.top-panel-export-button-label, .top-panel-spreadsheet-label) { font-weight: 500 !important; }

/* Export options use separators and one clear primary download. */
body#structacad-workspace.cad-workspace .export-dock-modal-content { overflow: hidden !important; }
body#structacad-workspace.cad-workspace .export-dock-modal-header { padding: 20px 24px !important; background: var(--ui-surface) !important; border-bottom: 1px solid var(--ui-line) !important; gap: 16px !important; }
body#structacad-workspace.cad-workspace .export-dock-modal-header .overlay-kicker { display: none !important; }
body#structacad-workspace.cad-workspace .export-dock-modal-body { padding: 8px 24px 24px !important; background: var(--ui-surface) !important; }
body#structacad-workspace.cad-workspace .export-dock-modal-body :is(.sidebar-dropdown-stack, .sidebar-dropdown-menu, .sidebar-dropdown-body, .export-dock-main-body, .export-dock-panels) { background: transparent !important; border-radius: 0 !important; box-shadow: none !important; }
body#structacad-workspace.cad-workspace .export-dock-modal-body .sidebar-dropdown-menu { border: 0 !important; border-bottom: 1px solid var(--ui-line) !important; margin: 0 !important; }
body#structacad-workspace.cad-workspace .export-dock-modal-body .sidebar-dropdown-summary { min-height: 44px !important; padding: 12px 0 !important; background: transparent !important; color: var(--ui-text) !important; border: 0 !important; font-size: 12px !important; font-weight: 500 !important; text-transform: none !important; }
body#structacad-workspace.cad-workspace .export-dock-modal-body .sidebar-dropdown-body { padding: 8px 0 16px !important; }
body#structacad-workspace.cad-workspace .export-dock-modal-body :is(label, .export-dock-option-label, .export-dock-item-label) { color: var(--ui-text) !important; font-size: 12px !important; font-weight: 400 !important; }
body#structacad-workspace.cad-workspace .export-dock-modal-header { border-radius: 0 !important; text-align: left !important; }
body#structacad-workspace.cad-workspace .export-dock-modal-header :is(.modal-title, .field-note) { text-align: left !important; max-width: none !important; width: auto !important; }
body#structacad-workspace.cad-workspace .export-dock-modal-body .sidebar-dropdown-summary { text-align: left !important; }
body#structacad-workspace.cad-workspace .export-dock-modal-body .export-dock-summary-label { text-align: left !important; }
body#structacad-workspace.cad-workspace .export-item-row {
  min-height: 40px !important; padding: 8px 0 !important;
  border: 0 !important; border-bottom: 1px solid var(--ui-line-soft) !important;
  border-radius: 0 !important; background: transparent !important; color: var(--ui-text) !important;
}
body#structacad-workspace.cad-workspace .export-item-label { text-align: left !important; font-size: 12px !important; font-weight: 400 !important; color: var(--ui-text) !important; }
body#structacad-workspace.cad-workspace :is(.cad-panel-header, .properties-dock-header, .cad-module-steel) { border-radius: 0 !important; }
body#structacad-workspace.cad-workspace #properties-dock .insert-properties-field > span { color: var(--ui-muted) !important; font-size: 12px !important; font-weight: 400 !important; text-transform: none !important; letter-spacing: 0 !important; }

@media (max-height: 720px) {
  body#structacad-workspace.cad-workspace #mode-dock .dock-button { min-height: 49px !important; flex-basis: 49px !important; gap: 5px !important; }
  body#structacad-workspace.cad-workspace #mode-dock #sidebar-mode-manage { min-height: 40px !important; flex-basis: 40px !important; }
}
@media (max-width: 760px) {
  body#structacad-workspace.cad-workspace { --sidebar-width: min(292px, calc(100vw - 64px)); --properties-dock-width: min(312px, calc(100vw - 64px)); }
  body#structacad-workspace.cad-workspace #sidebar { max-width: calc(100vw - 64px) !important; }
  body#structacad-workspace.cad-workspace .workspace-entry-card { padding: 20px !important; }
  body#structacad-workspace.cad-workspace :is(.modal-content, .app-dialog-content) { max-width: calc(100vw - 24px) !important; }
  body#structacad-workspace.cad-workspace .export-dock-modal-header { flex-wrap: wrap !important; padding: 16px !important; }
  body#structacad-workspace.cad-workspace .export-dock-modal-body { padding: 8px 16px 16px !important; }
  body#structacad-workspace.cad-workspace .import-provider-dialog-shell { padding: 20px !important; }
}
@media (prefers-reduced-motion: reduce) {
  body#structacad-workspace.cad-workspace *, body#structacad-workspace.cad-workspace *::before, body#structacad-workspace.cad-workspace *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Minimum reinforcement: available model types first, criteria on demand. */
body#structacad-workspace.cad-workspace #app-dialog-overlay[data-purpose="minimum-steel"] {
  padding: 12px;

  & .app-dialog-content {
    display: flex !important;
    flex-direction: column;
    width: min(520px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px) !important;
    padding: 24px !important;
    overflow: hidden;
  }
  & .overlay-header {
    flex: 0 0 auto;
    margin: 0 0 10px !important;
    padding: 0 !important;
    border: 0 !important;
    text-align: left !important;
  }
  & .overlay-kicker { margin: 0 0 6px; font-size: 10px !important; }
  & .modal-title { margin: 0; font-size: 21px !important; line-height: 1.25; text-align: left !important; }
  & .app-dialog-message {
    flex: 0 0 auto;
    width: auto;
    max-width: none !important;
    margin: 0 0 22px;
    font-size: 13px !important;
    text-align: left !important;
  }
  & .app-dialog-body { display: block; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; }
  & .minimum-steel-dialog { display: grid; gap: 16px; }
  & .minimum-steel-options { min-width: 0; margin: 0; padding: 0; border: 0; }
  & .minimum-steel-options legend {
    margin: 0 0 10px;
    padding: 0;
    color: var(--ui-muted);
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
  }
  & .minimum-steel-option-list { display: grid; gap: 8px; }
  & label.minimum-steel-option {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--ui-line);
    background: var(--ui-surface);
    color: var(--ui-text) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.4;
    letter-spacing: 0 !important;
    text-transform: none !important;
    cursor: pointer;
  }
  & .minimum-steel-option:has(input:checked) { border-color: var(--ui-accent); background: var(--ui-selected); }
  & .minimum-steel-option:has(input:enabled):hover { background: var(--ui-hover); }
  & .minimum-steel-option:has(input:focus-visible) { outline: 2px solid var(--ui-focus); outline-offset: 2px; }
  & .minimum-steel-option input[type="checkbox"] {
    appearance: auto;
    width: 16px !important;
    height: 16px !important;
    min-width: 0;
    min-height: 0;
    margin: 0 !important;
    padding: 0 !important;
    accent-color: var(--ui-accent);
    cursor: inherit;
  }
  & .minimum-steel-option-count { color: var(--ui-muted); font-size: 12px; font-weight: 400; text-align: right; }
  & label.minimum-steel-option.is-unavailable { color: var(--ui-muted) !important; border-color: var(--ui-line-soft); cursor: default; }
  & .minimum-steel-dialog p { width: auto; max-width: none; margin: 0; font-size: 12px !important; font-weight: 400 !important; line-height: 1.6; text-align: left; }
  & .minimum-steel-selection { color: var(--ui-accent); }
  & .minimum-steel-preserve { color: var(--ui-muted); }
  & .minimum-steel-criteria { border-block: 1px solid var(--ui-line-soft); }
  & .minimum-steel-criteria summary { padding: 14px 0; color: var(--ui-text); font-size: 12px; cursor: pointer; }
  & .minimum-steel-criteria summary::marker { color: var(--ui-muted); }
  & .minimum-steel-criteria summary:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: -2px; }
  & .minimum-steel-formulas { display: grid; gap: 10px; padding: 0 0 14px; color: var(--ui-muted); }
  & .minimum-steel-unavailable { color: var(--ui-muted); }
  & .minimum-steel-unavailable > p { margin-bottom: 6px; font-weight: 500 !important; }
  & .minimum-steel-unavailable ul { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0; padding: 0; list-style: none; }
  & .minimum-steel-unavailable li { font-size: 11px; line-height: 1.6; }
  & .minimum-steel-unavailable li:not(:last-child)::after { content: "·"; padding: 0 7px; }
  & .app-dialog-actions {
    display: flex !important;
    flex: 0 0 auto;
    flex-direction: row !important;
    justify-content: flex-end;
    gap: 8px;
    margin: 20px 0 0 !important;
    padding: 0 !important;
  }
  & .app-dialog-actions button { flex: 0 1 auto; width: auto; min-width: 88px; min-height: 38px; margin: 0; padding: 9px 16px; }
  & #app-dialog-confirm-btn:disabled { opacity: .45; cursor: not-allowed; }
}

@media (max-width: 540px) {
  body#structacad-workspace.cad-workspace #app-dialog-overlay[data-purpose="minimum-steel"] {
    & .app-dialog-content { padding: 20px !important; }
    & label.minimum-steel-option { gap: 10px; padding: 12px; }
    & .app-dialog-actions button { min-width: 0; padding-inline: 12px; }
  }
}

/* Single student purchase keeps the editor visible in either theme. */
body#structacad-workspace.cad-workspace #app-dialog-overlay[data-purpose="student-single-download"] {
  & .app-dialog-content {
    display: flex !important; flex-direction: column; width: min(480px, calc(100vw - 32px));
    padding: 24px !important; max-height: calc(100dvh - 32px) !important; overflow: hidden;
  }
  & .overlay-header { flex: 0 0 auto; padding-bottom: 14px !important; margin-bottom: 12px !important; }
  & .app-dialog-message { flex: 0 0 auto; margin: 0 0 16px; max-width: none; text-align: left !important; }
  & .app-dialog-body { min-height: 0; overflow-y: auto; text-align: left !important; }
  & .student-download-price { line-height: 1.2; text-align: left; }
  & .student-download-price span { margin-top: 4px; }
  & .student-download-note { max-width: none; text-align: left; }
  & .student-download-offer { gap: 12px; }
  & .student-download-offer .primary-btn { background: var(--ui-action-bg) !important; border-color: var(--ui-action-border) !important; color: var(--ui-action-text) !important; box-shadow: none !important; }
  & .student-download-offer li::marker { color: var(--ui-accent); }
  & .app-dialog-actions { flex: 0 0 auto; margin-top: 14px; justify-content: center; }
  & #app-dialog-confirm-btn { background: transparent !important; border: 0 !important; color: var(--ui-muted) !important; }
}

@media (max-height: 650px) {
  body#structacad-workspace.cad-workspace #app-dialog-overlay[data-purpose="student-single-download"] {
    & .app-dialog-content { padding: 18px !important; }
    & .overlay-header { padding-bottom: 10px !important; margin-bottom: 8px !important; }
    & .app-dialog-message { margin-bottom: 10px; }
    & .student-download-price { font-size: 34px; }
    & .student-download-offer { gap: 10px; }
    & .app-dialog-actions { margin-top: 8px; }
  }
}

/* Secondary dialogs follow the same form layout. */
body#structacad-workspace.cad-workspace :is(.modal-content, .app-dialog-content, .import-provider-dialog) .overlay-header {
  display: block !important;
  padding: 0 0 18px !important;
  margin: 0 0 18px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--ui-line) !important;
  border-radius: 0 !important;
  text-align: left !important;
  background: transparent !important;
}
body#structacad-workspace.cad-workspace :is(.modal-content, .app-dialog-content, .import-provider-dialog) .overlay-header :is(.modal-title, .overlay-kicker, p) {
  width: auto !important; max-width: none !important; margin-left: 0 !important; text-align: left !important;
}
/* Center simple notices, ETABS review consent, and the SAFE grid warning. */
body#structacad-workspace.cad-workspace #app-dialog-overlay[data-purpose="etabs-review-consent"],
body#structacad-workspace.cad-workspace #app-dialog-overlay[data-purpose="safe-import-grid-mismatch"],
body#structacad-workspace.cad-workspace #app-dialog-overlay:not([data-purpose]):has(#app-dialog-body[hidden]):has(#app-dialog-header-actions[hidden]):has(#app-dialog-cancel-btn[hidden]) {
  & :is(.overlay-header, .overlay-kicker, .modal-title, .app-dialog-message) {
    text-align: center !important;
  }
  & .modal-title {
    padding-inline: 0 !important;
  }
  & .app-dialog-message {
    width: 100% !important;
    max-width: none !important;
    margin-inline: 0 !important;
  }
}
body#structacad-workspace.cad-workspace .units-modal-content { width: min(520px, calc(100vw - 32px)) !important; padding: 24px !important; overflow-y: auto !important; }
body#structacad-workspace.cad-workspace .unit-system-options { display: grid !important; grid-template-columns: 1fr !important; gap: 0 !important; }
body#structacad-workspace.cad-workspace .unit-system-option {
  display: grid !important; grid-template-columns: 18px minmax(0, 1fr) !important; grid-template-rows: auto auto !important;
  gap: 4px 12px !important; align-items: center !important; padding: 14px 10px !important; margin: 0 !important;
  border: 0 !important; border-bottom: 1px solid var(--ui-line) !important; border-radius: 0 !important;
  background: transparent !important; box-shadow: none !important; text-align: left !important; text-transform: none !important;
}
body#structacad-workspace.cad-workspace .unit-system-option:has(input:checked) { background: var(--ui-selected) !important; }
body#structacad-workspace.cad-workspace .unit-system-option input { position: static !important; grid-column: 1; grid-row: 1 / 3; margin: 0 !important; width: 15px; height: 15px; }
body#structacad-workspace.cad-workspace .unit-system-option-title { grid-column: 2; grid-row: 1; color: var(--ui-text) !important; font-size: 14px !important; font-weight: 500 !important; text-transform: none !important; letter-spacing: 0 !important; text-align: left !important; }
body#structacad-workspace.cad-workspace .unit-system-option-copy { grid-column: 2; grid-row: 2; color: var(--ui-muted) !important; font-size: 12px !important; font-weight: 400 !important; line-height: 1.5 !important; text-transform: none !important; letter-spacing: 0 !important; text-align: left !important; }
body#structacad-workspace.cad-workspace .units-modal-actions { display: flex !important; justify-content: flex-end !important; padding: 18px 0 0 !important; }
body#structacad-workspace.cad-workspace .units-modal-actions button { width: auto !important; min-width: 96px; flex: 0 0 auto !important; }
body#structacad-workspace.cad-workspace :is(.import-provider-dialog-header .modal-title, .export-dock-modal-header .modal-title) { text-align: left !important; padding: 0 !important; }
body#structacad-workspace.cad-workspace :is(.language-switch-button, .project-color-label) { text-transform: none !important; font-size: 12px !important; font-weight: 400 !important; letter-spacing: 0 !important; }
body#structacad-workspace.cad-workspace .language-switch-button { border: 1px solid var(--ui-line) !important; border-radius: var(--ui-radius) !important; background: transparent !important; color: var(--ui-muted) !important; box-shadow: none !important; }
body#structacad-workspace.cad-workspace .language-switch-button.is-active { background: var(--ui-selected) !important; color: var(--ui-text) !important; border-color: var(--ui-line) !important; }

body#structacad-workspace.cad-workspace .drawing-preferences-modal-content { width: min(1000px, calc(100vw - 32px)) !important; min-width: 0 !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-modal-content .overlay-header { padding: 24px !important; margin: 0 !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-modal-content .overlay-kicker { display: none !important; }
body#structacad-workspace.cad-workspace :is(.drawing-preferences-list, .drawing-preferences-workspace) { gap: 12px !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-panel {
  background: transparent !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
}
body#structacad-workspace.cad-workspace .drawing-preferences-panel-header { background: transparent !important; border: 0 !important; padding: 8px 0 !important; border-radius: 0 !important; text-align: left !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-panel-title { font-size: 12px !important; font-weight: 500 !important; color: var(--ui-muted) !important; text-align: left !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-detail-list { display: flex !important; flex-direction: column !important; gap: 0 !important; padding: 0 !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-detail-card { flex-shrink: 0; border: 0 !important; border-bottom: 1px solid var(--ui-line) !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-detail-toggle { width: 100% !important; min-height: 44px !important; margin: 0 !important; padding: 12px 8px !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-detail-toggle:hover { background: var(--ui-hover) !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-detail-title { font-size: 12px !important; font-weight: 400 !important; color: var(--ui-text) !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-detail-summary-text { display: none !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-detail-body { padding: 8px !important; background: transparent !important; }
body#structacad-workspace.cad-workspace :is(.drawing-preferences-category-button, .steel-assignment-tab) { font-size: 12px !important; border: 0 !important; border-radius: var(--ui-radius) !important; background: transparent !important; color: var(--ui-muted) !important; box-shadow: none !important; }
body#structacad-workspace.cad-workspace :is(.drawing-preferences-category-button, .steel-assignment-tab).is-active { background: var(--ui-selected) !important; color: var(--ui-text) !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-category-label { font-weight: 500 !important; }
body#structacad-workspace.cad-workspace :is(.drawing-preferences-categories, .drawing-preferences-actions, .steel-assignment-tabs) { background: transparent !important; border-radius: 0 !important; border-color: var(--ui-line) !important; box-shadow: none !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-actions { display: flex !important; justify-content: flex-end !important; padding: 16px 24px !important; gap: 8px !important; }
body#structacad-workspace.cad-workspace .drawing-preferences-actions button { width: auto !important; flex: 0 0 auto !important; min-width: 92px; }
body#structacad-workspace.cad-workspace :is(.steel-assignment-table-wrap, .grid-axis-table-wrap, .grid-system-card) { border: 1px solid var(--ui-line) !important; border-radius: var(--ui-radius) !important; background: transparent !important; box-shadow: none !important; }
body#structacad-workspace.cad-workspace .steel-assignment-table :is(th, td) { font-size: 12px !important; font-weight: 400 !important; border-color: var(--ui-line) !important; color: var(--ui-text) !important; }
body#structacad-workspace.cad-workspace .steel-assignment-table th { background: var(--ui-raised) !important; font-weight: 500 !important; }
body#structacad-workspace.cad-workspace .steel-assignment-table td { background: var(--ui-surface) !important; }
body#structacad-workspace.cad-workspace :is(.support-drawer, .support-chat-panel) { background: var(--ui-surface) !important; border: 1px solid var(--ui-line) !important; border-radius: var(--ui-radius) !important; box-shadow: 0 16px 48px #0005 !important; color: var(--ui-text) !important; }
body#structacad-workspace.cad-workspace :is(.support-chat-header, .support-chat-tabs) { background: transparent !important; border-color: var(--ui-line) !important; }
body#structacad-workspace.cad-workspace .support-chat-header h2 { font-size: 16px !important; font-weight: 500 !important; }
body#structacad-workspace.cad-workspace .support-chat-section-title { font-size: 12px !important; font-weight: 500 !important; color: var(--ui-muted) !important; text-transform: none !important; }

@media (max-width: 760px) {
  body#structacad-workspace.cad-workspace { --top-panel-height: 108px; }
  body#structacad-workspace.cad-workspace #top-panel .top-panel-right { --top-panel-action-size: 32px; }
  body#structacad-workspace.cad-workspace #top-panel {
    display: grid !important; grid-template-columns: auto minmax(0, 1fr) !important;
    grid-template-rows: 38px 46px !important; gap: 6px 8px !important;
    height: 108px !important; min-height: 108px !important; padding: 8px !important;
  }
  body#structacad-workspace.cad-workspace #top-panel .top-panel-left { grid-column: 1; grid-row: 1; min-width: 0 !important; gap: 8px !important; }
  body#structacad-workspace.cad-workspace #top-panel .top-panel-identity-heading,
  body#structacad-workspace.cad-workspace #top-panel .top-panel-identity:not(:has(.top-panel-project-quota:not([hidden]))) { display: none; }
  body#structacad-workspace.cad-workspace #top-panel .top-panel-project-quota { max-width: 140px; white-space: normal; font-size: 10px; line-height: 13px; }
  body#structacad-workspace.cad-workspace #top-panel .top-panel-brand { font-size: 14px !important; gap: 6px !important; }
  body#structacad-workspace.cad-workspace #top-panel .cad-brand-mark { width: 26px !important; height: 26px !important; min-width: 26px !important; }
  body#structacad-workspace.cad-workspace #top-panel .top-panel-right { grid-column: 2; grid-row: 1; justify-content: flex-end !important; gap: 4px !important; overflow-x: auto; }
  body#structacad-workspace.cad-workspace #top-panel .top-panel-right :is(button, a) {
    width: 32px !important; min-width: 32px !important; max-width: 32px !important;
    height: 32px !important; min-height: 32px !important; flex: 0 0 32px !important; padding: 6px !important;
  }
  body#structacad-workspace.cad-workspace #top-panel .top-panel-export-pair { gap: 4px !important; }
  body#structacad-workspace.cad-workspace #top-panel #workspace-export-combined-btn { width: 32px !important; min-width: 32px !important; max-width: 32px !important; padding: 0 !important; }
  body#structacad-workspace.cad-workspace #top-panel :is(.top-panel-export-button-label, .top-panel-spreadsheet-button > span, .cad-export-arrow) { display: none !important; }
  body#structacad-workspace.cad-workspace #top-panel .top-panel-center { grid-column: 1 / -1; grid-row: 2; width: 100% !important; max-width: 100% !important; min-width: 0 !important; overflow-x: auto !important; padding: 0 !important; }
  body#structacad-workspace.cad-workspace .drawing-preferences-modal-content .overlay-header { padding: 20px !important; }
  body#structacad-workspace.cad-workspace .drawing-preferences-actions { padding: 12px !important; flex-wrap: wrap; }
  body#structacad-workspace.cad-workspace .drawing-preferences-actions button { min-width: 80px; }
}

body#structacad-workspace.cad-workspace .workspace-entry-option { margin: 0 !important; }
body#structacad-workspace.cad-workspace :is(.workspace-entry-option-title, .workspace-entry-option-copy) { margin: 0 !important; width: auto !important; max-width: none !important; }
body#structacad-workspace.cad-workspace .system-modal-content {
  display: flex !important; flex-direction: column !important;
  height: min(780px, calc(100dvh - 40px)); padding: 24px !important; overflow: hidden !important;
}
body#structacad-workspace.cad-workspace .system-modal-content > :is(.modal-title, .overlay-kicker, .field-note, .system-modal-tabs, .modal-actions) { flex: 0 0 auto; }
body#structacad-workspace.cad-workspace .system-modal-content .system-tab-panel { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 16px 2px 0; }
body#structacad-workspace.cad-workspace .system-modal-content > :is(.modal-title, .overlay-kicker, .field-note) { text-align: left !important; max-width: none !important; margin-left: 0 !important; }
body#structacad-workspace.cad-workspace .system-modal-content .menu-header { font-size: 12px !important; font-weight: 500 !important; text-transform: none !important; color: var(--ui-muted) !important; }
body#structacad-workspace.cad-workspace .system-modal-content .grid-axis-shell { border: 0 !important; border-radius: 0 !important; padding: 0 !important; background: transparent !important; }
body#structacad-workspace.cad-workspace .system-modal-content :is(.grid-axis-card, .grid-axis-editor, .grid-axis-panel) { border: 0 !important; border-radius: 0 !important; background: transparent !important; padding: 0 !important; box-shadow: none !important; }
body#structacad-workspace.cad-workspace .system-modal-content .grid-import-block { display: flex !important; flex-wrap: wrap !important; width: 100% !important; gap: 8px !important; }
body#structacad-workspace.cad-workspace .system-modal-content .grid-import-block :is(button, .import-action-wrap) { width: auto !important; min-width: 0 !important; }
body#structacad-workspace.cad-workspace .system-modal-content .grid-import-block > .import-action-wrap { display: flex !important; flex-wrap: wrap; gap: 8px; align-items: center; }
body#structacad-workspace.cad-workspace .system-modal-content .import-primary-action-row { display: flex !important; gap: 6px; align-items: center; }
body#structacad-workspace.cad-workspace .system-modal-content .grid-import-block .import-primary-action-row .import-help-toggle { flex: 0 0 28px !important; width: 28px !important; min-width: 28px !important; height: 28px !important; min-height: 28px !important; padding: 0 !important; }
body#structacad-workspace.cad-workspace #system-grid-title { display: none !important; }
body#structacad-workspace.cad-workspace .system-modal-content :is(.grid-axis-mode-switch, .grid-axis-table-wrap) { background: transparent !important; border-color: var(--ui-line) !important; box-shadow: none !important; border-radius: var(--ui-radius) !important; }
body#structacad-workspace.cad-workspace .system-modal-content :is(th, td) { background: transparent !important; color: var(--ui-text) !important; border-color: var(--ui-line) !important; border-radius: 0 !important; font-size: 12px !important; font-weight: 400 !important; text-transform: none !important; }
body#structacad-workspace.cad-workspace .system-modal-content th { background: var(--ui-raised) !important; color: var(--ui-muted) !important; }
body#structacad-workspace.cad-workspace .system-modal-content > .modal-actions { position: static; margin: 16px -24px -24px; padding: 16px 24px !important; border-top: 1px solid var(--ui-line); border-radius: 0 !important; background: var(--ui-surface) !important; z-index: 3; }
body#structacad-workspace.cad-workspace .system-modal-content > .modal-actions button { width: auto !important; margin-left: auto; min-width: 96px; }

body#structacad-workspace.cad-workspace .level-manager-row { border: 0 !important; border-bottom: 1px solid var(--ui-line) !important; border-radius: 0 !important; background: transparent !important; padding: 12px 8px !important; box-shadow: none !important; }
body#structacad-workspace.cad-workspace .level-manager-row.is-active { background: var(--ui-selected) !important; }
body#structacad-workspace.cad-workspace .level-manager-badge { border: 0 !important; background: transparent !important; color: var(--ui-muted) !important; font-size: 11px !important; font-weight: 400 !important; text-transform: none !important; }

/* ETABS import: intrinsic height, one scroll area, and quiet settings rows.
   Keep this scope stronger than the legacy full-screen import dialog rules. */
body#structacad-workspace.cad-workspace #app-dialog-overlay:has(.etabs-import-settings) {
  padding: 20px !important;
  backdrop-filter: blur(4px);

  & .app-dialog-content {
    position: relative;
    width: min(1060px, 100%) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100dvh - 40px) !important;
    display: flex !important;
    flex-direction: column;
    padding: 0 !important;
    overflow: hidden !important;
  }
  & .overlay-header {
    flex: 0 0 auto;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 20px 28px 18px !important;
  }
  & .overlay-kicker { margin: 0 0 6px !important; }
  & .modal-title { margin: 0 !important; }
  & .modal-title:focus { outline: none; }
  & .app-dialog-body {
    flex: 1 1 auto;
    min-height: 0;
    margin: 0 !important;
    padding: 0 28px !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--ui-line) transparent;
  }
  & .etabs-import-settings {
    position: static;
    display: flex;
    flex-direction: column;
    height: auto;
    gap: 0;
    text-align: left;
    font-size: 12px;
    line-height: 1.45;
  }
  & :is(label, strong, small, legend, h4, p, button, .etabs-import-settings-toggle-copy span) {
    text-transform: none !important;
    letter-spacing: normal !important;
    text-align: left;
  }
  & :is(.etabs-import-settings-section, .etabs-import-settings-bottom) {
    padding: 18px 0 !important;
    margin: 0;
    min-width: 0;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }
  & .etabs-import-settings-section.is-preparation {
    display: block;
    border-bottom: 1px solid var(--ui-line) !important;
    padding: 14px 0 !important;
  }
  & .is-preparation h4 { font-size: 12px !important; color: var(--ui-muted) !important; }
  & .etabs-import-settings-preparation-list { display: flex; flex-wrap: wrap; gap: 8px 28px; margin-top: 10px; }
  & .etabs-import-settings-preparation-check { padding: 0; gap: 8px; background: transparent; border-radius: 0; font-size: 12px; }
  & .etabs-import-settings-preparation-check strong { font-weight: 400; color: var(--ui-text); }
  & .etabs-import-settings-preparation-check > span { width: 18px; height: 18px; flex-basis: 18px; background: transparent; border: 1px solid var(--ui-line); color: var(--ui-muted); font-weight: 500; font-size: 10px; }
  & .etabs-import-settings-main-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  & .etabs-import-settings-steel-stack { display: block; overflow: visible; }
  & .etabs-import-settings-card-head { gap: 10px; margin: 0 0 12px !important; align-items: center; }
  & .etabs-import-settings-section-heading { gap: 0; min-width: 0; }
  & .etabs-import-settings-section-heading h4 { margin: 0; font-size: 14px !important; font-weight: 600; line-height: 1.4; color: var(--ui-text); }
  & .etabs-import-settings-section-heading p { margin-top: 3px; color: var(--ui-muted); font-size: 12px !important; line-height: 1.45; white-space: normal; }
  & .etabs-import-settings-active-count { padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--ui-muted); font-size: 11px; font-weight: 400; white-space: nowrap; }
  & .etabs-import-settings-toggle-list { display: grid; gap: 0; padding: 0 !important; border: 0 !important; background: transparent !important; border-radius: 0 !important; }
  & .etabs-import-settings-toggle {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px;
    align-items: center;
    gap: 14px;
    min-width: 0;
    min-height: 58px !important;
    margin: 0 !important;
    padding: 10px 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    cursor: pointer;
  }
  & .etabs-import-settings-toggle + .etabs-import-settings-toggle { border-top: 1px solid var(--ui-line-soft) !important; }
  & .etabs-import-settings-toggle-copy { grid-column: 1; grid-row: 1; }
  & .etabs-import-settings-toggle-control { grid-column: 2; grid-row: 1; background: #535e6d; box-shadow: none; }
  & .etabs-import-settings-toggle input:checked + .etabs-import-settings-toggle-control { background: #588bc4; }
  & :is(.etabs-import-settings-toggle-copy strong, .etabs-import-settings-wall-copy strong) { color: var(--ui-text); font-size: 12px !important; font-weight: 500 !important; line-height: 1.4; }
  & :is(.etabs-import-settings-toggle-copy span, .etabs-import-settings-toggle-copy small, .etabs-import-settings-wall-copy small) { color: var(--ui-muted); font-size: 12px !important; font-weight: 400 !important; line-height: 1.45; }
  & .etabs-import-settings-toggle-copy small { color: #d6b67b; }
  & .etabs-import-settings-select-field { display: grid; gap: 6px; margin: 0 !important; }
  & :is(.etabs-import-settings-select-field > span, .etabs-import-settings-rebar-group label > span) { text-align: left; color: var(--ui-muted); font-size: 12px !important; font-weight: 400; letter-spacing: 0; text-transform: none; }
  & :is(select, input[type="number"]) { width: 100%; min-width: 0; min-height: var(--ui-control-height); height: var(--ui-control-height) !important; border: 1px solid var(--ui-line) !important; border-radius: var(--ui-radius) !important; background: var(--ui-input) !important; color: var(--ui-text) !important; font-size: 12px !important; font-weight: 400 !important; padding: 6px 10px !important; box-shadow: none !important; }
  & .etabs-import-settings-beam-note { align-items: start; margin: 10px 0 0 !important; padding: 0 !important; background: transparent !important; color: var(--ui-muted); font-size: 12px !important; line-height: 1.5 !important; }
  & .etabs-import-settings-info { margin-top: 2px; flex-shrink: 0; border-color: var(--ui-muted); color: var(--ui-muted); font-weight: 500; }
  & .etabs-import-settings-beam-custom { margin-top: 14px !important; padding: 0 !important; }
  & .etabs-import-settings-rebar-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px !important; }
  & .etabs-import-settings-rebar-group { display: grid; grid-template-columns: 1fr; gap: 8px; margin: 0; padding: 0 !important; border: 0; border-radius: 0; background: transparent; }
  & .etabs-import-settings-rebar-group legend { padding: 0 0 8px !important; color: var(--ui-text); font-size: 12px !important; font-weight: 500; }
  & .etabs-import-settings-rebar-group label { display: grid; grid-template-columns: 1fr; gap: 5px; margin: 0; }
  & .etabs-import-settings-input-unit > span { color: var(--ui-muted); background: transparent; font-size: 11px; }
  & .etabs-import-settings-section.is-diameter-catalog { display: block; padding-top: 0 !important; }
  & .etabs-import-diameter-catalog-heading-copy { display: block; min-width: 0; width: 100%; }
  & .etabs-import-diameter-catalog-heading-copy p { max-width: none; margin: 5px 0 0; white-space: normal; }
  & .etabs-import-diameter-catalog { min-width: 0; gap: 12px; }
  & .etabs-import-diameter-catalog-tabs { display: flex; gap: 16px; border-bottom: 1px solid var(--ui-line); border-radius: 0 !important; overflow-x: auto; }
  & .etabs-import-diameter-catalog-tab { flex: 0 0 auto; width: auto !important; height: 32px; min-height: 32px; padding: 0 2px 8px !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; color: var(--ui-muted); font-size: 12px; font-weight: 400; }
  & .etabs-import-diameter-catalog-tab.is-active { color: var(--ui-accent); box-shadow: inset 0 -2px var(--ui-accent); }
  & .etabs-import-diameter-catalog-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 0; border: 0; border-radius: 0; background: transparent; }
  & .etabs-import-diameter-catalog-options { max-height: none; overflow: visible; gap: 6px; }
  & .etabs-import-diameter-chip { position: relative; }
  & .etabs-import-diameter-chip span { height: 30px; min-width: 38px; padding: 0 9px; border-color: var(--ui-line); background: var(--ui-input); color: var(--ui-muted); font-size: 12px; font-weight: 500; box-shadow: none; }
  & .etabs-import-diameter-chip input:checked + span { background: var(--ui-selected); border-color: #52769f; color: #c5ddff; box-shadow: none; }
  & .etabs-import-diameter-catalog-status { margin: 0; color: var(--ui-muted); font-size: 11px; font-weight: 400; text-align: left; }
  & .etabs-import-diameter-catalog-status.is-invalid { color: #f2a4a4; }
  & .etabs-import-settings-bottom { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; padding: 8px 0 14px !important; border-top: 1px solid var(--ui-line) !important; }
  & .etabs-import-settings-bottom > .etabs-import-settings-toggle { border-top: 0 !important; }
  & .etabs-import-settings-cover-control { grid-template-columns: minmax(0, 1fr) 32px; gap: 10px; }
  & .etabs-import-settings-cover-toggle { grid-column: 1; grid-row: 1; }
  & .etabs-import-settings-cover-config-button { grid-column: 2; grid-row: 1; width: 32px; height: 32px; min-height: 32px; background: transparent; border-color: var(--ui-line); color: var(--ui-muted); }
  & .etabs-import-settings-cover-config-button svg { width: 16px; height: 16px; }
  & .etabs-import-settings-cover-config-button:is(:hover, [aria-expanded="true"]) { background: var(--ui-hover); color: var(--ui-text); }
  & .etabs-import-settings-wall-review { align-self: start; min-height: 0; padding: 10px 0; border: 0; }
  & .etabs-import-settings-wall-review > summary { min-height: 38px; height: auto; gap: 14px; }
  & .etabs-import-settings-review-button { height: 32px; border-color: var(--ui-line); background: transparent; color: var(--ui-text); font-size: 12px; font-weight: 400; }
  & .etabs-import-settings-wall-review[open] { grid-column: 1 / -1; }
  & .etabs-import-settings-wall-review .etabs-import-settings-details-body { position: static; width: 100%; max-height: 300px; margin-top: 12px; padding: 12px; border-color: var(--ui-line); border-radius: var(--ui-radius); background: var(--ui-input); box-shadow: none; }
  & .etabs-import-settings-warning { display: block; margin-top: 14px; padding: 10px 12px; border-left: 2px solid #d6b67b; background: #d6b67b0a; color: #d6b67b; font-size: 12px; }
  & .app-dialog-actions { flex: 0 0 auto; display: flex !important; flex-direction: row !important; align-items: center; flex-wrap: wrap; min-height: 0; margin: 0 !important; padding: 14px 28px !important; background: var(--ui-surface) !important; border-radius: 0 !important; }
  & .etabs-import-settings-footer-summary { flex: 1 1 220px; font-size: 11px; white-space: normal; color: var(--ui-muted); }
  & .etabs-import-settings-footer-summary strong { color: var(--ui-text); font-weight: 500; }
  & .etabs-import-settings-footer-summary.is-invalid { color: #f2a4a4; }
  & :is(#app-dialog-cancel-btn, #app-dialog-confirm-btn) { flex: 0 0 auto; width: auto; min-width: 100px; padding: 0 18px; text-align: center; }
  & #app-dialog-cancel-btn { border-color: var(--ui-line); }
  & #app-dialog-confirm-btn { border-color: var(--ui-action-border); background: var(--ui-action-bg); }
  & #app-dialog-confirm-btn:hover:not(:disabled) { background: var(--ui-action-hover); }
  & #app-dialog-confirm-btn:disabled { opacity: .45; cursor: not-allowed; }
  & .etabs-import-cover-config-overlay { position: absolute; inset: 0; padding: 16px; border-radius: 0; background: #10151dc9; backdrop-filter: blur(3px); }
  & .etabs-import-cover-config-dialog { width: min(460px, 100%); max-height: 100%; overflow: auto; background: var(--ui-surface); border-color: var(--ui-line); }
  & .etabs-import-cover-config-head { padding: 20px; border-color: var(--ui-line); border-radius: 0 !important; }
  & .etabs-import-cover-config-head strong { font-size: 16px; font-weight: 500; color: var(--ui-text); }
  & .etabs-import-cover-config-head span { font-size: 12px; color: var(--ui-muted); }
  & .etabs-import-cover-config-list { padding: 12px 20px; gap: 0; }
  & .etabs-import-cover-config-row { grid-template-columns: 100px minmax(0, 1fr); padding: 10px 0; border: 0; border-bottom: 1px solid var(--ui-line-soft); border-radius: 0 !important; background: transparent; }
  & .etabs-import-cover-config-row > span { font-size: 12px; font-weight: 400; color: var(--ui-text); }
  & .etabs-import-cover-config-actions { display: flex; justify-content: end; padding: 12px 20px; border-color: var(--ui-line); border-radius: 0 !important; background: transparent; }
  & #etabs-import-cover-config-done { width: auto; min-width: 96px; min-height: 36px; padding: 0 18px; background: var(--ui-action-bg); border: 1px solid var(--ui-action-border); border-radius: var(--ui-radius); color: var(--ui-action-text); text-align: center; font-size: 12px; }
  & .etabs-import-cover-config-close { text-align: center; }

  @media (max-width: 760px) {
    padding: 12px !important;
    & .app-dialog-content { max-height: calc(100dvh - 24px) !important; }
    & .overlay-header { padding: 18px 20px 16px !important; }
    & .app-dialog-body { padding: 0 20px !important; }
    & .etabs-import-settings-main-grid { grid-template-columns: 1fr; gap: 0; }
    & .is-steel { border-top: 1px solid var(--ui-line) !important; }
    & .etabs-import-settings-section.is-diameter-catalog { grid-template-columns: 1fr; gap: 0; }
    & .etabs-import-settings-bottom { grid-template-columns: 1fr; }
    & .etabs-import-settings-preparation-list { flex-direction: column; }
    & .etabs-import-diameter-catalog-tabs { gap: 14px; }
    & .app-dialog-actions { padding: 12px 20px !important; }
    & .etabs-import-settings-footer-summary { flex-basis: 100%; }
    & :is(#app-dialog-cancel-btn, #app-dialog-confirm-btn) { flex: 1; }
    & .etabs-import-cover-config-row { grid-template-columns: 1fr; }
  }
}

/* Floating reinforcement editors use the same palette on the canvas and in
   the assignment overlay, including native select menus and status messages. */
body#structacad-workspace.cad-workspace .steel-assignment-scheme-quick-editor {
  color-scheme: var(--ui-color-scheme);
  border-radius: var(--ui-radius) !important;
  background: var(--ui-surface) !important;
  border-color: var(--ui-line) !important;
  color: var(--ui-text) !important;
  box-shadow: var(--ui-popover-shadow) !important;

  & .steel-assignment-scheme-quick-editor-head {
    background: transparent !important;
    border-color: var(--ui-line) !important;
  }
  & :is(.steel-assignment-scheme-quick-editor-head strong, .steel-assignment-scheme-quick-section-title, .steel-assignment-scheme-quick-count) {
    color: var(--ui-text) !important;
  }
  & :is(.steel-assignment-scheme-quick-editor-head > span, .steel-assignment-scheme-quick-editor-fields label, .steel-assignment-scheme-quick-input-with-unit em, .steel-assignment-scheme-quick-toggle) {
    color: var(--ui-muted) !important;
  }
  & .steel-assignment-scheme-quick-rebar-section {
    background: transparent !important;
    border-color: var(--ui-line-soft) !important;
  }
  & :is(select, input:not([type="checkbox"]), option, optgroup) {
    color-scheme: var(--ui-color-scheme) !important;
    background: var(--ui-input) !important;
    color: var(--ui-text) !important;
    border-color: var(--ui-line) !important;
  }
  & :is(select, input:not([type="checkbox"])) { min-height: var(--ui-control-height); padding: 5px 8px; font-size: 12px; }
  & :is(.steel-assignment-scheme-quick-editor-fields label, .steel-assignment-scheme-quick-toggle) { font-size: 11px; font-weight: 400; }
  & option:checked { background: var(--ui-selected) !important; color: var(--ui-text) !important; }
  & input[type="checkbox"] { accent-color: var(--ui-accent); }
  & .steel-assignment-scheme-quick-head-actions button {
    background: transparent !important;
    color: var(--ui-muted) !important;
  }
  & .steel-assignment-scheme-quick-head-actions button:hover:not(:disabled) {
    background: var(--ui-hover) !important;
    color: var(--ui-text) !important;
  }
  & .steel-assignment-scheme-quick-head-actions button:disabled { opacity: .35; }
  & .steel-assignment-scheme-quick-additional-button {
    background: transparent !important;
    border: 1px solid var(--ui-line) !important;
    color: var(--ui-accent) !important;
  }
  & .steel-assignment-scheme-quick-additional-button:hover {
    background: var(--ui-hover) !important;
    border-color: var(--ui-accent) !important;
  }
  & .steel-assignment-scheme-quick-reset { background: transparent !important; color: var(--ui-accent) !important; }
  & .steel-assignment-scheme-quick-reset:hover { color: var(--ui-text) !important; }
  & .steel-assignment-scheme-dialog-status {
    background: var(--ui-input) !important;
    border-color: var(--ui-line-soft) !important;
    color: var(--ui-muted) !important;
  }
  & .steel-assignment-scheme-dialog-status.is-ok { background: #22342b !important; border-color: #3c6250 !important; color: #a6d8b9 !important; }
  & .steel-assignment-scheme-dialog-status.is-fail { background: #39282d !important; border-color: #74464e !important; color: #f2a4a4 !important; }
  & .steel-assignment-scheme-dialog-status :is(strong, .steel-assignment-scheme-dialog-reasons) { color: inherit !important; }
  & .steel-assignment-scheme-quick-editor-actions .secondary { background: var(--ui-input) !important; border-color: var(--ui-line) !important; color: var(--ui-text) !important; }
  & .steel-assignment-scheme-quick-editor-actions .secondary:hover { background: var(--ui-hover) !important; }
  & .steel-assignment-scheme-quick-editor-actions .primary { background: var(--ui-action-bg) !important; border-color: var(--ui-action-border) !important; color: var(--ui-action-text) !important; }
  & .steel-assignment-scheme-quick-editor-actions .primary:hover { background: var(--ui-action-hover) !important; }
  & :is(button, input, select):focus-visible { outline: 1px solid var(--ui-focus) !important; outline-offset: 2px; }
}

/* The app owns visibility. Higher-specificity menu layout must never reveal
   tools from another module, closed dialogs, or unavailable actions. */
body#structacad-workspace.cad-workspace [hidden][hidden][hidden][hidden],
body#structacad-workspace.cad-workspace :is(#sidebar, #properties-dock, #top-panel, #workspace, #mode-dock, #app) [hidden][hidden][hidden][hidden] {
  display: none !important;
}
/* General grid coordinates share the modal's scroll area with X/Y axes. */
body#structacad-workspace #general-axis-panel .grid-axis-column-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
}
body#structacad-workspace #general-axis-panel .grid-axis-column-head .menu-header {
    text-align: left;
    margin: 0;
}
body#structacad-workspace #general-axis-panel #add-general-axis-btn {
    width: auto;
    min-width: 130px;
}
body#structacad-workspace #general-axis-panel .field-note {
    max-width: none;
    width: auto;
    margin: 10px 0;
}
body#structacad-workspace #general-axis-panel .grid-axis-table-wrap {
    max-height: none;
}

/* Workspace hierarchy: project identity, modeling shortcuts, then the model. */
body#structacad-workspace.cad-workspace #top-panel {
  grid-template-rows: 48px 40px !important;
  height: var(--top-panel-height) !important;
  min-height: var(--top-panel-height) !important;
  overflow: visible !important;
  & .top-panel-left { gap: 9px !important; }
  & .cad-brand-mark { width: 26px !important; height: 26px !important; min-width: 26px !important; padding: 3px; box-shadow: none; }
  & .top-panel-brand { font-size: 13px !important; font-weight: 500 !important; letter-spacing: 0 !important; color: var(--ui-muted); }
  & .top-panel-project-name { display: block; flex: 1; max-width: 420px; padding-left: 16px; font-size: 14px; font-weight: 600; }
  & .top-panel-center { padding: 0 12px 0 76px !important; gap: 16px; overflow: visible !important; background: var(--ui-surface) !important; }
  & .workspace-quick-tools-overlay { flex: 0 0 auto; width: auto; }
  & .workspace-quick-tools { gap: 4px !important; }
  & .top-tool-group { flex-direction: row; }
  & .top-tool-group + .top-tool-group { padding-left: 6px; }
  & .top-tool-group-label { display: none !important; }
  & #workspace-3d-open-btn { display: none !important; }
  & :is(#workspace-tool-select-shortcut, #workspace-tool-delete-shortcut) {
    display: inline-flex !important; flex-direction: row; gap: 7px; width: auto !important; min-width: 32px !important; max-width: none !important;
    flex: 0 0 auto !important; padding: 0 8px !important; color: var(--ui-text) !important;
  }
  & :is(#workspace-tool-select-shortcut, #workspace-tool-delete-shortcut) .workspace-tool-shortcut-label {
    display: inline !important; position: static !important; width: auto !important; height: auto !important;
    clip: auto !important; clip-path: none !important; overflow: visible !important; opacity: 1 !important;
    font-size: 12px !important; line-height: 1.3; color: inherit; white-space: nowrap;
  }
  & #workspace-export-combined-btn { border-radius: 2px !important; box-shadow: none !important; }
  & #workspace-steel-view-table-btn { height: 28px !important; min-height: 28px !important; padding: 0 8px !important; box-shadow: none !important; font-size: 12px; background: transparent !important; border-color: var(--ui-line) !important; color: var(--ui-text) !important; }
  & #download-feedback-resume-btn {
    height: var(--ui-control-height) !important; min-height: var(--ui-control-height) !important;
    margin: 0 !important; padding: 0 10px !important;
    border: 1px solid var(--ui-line) !important; border-radius: var(--ui-radius) !important;
    background: var(--ui-input) !important; color: var(--ui-text) !important;
    font-weight: 500; box-shadow: none !important;
    &:hover { background: var(--ui-hover) !important; border-color: var(--ui-muted) !important; }
    &:focus-visible { outline: 1px solid var(--ui-focus) !important; outline-offset: 2px; }
  }
  & #workspace-spreadsheet-download-btn { border-color: transparent !important; }
  & #workspace-corner-controls {
    position: static !important; flex: 1 1 auto; min-width: 0; max-width: none; flex-wrap: nowrap;
    justify-content: flex-end !important; gap: 10px !important; height: 100%;
  }
  & .workspace-corner-view-group { padding: 0 8px 0 0; border: 0; border-right: 1px solid var(--ui-line-soft); background: transparent; }
  & .workspace-corner-view-group .top-tool-button-row { gap: 1px !important; }
  & #workspace-steel-view-popover { left: 0 !important; right: auto !important; max-width: calc(100vw - 24px) !important; }
  & :is(.top-panel-options-trigger, #workspace-level-switch, #workspace-main-frame-control) {
    height: 28px !important; min-height: 28px !important; border: 0 !important; background: transparent !important; box-shadow: none !important;
  }
  & .workspace-level-label { font-size: 12px !important; }
  & .workspace-level-height { color: var(--ui-muted); }
  & [hidden][hidden] { display: none !important; }
}

body#structacad-workspace.cad-workspace #mode-dock {
  padding-top: 4px !important;
  & .dock-button { min-height: 48px !important; flex-basis: 48px !important; gap: 5px !important; }
  & .dock-button::before { width: 19px !important; height: 19px !important; }
  & #sidebar-mode-design { border-top: 1px solid var(--ui-line-soft); }
}
body#structacad-workspace.cad-workspace #sidebar {
  & #tools-section > .menu-heading { display: none !important; }
  & :is(#tool-delete, #tool-edit) { display: none !important; }
  & .tool-grid { padding-top: 10px !important; }
  & .cad-module-steel { margin-top: 12px; padding-top: 12px !important; }
  & .workspace-appearance-controls { display: flex; gap: 6px; margin-top: 8px; }
  & .workspace-appearance-controls button {
    display: flex; align-items: center; justify-content: center; gap: 7px; flex: 1; min-width: 0;
    width: auto; height: 32px; padding: 5px 8px; margin: 0; border: 1px solid var(--ui-line) !important;
    background: var(--ui-input) !important; color: var(--ui-muted) !important; font-size: 12px;
  }
  & .workspace-appearance-controls button[aria-pressed="true"] { background: var(--ui-selected) !important; border-color: var(--ui-accent) !important; color: var(--ui-text) !important; }
  & .workspace-appearance-controls svg { width: 16px; height: 16px; }
}

body#structacad-workspace.cad-workspace #properties-dock {
  & .properties-dock-header { min-height: 42px !important; flex-basis: 42px !important; }
  & .properties-dock-title { font-size: 13px !important; }
  & #insert-properties-dock .insert-properties-title { font-size: 16px !important; margin-bottom: 5px !important; }
  & #insert-properties-fields .insert-properties-field > span { font-size: 12px !important; }
  & #insert-properties-fields.is-organized-inspector :is(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select) {
    height: 29px !important; min-height: 29px !important; font-size: 12px !important;
  }
  & .inspector-section { gap: 8px; padding: 14px 0; }
  & .inspector-section-heading { font-size: 12px; font-weight: 600; text-transform: none; letter-spacing: 0; margin-bottom: 4px; }
  & #insert-properties-fields .materials-panel-flat-title { font-size: 12px !important; font-weight: 600; text-transform: none !important; letter-spacing: 0; }
  & .inspector-section-preview-slot .section-preview-figure { height: 180px !important; }
  & [data-inspector-type="col"] .inspector-section-preview-slot .section-preview-figure { height: 156px !important; }
  & #insert-properties-fields #insert-reinforcement-tray-launch { min-height: 32px !important; font-size: 12px !important; }
  & #workspace-reinforcement-tray-body :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]), select) {
    height: 32px !important; min-height: 32px !important;
  }
}

body#structacad-workspace.cad-workspace .beam-demand-preview {
  --demand-ink: var(--ui-text);
  --demand-muted: var(--ui-muted);
  --demand-grid: var(--ui-line);
  --demand-concrete: var(--ui-input);
}
body#structacad-workspace.cad-workspace #properties-dock.is-reinforcement-tab #workspace-section-preview-card .workspace-section-preview-header:has([data-section-preview-action="beam-demand"]) {
  display: flex !important;
  & .workspace-section-preview-copy { display: none; }
}

/* On narrow screens the same controls wrap into two rows. Popovers stay outside
   scrolling containers, so view and reinforcement menus cannot be clipped. */
@media (max-width: 1440px) {
  body#structacad-workspace.cad-workspace { --top-panel-height: 120px; }
  body#structacad-workspace.cad-workspace #top-panel {
    grid-template-rows: 48px 72px !important;
    & .top-panel-center { display: grid !important; grid-template-columns: 1fr; grid-template-rows: 34px 38px; gap: 0 !important; padding: 0 12px !important; }
    & #workspace-corner-controls { justify-content: flex-start !important; border-top: 1px solid var(--ui-line-soft); }
    & .workspace-corner-controls .top-panel-options-popover { left: 0 !important; right: auto !important; }
    & #workspace-level-switch { margin-left: auto; }
  }
  body#structacad-workspace.cad-workspace:has(#workspace-steel-view-menu:not([hidden])) {
    --top-panel-height: 154px;
    & #top-panel { grid-template-rows: 48px 106px !important; }
    & #top-panel .top-panel-center { grid-template-rows: 34px 72px; }
    & #top-panel #workspace-corner-controls { display: grid !important; grid-template-columns: auto auto minmax(0, 1fr); grid-template-rows: 34px 38px; row-gap: 0 !important; }
    & #top-panel #workspace-steel-view-menu { grid-column: 1 / -1; grid-row: 1; justify-self: start; }
    & #top-panel .workspace-corner-view-group { grid-column: 1; grid-row: 2; }
    & #top-panel #top-panel-workspace-options { grid-column: 2; grid-row: 2; }
    & #top-panel :is(#workspace-level-switch, #workspace-main-frame-control) { grid-column: 3; grid-row: 2; justify-self: end; }
  }
}
@media (max-width: 760px) {
  body#structacad-workspace.cad-workspace { --top-panel-height: 154px; }
  body#structacad-workspace.cad-workspace #top-panel {
    grid-template-rows: 48px 106px !important;
    grid-template-columns: minmax(0, 1fr) auto !important; gap: 0 !important; padding: 0 !important;
    & .top-panel-left { padding-left: 10px; }
    & .top-panel-project-name { margin-left: 0; padding-left: 8px; font-size: 12px; }
    & .top-panel-right { padding-right: 8px !important; }
    & .top-panel-center { position: relative; grid-template-rows: 68px 38px; padding: 0 6px !important; overflow: visible !important; }
    & .workspace-quick-tools-overlay { justify-content: flex-start !important; }
    & .workspace-quick-tools { display: grid !important; grid-template-columns: auto auto auto; grid-template-rows: 34px 34px; column-gap: 4px !important; row-gap: 0 !important; }
    & .top-tool-group.top-tool-group-steel-assignment { grid-column: 1 / -1; grid-row: 2; padding-left: 0; border-left: 0 !important; }
    & #workspace-corner-controls { gap: 4px !important; }
    & .workspace-corner-view-group { padding-right: 4px; }
    & .workspace-corner-view-group .workspace-history-button { width: 26px !important; min-width: 26px !important; flex-basis: 26px !important; }
    & .top-panel-options-trigger { min-width: 28px !important; padding: 0 5px !important; }
    & #top-panel-options-trigger-label { display: none; }
    & #workspace-level-switch { width: auto !important; min-width: 0 !important; padding: 0 2px !important; gap: 3px !important; }
    & .workspace-level-copy { flex: 0 1 auto !important; width: auto !important; }
    & .workspace-level-height { display: none !important; }
    & .workspace-level-label { font-size: 11px !important; max-width: 75px; overflow: hidden; text-overflow: ellipsis; }
    & :is(#workspace-tool-select-shortcut, #workspace-tool-delete-shortcut) .workspace-tool-shortcut-label { display: none !important; }
    & .workspace-corner-controls .top-panel-options-popover { position: fixed !important; top: var(--top-panel-height) !important; left: auto !important; right: 8px !important; width: min(280px, calc(100vw - 16px)) !important; min-width: 0 !important; }
    & #workspace-main-frame-control { min-width: 0 !important; max-width: 120px; padding-inline: 2px !important; }
    & #workspace-main-frame-select { min-width: 0; width: 70px; }
  }
  body#structacad-workspace.cad-workspace:has(#workspace-steel-view-menu:not([hidden])) {
    --top-panel-height: 188px;
    & #top-panel { grid-template-rows: 48px 140px !important; }
    & #top-panel .top-panel-center { grid-template-rows: 68px 72px; }
    & #top-panel #workspace-corner-controls { grid-template-columns: auto auto minmax(0, 1fr); }
    & #top-panel #workspace-tool-select-shortcut .workspace-tool-shortcut-label { display: none !important; }
    & #top-panel #workspace-steel-view-table-btn { width: 32px !important; min-width: 32px !important; max-width: 32px !important; padding: 0 !important; }
    & #top-panel #workspace-steel-view-table-btn .workspace-steel-view-table-label { display: none; }
  }
}

/* Steel assignment: element navigation, review controls and a useful empty state. */
body#structacad-workspace.cad-workspace #steel-assignment-overlay {
  padding: 20px;

  & .steel-assignment-modal {
    width: min(1180px, calc(100vw - 40px)) !important;
    max-height: calc(100dvh - 40px) !important;
    padding: 0 !important;
    gap: 0;
    overflow: hidden !important;
    border: 1px solid var(--ui-line) !important;
    border-radius: 12px !important;
    background: var(--ui-surface) !important;
    box-shadow: 0 24px 80px #0005 !important;
  }
  & .steel-assignment-header {
    flex: 0 0 auto;
    padding: 26px 28px 22px;
    align-items: flex-start;
  }
  & .overlay-kicker {
    margin: 0 0 7px !important;
    color: var(--ui-accent) !important;
    font-size: 10px !important;
    font-weight: 650 !important;
    letter-spacing: .12em !important;
  }
  & .modal-title {
    padding: 0 !important;
    margin: 0 0 8px !important;
    font-size: 23px !important;
    font-weight: 650 !important;
    letter-spacing: -.025em;
    text-align: left !important;
  }
  & .steel-assignment-header .field-note {
    margin: 0 !important;
    max-width: 680px;
    font-size: 13px !important;
    line-height: 1.6;
  }
  & .steel-assignment-close {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid var(--ui-line) !important;
    border-radius: 6px !important;
    background: transparent !important;
    color: var(--ui-muted) !important;
    font-size: 20px !important;
  }
  & .steel-assignment-tabs {
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 0 28px !important;
    gap: 26px !important;
    border-bottom: 1px solid var(--ui-line) !important;
    overflow-x: auto;
  }
  & .steel-assignment-tab {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    gap: 8px;
    min-height: 46px !important;
    padding: 0 2px !important;
    border: 0 !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--ui-muted) !important;
    font-size: 13px !important;
    font-weight: 500 !important;
  }
  & .steel-assignment-tab.is-active {
    border-bottom-color: var(--ui-accent) !important;
    color: var(--ui-text) !important;
    font-weight: 650 !important;
  }
  & .steel-assignment-tab-count {
    min-width: 23px;
    padding: 2px 6px;
    border-radius: 5px;
    background: var(--ui-raised);
    color: var(--ui-muted);
    font-size: 10px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
  }
  & .is-active .steel-assignment-tab-count { background: var(--ui-selected); color: var(--ui-accent); }
  & .steel-assignment-import-row {
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 18px 24px;
    margin: 0;
    padding: 18px 28px;
    border-radius: 0 !important;
    background: var(--ui-raised);
    border-bottom: 1px solid var(--ui-line);
  }
  & .steel-assignment-beam-controls-host { width: auto; margin: 0 auto 0 0; }
  & .steel-assignment-beam-controls-stack { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
  & .steel-assignment-control-group { display: grid; gap: 7px; }
  & .steel-assignment-control-label { color: var(--ui-muted); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
  & :is(.steel-assignment-beam-presentation-toggle, .steel-assignment-beam-view-toggle) {
    padding: 3px;
    gap: 3px;
    border: 1px solid var(--ui-line) !important;
    border-radius: 7px !important;
    background: var(--ui-surface) !important;
  }
  & .steel-assignment-beam-view-button {
    min-height: 30px !important;
    padding: 6px 12px !important;
    border: 0 !important;
    border-radius: 4px !important;
    background: transparent !important;
    color: var(--ui-muted) !important;
    font-size: 12px !important;
  }
  & .steel-assignment-beam-view-button.is-active { background: var(--ui-selected) !important; color: var(--ui-text) !important; }
  & .steel-assignment-import-action { display: grid; justify-items: end; gap: 7px; margin-left: auto; }
  & .steel-assignment-import-button { min-height: 36px !important; border-radius: 6px !important; font-size: 12px !important; }
  & .steel-assignment-import-formats { color: var(--ui-muted); font-size: 10px; letter-spacing: .04em; }
  & .steel-assignment-table-wrap {
    min-height: 0;
    margin: 20px 28px;
    border-radius: 7px !important;
    scrollbar-gutter: stable;
  }
  & .steel-assignment-table-wrap.is-scheme { flex: 1 1 auto; }
  & .steel-assignment-table th { border-radius: 0 !important; }
  & .steel-assignment-method-display { inset: 0 24px 0 8px; align-items: center !important; color: var(--ui-text); font-weight: 500; }
  & .steel-assignment-method-select { display: block; margin: 0 !important; }
  & .steel-assignment-method-select:not(:focus) { color: transparent !important; -webkit-text-fill-color: transparent !important; text-shadow: none !important; }
  & .steel-assignment-method-select option { color: var(--ui-text) !important; -webkit-text-fill-color: var(--ui-text) !important; background: var(--ui-input) !important; }
  & :is(.steel-assignment-status.is-na, .steel-assignment-status.is-pending) { color: var(--ui-muted) !important; background: var(--ui-raised) !important; border-color: var(--ui-line) !important; }
  & .steel-assignment-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 256px;
    padding: 30px 24px;
    text-align: center;
  }
  & .steel-assignment-empty-icon {
    width: 64px;
    height: 64px;
    padding: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--ui-line);
    border-radius: 14px;
    background: var(--ui-raised);
    color: var(--ui-accent);
  }
  & .steel-assignment-empty-icon svg { display: block; width: 100%; height: 100%; }
  & .steel-assignment-empty h4 { margin: 0 0 9px; font-size: 17px; font-weight: 600; color: var(--ui-text); }
  & .steel-assignment-empty p { max-width: 440px; margin: 0; font-size: 13px; line-height: 1.7; color: var(--ui-muted); }
  & .steel-assignment-empty .steel-assignment-empty-hint { max-width: 520px; margin-top: 16px; font-size: 11px; }
  &.is-empty .steel-assignment-table-wrap { border-style: dashed !important; }
  & .steel-assignment-actions-row {
    display: flex !important;
    flex-direction: row !important;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end !important;
    gap: 10px !important;
    margin: 0 !important;
    padding: 16px 28px !important;
    border-top: 1px solid var(--ui-line);
    border-radius: 0 !important;
  }
  & .steel-assignment-summary { margin: 0 auto 0 0; color: var(--ui-muted); font-size: 12px; }
  & .steel-assignment-actions-row button { flex: 0 0 auto !important; width: auto !important; min-width: 90px; min-height: 36px !important; padding: 8px 16px !important; border-radius: 6px !important; }
  & button:disabled { opacity: .45; cursor: default !important; }
  & button:hover:not(:disabled) { filter: brightness(1.12); }
  & :is(button, [role="tabpanel"]):focus-visible { outline: 2px solid var(--ui-focus) !important; outline-offset: -2px; }

  @media (max-width: 680px) {
    padding: 10px;
    & .steel-assignment-modal { width: calc(100vw - 20px) !important; max-height: calc(100dvh - 20px) !important; }
    & .steel-assignment-header { padding: 20px 18px 16px; }
    & .modal-title { font-size: 21px !important; }
    & .steel-assignment-tabs { padding: 0 18px !important; gap: 20px !important; }
    & .steel-assignment-import-row { padding: 14px 18px; gap: 14px; }
    & .steel-assignment-beam-controls-stack { gap: 12px; }
    & .steel-assignment-beam-view-button { padding-inline: 9px !important; }
    & .steel-assignment-import-action { display: flex; flex-wrap: wrap; align-items: center; margin-left: 0; margin-right: auto; gap: 10px; }
    & .steel-assignment-table-wrap { margin: 16px 18px; }
    & .steel-assignment-empty { min-height: 220px; padding: 24px 16px; }
    & .steel-assignment-actions-row { padding: 14px 18px !important; }
    & .steel-assignment-summary { flex-basis: 100%; }
  }
  @media (max-height: 480px) {
    & .steel-assignment-modal { overflow-y: auto !important; }
    & .steel-assignment-table-wrap { flex-shrink: 0; }
    & .steel-assignment-table-wrap.is-scheme { min-height: 260px; }
    & .steel-assignment-empty { min-height: 180px; }
  }
}

/* Compact graphite CAD chrome; the explicit light theme remains available. */
body#structacad-workspace.cad-workspace[data-ui-theme="dark"] :is(#top-panel, #mode-dock, #sidebar, .workspace-bottom-bar) {
  --ui-bg: #22292d;
  --ui-surface: #252c30;
  --ui-raised: #20272b;
  --ui-input: #1d2428;
  --ui-hover: #303b43;
  --ui-line: #3a444b;
  --ui-line-soft: #343d43;
  --ui-text: #e7ecef;
  --ui-muted: #b8c2c9;
  --ui-accent: #2f9bff;
  --ui-selected: #233f58;
  --ui-focus: #69b6ff;
  --ui-action-bg: #066cf3;
  --ui-action-hover: #005bd5;
  --ui-action-border: #066cf3;
  --ui-action-text: #ffffff;
  --ui-color-scheme: dark;
  --ui-popover-shadow: 0 5px 18px #0004;
  color-scheme: dark;
  color: var(--ui-text);
}
body#structacad-workspace.cad-workspace[data-ui-theme="dark"] #canvas-stage { background-color: #141c21 !important; }
body#structacad-workspace.cad-workspace #mode-dock {
  padding-top: 0 !important;
  gap: 0 !important;
  border-right-color: var(--ui-line) !important;
  & .dock-button { min-height: 52px !important; flex-basis: 52px !important; color: var(--ui-text) !important; }
  & .dock-button.is-active { color: var(--ui-accent) !important; }
}
body#structacad-workspace.cad-workspace #sidebar {
  & > .cad-panel-header { min-height: 38px !important; padding: 5px 10px !important; }
  & .sidebar-shell { padding: 0 10px 12px !important; }
  & .sidebar-dropdown-summary { min-height: 34px !important; padding: 8px 2px !important; font-size: 11px !important; font-weight: 600 !important; }
  & .sidebar-dropdown-summary::after { content: "" !important; flex: 0 0 5px; width: 5px !important; height: 5px !important; margin-right: 5px; border: 0 !important; border-right: 1px solid currentColor !important; border-bottom: 1px solid currentColor !important; border-radius: 0 !important; mask: none !important; -webkit-mask: none !important; background: none !important; transform: rotate(45deg); }
  & details[open] > .sidebar-dropdown-summary::after { transform: rotate(225deg); }
  & .sidebar-dropdown-body { padding: 6px 0 10px !important; }
  & :is(.grid-system-launch, .cad-module-steel button) { min-height: 30px !important; padding: 6px 8px !important; font-size: 11px !important; }
  & :is(.grid-system-launch, .cad-module-steel button, .project-unit-system-button, .project-action-button, .btn-preview, .btn-export):hover:not(:disabled) { color: var(--ui-text) !important; }
  & #sidebar-import-menu > .sidebar-dropdown-body { padding: 5px 3px !important; margin: 0 0 4px; border-radius: 3px; background: var(--ui-raised); }
  & #sidebar-import-menu .ui-vector-icon::before { width: 15px !important; height: 15px !important; flex-basis: 15px !important; }
  & #sidebar-import-menu .grid-system-launch { gap: 10px; }
  & .workspace-more-imports { margin-top: 3px; border: 0 !important; border-top: 1px solid var(--ui-line-soft) !important; border-radius: 0 !important; background: transparent; box-shadow: none; }
  & .workspace-more-imports > summary { display: flex; align-items: center; min-height: 29px; gap: 8px; padding: 5px 8px; color: var(--ui-muted); font-size: 11px; cursor: pointer; list-style: none; }
  & .workspace-more-imports > summary::-webkit-details-marker { display: none; }
  & .workspace-more-imports > summary::after { content: ""; margin-left: auto; width: 5px; height: 5px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); }
  & .workspace-more-imports[open] > summary::after { transform: rotate(225deg); }
  & .workspace-more-imports > summary:hover { background: var(--ui-hover); color: var(--ui-text); }
  & :is(input, select, textarea) { color-scheme: var(--ui-color-scheme) !important; }
  & select option { background: var(--ui-input); color: var(--ui-text); }
  & #project-bar-set-open-btn { width: 100% !important; min-width: 0 !important; padding-inline: 4px !important; white-space: normal !important; overflow-wrap: anywhere; }
}
body#structacad-workspace.cad-workspace #top-panel {
  & .top-panel-brand { color: var(--ui-text) !important; font-weight: 650 !important; }
  & .top-panel-project-name { border-left: 1px solid var(--ui-line); margin-left: 8px; padding-left: 16px; }
  & #top-panel-project-name { font-size: 12px !important; }
  & .top-panel-icon-button { color: var(--ui-muted) !important; }
  & #workspace-tool-select-shortcut:is(.active-tool, .is-active) { background: var(--ui-selected) !important; color: var(--ui-text) !important; box-shadow: none !important; border-radius: 3px !important; }
  & #workspace-export-combined-btn { color: #fff !important; background: var(--ui-action-bg) !important; border-color: var(--ui-action-border) !important; border-radius: 3px !important; }
  & #workspace-export-combined-btn:hover:not(:disabled) { background: var(--ui-action-hover) !important; }
  & #workspace-spreadsheet-download-btn { color: var(--ui-text) !important; border: 1px solid var(--ui-line-soft) !important; border-radius: 3px !important; }
}
body#structacad-workspace.cad-workspace #canvas-stage .workspace-bottom-bar {
  background: var(--ui-bg) !important;
  border-top-color: var(--ui-line) !important;
  & :is(#coordinates-display, #tool-display, #tool-display strong) { color: var(--ui-text) !important; font-size: 11px !important; }
}
/* The canvas now draws the grid in model coordinates, including zoom and pan. */
body#structacad-workspace.cad-workspace #canvas-stage,
body#structacad-workspace.cad-workspace #canvas-stage::before { background-image: none !important; }

/* Drawing settings stay accessible at the right edge of the status strip. */
body#structacad-workspace.cad-workspace #canvas-stage .workspace-bottom-bar #coordinates-bar {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px !important;
  padding: 0 8px 0 14px !important;
  overflow: visible;
  & #tool-display { min-width: 0; text-align: left; }
}
body#structacad-workspace.cad-workspace .workspace-drawing-status {
  pointer-events: auto;
  display: flex;
  align-items: stretch;
  align-self: stretch;
  min-width: 0;
  gap: 0;
  border-left: 1px solid var(--ui-line-soft);
  border-radius: 0 !important;
  & .workspace-status-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: auto;
    min-width: 0;
    min-height: 0;
    height: 100%;
    margin: 0;
    padding: 0 10px;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: var(--ui-muted) !important;
    box-shadow: none !important;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    list-style: none;
  }
  & .workspace-status-control:hover,
  & details[open] > summary { background: var(--ui-hover) !important; color: var(--ui-text) !important; }
  & summary::-webkit-details-marker { display: none; }
  & [data-status-value] { color: var(--ui-text); font-variant-numeric: tabular-nums; }
  & .workspace-status-toggle { gap: 7px; }
  & .workspace-status-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: var(--ui-muted); opacity: .55; }
  & [aria-pressed="true"] .workspace-status-dot { background: #258cff; opacity: 1; }
  & .workspace-status-alignment { position: relative; margin: 0; padding: 0; border: 0; border-right: 1px solid var(--ui-line-soft); background: transparent; }
  & .workspace-status-popover {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    z-index: 2;
    width: 250px;
    box-sizing: border-box;
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--ui-line);
    border-radius: 4px;
    background: var(--ui-surface);
    color: var(--ui-text);
    box-shadow: var(--ui-popover-shadow);
    & label { font-size: 12px; }
    & input { width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid var(--ui-line); border-radius: 3px; background: var(--ui-input); color: var(--ui-text); color-scheme: var(--ui-color-scheme); }
    & p { margin: 0; color: var(--ui-muted); font-size: 11px; }
    & .workspace-status-actions { display: flex; justify-content: flex-end; gap: 6px; }
    & button { width: auto; min-height: 28px; padding: 4px 10px; border: 1px solid var(--ui-line); border-radius: 3px; background: var(--ui-raised); color: var(--ui-text); font-size: 11px; cursor: pointer; }
    & button:hover { background: var(--ui-hover); }
    & button[type="submit"] { background: var(--ui-action-bg); color: var(--ui-action-text); border-color: var(--ui-action-border); }
  }
}
@media (max-width: 1050px) {
  body#structacad-workspace.cad-workspace #canvas-stage .workspace-bottom-bar #coordinates-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    & #coordinates-display { display: none; }
    & #tool-display { grid-column: 1; }
  }
}
@media (max-width: 640px) {
  body#structacad-workspace.cad-workspace { --cad-status-height: 56px; }
  body#structacad-workspace.cad-workspace #canvas-stage .workspace-bottom-bar #coordinates-bar {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 24px 30px;
    gap: 0 !important;
    padding: 0 4px !important;
    & #tool-display { padding: 0 6px; }
  }
  body#structacad-workspace.cad-workspace .workspace-drawing-status {
    grid-row: 2;
    justify-content: flex-end;
    border-left: 0;
    border-top: 1px solid var(--ui-line-soft);
    & .workspace-status-control { padding-inline: 6px; font-size: 10px; gap: 4px; }
    & .workspace-status-alignment { position: static; }
    & .workspace-status-popover { right: 4px; bottom: calc(100% + 6px); width: min(250px, calc(100vw - 8px)); }
  }
}
body#structacad-workspace.cad-workspace #workspace-steel-legend:not(.is-editing) {
  width: 244px;
  border-radius: 3px !important;
  box-shadow: none;
  & .steel-legend-header { padding: 8px 10px 5px; }
  & h2 { font-size: 12px; }
  & .steel-legend-header p { font-size: 10px; }
  & .steel-legend-header-actions button { width: 24px; min-height: 24px; padding: 4px; }
  & .steel-legend-ratio { margin: 0 10px 4px; padding: 5px 0; border: 0 !important; border-top: 1px solid var(--ui-line) !important; border-radius: 0 !important; background: transparent; font-size: 10px; }
  & .steel-legend-rows { padding: 0 10px 8px; }
  & .steel-legend-row { min-height: 23px; gap: 6px; }
  & .steel-legend-row:last-child { margin-top: 0; padding-top: 0; border: 0; }
  & :is(.steel-legend-name, .steel-legend-range) { font-size: 10px; }
  & .steel-legend-swatch { width: 9px; height: 9px; border-radius: 2px !important; }
}
body#structacad-workspace.cad-workspace #workspace-exit-beam-steel-mode-btn { left: calc(var(--workspace-sidebar-overlap, 0px) + 12px); max-width: calc(100% - var(--workspace-sidebar-overlap, 0px) - 24px); }
/* Keep desktop tools and view selectors on one strip; smaller screens wrap. */
@media (min-width: 1100px) {
  body#structacad-workspace.cad-workspace,
  body#structacad-workspace.cad-workspace:has(#workspace-steel-view-menu:not([hidden])) { --top-panel-height: 78px; }
  body#structacad-workspace.cad-workspace #top-panel {
    grid-template-rows: 40px 38px !important;
    & .top-panel-center { display: flex !important; padding: 0 12px 0 64px !important; gap: 8px !important; }
    & .workspace-quick-tools { gap: 3px !important; }
    & .workspace-quick-tools-overlay { flex: 0 0 auto !important; }
    & .top-tool-group + .top-tool-group { padding-left: 4px; }
    & :is(.workspace-tool-shortcut, .workspace-history-button) { width: 28px !important; min-width: 28px !important; flex-basis: 28px !important; }
    & #workspace-corner-controls { display: flex !important; justify-content: flex-end !important; gap: 6px !important; border-top: 0; }
    & #workspace-level-switch { margin-left: 0; }
    & #workspace-steel-view-menu { min-width: 0; flex: 0 1 168px; }
    & #workspace-steel-view-trigger { min-width: 0 !important; max-width: 168px; }
    & #workspace-steel-view-trigger-label { min-width: 0; overflow: hidden !important; text-overflow: ellipsis; white-space: nowrap; }
    & :is(#workspace-tool-select-shortcut, #workspace-tool-delete-shortcut) { width: auto !important; flex-basis: auto !important; }
  }
  body#structacad-workspace.cad-workspace:has(#workspace-steel-view-menu:not([hidden])) #top-panel {
    grid-template-rows: 40px 38px !important;
    & .top-panel-center { display: flex !important; }
    & #workspace-corner-controls { display: flex !important; }
    & .top-tool-group-draw [data-workspace-sidebar-mode] { display: none !important; }
  }
}
@media (min-width: 761px) and (max-width: 1099px) {
  body#structacad-workspace.cad-workspace { --top-panel-height: 112px; }
  body#structacad-workspace.cad-workspace #top-panel { grid-template-rows: 40px 72px !important; }
  body#structacad-workspace.cad-workspace:has(#workspace-steel-view-menu:not([hidden])) { --top-panel-height: 146px; }
  body#structacad-workspace.cad-workspace:has(#workspace-steel-view-menu:not([hidden])) #top-panel { grid-template-rows: 40px 106px !important; }
}

/* SAFE foundation review: keep the common elevation, element identity and
   per-footing values distinct, using the active workspace palette. */
body#structacad-workspace.cad-workspace #app-dialog-overlay[data-purpose="safe-foundation-levels"] {
  & .app-dialog-content {
    --ui-radius: 7px;
    box-sizing: border-box;
    width: min(860px, calc(100vw - 40px));
    max-width: none;
    max-height: calc(100dvh - 40px) !important;
    padding: 0 !important;
    gap: 0;
    overflow: hidden;
    border-radius: 14px !important;
    box-shadow: 0 24px 80px #0005 !important;
  }
  & .overlay-header {
    padding: 26px 28px 0 !important;
    margin: 0 !important;
    border: 0 !important;
  }
  & .overlay-kicker { margin: 0 0 9px !important; color: var(--ui-accent) !important; font-size: 10px !important; letter-spacing: .1em !important; }
  & .modal-title { margin: 0 !important; font-size: 24px !important; font-weight: 600 !important; line-height: 1.25 !important; letter-spacing: -.6px !important; }
  & .app-dialog-message {
    box-sizing: border-box;
    width: auto;
    margin: 12px 28px 22px !important;
    padding: 0;
    color: var(--ui-muted) !important;
    font-size: 12px !important;
    line-height: 1.65;
  }
  & .app-dialog-body { display: block; padding: 0 28px 22px; margin: 0; overflow: auto; scrollbar-width: thin; }
  & .safe-foundation-levels-form { display: grid; gap: 0; font-size: 13px; }
  & .safe-foundation-levels-bulk {
    grid-template-columns: minmax(0, 1fr) 116px auto;
    gap: 12px;
    padding: 16px;
    margin: 0 0 22px;
    border: 1px solid var(--ui-line);
    border-radius: 10px;
    background: var(--ui-raised);
  }
  & .safe-levels-bulk-copy label { display: block; margin: 0; color: var(--ui-text) !important; font-size: 13px !important; font-weight: 600 !important; }
  & .safe-levels-bulk-copy small { display: block; margin-top: 5px; color: var(--ui-muted); font-size: 11px; line-height: 1.5; }
  & .safe-level-input { position: relative; min-width: 0; }
  & .safe-level-input > span { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); color: var(--ui-muted); font-size: 12px; pointer-events: none; }
  & .safe-foundation-levels-form :is(input, select) {
    height: 40px !important;
    min-height: 40px !important;
    margin: 0;
    padding: 9px 12px !important;
    border: 1px solid var(--ui-line) !important;
    border-radius: 7px !important;
    background: var(--ui-input) !important;
    color: var(--ui-text) !important;
    font-size: 13px !important;
    box-shadow: none !important;
  }
  & .safe-level-input input { padding-right: 38px !important; font-variant-numeric: tabular-nums; }
  & .safe-foundation-levels-form :is(input, select):focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 2px; border-color: var(--ui-focus) !important; }
  & .safe-foundation-levels-form :is(input, select)[aria-invalid="true"] { border-color: #d67474 !important; background: color-mix(in srgb, #d67474 8%, var(--ui-input)) !important; }
  & .safe-foundation-levels-bulk button {
    height: 40px; margin: 0; padding: 0 14px;
    border: 1px solid var(--ui-action-border) !important;
    border-radius: 7px !important;
    background: var(--ui-selected) !important;
    color: var(--ui-accent) !important;
    font-size: 12px !important;
    white-space: nowrap;
  }
  & .safe-foundation-levels-bulk button:hover:not(:disabled) { background: var(--ui-hover) !important; }
  & .safe-foundation-levels-bulk button:disabled { opacity: .45; cursor: default; }
  & .safe-levels-table-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: var(--ui-text); font-size: 12px; font-weight: 600; }
  & .safe-levels-count { color: var(--ui-muted); font-size: 11px; font-weight: 400; }
  & .safe-foundation-levels-table { max-height: 38vh; max-height: min(400px, 38dvh); border: 1px solid var(--ui-line); border-radius: 9px; scrollbar-width: thin; scrollbar-color: var(--ui-line) transparent; }
  & .safe-foundation-levels-table table { table-layout: fixed; border-spacing: 0; border-collapse: separate; margin: 0; }
  & .safe-foundation-levels-table :is(th, td) { padding: 15px 16px; border: 0; border-bottom: 1px solid var(--ui-line-soft); vertical-align: middle; text-align: left; background: transparent; }
  & .safe-foundation-levels-table thead th { padding-block: 11px; background: var(--ui-raised) !important; color: var(--ui-muted) !important; font-size: 11px !important; font-weight: 500 !important; border-radius: 0 !important; }
  & .safe-foundation-levels-table thead th:first-child { width: 46%; }
  & .safe-foundation-levels-table thead th:nth-child(2) { width: 20%; }
  & .safe-foundation-levels-table thead th:last-child { width: 34%; }
  & .safe-foundation-levels-table tbody tr:last-child > * { border-bottom: 0; }
  & .safe-foundation-levels-table tbody tr:hover { background: color-mix(in srgb, var(--ui-hover) 45%, transparent); }
  & .safe-foundation-levels-table tbody tr:focus-within { background: color-mix(in srgb, var(--ui-selected) 40%, transparent); }
  & .safe-element-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
  & .safe-element-identity > div { min-width: 0; }
  & .safe-element-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border: 1px solid var(--ui-line); border-radius: 8px; background: var(--ui-raised); color: var(--ui-accent); }
  & .safe-element-icon svg { display: block; width: 28px; height: 28px; }
  & .safe-element-name { display: block; margin: 0 !important; color: var(--ui-text) !important; font-size: 13px !important; font-weight: 600 !important; line-height: 1.4; overflow-wrap: anywhere; }
  & .safe-element-kind { display: block; margin-top: 4px; color: var(--ui-accent); font-size: 11px; font-weight: 400; line-height: 1.4; }
  & .safe-element-dimension { color: var(--ui-text); font-size: 13px; font-variant-numeric: tabular-nums; }
  & .safe-foundation-levels-table small { margin-top: 6px; color: var(--ui-muted); font-size: 10px; line-height: 1.45; }
  & .safe-level-automatic { color: var(--ui-accent); font-size: 12px; }
  & .safe-foundation-levels-status { display: flex; align-items: flex-start; gap: 9px; width: auto; margin: 14px 0 0; color: var(--ui-muted) !important; font-size: 11px !important; line-height: 1.6; }
  & .safe-foundation-levels-status::before { content: ""; box-sizing: border-box; width: 15px; height: 15px; flex: 0 0 15px; margin-top: 1px; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='none' stroke='black'/%3E%3Cpath d='M8 7v5M8 4v1.5' stroke='black'/%3E%3C/svg%3E") center / contain no-repeat; }
  & .safe-foundation-levels-status[data-state="ready"] { color: var(--ui-accent) !important; }
  & .safe-foundation-levels-status[data-state="ready"]::before { mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.5' fill='none' stroke='black'/%3E%3Cpath d='m4.5 8 2.3 2.5 4.7-5' fill='none' stroke='black'/%3E%3C/svg%3E"); }
  & .safe-foundation-levels-error { margin: 14px 0 0; padding: 12px 14px; font-size: 12px; }
  & :is(.safe-foundation-levels-status, .safe-foundation-levels-error)[hidden] { display: none !important; }
  & .app-dialog-actions {
    display: flex !important; justify-content: flex-end; flex-wrap: wrap;
    margin: 0 !important; padding: 18px 28px !important;
    border-top: 1px solid var(--ui-line-soft); border-radius: 0;
    background: var(--ui-raised); gap: 10px !important;
  }
  & .app-dialog-actions button { flex: 0 1 auto !important; width: auto !important; min-width: 100px; min-height: 42px; margin: 0; padding: 10px 18px !important; border-radius: 7px !important; font-size: 12px !important; }
  & #app-dialog-cancel-btn { background: transparent !important; }
  & #app-dialog-confirm-btn { min-width: 220px; }
  @media (max-width: 600px) {
    & .app-dialog-content { width: calc(100vw - 20px); max-height: calc(100dvh - 20px) !important; border-radius: 11px !important; }
    & .overlay-header { padding: 20px 16px 0 !important; }
    & .modal-title { font-size: 21px !important; }
    & .app-dialog-message { margin: 10px 16px 16px !important; font-size: 11px !important; }
    & .app-dialog-body { padding: 0 16px 16px; }
    & .safe-foundation-levels-bulk { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px; margin-bottom: 18px; }
    & .safe-levels-bulk-copy { grid-column: 1 / -1; }
    & .safe-foundation-levels-table { max-height: 38dvh; }
    & .safe-foundation-levels-table :is(th, td) { padding: 12px 8px; }
    & .safe-foundation-levels-table thead th:first-child { width: 42%; }
    & .safe-foundation-levels-table thead th:nth-child(2) { width: 19%; }
    & .safe-foundation-levels-table thead th:last-child { width: 39%; }
    & .safe-element-icon { display: none; }
    & .safe-element-name { font-size: 12px !important; }
    & .safe-element-dimension { font-size: 11px; }
    & .safe-element-kind { font-size: 10px; }
    & .app-dialog-actions { padding: 14px 16px !important; gap: 8px !important; }
    & .app-dialog-actions button { min-width: 0; padding: 10px 12px !important; }
    & #app-dialog-confirm-btn { min-width: 0; flex: 1 1 auto !important; }
  }
}

@keyframes split-dxf-activity {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}
