/* Chat-Tag 5.5 — Flow Builder contrast correction.
 * Source extension for native surfaces; no global theme or component mutation.
 * The native theme lives on body, so SVG presentation attributes must inherit
 * tokens at the rendered canvas instead of document.documentElement.
 */
#pattern-mega-flow-builder-canvas circle {
  fill: rgb(var(--slate-7, 66 72 74));
}
#pattern-mega-flow-builder-execution-canvas circle {
  fill: rgb(var(--slate-8, 92 91 97));
}

/* Native markers identify Flow Builder editor, library, outputs and list rows.
 * Dialog/sheet coverage stays bounded to a container with these Flow markers.
 * No router, history, observer, API, stored flow or account flag is changed.
 */
.dark :is(section, aside, [role="dialog"]):has(
  #pattern-mega-flow-builder-canvas,
  #pattern-mega-flow-builder-execution-canvas,
  [data-block-list],
  [data-block-outputs],
  [data-flow-name]
) .text-n-slate-10 {
  color: rgb(var(--slate-11, 166 165 172));
}
.dark :is(section, aside, [role="dialog"]):has(
  #pattern-mega-flow-builder-canvas,
  #pattern-mega-flow-builder-execution-canvas,
  [data-block-list],
  [data-block-outputs],
  [data-flow-name]
) :is(input, textarea)::placeholder {
  color: rgb(var(--slate-11, 166 165 172));
  opacity: 1;
}

/* Preserve the native teal family for secondary library icons in dark mode.
 * The existing blue utility is branded teal, but its pale light-mode chip
 * remained unchanged in dark mode. The label keeps its native foreground.
 */
.dark [data-block-list] .bg-n-blue-3 {
  background-color: rgb(var(--teal-3, 18 59 61));
}
.dark [data-block-list] .bg-n-blue-3 > .text-n-blue-11 {
  color: rgb(var(--teal-11, 77 217 180));
}

/* The native block list uses the same subtle fill for hover and focus.
 * Keep that feedback and add an inset ring so keyboard position is explicit
 * in both themes without changing the button geometry or clipping the ring.
 */
[data-block-list] [data-block-item]:focus-visible {
  outline: 2px solid var(--ct-v550-teal, #0f7672);
  outline-offset: -2px;
}

/* Light-only native Flow dashed add controls. The editor header persists for
 * new/empty definitions. Mobile BlockEditor is teleported into BottomSheet;
 * restrict that second arm to its native scrollbody rather than every dialog.
 * Preserve native backgrounds, geometry, focus and all existing dark rules.
 */
:where(body:not(.dark) section:has(> header [aria-controls="flow-builder-editor-actions-menu"]))
  button.text-n-teal-11.outline-dashed:not(.dark, .dark *),
:where(body:not(.dark):has(section > header [aria-controls="flow-builder-editor-actions-menu"])
  section[role="dialog"][aria-modal="true"][data-popover-content]
  div.flex.min-h-0.flex-1.flex-col.-mx-3
  > div.min-h-0.flex-1.overflow-y-auto.px-4.py-4)
  button.text-n-teal-11.outline-dashed:not(.dark, .dark *) {
  color: var(--ct-v550-teal, #0f7672);
}

/* Native Flow add-control keyboard focus in both themes. Reuse the qualified
 * editor and mobile BlockEditor scopes; the inset outline does not change the
 * box model or require filled conditions, branches, outputs or an open menu.
 */
:where(body section:has(> header [aria-controls="flow-builder-editor-actions-menu"]))
  button.text-n-teal-11.outline-dashed:focus-visible,
:where(body:has(section > header [aria-controls="flow-builder-editor-actions-menu"])
  section[role="dialog"][aria-modal="true"][data-popover-content]
  div.flex.min-h-0.flex-1.flex-col.-mx-3
  > div.min-h-0.flex-1.overflow-y-auto.px-4.py-4)
  button.text-n-teal-11.outline-dashed:focus-visible {
  outline: 2px solid var(--ct-v550-teal, #0f7672);
  outline-offset: -2px;
}
