/*
 * SHARED_BUILDER_001_H1 — workspace state/action isolation closeout.
 *
 * Scope:
 *   - keep Professional-only actions and presentation out of Main Builder/Race Profiler;
 *   - preserve the Professional Canvas state for return without leaving visible DOM behind;
 *   - refine the Main Builder System Management controls.
 *
 * No report calculation, saved-state payload, database or backend behaviour changes.
 */

/* Professional report actions are never allowed to participate in non-Pro layouts. */
#builder-actions .report-option.pro-only[hidden],
body:not([data-workspace-mode="pro_system_builder"]) #builder-actions .report-option.pro-only,
body[data-workspace-mode="system_builder"] #builder-actions .report-option.pro-only,
body[data-workspace-mode="race_profiler"] #builder-actions .report-option.pro-only{
  display:none!important;
}
body[data-workspace-mode="pro_system_builder"] #builder-actions .report-option.pro-only:not([hidden]){
  display:grid!important;
}

/* Defensive presentation boundary for dynamically mounted Professional components. */
body:not([data-workspace-mode="pro_system_builder"]) :is(
  #proCanvasShell,
  #proCanvasStageIntro,
  #proCanvasSystemJourney,
  #proCanvasRaceRulesStage,
  #proCanvasRunnerSelectionStage,
  #proSireQueryGridPanel
){
  display:none!important;
}

/* Main System Builder management is one balanced command row. */
body[data-workspace-mode="system_builder"] #builder-actions .system-management-card{
  grid-template-rows:auto auto auto!important;
  align-content:center!important;
  justify-content:stretch!important;
  gap:8px!important;
}
body[data-workspace-mode="system_builder"] #builder-actions .system-management-card > .card-title{
  text-align:center!important;
}
body[data-workspace-mode="system_builder"] #builder-actions .system-management-card .management-copy{
  max-width:620px!important;
  margin:0 auto!important;
  text-align:center!important;
  font-size:8.8px!important;
  line-height:1.3!important;
}
body[data-workspace-mode="system_builder"] #builder-actions .system-management-card .action-row{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  align-items:stretch!important;
  justify-content:stretch!important;
  gap:7px!important;
  width:100%!important;
  margin:2px 0 0!important;
}
body[data-workspace-mode="system_builder"] #builder-actions .system-management-card .action-row .btn{
  min-width:0!important;
  min-height:38px!important;
  height:auto!important;
  padding:7px 8px!important;
  border-radius:10px!important;
  font-size:9px!important;
  line-height:1.12!important;
  white-space:normal!important;
  text-align:center!important;
}

@media(max-width:1100px){
  body[data-workspace-mode="system_builder"] #builder-actions .system-management-card .action-row{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}
