.pb-builder-layout.pb-builder-flow {
  display: block;
}
main:has(.pb-builder-flow) > .page-heading {
  max-width: 1240px;
  margin-inline: auto;
}
.pb-refined .pb-starting-title {
  font-size: 16px;
  margin: 30px 0 14px;
}
.pb-refined .pb-starters {
  margin-top: 0;
}
.pb-setup-section {
  margin-bottom: 26px;
}
.pb-setup-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.pb-setup-heading h2 {
  font-size: 16px;
  margin: 0;
}
.pb-setup-section .pb-setup {
  margin-bottom: 0;
}
.pb-setup-section .pb-setup > p {
  margin: 0;
}
.pb-start-dialog {
  width: 700px;
}
.pb-start-manual,
.pb-start-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  font-size: 13px;
}
.pb-start-manual {
  background: var(--surface-2);
  border-radius: 10px;
}
.pb-start-manual p {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
}
.pb-popup-section-title {
  font-size: 12px;
  margin: 24px 0 12px;
}
.pb-start-list {
  border: 1px solid var(--line);
  border-radius: 10px;
}
.pb-start-row + .pb-start-row {
  border-top: 1px solid var(--line);
}
.pb-start-copy {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.pb-start-copy small,
.pb-start-choice small {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.5;
}
.pb-start-row > svg,
.pb-start-row > .icon-button {
  flex-shrink: 0;
}
.pb-start-choices {
  display: grid;
  gap: 8px;
}
.pb-start-choice {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.pb-start-choice:hover {
  background: var(--surface-2);
  border-color: var(--purple);
}
.pb-start-choice > svg {
  color: var(--purple);
  flex-shrink: 0;
}
.pb-inputs-dialog {
  width: 920px;
}
.pb-inputs-dialog .pb-input-columns,
.pb-inputs-dialog .pb-input-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(125px, 160px) 70px 30px;
  gap: 16px;
  align-items: center;
}
.pb-input-columns {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 0 12px 10px;
}
.pb-inputs-dialog .pb-input-row {
  padding: 10px 12px;
  margin: 0;
}
.pb-inputs-dialog .pb-input-row:last-child {
  border-bottom: 0;
}
.pb-inputs-dialog .pb-inputs {
  margin-bottom: 18px;
}
.pb-inputs-dialog .form-field {
  margin: 0;
  min-width: 0;
  grid-column: auto;
}
.pb-inputs-dialog .form-field > label,
.pb-inputs-dialog .form-field > span {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
}
.pb-inputs-dialog .pb-required {
  font-size: 0;
}
.pb-inputs-dialog .pb-required {
  justify-self: start;
}
.pb-inputs-dialog .pb-remove-input {
  width: 30px;
  height: 30px;
  opacity: 0;
}
.pb-input-row:hover .pb-remove-input,
.pb-input-row:focus-within .pb-remove-input {
  opacity: 1;
}
@media (hover: none) {
  .pb-inputs-dialog .pb-remove-input {
    opacity: 1;
  }
}
@media (max-width: 600px) {
  .pb-inputs-dialog .pb-input-columns {
    display: none;
  }
  .pb-inputs-dialog .pb-input-row {
    grid-template-columns: minmax(0, 1fr) 30px;
    gap: 10px;
    padding-inline: 0;
  }
  .pb-inputs-dialog .form-field:first-child {
    grid-column: 1;
  }
  .pb-inputs-dialog .form-field > label,
  .pb-inputs-dialog .form-field > span {
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
    overflow: visible;
    font-size: 12px;
  }
  .pb-inputs-dialog .pb-required {
    font-size: 12px;
  }
  .pb-inputs-dialog .pb-remove-input {
    grid-column: 2;
    grid-row: 1;
    opacity: 1;
  }
  .pb-inputs-dialog .form-field,
  .pb-inputs-dialog .pb-required {
    grid-column: 1;
  }
}
.pb-builder-flow .pb-guide {
  margin-top: 18px;
  display: block;
}
.pb-builder-flow .pb-guide > :not(.pb-advanced) {
  display: none;
}
.wf-editor {
  --wf-wire: color-mix(in srgb, var(--muted) 45%, var(--line));
  margin-top: 26px;
  min-width: 0;
}
.wf-toolbar,
.wf-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.wf-toolbar {
  justify-content: space-between;
  margin-bottom: 16px;
}
.wf-toolbar h2 {
  font-size: 16px;
  margin: 0 0 3px;
}
.wf-toolbar .muted {
  font-size: 12px;
}
.wf-tools .button {
  font-size: 12px;
}
.wf-viewport {
  border: 1px solid var(--line);
  border-radius: 14px;
  /* Only branches scroll here; vertical gestures belong to the page. */
  overflow-x: auto;
  overflow-y: hidden;
  /* Theme tokens, so the canvas darkens with the rest of the page in dark mode. */
  background-color: var(--bg);
  background-image: radial-gradient(circle, color-mix(in srgb, var(--muted) 28%, transparent) 0.8px, transparent 0.8px);
  background-size: 18px 18px;
  background-attachment: local;
  max-width: 100%;
}
.wf-canvas {
  position: relative;
  isolation: isolate;
  width: max-content;
  min-width: 100%;
  /* Room at the top for the zoom control, clear of the first phase's buttons. */
  padding: 60px 42px 36px;
  box-sizing: border-box;
}
.wf-wires {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
  z-index: -1;
  stroke: var(--wf-wire);
}
.wf-phase {
  min-width: 380px;
}
.wf-phase + .wf-phase {
  margin-top: 14px;
}
.wf-phase-heading {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 44px;
}
.wf-phase-toggle {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  border: 0;
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  padding: 8px 10px 8px 0;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}
.wf-phase-toggle strong {
  max-width: 340px;
  overflow-wrap: anywhere;
}
.wf-phase-toggle > span {
  display: flex;
  align-items: center;
  gap: 9px;
}
.wf-phase-rule {
  height: 1px;
  background: var(--line);
  flex: 1;
  min-width: 32px;
}
.wf-phase.is-collapsed .wf-phase-toggle svg {
  transform: rotate(-90deg);
}
.wf-phase-body {
  padding: 8px 0;
}
.wf-phase-body[hidden] {
  display: none;
}
.wf-sequence,
.wf-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.wf-sequence {
  width: 100%;
}
.wf-step {
  width: 100%;
}
.wf-port {
  display: block;
  width: 1px;
  height: 1px;
  flex: none;
}
.wf-card.pb-step {
  position: relative;
  display: flex;
  width: 308px;
  min-width: 0;
  padding: 0;
  gap: 0;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 2px 4px #00000004;
  overflow: visible;
}
.wf-card .pb-step-open {
  padding: 13px 14px;
  gap: 11px;
  flex: 1;
  border-radius: 12px;
  min-height: 88px;
}
.wf-card .pb-step-copy {
  gap: 4px;
  min-width: 0;
}
.wf-card .pb-step-copy strong {
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.wf-card .pb-step-copy small {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  color: var(--muted);
}
.wf-card .pb-step-copy > .muted {
  font-size: 11px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wf-card .pb-block-icon {
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
}
.wf-number {
  position: absolute;
  right: calc(100% + 12px);
  top: 18px;
  color: var(--muted);
  font:
    11px/1.5 ui-monospace,
    monospace;
}
.wf-card-actions {
  position: absolute;
  top: -15px;
  right: 8px;
  display: flex;
  padding: 2px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  visibility: hidden;
  z-index: 2;
}
.wf-card:hover .wf-card-actions,
.wf-card:focus-within .wf-card-actions {
  visibility: visible;
}
.wf-card-actions .icon-button {
  width: 26px;
  height: 26px;
}
.wf-card-actions .icon-button:first-child svg,
.wf-card-actions .icon-button:nth-child(2) svg {
  transform: rotate(90deg);
}
.wf-add.button {
  min-height: 25px;
  height: 25px;
  margin: 7px 0;
  padding: 2px 9px;
  border-radius: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  gap: 4px;
  box-shadow: none;
  z-index: 1;
}
.wf-add svg {
  width: 12px;
  height: 12px;
}
.wf-add:hover,
.wf-add:focus-visible {
  color: var(--ink);
  border-color: var(--muted);
  background: var(--surface);
}
.wf-branches {
  display: grid;
  grid-template-columns: repeat(var(--branch-count), minmax(330px, auto));
  align-items: start;
  gap: 14px;
  padding: 24px 4px 18px;
}
.wf-lane {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
.wf-branch-label {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11px;
  color: var(--muted);
}
.wf-path-then,
.wf-path-on_yes,
.wf-path-on_approve {
  background: color-mix(in srgb, #30a46c 12%, var(--surface));
  color: #238354;
}
.wf-path-else,
.wf-path-on_no,
.wf-path-on_reject {
  background: color-mix(in srgb, #e5484d 10%, var(--surface));
  color: #c13c41;
}
.wf-continue {
  background: var(--bg);
  color: var(--muted);
  font-size: 10px;
  margin: 4px 0 7px;
}
.wf-terminal {
  border-color: color-mix(in srgb, #e5484d 40%, var(--line));
}
.wf-stop {
  margin-top: 8px;
  font-size: 10px;
  color: #c13c41;
  background: var(--bg);
}
.wf-draw-hint {
  padding: 12px 16px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.wf-phase-target {
  align-self: stretch;
  min-height: 43px;
  position: relative;
  margin: 9px 0;
  border: 1px dashed var(--muted);
  background: var(--surface);
  border-radius: 7px;
  color: var(--muted);
  cursor: crosshair;
  touch-action: pan-y;
  font: inherit;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.wf-phase-target::after {
  content: "";
  position: absolute;
  height: 2px;
  left: 0;
  width: var(--draw-width, 0%);
  background: var(--ink);
  pointer-events: none;
}
.wf-phase-target:hover,
.wf-phase-target:focus-visible {
  border-color: var(--ink);
  color: var(--ink);
}
@media (hover: none) {
  .wf-card-actions {
    position: static;
    visibility: visible;
    flex-direction: column;
    border: none;
    align-self: center;
    margin-right: 5px;
  }
}
@media (max-width: 700px) {
  .wf-canvas {
    padding: 54px 34px 18px;
  }
  .wf-phase {
    min-width: 318px;
  }
  .wf-card.pb-step {
    width: 274px;
  }
  .wf-branches {
    grid-template-columns: repeat(var(--branch-count), minmax(316px, auto));
    gap: 16px;
  }
  .wf-tools {
    gap: 6px;
  }
}

/* Permanent, non-modal inspector. Its body scrolls independently of the flow. */
.pb-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.pb-header-actions[hidden] {
  display: none;
}
.pb-activity-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-size: 13px;
}
.pb-activity-filter select {
  min-width: 0;
  max-width: 100%;
}
.pb-inspector.pb-dialog[hidden],
.pb-inspector-reopen[hidden] {
  display: none;
}
.pb-inspector-reopen {
  position: fixed;
  top: 84px;
  right: 12px;
  z-index: 4;
  background: var(--surface);
  box-shadow: 0 2px 8px #00000012;
  font-size: 12px;
}
.pb-inspector-controls {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
}
main:has(.pb-inspector:not([hidden])) {
  margin-right: clamp(460px, 36vw, 600px);
  max-width: none;
}
main:has(.pb-inspector:not([hidden])) .page-heading {
  align-items: flex-start;
}
.pb-inspector.pb-dialog {
  position: fixed;
  top: 72px;
  right: 0;
  bottom: 0;
  width: clamp(460px, 36vw, 600px);
  max-width: none;
  margin: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -3px 0 15px #00000005;
  overflow: hidden;
}
.pb-inspector > .popup-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--line);
}
.pb-inspector-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.pb-inspector-heading > div {
  min-width: 0;
}
.pb-inspector-heading small {
  font-size: 9px;
  letter-spacing: 0.08em;
}
.pb-inspector h2 {
  margin: 5px 0 0;
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.pb-inspector > .popup-body {
  padding: 20px;
}
.pb-inspector > .popup-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.5;
}
.pb-inspector .form-field > label,
.pb-inspector .form-field > span {
  font-size: 12px;
  font-weight: 500;
}
.pb-inspector .form-error {
  font-size: 12px;
  line-height: 1.5;
}
.pb-inspector .form-error:empty {
  display: none;
}
.pb-inspector-empty {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.pb-inspector .icon-button {
  flex-shrink: 0;
}
.wf-card.pb-step.is-selected {
  --pb-selection: #2563eb;
  outline: 3px dashed var(--pb-selection);
  outline-offset: 3px;
  border-color: var(--pb-selection);
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--pb-selection) 12%, transparent);
}
.wf-card.is-selected .wf-number {
  color: var(--pb-selection);
  font-weight: 700;
}
.wf-card.is-selected .pb-step-open {
  background: color-mix(in srgb, var(--pb-selection) 5%, var(--surface));
}
@media (max-width: 1000px) {
  main:has(.pb-inspector:not([hidden])) {
    margin-right: 390px;
    padding-right: 18px;
    padding-left: 18px;
  }
  .pb-inspector.pb-dialog {
    width: 390px;
  }
}
@media (max-width: 760px) {
  main:has(.pb-inspector:not([hidden])) {
    margin-right: 0;
  }
  main:has(.pb-inspector.has-selection:not([hidden])) {
    padding-bottom: 48dvh;
  }
  .pb-inspector-reopen {
    top: auto;
    bottom: 16px;
  }
  .pb-inspector.pb-dialog:not(.has-selection) {
    display: none;
  }
  .pb-inspector.pb-dialog {
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: 43dvh;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .pb-inspector > .popup-header {
    padding: 10px 16px;
  }
  .pb-inspector > .popup-body {
    padding: 14px 16px;
  }
  .pb-inspector > .popup-footer {
    padding: 8px 16px;
  }
  .pb-inspector h2 {
    font-size: 14px;
  }
  .pb-header-actions {
    justify-content: flex-start;
  }
}

/* Start method tiles and focused configuration forms. */
.pb-start-choices {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.pb-start-choice {
  flex-direction: column;
  align-items: flex-start;
  padding: 20px;
  min-height: 132px;
}
.pb-start-choice > svg {
  width: 24px;
  height: 24px;
}
.pb-start-dialog .pb-popup-section-title:first-child {
  margin-top: 0;
}
.pb-trigger-dialog {
  width: 780px;
}
.dialog-title-control {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
  flex: none;
}
.pb-start-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  cursor: pointer;
  font-size: 11px;
  margin-right: 14px;
}
.pb-start-toggle input {
  position: absolute;
  opacity: 0;
  width: 34px;
  height: 20px;
  margin: 0;
}
.pb-start-toggle-track {
  pointer-events: none;
  width: 34px;
  height: 20px;
  border-radius: 12px;
  background: #9ca3af;
  position: relative;
  flex: none;
}
.pb-start-toggle-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
}
.pb-start-toggle input:checked + .pb-start-toggle-track {
  background: #20a464;
}
.pb-start-toggle input:checked + .pb-start-toggle-track::after {
  transform: translateX(14px);
}
.pb-start-toggle input:focus-visible + .pb-start-toggle-track {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}
.pb-start-toggle:has(input:disabled) {
  opacity: .5;
  cursor: wait;
}
.pb-trigger-dialog .form-field > span {
  font-size: 12px;
  font-weight: 600;
}
.pb-trigger-dialog .pb-schedule-settings,
.pb-trigger-parameters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.pb-trigger-dialog .pb-schedule-settings[hidden] {
  display: none;
}
.pb-trigger-dialog .pb-schedule-settings > .form-field,
.pb-trigger-parameters > .form-field {
  grid-column: auto;
  margin: 0;
}
.pb-trigger-dialog .pb-schedule-settings > .form-field:last-child {
  grid-column: 1 / -1;
}
.pb-schedule-tabs {
  margin: 24px 0;
}
.pb-trigger-inputs {
  margin-top: 24px;
}
.pb-trigger-inputs h3 {
  font-size: 14px;
  margin-bottom: 10px;
}
.pb-trigger-inputs > p {
  font-size: 12px;
}
.pb-trigger-input-list {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.pb-trigger-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px 12px;
  align-items: center;
  padding: 12px 16px;
  font-size: 12px;
}
.pb-trigger-input + .pb-trigger-input {
  border-top: 1px solid var(--line);
}
.pb-trigger-input code {
  display: block;
  font-size: 11px;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
  margin-top: 4px;
}
.pb-trigger-mapping {
  grid-column: 1 / -1;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-2);
}
.pb-trigger-map,
.pb-trigger-map-note {
  grid-column: 1 / -1;
}
.pb-trigger-map-note {
  margin: 0;
  font-size: 12px;
}
.pb-description-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
}
.pb-description-label .button {
  font-size: 11px;
  padding: 7px 10px;
}
@media (max-width: 600px) {
  .pb-trigger-dialog .dialog-title-row {
    flex-wrap: wrap;
  }
  .pb-trigger-dialog .dialog-title-control {
    order: 2;
    flex-basis: 100%;
    margin-top: 12px;
  }
  .pb-trigger-dialog .pb-schedule-settings,
  .pb-trigger-parameters {
    grid-template-columns: minmax(0, 1fr);
  }
  .pb-start-choice {
    padding: 14px;
  }
}

/* AI proposals are local drafts and remain reviewable before applying. */
.pb-inspector-actions { flex-direction: column; align-items: stretch; gap: 10px; }
.pb-inspector-actions > span { font-size: 12px; }
.wf-phase-heading .wf-phase-ai { color: var(--purple); flex: 0 0 auto; }
.wf-phase-heading .wf-phase-ai:hover { background: color-mix(in srgb, var(--purple) 12%, var(--surface)); }
.pb-ai-dialog { width: min(960px, calc(100vw - 32px)); }
.pb-ai-feedback { min-height: 1.5em; margin: 4px 0; }
.pb-ai-comparison { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.pb-ai-comparison > section { border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.pb-ai-comparison > section + section { border-color: color-mix(in srgb, var(--purple) 35%, var(--line)); background: color-mix(in srgb, var(--purple) 5%, var(--surface)); }
.pb-ai-comparison h3 { margin-top: 0; }
.pb-ai-comparison pre { max-height: 340px; overflow: auto; font-size: 11px; }
.pb-ai-step-list { padding-left: 20px; overflow-wrap: anywhere; }
.pb-ai-step-list li { padding: 5px 0; }
.pb-ai-step-list p { margin: 4px 0; font-size: 12px; }
.pb-ai-inputs { margin-bottom: 12px; }
/* The proposal as one annotated list: new / changed / moved / removed stand out, the rest is quiet. */
.pb-ai-diff-summary { margin: 4px 0 10px; font-weight: 600; }
.pb-ai-diff-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; overflow-wrap: anywhere; }
.pb-ai-diff-list .pb-ai-diff-list { margin-top: 6px; padding-left: 14px; border-left: 1px solid var(--line); }
.pb-ai-diff { padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; }
.pb-ai-diff section > small { display: block; margin-top: 6px; color: var(--muted); }
.pb-ai-diff-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pb-ai-diff-mark { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; color: var(--on-solid); }
.pb-ai-diff-same { background: var(--surface-2); border-color: var(--line); }
.pb-ai-diff-same > .pb-ai-diff-head strong { font-weight: 500; color: var(--muted); }
.pb-ai-diff-added { background: color-mix(in srgb, var(--allow) 9%, transparent); border-color: color-mix(in srgb, var(--allow) 45%, transparent); }
.pb-ai-diff-added > .pb-ai-diff-head .pb-ai-diff-mark { background: var(--allow); }
.pb-ai-diff-changed, .pb-ai-diff-moved { background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.pb-ai-diff-changed > .pb-ai-diff-head .pb-ai-diff-mark, .pb-ai-diff-moved > .pb-ai-diff-head .pb-ai-diff-mark { background: var(--warn); color: #1E2126; }
.pb-ai-diff-removed { background: color-mix(in srgb, var(--block) 8%, transparent); border-color: color-mix(in srgb, var(--block) 40%, transparent); }
.pb-ai-diff-removed > .pb-ai-diff-head .pb-ai-diff-mark { background: var(--block); }
.pb-ai-diff-removed > .pb-ai-diff-head strong { text-decoration: line-through; }
.pb-ai-diff p { margin: 4px 0 0; font-size: 12px; }
.pb-ai-diff-changes { margin: 4px 0 0; padding-left: 18px; font-size: 12px; }
.pb-ai-diff-old { color: var(--block); text-decoration: line-through; }
.pb-ai-diff-new { color: var(--allow); font-weight: 600; }
.pb-ai-side-by-side { margin-top: 14px; }
/* Overview tab: the same outline, every step boxed, with its type and what it does. */
.pb-outline-intro { margin: 0 0 12px; }
.pb-ai-diff-step { background: var(--surface-2); border-color: var(--line); }
.pb-outline-list .pb-ai-diff-head { align-items: center; }
.pb-ai-input-list { padding-left: 20px; overflow-wrap: anywhere; }
.pb-ai-input-list li { padding: 4px 0; }
.pb-ai-preview > details { margin-top: 16px; }
@media (max-width: 760px) { .pb-ai-comparison { grid-template-columns: minmax(0, 1fr); } }
main:has(.pb-builder-flow) > .page-heading { flex-wrap: wrap; }
main:has(.pb-builder-flow) > .page-heading > div:first-child { flex: 1 1 240px; min-width: 0; }
main:has(.pb-builder-flow) > .page-heading > .page-actions { flex: 0 1 auto; min-width: 0; max-width: 100%; margin-left: auto; }
.dialog-footer-start { margin-right: auto; }
.pb-dialog .dialog-footer:has(.dialog-footer-start) { flex-wrap: wrap; }

.pb-access-roles{display:grid;gap:8px;margin:8px 0 20px}.pb-access-role{display:flex;align-items:center;gap:10px;padding:10px 12px;border:1px solid #e9e6ed;border-radius:8px}.pb-access-role input{width:16px;height:16px;accent-color:#8051d0}
.pb-execution-permissions{display:grid;gap:12px;padding-top:20px;margin-top:8px;border-top:1px solid var(--line)}
.pb-execution-permissions h3,.pb-execution-permissions p{margin:0}

/* Data dependencies are a separate, optional layer over execution order. */
.wf-canvas.has-dataflow { padding-left: 320px; }
.wf-data-wires { position: absolute; top: 0; left: 0; pointer-events: none; overflow: visible; z-index: 1; }
.wf-data-edge { stroke: var(--purple); stroke-width: 1.8; }
.wf-data-edge.is-conditional { stroke: #a66a13; stroke-dasharray: 6 4; }
.wf-data-edge.is-unavailable { stroke: #c74343; stroke-dasharray: 3 4; }
.wf-data-label { pointer-events: auto; stroke: none; }
.wf-data-label rect { fill: var(--surface); opacity: .96; }
.wf-data-label text { fill: var(--ink); font-size: 11px; font-family: inherit; }
.wf-data-legend { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 0 0 14px; }
.wf-data-legend p { margin: 0 0 6px; }
.wf-data-legend ul { max-height: 200px; overflow: auto; overflow-wrap: anywhere; }
.pb-editor-analysis:not(.has-issues) { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }

.page-heading:has(> .pb-readiness-notice:not([hidden])) { flex-wrap: wrap; }
.page-heading > .pb-readiness-notice { width: 100%; flex: 0 0 100%; box-sizing: border-box; margin-top: 0; padding: 16px 18px; }
.pb-readiness-notice > div { flex: 1; min-width: 0; }
.pb-problem-list > li { margin: 8px 0; overflow-wrap: anywhere; }
.pb-fix-problem.button { display: inline-flex; padding: 3px 7px; margin-left: 8px; font-size: 11px; white-space: nowrap; vertical-align: middle; }
.pb-fix-all.button { display: flex; margin-top: 14px; padding: 12px 18px; font-size: 14px; font-weight: 600; }
.pb-ai-repair-checks { font-size: 12px; line-height: 1.6; padding: 12px; background: var(--surface-2); border-radius: 8px; overflow-wrap: anywhere; }

/* System keys have one semantic treatment, independent of step type/status. */
:root { --pb-key-ink: #185fa5; --pb-key-bg: #eaf3ff; --pb-key-line: #bad4f3; }
:root[data-theme="dark"] { --pb-key-ink: #a9d2ff; --pb-key-bg: #172d45; --pb-key-line: #3e638a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --pb-key-ink: #a9d2ff; --pb-key-bg: #172d45; --pb-key-line: #3e638a; }
}
.pb-system-key { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 5px; width: fit-content; max-width: 100%; padding: 2px 5px; border: 1px solid var(--pb-key-line); border-radius: 4px; background: var(--pb-key-bg); color: var(--pb-key-ink); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; text-transform: none; letter-spacing: normal; }
.pb-system-key code, .pb-key-field.form-field input { font-family: var(--font-mono); text-transform: none; letter-spacing: normal; color: var(--pb-key-ink); }
.pb-key-caption { font-family: var(--font-body, sans-serif); font-size: 10px; }
.pb-key-field.form-field input { background: var(--pb-key-bg); border-color: var(--pb-key-line); cursor: text; }
.pb-key-heading { display: inline-flex; align-items: center; gap: 5px; }
.pb-key-help { position: relative; display: inline-flex; }
.pb-key-help > .icon-button { width: 20px; height: 20px; padding: 2px; color: var(--pb-key-ink); }
.pb-key-help .role-tooltip { left: -65px; width: min(290px, calc(100vw - 80px)); text-transform: none; letter-spacing: normal; z-index: 10; }
.pb-step .pb-step-copy .pb-node-key { color: var(--pb-key-ink); font-family: var(--font-mono); text-transform: none; letter-spacing: normal; }
.pb-node-key code { font-family: inherit; }
.pb-step-data > .pb-system-key:last-child { margin-top: 5px; }
.pb-reference { flex-wrap: wrap; }

.pb-input-row .pb-system-key { margin-top: 5px; }

.wf-data-label text { fill: var(--pb-key-ink); font-family: var(--font-mono); }
.wf-data-label rect { fill: var(--pb-key-bg); stroke: var(--pb-key-line); }

.pb-input-summary { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 4px; }

.pb-reference-select { display: flex; align-items: center; gap: 5px; min-width: 0; flex: 1; }
.pb-reference-select > select { flex: 1; min-width: 0; color: var(--pb-key-ink); font-family: var(--font-mono); }
.pb-dialog .pb-reference-select > select { color: var(--pb-key-ink); font-family: var(--font-mono); }
.pb-source-targets { display: inline-flex; flex-shrink: 0; gap: 2px; }
.pb-source-target.icon-button { color: var(--pb-key-ink); width: 27px; height: 27px; padding: 4px; flex-shrink: 0; }
.pb-source-target:disabled { opacity: .4; }

/* Editor actions keep accessible names and show labels immediately on hover/focus. */
.pb-toolbar-icon { position: relative; width: 36px; height: 36px; padding: 8px; flex: 0 0 36px; }
.pb-toolbar-icon::after {
  content: attr(data-tooltip); position: absolute; top: calc(100% + 6px); right: 0;
  padding: 5px 8px; border-radius: 5px; background: #252238; color: white;
  font-size: 12px; font-weight: 400; white-space: nowrap; pointer-events: none;
  opacity: 0; visibility: hidden; transition: opacity 80ms; z-index: 30;
}
.pb-toolbar-icon:hover::after, .pb-toolbar-icon:focus-visible::after { opacity: 1; visibility: visible; }
.pb-validation-result { padding: 16px 20px; margin-bottom: 16px; overflow-wrap: anywhere; }
.pb-validation-result[hidden] { display: none; }
.pb-validation-result p { margin: 6px 0; }
.pb-validation-result ul { padding-left: 20px; margin-bottom: 0; }
.pb-validation-result li + li { margin-top: 6px; }
/* Step details: Properties / Advanced tabs and the compact action inputs. */
.pb-field-tabs {
  margin: 0 0 16px;
}
.pb-field-tabs [role="tab"].has-issue::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  vertical-align: middle;
  border-radius: 50%;
  background: var(--warn);
}
.pb-args {
  margin: 0 0 16px;
  min-width: 0;
}
.pb-args-title {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 500;
}
.pb-args .pb-field-tabs {
  margin-bottom: 10px;
}
.pb-arg-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.pb-arg + .pb-arg {
  border-top: 1px solid var(--line);
}
.pb-arg-head {
  display: flex;
  align-items: center;
  margin: 0;
  font: inherit;
}
.pb-arg-head .pb-field-warning {
  margin: 0 10px 0 0;
  flex-shrink: 0;
}
.pb-arg-toggle {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.pb-arg-toggle:hover {
  background: var(--surface-2);
}
.pb-arg-toggle:focus-visible {
  outline-offset: -3px;
}
.pb-arg-name {
  flex-shrink: 0;
  max-width: 55%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.pb-arg-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  color: var(--muted);
  font-size: 11px;
}
.pb-arg.is-set .pb-arg-value {
  color: var(--ink-soft);
}
.pb-arg.is-missing .pb-arg-value {
  color: color-mix(in srgb, var(--warn) 60%, var(--ink));
  font-weight: 600;
}
.pb-arg-toggle > svg {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.15s;
}
.pb-arg.is-open .pb-arg-toggle > svg {
  transform: rotate(180deg);
}
.pb-arg-body {
  padding: 2px 10px 10px;
}
.pb-arg-body[hidden] {
  display: none;
}
.pb-dialog .pb-arg-body > .form-field,
.pb-arg-body > .pb-value-group {
  margin-bottom: 0;
}
.pb-arg-body > .form-field > label,
.pb-arg-body > .pb-value-group > h4 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.pb-arg-none {
  margin: 4px 0 0;
  font-size: 12px;
}
.pb-field-heading {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pb-field-help > .icon-button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
}
.pb-field-help .role-tooltip {
  left: -90px;
  width: min(260px, calc(100vw - 80px));
  z-index: 10;
}
/* "What you need": input keys in a Required and an Optional column. */
.pb-input-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-width: 0;
}
.pb-input-column {
  min-width: 0;
}
.pb-input-column h3 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.pb-input-column ul {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pb-input-column code {
  font-size: 12px;
  overflow-wrap: anywhere;
}
.pb-input-column p {
  margin: 0;
  font-size: 12px;
}
/* Step details → Output: the references a step's result offers later steps. */
.pb-output p {
  margin: 0 0 10px;
  font-size: 12px;
}
.pb-output-list {
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.pb-output-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 6px 6px 10px;
  font-size: 12px;
}
.pb-output-field + .pb-output-field {
  border-top: 1px solid var(--line);
}
.pb-output-field code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pb-output-type {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 11px;
}
.pb-output-field .icon-button {
  width: 26px;
  height: 26px;
}
.pb-output-example summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
}
.pb-output-example pre {
  margin: 8px 0 0;
  max-height: 320px;
  overflow: auto;
  font-size: 11px;
}
.pb-arg-group {
  margin-top: 10px;
}
.pb-arg-group-title {
  margin: 0 0 6px;
  font-size: 12px;
  color: var(--ink-soft);
}
.pb-arg-group-status {
  margin-left: 8px;
  color: color-mix(in srgb, var(--warn) 60%, var(--ink));
  font-size: 11px;
  font-weight: 600;
}
/* Playbook sections as tabs, and the bordered header actions. */
.pb-section-tabs {
  margin: 0 0 18px;
}
.pb-toolbar-icon.pb-toolbar-bordered {
  border: 1px solid var(--line-strong, var(--line));
  border-radius: 8px;
  background: var(--surface);
}
.pb-toolbar-icon.pb-toolbar-bordered:hover {
  background: var(--surface-2);
}
.pb-notify-notice { display: flex; gap: 10px; align-items: flex-start; padding: 16px 20px; margin-bottom: 16px; overflow-wrap: anywhere; }
.pb-notify-notice[hidden] { display: none; }
.pb-notify-notice > svg { flex: none; margin-top: 3px; color: var(--warning, #b45309); }
.pb-notify-notice p { margin: 6px 0; }
.pb-notify-notice ul { padding-left: 20px; margin: 6px 0 0; }
.pb-ai-usage-notice { padding: 16px 20px; overflow-wrap: anywhere; }
.pb-ai-usage-notice[hidden] { display: none; }
.pb-ai-usage-notice > strong { display: block; }
.pb-ai-usage-notice p { margin: 6px 0; }
.pb-ai-usage-notice ul { padding-left: 20px; margin: 6px 0 0; }
/* What kind of step this is, on the card and in the step details header. */
.pb-step-type { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; max-width: 100%; padding: 2px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2); color: var(--ink-soft); font-size: 10px; font-weight: 600; line-height: 1.5; letter-spacing: .2px; }
.pb-step-type code { font-family: var(--font-mono); font-weight: 400; color: var(--muted); overflow-wrap: anywhere; }
.pb-inspector-heading .pb-step-type { margin-top: 6px; }
/* Set up this playbook: what it still needs, with one-click fixes. */
.pb-setup-panel { padding: 16px 20px; margin-bottom: 16px; }
.pb-setup-panel[hidden] { display: none; }
.pb-setup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pb-setup-head h2 { font-size: 14px; margin: 0; }
.pb-setup-head p { margin: 4px 0 0; font-size: 12px; }
.pb-req-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.pb-req { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.pb-req > .ai-progress { flex: 1 0 100%; }
.pb-setup-panel > .ai-progress { margin-top: 12px; }
.pb-req-mark { flex: none; margin-top: 2px; }
.pb-req-ok .pb-req-mark { color: var(--allow, #1f7a45); }
.pb-req-missing .pb-req-mark { color: var(--warning, #b45309); }
.pb-req-blocked .pb-req-mark { color: var(--muted); }
.pb-req-warning .pb-req-mark { color: var(--danger, #b42318); }
.pb-req-copy { display: flex; flex-direction: column; gap: 2px; flex: 1 1 160px; min-width: 0; font-size: 12px; overflow-wrap: anywhere; }
/* In a narrow column the fix button wraps under the text instead of squeezing it. */
.pb-req > .button { margin-left: auto; }
.pb-req-copy strong { font-size: 13px; }
.pb-req > .button { flex: none; }
@media (max-width: 640px) { .pb-req { flex-wrap: wrap; } .pb-req > .button { width: 100%; } }


/* Overview tab: notices first, then the outline; a dot on the tab when one needs attention. */
.pb-overview { display: grid; gap: 14px; }
.pb-overview > .panel { margin: 0; }
.pb-overview-description { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.pb-overview-notices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; align-items: start; }
.pb-overview-setup:not(:has(> .panel:not([hidden]))), .pb-overview-warnings:not(:has(> .panel:not([hidden]))) { display: none; }
.pb-overview-notices:not(:has(> section > .panel:not([hidden]))) { display: none; }
.pb-overview-warnings > .panel + .panel { margin-top: 10px; } /* a block, like Setup: the title-to-box gap matches */
.pb-overview-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.pb-overview-cards > .pb-setup-section { display: flex; flex-direction: column; min-width: 0; }
.pb-overview-cards > .pb-setup-section > .panel { flex: 1; }
.pb-overview-cards .pb-setup-heading { flex-wrap: wrap; gap: 6px; }
.pb-overview-cards .pb-setup-heading h2 { font-size: 15px; }
.pb-overview-cards .pb-input-columns { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1100px) { .pb-overview-cards { grid-template-columns: minmax(0, 1fr); } }
.pb-overview-notices .panel { margin: 0; }
.pb-outline-list .pb-ai-diff-head { flex-wrap: nowrap; }
.pb-outline-list .pb-ai-diff-head strong { min-width: 0; }

/* Drag the canvas by an empty spot (enableDragPan). */
.wf-viewport { cursor: grab; }
.wf-viewport .wf-card, .wf-viewport .wf-phase-heading { cursor: auto; }
.wf-viewport.is-panning, .wf-viewport.is-panning * { cursor: grabbing; user-select: none; }
.pb-notify-note { margin: 0 0 10px; font-size: 12px; }
.pb-notify-note[hidden] { display: none; }
/* Only the canvas widens: past the page's reading width to the frame's (less the page
   gutters), centred under the column. Not while the step details take the right side. */
.frame:has(.wf-editor) { container-type: inline-size; }
main:not(:has(.pb-inspector:not([hidden]))) .wf-stage {
  max-width: none;
  width: max(100%, 100cqw - 72px);
  margin-left: min(0px, (100% - (100cqw - 72px)) / 2);
}
/* Zoom for the canvas only, in its top-right corner (outside the scrolling area). */
.wf-stage { position: relative; }
.wf-zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 2px 6px #0000000d;
}
.wf-zoom .icon-button { width: 28px; height: 28px; }
.wf-zoom .icon-button:disabled { opacity: .4; cursor: default; }
.wf-zoom .wf-zoom-reset.button { min-width: 48px; height: 28px; padding: 0 4px; border: 0; background: transparent; font-size: 11px; font-variant-numeric: tabular-nums; justify-content: center; }
.wf-zoom .wf-zoom-reset.button:hover { background: var(--surface-2); }
