/* ── Workflows App Styles ─────────────────────────────────────────────────── */

/* Toolbar — one row, horizontal scroll on narrow widths (never flex-wrap).
   Same pattern as .tasks-filter-bar. */
.wf-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: thin;
}
.wf-toolbar::-webkit-scrollbar { height: 6px; }
.wf-toolbar::-webkit-scrollbar-thumb { background: var(--border); border-radius: var(--radius-sm); }
.wf-toolbar-spacer { flex: 1; }
.wf-count { font-size: 12px; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; }

.wf-table-wrap { padding: 4px 0; }
.wf-cell-name { font-size: 13px; font-weight: 600; color: var(--text); }
.wf-cell-trigger { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.wf-row-actions { display: flex; gap: 2px; }
.wf-mono { font-family: var(--font-mono); font-size: 10px; color: var(--text-dim); }

/* Approvals banner (amber) */
.wf-approvals-banner {
  margin: 10px 12px 0;
  border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
  background: var(--warning-tint);
  border-radius: var(--radius);
  overflow: hidden;
}
.wf-approvals-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
}
.wf-approvals-icon, .wf-approvals-chev { display: inline-flex; align-items: center; }
.wf-approvals-chev svg { width: 14px; height: 14px; }
.wf-approvals-list { border-top: 1px solid color-mix(in srgb, var(--warning) 25%, transparent); }
.wf-approval-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--warning) 15%, transparent);
}
.wf-approval-item:last-child { border-bottom: none; }
.wf-approval-info { flex: 1; min-width: 0; }
.wf-approval-title { font-size: 12px; font-weight: 600; color: var(--text); }
.wf-approval-summary {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wf-approval-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }

/* Editor / sub-view header — one row, horizontal scroll, never wraps */
.wf-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 4px;
}
.wf-editor-header .ou-btn { flex-shrink: 0; }
/* Primary actions get their own row so Save/Run can never scroll off-screen
   in a narrow panel (the old single-row overflow-x header hid them). */
.wf-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.wf-editor-actions .ou-btn,
.wf-editor-actions .wf-save-btn { flex-shrink: 0; }
.wf-actions-spacer { flex: 1; }
.wf-name-input { flex: 1; min-width: 140px; font-size: 13px; font-weight: 600; }
/* select.* specificity (element+class) beats the canonical `.ou-select { width: 100% }`. */
select.wf-status-select { width: auto; flex: 0 0 auto; font-size: 12px; }
.wf-sub-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wf-save-btn { flex-shrink: 0; }
.wf-save-dot {
  display: none;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--warning);
  margin-right: 5px;
  flex-shrink: 0;
}
.wf-save-btn.wf-dirty .wf-save-dot { display: inline-block; }
.wf-save-error { padding: 6px 12px; font-size: 11px; color: var(--danger); white-space: pre-line; }

/* Cards */
.wf-card {
  margin: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.wf-card-title {
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.wf-card-body { padding: 10px 12px; }
.wf-detail-rows { padding: 0; }

/* Steps */
.wf-steps { padding: 0 12px 16px; }
.wf-steps-empty { text-align: center; padding: 16px; color: var(--text-dim); font-size: 12px; }
.wf-step-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.wf-step-card.expanded { border-color: var(--accent); }
.wf-step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.wf-step-num {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}
/* Per-step-type tile colour from the categorical palette (§4 --c*); tint via
   color-mix off the same token so there's one source of truth per type. */
.wf-step-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-tint);
  color: var(--accent);
  flex-shrink: 0;
}
.wf-step-icon svg { width: 14px; height: 14px; }
.wf-step-icon-llm { background: color-mix(in srgb, var(--c4) 12%, transparent); color: var(--c4); }
.wf-step-icon-http_request { background: color-mix(in srgb, var(--c8) 12%, transparent); color: var(--c8); }
.wf-step-icon-condition { background: var(--warning-tint); color: var(--warning); }
.wf-step-icon-approval { background: var(--danger-tint); color: var(--danger); }
.wf-step-icon-foreach { background: color-mix(in srgb, var(--c6) 12%, transparent); color: var(--c6); }
.wf-step-icon-delay { background: color-mix(in srgb, var(--c5) 12%, transparent); color: var(--c5); }
.wf-step-icon-subworkflow { background: color-mix(in srgb, var(--c7) 12%, transparent); color: var(--c7); }
.wf-step-titles { flex: 1; min-width: 0; }
.wf-step-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wf-step-summary {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wf-step-actions { display: flex; gap: 2px; flex-shrink: 0; }
/* Up/down reorder iconButtons disable at the ends of the list. .ou-icon-btn has
   no shared :disabled style yet (noted for oscar-ui owner); scope a local dim. */
.wf-step-actions .ou-icon-btn:disabled { opacity: 0.3; cursor: default; }
.wf-step-actions .ou-icon-btn:disabled:hover { background: transparent; color: var(--text-dim); }
.wf-step-config { border-top: 1px solid var(--border); padding: 10px 12px; }

/* foreach: indented nested-steps container inside the expanded config */
.wf-substeps { margin-left: 22px; border-left: 2px solid var(--border); padding-left: 8px; }
.wf-substeps .wf-steps-empty { padding: 8px; }
.wf-step-meta {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}
.wf-step-meta-remote { display: inline-flex; vertical-align: -2px; }
.wf-step-meta-remote svg { width: 12px; height: 12px; }
.wf-step-id { padding: 6px 0; }

/* .wf-icon-btn retired → OscarUI.iconButton (.ou-icon-btn). */

/* Add-step rows between cards */
.wf-add-row { display: flex; align-items: center; justify-content: center; padding: 2px 0; }
.wf-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-pill);
  border: 1px dashed var(--border);
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}
.wf-add-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Form fields — density modifiers layered on the canonical OscarUI.formGroup
   substrate (.ou-form-group/.ou-label/.ou-input/.ou-textarea/.ou-select). The
   .wf-field micro-framework was retired into .ou-form-group; what remains here
   is workflows' compact sizing (11–12px, tighter margins) — not a parallel
   component. .wf-checkbox-row → .ou-checkbox (OscarUI.formGroup checkbox). */
.wf-field { margin-bottom: 10px; min-width: 0; }
.wf-field-label {
  font-size: 11px;
  margin-bottom: 4px;
  text-transform: none;
  letter-spacing: 0;
}
.wf-field-hint { font-size: 10px; color: var(--text-dim); opacity: 0.85; margin-top: 3px; }
.wf-input, .wf-select, .wf-textarea { box-sizing: border-box; font-size: 12px; padding: 6px 10px; border-radius: var(--radius); }
.wf-textarea { min-height: 0; font-family: var(--font-mono); }
.wf-input.invalid, .wf-textarea.invalid { border-color: var(--danger); }
.wf-form-row { display: flex; gap: 8px; }
.wf-form-row > .wf-field,
.wf-form-row > .ou-form-group { flex: 1; }

/* JSON output fields editor (LLM step) */
.wf-json-field-row { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.wf-json-field-row .wf-input { flex: 1; }

/* Templating chips */
.wf-hint-block {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.wf-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.wf-chip {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.wf-chip:hover { border-color: var(--accent); }

/* Step picker modal */
.wf-picker-search { margin-bottom: 8px; }
/* Two-pane picker: category rail left, tools right; stacks on narrow widths */
.wf-picker-split { display: flex; min-height: 300px; max-height: 55vh; }
.wf-picker-cats {
  width: 150px;
  flex-shrink: 0;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 4px 0;
}
.wf-picker-cat {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wf-picker-cat:hover { color: var(--text); background: var(--surface); }
.wf-picker-cat.active { color: var(--text); border-left-color: var(--accent); background: var(--surface); font-weight: 600; }
.wf-picker-cat-divider { height: 1px; background: var(--border); margin: 4px 10px; }
.wf-picker-tools { flex: 1; min-width: 0; overflow-y: auto; padding: 2px 0 2px 8px; }
.wf-picker-empty { padding: 12px; }
@media (max-width: 640px) {
  .wf-picker-split { flex-direction: column; max-height: 60vh; }
  .wf-picker-cats {
    width: auto;
    display: flex;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0 0 4px;
  }
  .wf-picker-cat { width: auto; border-left: none; border-bottom: 2px solid transparent; }
  .wf-picker-cat.active { border-bottom-color: var(--accent); }
  .wf-picker-cat-divider { width: 1px; height: auto; margin: 4px 2px; }
  .wf-picker-tools { padding: 2px 0; }
}

/* Runs list / run detail */
.wf-runs-list { padding: 4px 0; }
.wf-run-section { margin: 10px 12px; }
.wf-run-steps { padding: 0 12px 16px; }
.wf-run-step {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 8px;
}
.wf-run-step-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px;
}
.wf-run-step-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wf-run-step-chev { display: inline-flex; align-items: center; color: var(--text-dim); }
.wf-run-step-chev svg { width: 14px; height: 14px; }
.wf-run-step-body { border-top: 1px solid var(--border); padding: 8px 12px; }

/* foreach sub-rows in run detail: indented under the parent row, grouped by
   a small 'Item N' label per iteration. Subworkflow child rows ('parent>child')
   share the same class; -deep = a child row inside a foreach iteration. */
.wf-run-substep { margin-left: 22px; }
.wf-run-substep-deep { margin-left: 44px; }
.wf-run-iter-label {
  margin: 2px 0 4px 22px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
}

/* Webhook trigger URL row */
.wf-webhook-row { display: flex; gap: 6px; align-items: center; }
.wf-webhook-row .wf-input { flex: 1; min-width: 0; }
.wf-webhook-row .ou-btn { flex-shrink: 0; }

.wf-json-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-dim);
}
.wf-json {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow: auto;
  margin: 4px 0 10px;
}
.wf-json.wf-error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

.wf-confirm-text { color: var(--text); font-size: 14px; line-height: 1.5; margin: 0 0 8px; }

/* Approval card on run detail */
.wf-approval-card {
  margin: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 45%, transparent);
  background: var(--warning-tint);
  border-radius: var(--radius);
  padding: 12px;
}
.wf-approval-card .wf-approval-title { margin-bottom: 4px; }
.wf-approval-card-summary { font-size: 12px; color: var(--text); margin-bottom: 10px; white-space: pre-wrap; }

/* ── Remote MCP servers view (.wf-srv-*) ── */
.wf-srv-list { display: flex; flex-direction: column; gap: 8px; padding: 8px 12px; }
.wf-srv-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.wf-srv-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.wf-srv-titles { min-width: 0; flex: 1; }
.wf-srv-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wf-srv-host {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wf-srv-actions { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }
.wf-srv-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
  min-width: 0;
}
.wf-srv-status > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Server reachability dot — drives OscarUI.statusDot via the --c custom prop
   (ok=success, fail=danger, unknown=faint). */
.wf-srv-dot { --c: var(--text-dim); }
.wf-srv-dot.ok { --c: var(--success); }
.wf-srv-dot.fail { --c: var(--danger); }
.wf-srv-mark { margin-left: 4px; display: inline-flex; align-items: center; opacity: 0.6; }
.wf-srv-mark svg { width: 11px; height: 11px; }
/* Server enable/disable toggle sits inline in the card head — drop the
   form-group block margin. */
.wf-srv-toggle { margin: 0; flex-shrink: 0; }
