/* Local workbench controls: neutral utilities, independent of primary CTAs. */
.flow-editor[data-flow-panels-ready] { position:fixed; inset:0; padding:0; }
.flow-editor[data-flow-panels-ready] .flow-layout { display:block; position:relative; height:100dvh; min-height:0; border:0; isolation:isolate; }
.flow-editor[data-flow-panels-ready] .flow-layout>.flow-board { position:absolute; inset:0; width:100%; height:100%; }
.flow-editor[data-flow-panels-ready] h1.flow-canvas-help { top:calc(var(--flow-gnb-height,66px) + 12px); left:144px; right:144px; height:44px; display:flex; align-items:center; justify-content:center; gap:7px; }
.flow-editor[data-flow-panels-ready] :is(.flow-palette,.flow-inspector) {
  position:absolute; z-index:6; top:calc(var(--flow-gnb-height,66px) + 68px); bottom:80px;
  width:330px; max-width:calc(100% - 32px); max-height:none; margin:0; padding:20px;
  overflow:auto; opacity:1; visibility:visible; transform:translateX(0);
  transition:opacity 180ms ease,transform 180ms cubic-bezier(.22,1,.36,1),visibility 0s;
}
.flow-editor[data-flow-panels-ready] .flow-palette { left:16px; }
.flow-editor[data-flow-panels-ready] .flow-inspector { right:16px; }
.flow-editor[data-flow-panels-ready] .flow-resource-buttons { grid-template-columns:repeat(3,minmax(0,1fr)); }
.flow-editor[data-flow-panels-ready] .flow-resource-buttons button { width:100%; height:auto; min-height:72px; aspect-ratio:1; }
.flow-editor[data-flow-panels-ready] .flow-panel-is-collapsed {
  opacity:0; visibility:hidden; pointer-events:none; transform:translateX(-12px);
  transition:opacity 150ms ease,transform 180ms cubic-bezier(.22,1,.36,1),visibility 0s linear 180ms;
}
.flow-editor[data-flow-panels-ready] .flow-inspector.flow-panel-is-collapsed { transform:translateX(12px); }
.flow-editor[data-flow-panels-ready] .flow-panel-toggles {
  position:fixed; z-index:8; top:calc(var(--flow-gnb-height,66px) + 12px); left:16px; right:16px;
  display:flex; align-items:center; justify-content:space-between; gap:12px; pointer-events:none;
}
.flow-editor[data-flow-panels-ready] .flow-panel-toggle {
  --action-primary-fill:var(--surface); --action-primary-foreground:var(--text); --action-primary-border:var(--line);
  --action-primary-hover-fill:var(--workspace-hover,var(--surface)); --action-primary-hover-border:var(--line-strong);
  display:inline-flex; flex:none; align-items:center; justify-content:center; gap:8px; width:auto;
  height:44px; min-width:44px; min-height:44px; padding:0 12px; pointer-events:auto;
  background:var(--surface); color:var(--text); border:1px solid var(--line);
  border-radius:var(--control-radius); corner-shape:var(--corner-curve); box-shadow:0 2px 10px rgb(0 0 0 / .05);
  font:500 12px/18px var(--font-ui); letter-spacing:0; cursor:pointer;
  transition:background-color 140ms ease,border-color 140ms ease;
}
.flow-editor[data-flow-panels-ready] .flow-panel-toggle:hover { background:var(--workspace-hover,var(--surface)); border-color:var(--line-strong); }
.flow-panel-toggle svg { width:20px; height:20px; flex:none; fill:none; stroke:currentColor; stroke-width:1.5; stroke-linecap:round; stroke-linejoin:round; }
.flow-panel-toggle__pane { fill:currentColor; stroke:none; opacity:.14; transition:opacity 140ms ease; }
.flow-panel-toggle[aria-expanded="false"] .flow-panel-toggle__pane { opacity:0; }
@media (max-width:1100px) {
  .flow-editor[data-flow-panels-ready] .flow-inspector { grid-column:auto; }
  .flow-editor[data-flow-panels-ready] .flow-palette [data-palette] { display:block; }
  .flow-editor[data-flow-panels-ready] .flow-palette>h2:not(:first-child) { margin-top:26px; }
}
@media (max-width:540px) {
  .flow-editor[data-flow-panels-ready] :is(.flow-palette,.flow-inspector) { top:calc(var(--flow-gnb-height,68px) + 66px); bottom:80px; border-radius:var(--radius-panel-mobile); }
  .flow-editor[data-flow-panels-ready] .flow-panel-toggle { width:44px; padding:0; }
  .flow-editor[data-flow-panels-ready] h1.flow-canvas-help { left:68px; right:68px; }
  .flow-panel-toggle__label { display:none; }
}
@media (prefers-reduced-motion:reduce) {
  .flow-editor[data-flow-panels-ready] :is(.flow-palette,.flow-inspector,.flow-panel-toggle,.flow-panel-toggle__pane) { transition:none; }
}
@media (forced-colors:active) {
  .flow-editor[data-flow-panels-ready] .flow-panel-toggle { background:Canvas; color:ButtonText; border-color:ButtonText; box-shadow:none; }
}

@media(max-width:850px){.flow-editor[data-flow-panels-ready] :is(.flow-palette,.flow-inspector){bottom:146px}}

/* Keep the workbench on the shared LABS control scale. The global CTA and icon
   rules load later, so these scoped geometry overrides deliberately win both. */
.flow-editor {
  --flow-control-height:var(--labs-control-height,48px);
  --flow-control-radius:var(--labs-radius-control,var(--control-radius));
}
/* Shared CTA display rules must not reveal inactive progress/run controls. */
html:root body .flow-editor [hidden] { display:none!important; }
html:root body .flow-editor :is(
  .flow-header-actions>button,.flow-panel-toggle,.flow-zoom>button,
  .flow-inspector-heading>.flow-icon,.flow-connection>button,
  .flow-clip-editor button,.flow-output-editor button,.flow-merge-settings button,
  .flow-review-actions>button,.flow-execution-dialog .flow-run>button
) {
  display:inline-flex; align-items:center; justify-content:center;
  height:var(--flow-control-height)!important;
  min-height:var(--flow-control-height)!important;
  padding-block:0!important;
  border-radius:var(--flow-control-radius)!important;
  font-family:var(--font-ui)!important;
  font-size:var(--labs-control-font-size,13px)!important;
  font-weight:var(--labs-control-font-weight,600)!important;
  line-height:18px!important;
  letter-spacing:.07em!important;
  box-sizing:border-box; white-space:nowrap;
}
html:root body .flow-editor :is(
  .flow-header-actions>.flow-icon,.flow-zoom>.flow-icon,.flow-inspector-heading>.flow-icon
) {
  width:var(--flow-control-height)!important;
  min-width:var(--flow-control-height)!important;
  flex:0 0 var(--flow-control-height); padding:0!important;
}
html:root body .flow-editor .flow-header-actions>.flow-icon {
  border-color:transparent!important; background:transparent!important; color:var(--text)!important;
}
html:root body .flow-editor .flow-header-actions>.flow-icon:hover:not(:disabled) {
  border-color:var(--line)!important; background:var(--workspace-hover,var(--surface))!important;
}
html:root body .flow-editor :is(.flow-header-actions,.flow-zoom) svg {
  display:block; width:20px; height:20px; flex:none;
}
.flow-editor[data-flow-panels-ready] .flow-panel-toggle {
  min-width:var(--flow-control-height); padding-inline:14px;
}
.flow-editor[data-flow-panels-ready] .flow-panel-toggle[aria-expanded="true"] {
  border-color:var(--line-strong); background:var(--surface-raised,var(--surface));
}
.flow-editor[data-flow-panels-ready] h1.flow-canvas-help { height:var(--flow-control-height); }
.flow-editor[data-flow-panels-ready] :is(.flow-palette,.flow-inspector) {
  top:calc(var(--flow-gnb-height,66px) + 76px); bottom:88px;
  overscroll-behavior:contain; scrollbar-width:thin;
  scrollbar-color:var(--line-strong) transparent; scrollbar-gutter:stable;
}
.flow-editor[data-flow-panels-ready] :is(.flow-palette,.flow-inspector)::-webkit-scrollbar {
  display:block; width:5px; height:5px;
}
.flow-editor[data-flow-panels-ready] :is(.flow-palette,.flow-inspector)::-webkit-scrollbar-thumb {
  background:var(--line-strong); border-radius:var(--corner-handle);
}
.flow-editor .flow-palette>select,
.flow-editor .flow-save-dialog input,
.flow-editor :is(.flow-clip-options,.flow-merge-settings) :is(select,input:not([type="checkbox"])) {
  height:var(--flow-control-height); min-height:var(--flow-control-height);
  padding-block:0; border-radius:var(--flow-control-radius);
  font:500 13px/18px var(--font-ui);
}
.flow-editor .flow-inspector-heading { align-items:center; gap:8px; margin-bottom:16px; }
.flow-editor .flow-inspector-heading h2 { min-width:0; font:600 15px/1.4 var(--font-ui); overflow-wrap:anywhere; }
.flow-editor .flow-inspector [data-inspector]>h2+p { margin-top:10px; }
.flow-editor .flow-help { line-height:1.65; }
.flow-editor .flow-header-actions { gap:8px; }
.flow-editor .flow-zoom { gap:4px; }
.flow-editor .flow-zoom output { width:44px; font-variant-numeric:tabular-nums; }
.flow-editor .flow-review-actions { align-items:stretch; gap:8px; }
@media(max-width:850px) {
  .flow-editor[data-flow-panels-ready] :is(.flow-palette,.flow-inspector) {
    bottom:calc(156px + env(safe-area-inset-bottom,0px));
  }
  .flow-editor .flow-board>.flow-header { bottom:calc(16px + env(safe-area-inset-bottom,0px)); z-index:8; }
  .flow-editor .flow-board>.flow-header>.flow-status {
    bottom:calc(100% + 88px); max-width:calc(100vw - 32px);
    max-height:120px; overflow-y:auto;
  }
  .flow-editor .flow-zoom { bottom:calc(88px + env(safe-area-inset-bottom,0px)); }
  .flow-editor .flow-header-actions { flex-wrap:nowrap; gap:6px; }
  .flow-editor .flow-header-actions .flow-file-action[data-action="new"] { margin-left:0; }
  .flow-editor .flow-header-actions>.flow-progress-action {
    position:absolute; right:0; bottom:calc(100% + 20px); max-width:none;
  }
}
@media(max-width:540px) {
  .flow-editor[data-flow-panels-ready] .flow-panel-toggle { width:var(--flow-control-height); padding:0; }
  .flow-editor .flow-board>.flow-header { max-width:calc(100% - 24px); }
  .flow-editor .flow-header-actions>[data-action="quote"] { padding-inline:14px; }
  .flow-editor[data-flow-panels-ready] h1.flow-canvas-help { left:76px; right:76px; font-size:20px; }
}
