/* Local production workspace; existing cutting/inspection widgets keep their IDs. */
#guillotineWorkspace .guillotine-layout { grid-template-columns: minmax(230px, 280px) minmax(0, 1fr); grid-template-rows: 330px auto auto; grid-template-areas: 'settings map' 'settings previews' 'parts parts'; min-height: 0; align-items: start; }
#guillotineWorkspace .guillotine-canvas-panel { min-height: 330px; height: 330px; }
#guillotineWorkspace .guillotine-settings { max-height: 980px; }
#guillotineWorkspace .guillotine-parts-section { max-height: 320px; min-height: 180px; }
#guillotineWorkspace .guillotine-production-host { display: block; height: auto; min-height: 620px; max-height: none; align-self: stretch; }
#guillotineWorkspace .guillotine-canvas-panel { grid-template-rows: auto minmax(0, 1fr) auto; }
#guillotineWorkspace .guillotine-parts-section { height: 260px; }
#guillotineWorkspace .guillotine-layout { height: max-content; align-self: start; }
#guillotineWorkspace .guillotine-production-host { height: max-content; }
#guillotineProductionPanel.production-panel { display: block; height: auto; }
#guillotineWorkspace .guillotine-production-host > [hidden], .production-panel [hidden], .production-tabs [hidden] { display: none !important; }
#guillotineWorkspace .guillotine-production-host > .guillotine-preview-card, #guillotineWorkspace .guillotine-production-host > .guillotine-technical-preview-card { height: 610px; min-height: 610px; }
#guillotineWorkspace .guillotine-production-host .guillotine-preview-3d { min-height: 490px; }
.production-tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 0 10px; }
.production-tabs button, .production-segment button { padding: 8px 12px; background: #132238; color: #9fb3cc; border: 1px solid #2b405d; border-radius: 7px; cursor: pointer; font-size: 12px; }
.production-tabs [aria-selected='true'], .production-segment [aria-pressed='true'] { color: #ecf6ff; background: #214c7e; border-color: #5aa8fa; }
.production-panel { padding: 16px; border: 1px solid #2c4562; border-radius: 14px; background: #101c2d; color: #e0edfb; overflow: hidden; }
.production-heading, .production-toolbar, .production-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.production-heading { justify-content: space-between; margin-bottom: 14px; }
.production-heading small { color: #69b5ff; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.production-heading h3 { font-size: 20px; margin: 4px 0 0; }
.production-mm { color: #a7bdd6; border: 1px solid #355373; padding: 5px 10px; border-radius: 6px; font-size: 11px; }
.production-toolbar { justify-content: space-between; margin-bottom: 10px; }
.production-segment { display: flex; gap: 4px; }
.production-actions { margin: 10px 0; }
.production-actions button { font-size: 11px; padding: 8px 10px; }
.production-actions span { color: #90a8c4; font-size: 11px; }
.production-toolbar-spacer { flex: 1; }
.production-status { color: #9ab6d3; font-size: 12px; padding: 10px 12px; background: #15283f; border-radius: 7px; margin: 12px 0; line-height: 1.5; }
.production-status[data-state='ready'] { border-left: 3px solid #52c6a1; }
.production-status[data-state='busy'] { border-left: 3px solid #66b7ff; }
.production-status[data-state='error'] { color: #ffd198; border-left: 3px solid #efa55e; }
.production-viewport { position: relative; border: 1px solid #2a415b; border-radius: 10px; overflow: hidden; }
.production-canvas { width: 100%; height: 450px; background: #09121e; }
.production-canvas canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.production-selection { position: absolute; top: 12px; left: 12px; max-width: 260px; padding: 12px 14px; background: #132338ed; border: 1px solid #5285b8; border-radius: 8px; font-size: 12px; pointer-events: none; }
.production-selection p { margin: 6px 0 0; color: #b9cce1; }
.production-empty { position: absolute; inset: 0; display: grid; place-content: center; padding: 20px; text-align: center; color: #a9c2dc; pointer-events: none; }
.production-surface-list { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 3px; }
.production-surface { flex: 0 0 auto; display: flex; flex-direction: column; gap: 5px; align-items: start; background: #172a42; color: #d7e8fc; border: 1px solid #314d6e; border-radius: 8px; padding: 10px 12px; cursor: pointer; }
.production-surface strong { font-size: 11px; }
.production-surface span { font-size: 10px; color: #a1bad5; }
.production-process-label { position: absolute; left: 12px; top: 10px; pointer-events: none; color: #c4daed; background: #09121ed9; border: 1px solid #334c63; border-radius: 5px; padding: 5px 9px; font-size: 11px; }
.production-process-label[hidden] { display: none; }
#productionProcess { white-space: nowrap; }
.guillotine-part-detail .guillotine-fit-status[data-state='pending'] { color: #9fb6c9; }
.guillotine-part-detail .guillotine-fit-status[data-state='rejected'] { color: #f28d96; }
#productionProcess[aria-pressed='true'] { border-color: #6db6e4; color: #c4e8ff; }
@media (max-width: 1000px) { #guillotineWorkspace .guillotine-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: 330px auto auto auto; grid-template-areas: 'map' 'previews' 'settings' 'parts'; } #guillotineWorkspace .guillotine-settings { max-height: none; } .production-canvas { height: 400px; } }
@media (max-width: 600px) { .production-panel { padding: 10px; } .production-heading h3 { font-size: 17px; } .production-canvas { height: 340px; } }

/* Desktop workbench: both primary canvases share the available viewport.
   Only secondary lists/settings may scroll; neither central pane does. */
@media (min-width: 1200px) and (min-height: 700px) {
  body:has(.viewer-area[data-workspace-mode='guillotine']) .app-shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  body:has(.viewer-area[data-workspace-mode='guillotine']) .app-shell > .sidebar,
  body:has(.viewer-area[data-workspace-mode='guillotine']) #panelToggleBtn { display: none; }
  .viewer-area[data-workspace-mode='guillotine'] { grid-template-rows: minmax(0, 1fr); gap: 0; }
  .viewer-area[data-workspace-mode='guillotine'] .viewer-bottom-grid,
  .viewer-area[data-workspace-mode='guillotine'] #viewerConsoleCard { display: none !important; }
  #guillotineWorkspace { display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
  #guillotineWorkspace .guillotine-header { display: flex; flex-wrap: nowrap; align-items: center; min-height: 42px; padding: 4px 8px; gap: 8px; }
  #guillotineWorkspace .guillotine-header-left { display: flex; flex: 1; min-width: 0; align-items: center; gap: 8px; }
  #guillotineWorkspace .guillotine-header-left .guillotine-header-title { margin-right: auto; }
  #guillotineWorkspace .guillotine-header-meta { flex-wrap: nowrap; }
  #guillotineWorkspace .guillotine-subtitle,
  #guillotineWorkspace .guillotine-kicker { display: none; }
  #guillotineWorkspace .guillotine-header-title { gap: 7px; }
  #guillotineWorkspace .guillotine-layout {
    height: 100%; min-height: 0; align-self: stretch; overflow: hidden;
    grid-template-columns: var(--guillotine-left, 214px) minmax(0, 1fr) var(--guillotine-right, 190px);
    grid-template-rows: minmax(0, .44fr) minmax(0, .56fr);
    grid-template-areas: 'settings map parts' 'previews previews previews';
    gap: 6px; padding: 6px; align-items: stretch;
  }
  #guillotineWorkspace .guillotine-settings { min-height: 0; max-height: none; overflow-y: auto; }
  #guillotineWorkspace .guillotine-parts-section { min-height: 0; max-height: none; height: 100%; padding: 8px; }
  #guillotineWorkspace .guillotine-parts-heading { padding: 0 0 6px; }
  #guillotineWorkspace .guillotine-canvas-panel { min-height: 0; height: 100%; overflow: hidden; padding: 4px; gap: 4px; }
  #guillotineWorkspace .guillotine-canvas-frame { min-height: 0; max-height: none; height: 100%; margin: 0; }
  #guillotineWorkspace .guillotine-canvas-toolbar { min-height: 30px; height: 30px; padding: 0; }
  #guillotineWorkspace .guillotine-canvas-toolbar button { min-height: 28px; height: 28px; padding: 4px 8px; font-size: 11px; }
  #guillotineWorkspace .guillotine-legend { min-height: 14px; height: 14px; margin: 0; padding: 0; font-size: 10px; }
  #guillotineWorkspace .guillotine-production-host {
    display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 4px;
    min-height: 0; height: 100%; overflow: hidden;
  }
  #guillotineWorkspace .guillotine-production-host > * { grid-area: auto; grid-column: 1; }
  #guillotineWorkspace .production-tabs { padding: 0; gap: 4px; }
  #guillotineWorkspace .production-tabs button { padding: 5px 10px; min-height: 28px; }
  #guillotineProductionPanel.production-panel {
    display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto;
    min-height: 0; height: 100%; gap: 4px; padding: 6px;
  }
  #guillotineWorkspace .production-heading { display: none; }
  #guillotineWorkspace .production-toolbar,
  #guillotineWorkspace .production-actions { margin: 0; gap: 5px; }
  #guillotineWorkspace .production-toolbar > button { min-height: 28px; padding: 5px 8px; font-size: 11px; }
  #guillotineWorkspace .production-segment { gap: 3px; }
  #guillotineWorkspace .production-segment button,
  #guillotineWorkspace .production-actions button { min-height: 28px; padding: 5px 8px; font-size: 11px; }
  #guillotineWorkspace .production-status { margin: 0; padding: 2px 8px; font-size: 11px; line-height: 16px; }
  #guillotineWorkspace .production-viewport { min-height: 0; height: 100%; }
  #guillotineWorkspace .production-canvas { height: 100%; min-height: 0; }
  #guillotineWorkspace .production-surface-list { padding: 0; gap: 5px; }
  #guillotineWorkspace .production-surface { padding: 5px 8px; gap: 3px; }
  #guillotineWorkspace .production-surface strong { font-size: 11px; }
  #productionSurfaceList .production-surface { min-height: 28px; justify-content: center; }
  #productionSurfaceList .production-surface span { display: none; }
  #guillotineWorkspace .guillotine-production-host > .guillotine-preview-card,
  #guillotineWorkspace .guillotine-production-host > .guillotine-technical-preview-card { min-height: 0; height: 100%; overflow: hidden; }
  #guillotineWorkspace .guillotine-production-host .guillotine-preview-3d,
  #guillotineWorkspace .guillotine-production-host .guillotine-preview-3d canvas,
  #guillotineWorkspace .guillotine-production-host .guillotine-technical-preview-svg { min-height: 0; height: 100%; }
  #guillotineWorkspace .guillotine-preview-note { display: none; }
  body:has(.viewer-area[data-workspace-mode='guillotine']) #localDevAuthBar { top: 8px !important; padding: 3px 8px; font-size: 11px; }
  body:has(.viewer-area[data-workspace-mode='guillotine']) #localDevAuthBar select { min-height: 26px; height: 26px; }
}

/* Compact secondary controls, shared by desktop and the small-screen fallback. */
#guillotineWorkspace [hidden] { display: none !important; }
#guillotineWorkspace[data-left-collapsed='true'] { --guillotine-left: 0px; }
#guillotineWorkspace[data-right-collapsed='true'] { --guillotine-right: 0px; }
.guillotine-panel-toggles { display: flex; align-items: center; gap: 4px; pointer-events: auto; }
#guillotineWorkspace .guillotine-panel-toggles button { padding: 5px 8px; min-height: 28px; font-size: 11px; }
.guillotine-panel-toggles [aria-expanded='true'], .guillotine-panel-toggles [aria-pressed='true'] { border-color: #5797cc; background: #163554; }
#guillotineWorkspace .guillotine-settings { gap: 5px; }
#guillotineWorkspace .guillotine-panel-body { padding: 7px; }
#guillotineWorkspace .guillotine-native-section > summary { padding: 8px; }
#guillotineWorkspace .guillotine-fields-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
#guillotineWorkspace .guillotine-fields-grid input,
#guillotineWorkspace .guillotine-fields-grid select { height: 32px; min-height: 32px; padding: 4px 7px; font-size: 12px; }
#guillotineWorkspace .guillotine-fields-grid .field > span { font-size: 11px; line-height: 1.25; }
#guillotineWorkspace .guillotine-unit-readout { padding: 5px 7px; }
#guillotineWorkspace .guillotine-help-panel > p { font-size: 11px; line-height: 1.4; margin: 3px 0; }
#guillotineWorkspace #guillotineAddCutBtn { min-height: 32px; padding: 6px; font-size: 12px; }
#guillotineWorkspace .guillotine-cut-list-section { margin-top: 4px; }
#guillotineWorkspace .guillotine-cut-list-section h3 { margin: 3px 0; }
.guillotine-browser-tabs { display: flex; gap: 4px; width: 100%; }
.guillotine-browser-tabs button { flex: 1; padding: 6px 4px; font-size: 11px; background: #12283c; border: 1px solid #2a4560; border-radius: 6px; color: #b5cce1; cursor: pointer; white-space: nowrap; }
.guillotine-browser-tabs [aria-selected='true'] { background: #204c72; color: #eef6ff; border-color: #609dc9; }
#guillotineWorkspace .guillotine-parts-section { display: flex; flex-direction: column; overflow: hidden; }
#guillotinePartsContent, #guillotineBedsList { overflow-y: auto; min-height: 0; }
#guillotineWorkspace .guillotine-parts-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: 32px; height: auto; min-height: 0; max-height: none; align-content: start; gap: 4px; padding: 0; overflow: visible; }
#guillotineWorkspace .guillotine-part-card { display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr; place-content: center; height: 32px; min-height: 32px; padding: 5px 2px; border-radius: 5px; cursor: pointer; }
#guillotineWorkspace .guillotine-part-card h4 { grid-area: 1 / 1; align-self: center; margin: 0; font-size: 11px; text-align: center; }
#guillotineWorkspace .guillotine-part-card.is-selected { border-color: #7bb9e9; background: #1f4565; }
.guillotine-part-detail { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 6px; padding: 10px 0 0; font-size: 11px; }
.guillotine-part-detail > strong { grid-column: 1 / -1; }
.guillotine-part-detail .guillotine-part-thumbnail { height: 72px; min-height: 0; width: 60px; }
.guillotine-part-detail dl { margin: 0; display: grid; gap: 4px; }
.guillotine-part-detail dl > div { display: flex; justify-content: space-between; gap: 3px; font-size: 10px; }
.guillotine-part-detail dt { color: #9bb5ce; }
.guillotine-part-detail dd { margin: 0; white-space: nowrap; }
.guillotine-part-detail .guillotine-fit-status { color: #6dd3b1; }
.guillotine-beds-list { display: grid; align-content: start; gap: 5px; }
.guillotine-beds-list .production-surface { white-space: normal; padding: 8px; font-size: 11px; }
.production-surface[data-material='base'] { border-left: 3px solid #4e8fcb; }
.production-surface[data-material='tapa'] { border-left: 3px solid #809dc0; }
.production-surface[aria-pressed='true'] { background: #264963; border-color: #9bd7ff; }
.production-surface:hover { background: #213c55; }
.production-selection { top: 8px; left: 8px; padding: 7px 10px; max-width: 220px; font-size: 11px; }
#guillotineWorkspace button:focus-visible, #guillotineWorkspace [role='option']:focus-visible { outline: 2px solid #a1d6ff; outline-offset: 2px; }
