/* Workflow-only presentation; load after styles.css. No graph or form semantics. */
.workflow-graph-modal { border-radius: 16px; overflow: hidden; }
.workflow-graph-modal .modal-head { padding: 18px 22px; }
.workflow-graph-tools { gap: 10px 16px; padding: 12px 20px; background: var(--panel, #f7f9ff); }
.workflow-tool-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-right: 14px; border-right: 1px solid var(--line, #e8eef7); }
.workflow-tool-group:last-child { border-right: 0; padding-right: 0; }
.workflow-tool-add { flex: 0 0 auto; }
.workflow-graph-tools button { white-space: nowrap; }
#workflow-graph-zoom { min-width: 44px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted, #64748b); }
.workflow-graph-new { gap: 16px; }
.workflow-graph-new label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.workflow-graph-library { width: 226px; padding: 16px; background: #fff; scrollbar-gutter: stable; }
.workflow-graph-library > label { font-size: 14px; font-weight: 600; }
.workflow-search-row { display: grid; grid-template-columns: minmax(0, 1fr) max-content; align-items: center; gap: 6px; margin-top: 6px; }
.workflow-search-row input { width: 100%; min-width: 0; margin: 0; }
.workflow-search-row button.secondary { min-height: 32px; padding: 6px 12px; font-size: 12px; line-height: 1.5; white-space: nowrap; }
.workflow-graph-library .hint { margin: 10px 0 14px; font-size: 12px; line-height: 1.6; }
.workflow-library-task { display: block; width: 100%; margin: 0 0 10px; padding: 12px; border: 1px solid var(--line, #e8eef7); border-radius: 10px; background: var(--panel, #f7f9ff); color: var(--text, #111827); text-align: left; white-space: pre-line; overflow-wrap: anywhere; line-height: 1.8; font-size: 13px; }
.workflow-library-task:not(:disabled):hover { border-color: #adcfff; background: #eef5ff; box-shadow: 0 2px 8px #1677ff0d; }
#workflow-graph-inspector { width: 340px; padding: 18px 16px; background: #fff; scrollbar-gutter: stable; overscroll-behavior: contain; }
#workflow-graph-inspector > h3 { font-size: 16px; line-height: 1.5; margin-bottom: 12px; overflow-wrap: anywhere; }
#workflow-graph-inspector h4 { margin: 0 0 8px; font-size: 13px; }
#workflow-graph-inspector .workflow-graph-search-empty { margin-top: 8px; color: var(--muted, #64748b); font-size: 12px; line-height: 1.7; }
#workflow-graph-inspector .hint { font-size: 12px; line-height: 1.7; margin: 8px 0 12px; }
#workflow-graph-inspector .section-box { margin-top: 14px; padding: 14px; border: 1px solid var(--line, #e8eef7); border-radius: 12px; background: var(--panel, #f7f9ff); }
#workflow-graph-inspector .section-box > label { display: grid; gap: 8px; font-size: 12px; }
#workflow-graph-inspector .workflow-route-summary > p { margin: 8px 0; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
#workflow-graph-inspector input, #workflow-graph-inspector select, #workflow-graph-inspector textarea { width: 100%; min-width: 0; max-width: 100%; border-radius: 8px; }
#workflow-graph-inspector input[type="checkbox"] { width: 16px; min-height: 16px; }
#workflow-graph-inspector .form-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; font-size: 12px; }
#workflow-graph-inspector button:not(.workflow-graph-minimap-node), .workflow-graph-tools button { min-height: 32px; padding: 6px 12px; border: 1px solid var(--line, #e8eef7); border-radius: 18px; background: #eef2f9; color: #43536a; font-size: 12px; line-height: 1.5; }
#workflow-graph-inspector button:not(:disabled):hover, .workflow-graph-tools button:not(:disabled):hover { background: #e2ecfa; border-color: #c5d8f1; }
#workflow-graph-inspector button.workflow-remove { color: #cf3845; background: #fff3f3; border-color: #ffdada; }
#workflow-graph-inspector [data-removal-confirmation] { display: flex; flex-wrap: wrap; gap: 8px; border-color: #ffdada; background: #fff8f8; }
#workflow-graph-inspector [data-removal-confirmation] > p { flex: 1 0 100%; margin: 0; line-height: 1.7; overflow-wrap: anywhere; }
#workflow-graph-inspector .workflow-graph-dependency { grid-template-columns: minmax(0, 1fr); overflow-wrap: anywhere; gap: 9px; padding: 12px 0; margin-top: 6px; }
#workflow-graph-inspector .workflow-graph-route { gap: 8px; margin: 14px 0; padding: 14px 12px; border: 1px solid #dce5f3; border-radius: 10px; background: #fff; box-shadow: 0 2px 6px #17233f04; }
#workflow-graph-inspector .workflow-route-card-title { flex: 1 0 100%; margin-bottom: 2px; font-size: 12px; font-weight: 600; color: #51647f; }
#workflow-graph-inspector .workflow-graph-route > .workflow-graph-dependency { margin-top: 4px; padding: 12px 0 0; border-top: 1px solid var(--line, #e8eef7); }
#workflow-graph-inspector .workflow-graph-route > .workflow-graph-dependency { flex: 1 0 100%; }
#workflow-graph-inspector .workflow-route-success > h4 { color: #237b42; }
#workflow-graph-inspector .workflow-route-failure > h4 { color: #bd3842; }
#workflow-graph-inspector .workflow-route-finished > h4 { color: #6551aa; }
.workflow-canvas-context { position: fixed; z-index: 90; display: flex; flex-direction: column; gap: 10px; width: min(270px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; padding: 16px; border: 1px solid #dce5f3; border-radius: 12px; background: #fff; color: #172033; box-shadow: 0 8px 30px #17233f26; }
.workflow-canvas-context > * { flex-shrink: 0; }
.workflow-canvas-context > strong { font-size: 14px; }
.workflow-canvas-context .workflow-canvas-identity { margin: 0; min-width: 0; padding: 8px 10px; border-radius: 8px; background: #f1f5fb; font-size: 12px; line-height: 1.6; white-space: normal; overflow-wrap: anywhere; }
.workflow-canvas-context .workflow-canvas-state { margin: 0; font-size: 12px; font-weight: 600; line-height: 1.5; }
.workflow-canvas-context .workflow-canvas-palette { display: flex; flex-wrap: wrap; gap: 8px; }
.workflow-canvas-context .workflow-canvas-palette button { flex: 0 0 28px; width: 28px; height: 28px; min-height: 28px; padding: 0; font-size: 0; border: 1px solid #ccd6e5; border-radius: 6px; }
.workflow-canvas-context label { display: grid; gap: 6px; font-size: 12px; }
.workflow-canvas-context input { width: 100%; min-width: 0; }
.workflow-canvas-context button { min-height: 32px; }
.workflow-canvas-context :is(button,input):focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.workflow-canvas-context .schedule-field-error { display: block; margin: 0; color: #bd3842; }
.workflow-canvas-outcomes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding-top: 12px; border-top: 1px solid #e8eef7; }
.workflow-canvas-outcomes button { min-width: 0; padding: 6px 8px; font-size: 12px; }
.workflow-canvas-outcomes button[aria-pressed="true"] { background: #e8f0ff; color: #1d4ed8; outline: 1px solid #9bbcff; }
.workflow-canvas-removal-mask { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px; background: #14213c55; }
.workflow-canvas-removal-dialog { display: flex; flex-direction: column; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: hidden; padding: 24px; border: 1px solid #dce5f3; border-radius: 14px; background: #fff; color: #172033; box-shadow: 0 16px 48px #17233f33; }
.workflow-canvas-removal-dialog h3 { margin: 0 0 16px; font-size: 18px; }
.workflow-canvas-removal-head { display: flex; flex-shrink: 0; align-items: flex-start; justify-content: space-between; gap: 16px; }
.workflow-canvas-removal-head .icon-btn { flex: 0 0 32px; min-height: 32px; padding: 0; }
.workflow-canvas-removal-dialog p { min-height: 0; margin: 0; overflow: auto; line-height: 1.8; overflow-wrap: anywhere; }
.workflow-canvas-removal-blockers { min-height: 0; max-height: min(45dvh, 320px); margin: 12px 0 0; padding: 8px 12px 8px 28px; overflow: auto; overscroll-behavior: contain; border: 1px solid #dce5f3; border-radius: 8px; background: #f6f8ff; line-height: 1.65; overflow-wrap: anywhere; }
.workflow-canvas-removal-blockers li + li { margin-top: 8px; }
.workflow-canvas-removal-blockers:focus-visible { outline: 2px solid #3370ff; outline-offset: 2px; }
.workflow-canvas-removal-actions { display: flex; flex-shrink: 0; justify-content: flex-end; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.workflow-canvas-removal-actions button { min-height: 36px; min-width: 72px; }
.workflow-graph-modal .modal-foot { gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line, #e8eef7); }
#workflow-graph-message { line-height: 1.6; }
#workflow-graph-minimap { border-color: var(--line, #e8eef7); border-radius: 12px; box-shadow: 0 4px 16px #17233f12; }
.workflow-configuration { width: min(780px, calc(100vw - 32px)); border-radius: 16px; }
.workflow-config-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.workflow-config-grid > .form-row { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 8px; }
.workflow-config-grid > .workflow-check-field { display: flex; align-items: center; gap: 12px; }
.workflow-config-grid > .section-box, .workflow-config-grid > .hint, .workflow-config-grid > button { grid-column: 1 / -1; }
.workflow-config-grid .section-box { border-radius: 12px; padding: 18px; background: var(--panel, #f7f9ff); }
.workflow-config-grid .section-box h3 { margin-bottom: 14px; font-size: 14px; }
.workflow-config-grid .section-box > input { width: 100%; margin-bottom: 12px; }
.workflow-config-grid .hint { line-height: 1.7; }
.workflow-inline-task-hint { padding: 12px 16px; margin-bottom: 18px; border: 1px solid #d7e6fb; border-radius: 10px; background: #f1f7ff; line-height: 1.7; }
.workflow-list-panel { border-radius: 12px; }
.workflow-list-panel .pager-btn { scroll-margin: 8px; }
.workflow-name-cell { white-space: normal; text-overflow: clip; }
.workflow-name-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workflow-name-cell > .status { margin-top: 4px; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.workflow-readiness-hint { width: max-content; max-width: min(32ch, 55vw); white-space: normal; overflow-wrap: anywhere; line-height: 1.6; margin: 6px 0 0; }
.workflow-graph-modal button:focus-visible, .workflow-graph-modal input:focus-visible, .workflow-graph-modal select:focus-visible, .workflow-configuration button:focus-visible { outline: 2px solid var(--blue, #1677ff); outline-offset: 2px; }
@media (max-width: 1100px) {
  .workflow-graph-library { width: 190px; padding: 12px; }
  #workflow-graph-inspector { width: 300px; padding: 14px 12px; }
  .workflow-tool-group { border-right: 0; padding-right: 0; }
}
@media (max-width: 700px) {
  .workflow-graph-modal { width: calc(100vw - 12px); height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); overflow: auto; }
  .workflow-graph-modal > * { flex-shrink: 0; }
  .workflow-graph-tools { max-height: 150px; overflow: auto; padding: 10px 12px; }
  .workflow-tool-add { flex-basis: auto; }
  /* Scroll the narrow dialog rather than shrinking the canvas to the space left
     by the header/tools. The inspector and footer remain in normal flow. */
  .workflow-graph-workspace { flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 90px 220px 220px; overflow: visible; }
  .workflow-graph-library { width: auto; min-height: 0; max-height: none; }
  #workflow-graph-inspector { width: auto; min-height: 0; max-height: none; border-left: 0; border-top: 1px solid var(--line, #e8eef7); }
  .workflow-graph-viewport { min-height: 0; }
  #workflow-graph-minimap { display: none; }
  .workflow-graph-minimap-canvas { height: 65px; }
  .workflow-config-grid { grid-template-columns: minmax(0, 1fr); }
  .workflow-graph-modal .modal-foot { flex-wrap: wrap; }
  #workflow-graph-message { flex-basis: 100%; }
}

/* Root configuration follows the same sections and trigger choices as regular tasks. */
.workflow-configuration { width: min(980px, calc(100vw - 32px)); }
.workflow-config-body { display: flex; flex-direction: column; gap: 20px; }
.workflow-config-body .section-box { margin: 0; padding: 22px; border-radius: 10px; }
.workflow-config-body .section-title { margin-bottom: 16px; }
.workflow-config-basic { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 22px; }
.workflow-config-numbers { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin: 18px 0 12px; }
.workflow-config-body .form-row { display: grid; grid-template-columns: minmax(0,1fr); gap: 8px; }
.workflow-config-body .radio-line, .workflow-config-body .check-line { flex-wrap: wrap; gap: 12px 24px; }
.workflow-config-body .hint { line-height: 1.75; margin: 10px 0 0; }
.workflow-config-body .inline-options .form-row { margin-top: 12px; }
.workflow-config-body .inline-options { margin-top: 16px; }
.workflow-config-clear { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
@media(max-width:900px) { .workflow-config-numbers { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media(max-width:640px) { .workflow-config-basic, .workflow-config-numbers { grid-template-columns:minmax(0,1fr); } .workflow-config-body .section-box { padding: 18px; } }

.workflow-config-basic + .check-line { margin-top: 16px; }

/* Parameter rows keep their add action compact rather than stretching a grid cell. */
.workflow-config-parameters { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: start; }
.workflow-config-parameters > .section-box { display: grid; grid-template-columns: minmax(0,1fr) 120px minmax(0,1fr) auto; align-items: start; gap: 12px; padding: 16px; }
.workflow-config-parameters > .section-box > button { align-self: start; margin-top: 29px; }
.workflow-config-parameters .form-row { min-width: 0; margin: 0; }
.workflow-config-parameters > button { justify-self: start; align-self: start; }
@media (max-width: 700px) { .workflow-config-parameters > .section-box { grid-template-columns: 1fr; } .workflow-config-parameters > .section-box > button { justify-self: start; margin-top: 0; } }

.workflow-graph-locate-status { position: absolute; top: 12px; left: 12px; z-index: 5; max-width: calc(100% - 24px); padding: 8px 12px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: #1e40af; font-size: 12px; line-height: 1.5; pointer-events: none; box-shadow: 0 2px 8px #0f172a0d; }
.workflow-graph-locate-status[hidden] { display: none; }

#workflow-graph-stage:focus-visible { outline: 2px solid var(--blue, #1677ff); outline-offset: -2px; }
#workflow-graph-stage .smart-guides { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
#workflow-graph-stage .smart-guides line { stroke: #5883ff; stroke-width: 1; vector-effect: non-scaling-stroke; }
#workflow-graph-stage .smart-guides text { fill: #527cff; font-size: 10px; paint-order: stroke; stroke: #fafbfe; stroke-width: 4px; }
#workflow-graph-stage .drag-status { position: absolute; inset: 12px auto auto 12px; z-index: 11; background: #fff5df; color: #7d500a; border: 1px solid #f1cf8c; padding: 6px 10px; border-radius: 6px; pointer-events: none; }
#workflow-graph-stage .x6-node.node-overlap rect { stroke: #dc8e20; stroke-dasharray: 4 3; }
.workflow-route-ports { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.workflow-route-ports label { display: grid; gap: 4px; }
.workflow-route-ports select { min-width: 0; }

/* One minimap interaction target; tiny marks retain only spatial meaning. */
button.workflow-graph-minimap-canvas { display: block; width: 100%; min-width: 0; min-height: 32px; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.workflow-graph-minimap-canvas .workflow-graph-minimap-node { pointer-events: none; cursor: inherit; }
.workflow-graph-minimap-canvas:focus-visible .workflow-graph-minimap-node[data-keyboard-current="true"] { outline: 2px solid #2563eb; outline-offset: 1px; }
