/*
 * studio.css — 角色库 / 工作流 页面样式
 * 所有类名 stx- 前缀，避免污染全局。不使用 body/html 全局选择器。
 * 依赖主应用 CSS 变量：--color-bg-* / --color-text-* / --color-border-* / --color-accent 等。
 */

/* ---------- 挂载容器 ---------- */
.stx-view-host {
  flex: 1 1 0%;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
}

/* ---------- 页面骨架 ---------- */
.stx-page {
  padding: 32px 36px 48px;
  max-width: 1200px;
  margin: 0 auto;
  color: var(--color-text-primary, #111);
  font: inherit;
}
.stx-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.stx-page-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--color-text-primary, #111);
}
.stx-page-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--color-text-secondary, #666);
}
.stx-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- 按钮 ---------- */
.stx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
  font-family: inherit;
  white-space: nowrap;
}
.stx-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.stx-btn-primary {
  background: var(--color-accent, #6366f1);
  color: #fff;
}
.stx-btn-primary:hover:not(:disabled) {
  background: var(--color-accent-hover, #4f46e5);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.stx-btn-secondary {
  background: var(--color-bg-tertiary, #f3f4f6);
  color: var(--color-text-primary, #111);
  border-color: var(--color-border-primary, #e5e7eb);
}
.stx-btn-secondary:hover:not(:disabled) {
  border-color: var(--color-border-secondary, #d1d5db);
  background: var(--color-bg-secondary, #eceef1);
}
.stx-btn-danger {
  background: transparent;
  color: var(--color-error, #ef4444);
  border-color: transparent;
}
.stx-btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.08);
}
.stx-btn-sm {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: 8px;
}
.stx-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--color-border-primary, #e5e7eb);
  background: var(--color-bg-tertiary, #f3f4f6);
  color: var(--color-text-secondary, #666);
  font-size: 13px;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease;
  font-family: inherit;
  padding: 0;
}
.stx-btn-icon:hover:not(:disabled) {
  background: var(--color-bg-secondary, #eceef1);
  color: var(--color-text-primary, #111);
}
.stx-btn-icon:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.stx-btn-icon-danger:hover:not(:disabled) {
  color: var(--color-error, #ef4444);
}

/* ---------- 卡片 / 网格 ---------- */
.stx-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.stx-card {
  background: var(--color-bg-secondary, #fff);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: 16px;
  padding: 20px;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stx-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  border-color: var(--color-border-secondary, #d1d5db);
}
.stx-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary, #111);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.stx-card-desc {
  font-size: 13px;
  color: var(--color-text-secondary, #666);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}
.stx-card-meta {
  font-size: 12px;
  color: var(--color-text-tertiary, #999);
}
.stx-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
}

/* ---------- 角色卡 ---------- */
.stx-char-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.stx-char-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 27px;
  flex-shrink: 0;
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.28), rgba(0, 0, 0, 0.18));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.stx-char-title-wrap {
  min-width: 0;
}

/* ---------- 标签 / 徽标 / 芯片 ---------- */
.stx-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.stx-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.5;
  background: var(--color-bg-tertiary, #f3f4f6);
  color: var(--color-text-secondary, #666);
  border: 1px solid var(--color-border-primary, #e5e7eb);
}
.stx-tag-more {
  color: var(--color-text-tertiary, #999);
}
.stx-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: rgba(99, 102, 241, 0.12);
  color: var(--color-accent, #6366f1);
}
.stx-badge-preset {
  background: var(--color-bg-tertiary, #f3f4f6);
  color: var(--color-text-tertiary, #999);
}
.stx-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}
.stx-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.stx-chip-pending {
  background: var(--color-bg-tertiary, #f3f4f6);
  color: var(--color-text-tertiary, #999);
}
.stx-chip-running {
  background: rgba(99, 102, 241, 0.12);
  color: var(--color-accent, #6366f1);
}
.stx-chip-running::before {
  animation: stx-pulse 1.2s ease-in-out infinite;
}
.stx-chip-succeeded {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-success, #10b981);
}
.stx-chip-failed {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-error, #ef4444);
}
@keyframes stx-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---------- 空状态 ---------- */
.stx-empty {
  border: 1px dashed var(--color-border-secondary, #d1d5db);
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  background: var(--color-bg-secondary, #fff);
}
.stx-empty-small {
  padding: 28px 20px;
  margin-bottom: 0;
  margin-top: 18px;
}
.stx-empty-art {
  font-size: 40px;
  line-height: 1;
}
.stx-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary, #111);
}
.stx-empty-sub {
  font-size: 13px;
  color: var(--color-text-secondary, #666);
}
.stx-empty .stx-btn {
  margin-top: 8px;
}

/* ---------- 模态框 ---------- */
.stx-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: stx-fade-in 160ms ease;
}
.stx-modal {
  width: min(560px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  background: var(--color-bg-secondary, #fff);
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  animation: stx-pop-in 180ms ease;
}
.stx-modal-lg {
  width: min(720px, 94vw);
}
.stx-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.stx-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-text-primary, #111);
}
.stx-modal-close {
  border: none;
  background: transparent;
  color: var(--color-text-tertiary, #999);
  font-size: 15px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  transition: background 200ms ease, color 200ms ease;
  font-family: inherit;
}
.stx-modal-close:hover {
  background: var(--color-bg-tertiary, #f3f4f6);
  color: var(--color-text-primary, #111);
}
.stx-modal-body {
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.stx-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 20px;
}
@keyframes stx-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes stx-pop-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- 表单 ---------- */
.stx-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.stx-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary, #111);
}
.stx-hint {
  font-size: 12px;
  color: var(--color-text-tertiary, #999);
  line-height: 1.5;
}
.stx-input,
.stx-textarea,
.stx-select {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--color-border-primary, #e5e7eb);
  background: var(--color-bg-primary, #fff);
  color: var(--color-text-primary, #111);
  font-size: 13px;
  font-family: inherit;
  line-height: 1.5;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.stx-textarea {
  resize: vertical;
  min-height: 64px;
}
.stx-input:focus,
.stx-textarea:focus,
.stx-select:focus {
  outline: none;
  border-color: var(--color-accent, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.stx-input::placeholder,
.stx-textarea::placeholder {
  color: var(--color-text-tertiary, #999);
}
.stx-select {
  appearance: auto;
  cursor: pointer;
}
.stx-form-error {
  padding: 10px 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.08);
  color: var(--color-error, #ef4444);
  font-size: 13px;
  line-height: 1.5;
}

/* 色块 / emoji 选择 */
.stx-swatches,
.stx-emojis {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.stx-swatch {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.stx-swatch:hover {
  transform: scale(1.08);
}
.stx-swatch.stx-selected {
  border-color: var(--color-text-primary, #111);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}
.stx-emoji {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--color-border-primary, #e5e7eb);
  background: var(--color-bg-tertiary, #f3f4f6);
  font-size: 19px;
  cursor: pointer;
  padding: 0;
  transition: transform 200ms ease, border-color 200ms ease, background 200ms ease;
}
.stx-emoji:hover {
  transform: scale(1.08);
}
.stx-emoji.stx-selected {
  border-color: var(--color-accent, #6366f1);
  background: rgba(99, 102, 241, 0.1);
}

/* ---------- 步骤编辑器 ---------- */
.stx-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stx-step-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--color-border-primary, #e5e7eb);
  border-radius: 12px;
  background: var(--color-bg-tertiary, #f3f4f6);
}
.stx-step-index {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--color-accent, #6366f1);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 4px;
}
.stx-step-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stx-step-selects {
  display: flex;
  gap: 8px;
}
.stx-step-selects .stx-select {
  width: auto;
  flex: 1;
}
.stx-step-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.stx-add-step {
  align-self: flex-start;
}

/* ---------- 工作流卡片 ---------- */
.stx-step-preview {
  gap: 5px;
}

/* ---------- Tabs ---------- */
.stx-tabs {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--color-bg-tertiary, #f3f4f6);
  border: 1px solid var(--color-border-primary, #e5e7eb);
}
.stx-tab {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary, #666);
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease, box-shadow 200ms ease;
  font-family: inherit;
}
.stx-tab:hover {
  color: var(--color-text-primary, #111);
}
.stx-tab.stx-active {
  background: var(--color-bg-secondary, #fff);
  color: var(--color-text-primary, #111);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

/* ---------- 运行记录 ---------- */
.stx-runs-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.stx-runs-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary, #111);
  flex: 1;
  min-width: 0;
}
.stx-run-panel {
  margin-bottom: 22px;
}
.stx-run-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.stx-run-input-line {
  margin-top: -4px;
}
.stx-run-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stx-run-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--color-border-primary, #e5e7eb);
  background: var(--color-bg-tertiary, #f3f4f6);
  transition: border-color 200ms ease;
}
.stx-run-step .stx-step-index {
  margin-top: 0;
  background: var(--color-bg-secondary, #eceef1);
  color: var(--color-text-secondary, #666);
}
.stx-run-step-running {
  border-color: var(--color-accent, #6366f1);
}
.stx-run-step-running .stx-step-index {
  background: var(--color-accent, #6366f1);
  color: #fff;
}
.stx-run-step-succeeded .stx-step-index {
  background: var(--color-success, #10b981);
  color: #fff;
}
.stx-run-step-failed .stx-step-index {
  background: var(--color-error, #ef4444);
  color: #fff;
}
.stx-run-step-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stx-run-step-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary, #111);
}
.stx-run-done {
  display: flex;
  justify-content: flex-end;
  padding-top: 6px;
}
.stx-run-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stx-run-summary-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--color-bg-tertiary, #f3f4f6);
  border: 1px solid var(--color-border-primary, #e5e7eb);
}
.stx-run-summary-step .stx-step-index {
  margin-top: 0;
}
.stx-run-summary-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary, #111);
  flex: 1;
  min-width: 0;
}
.stx-runs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stx-run-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--color-border-primary, #e5e7eb);
  background: var(--color-bg-secondary, #fff);
  cursor: pointer;
  text-align: left;
  transition: border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
  font-family: inherit;
}
.stx-run-item:hover {
  transform: translateY(-1px);
  border-color: var(--color-border-secondary, #d1d5db);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}
.stx-run-item-time {
  font-size: 12px;
  color: var(--color-text-tertiary, #999);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.stx-run-item-input {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--color-text-primary, #111);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stx-run-pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, 100%);
  margin-top: 8px;
}
.stx-run-pick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--color-border-primary, #e5e7eb);
  background: var(--color-bg-primary, #fff);
  color: var(--color-text-primary, #111);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 200ms ease;
  font-family: inherit;
}
.stx-run-pick:hover {
  border-color: var(--color-accent, #6366f1);
}

/* ---------- 骨架屏 ---------- */
.stx-skeleton {
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary, #f3f4f6) 25%,
    var(--color-bg-secondary, #eceef1) 50%,
    var(--color-bg-tertiary, #f3f4f6) 75%
  );
  background-size: 200% 100%;
  animation: stx-shimmer 1.4s ease infinite;
}
.stx-skel-card {
  pointer-events: none;
}
.stx-skel-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
}
.stx-skel-line {
  height: 12px;
}
@keyframes stx-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- 内联错误 ---------- */
.stx-error {
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  background: var(--color-bg-secondary, #fff);
}
.stx-error-msg {
  font-size: 13px;
  color: var(--color-error, #ef4444);
}

/* ---------- Toast（fallback） ---------- */
.stx-toast-wrap {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.stx-toast {
  padding: 11px 18px;
  border-radius: 12px;
  background: var(--color-bg-secondary, #1f2937);
  color: var(--color-text-primary, #f9fafb);
  border: 1px solid var(--color-border-primary, #374151);
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  animation: stx-toast-in 220ms ease;
  max-width: 320px;
  pointer-events: auto;
}
.stx-toast-success {
  border-color: rgba(16, 185, 129, 0.5);
}
.stx-toast-error {
  border-color: rgba(239, 68, 68, 0.5);
}
.stx-toast-out {
  opacity: 0;
  transform: translateX(12px);
  transition: opacity 300ms ease, transform 300ms ease;
}
@keyframes stx-toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 暗色模式微调 ---------- */
.dark .stx-card:hover {
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
.dark .stx-run-item:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}
.dark .stx-tab.stx-active {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.dark .stx-swatch.stx-selected {
  border-color: var(--color-text-primary, #f9fafb);
}
.dark .stx-modal-backdrop {
  background: rgba(0, 0, 0, 0.6);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .stx-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 768px) {
  .stx-page {
    padding: 20px 16px 40px;
  }
  .stx-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .stx-page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .stx-head-actions {
    justify-content: flex-start;
  }
  .stx-step-row {
    flex-wrap: wrap;
  }
  .stx-step-tools {
    flex-direction: row;
  }
  .stx-run-item {
    flex-wrap: wrap;
    gap: 8px;
  }
  .stx-runs-head {
    align-items: stretch;
    flex-direction: column;
  }
}

/* ================================================================== *
 * 工作流工作台
 * 左侧流程列表 + 右侧流程画布；画布在展示 / 编辑 / 运行三种形态下
 * 复用同一套节点布局，只切换节点内部的内容。
 * ================================================================== */

.stx-page-wf {
  max-width: 1320px;
}

.stx-wf-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* ---------- 左侧流程列表 ---------- */

.stx-wf-rail {
  position: sticky;
  top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.08));
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.02));
}
.stx-wf-rail-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-tertiary, #8b8b8b);
  padding: 2px 6px 6px;
}
.stx-wf-rail-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 52vh;
  overflow-y: auto;
}
.stx-wf-rail-empty {
  padding: 8px 6px;
}
.stx-wf-rail-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.stx-wf-rail-item:hover {
  background: var(--color-bg-primary, #fff);
}
.stx-wf-rail-item.stx-active {
  background: var(--color-bg-primary, #fff);
  border-color: color-mix(in srgb, var(--color-accent, #4f46e5) 40%, transparent);
}
.stx-wf-rail-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary, #111);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stx-wf-rail-meta {
  font-size: 11px;
  color: var(--color-text-tertiary, #8b8b8b);
}
.stx-wf-rail-new {
  width: 100%;
  justify-content: center;
}

/* ---------- 右侧画布 ---------- */

.stx-wf-canvas {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.stx-wf-canvas-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.stx-wf-canvas-title {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 320px;
}
.stx-wf-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.stx-wf-desc {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-secondary, #666);
}
.stx-wf-titleinput {
  font-size: 16px;
  font-weight: 600;
}
.stx-wf-canvas-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- 运行条 ---------- */

.stx-wf-runbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.08));
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.02));
}
.stx-wf-runinput {
  flex: 1 1 260px;
  min-width: 0;
}
.stx-wf-runbtn {
  flex-shrink: 0;
}
.stx-wf-chainhint {
  flex-basis: 100%;
}

/* ---------- 流水线 ---------- */

.stx-wf-flow {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.stx-wf-origin {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px dashed var(--color-border-primary, rgba(0, 0, 0, 0.16));
  font-size: 12px;
  color: var(--color-text-secondary, #666);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stx-wf-origin-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-accent, #4f46e5);
  flex-shrink: 0;
}

/* 节点之间的连接线：链式步骤用实心强调色，独立步骤用虚线 */
.stx-wf-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0 2px 27px;
  min-height: 26px;
}
.stx-wf-link-line {
  width: 2px;
  align-self: stretch;
  border-left: 2px dashed var(--color-border-primary, rgba(0, 0, 0, 0.18));
}
.stx-wf-link-chained .stx-wf-link-line {
  border-left: 2px solid color-mix(in srgb, var(--color-accent, #4f46e5) 55%, transparent);
}
.stx-wf-link-label {
  font-size: 11px;
  color: var(--color-text-tertiary, #8b8b8b);
}
.stx-wf-link-chained .stx-wf-link-label {
  color: var(--color-accent, #4f46e5);
  font-weight: 600;
}

/* ---------- 节点 ---------- */

.stx-wf-node {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.08));
  background: var(--color-bg-primary, #fff);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.stx-wf-node-view:hover {
  border-color: var(--color-border-primary, rgba(0, 0, 0, 0.16));
}
.stx-wf-node-badge {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-secondary, #666);
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.05));
}
.stx-wf-node-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stx-wf-node-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.stx-wf-node-name {
  font-size: 14px;
  font-weight: 650;
}
.stx-wf-node-spec {
  font-size: 11px;
  color: var(--color-text-tertiary, #8b8b8b);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.04));
}
.stx-wf-node-prompt {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--color-text-secondary, #666);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.stx-wf-node-thumb {
  flex-shrink: 0;
  width: 62px;
  height: 62px;
  padding: 0;
  border: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.08));
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.04));
  cursor: zoom-in;
}
.stx-wf-node-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 运行态：节点描边跟随状态 */
.stx-wf-node-running {
  border-color: color-mix(in srgb, var(--color-accent, #4f46e5) 45%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent, #4f46e5) 10%, transparent);
}
.stx-wf-node-succeeded {
  border-color: color-mix(in srgb, #10b981 45%, transparent);
}
.stx-wf-node-failed {
  border-color: color-mix(in srgb, #ef4444 45%, transparent);
}
.stx-wf-node-running .stx-wf-node-badge {
  background: color-mix(in srgb, var(--color-accent, #4f46e5) 16%, transparent);
  color: var(--color-accent, #4f46e5);
}

/* ---------- 编辑态节点 ---------- */

.stx-wf-node-edit {
  border-style: dashed;
}
.stx-wf-node-editrow {
  display: flex;
  align-items: center;
  gap: 8px;
}
.stx-wf-node-nameinput {
  flex: 1 1 auto;
  min-width: 0;
}
.stx-wf-node-tools {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.stx-wf-node-fields {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.stx-wf-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--color-text-tertiary, #8b8b8b);
}
.stx-wf-field select {
  min-width: 0;
}
.stx-wf-addstep {
  align-self: flex-start;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px dashed var(--color-border-primary, rgba(0, 0, 0, 0.2));
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary, #666);
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}
.stx-wf-addstep:hover {
  border-color: var(--color-accent, #4f46e5);
  color: var(--color-accent, #4f46e5);
}

/* ---------- 历史运行 ---------- */

.stx-wf-runs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stx-wf-runs-toggle {
  align-self: flex-start;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary, #666);
  cursor: pointer;
}
.stx-wf-runs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (max-width: 900px) {
  .stx-wf-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .stx-wf-rail {
    position: static;
  }
  .stx-wf-rail-list {
    flex-direction: row;
    overflow-x: auto;
    max-height: none;
  }
  .stx-wf-rail-item {
    flex: 0 0 auto;
    min-width: 140px;
  }
}

/* 工作流：模型选择 */
.stx-wf-flowmodel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.stx-wf-flowmodel select {
  max-width: 220px;
}
.stx-wf-flowmodel-view {
  margin: 0;
}
.stx-wf-field-model select {
  max-width: 160px;
}
.stx-wf-node-model {
  background: color-mix(in srgb, var(--color-accent, #4f46e5) 12%, transparent);
  color: var(--color-accent, #4f46e5);
}

/* ---------------- 工作台排布调整 ----------------
   原来左栏 232px 固定、右侧内容贴边，节点、运行条、标题挤在一列里没有节奏。
   收窄左栏、给画布加内边距和分组，让"选流程 → 填主题 → 看流水线"三段分明。 */

.stx-wf-shell {
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
}

.stx-wf-rail {
  padding: 10px;
  border-radius: 14px;
}
.stx-wf-rail-item {
  padding: 8px 10px;
}
.stx-wf-rail-item.stx-active {
  box-shadow: inset 2px 0 0 var(--color-accent, #4f46e5);
}

/* 画布：标题区与流水线之间拉开层次 */
.stx-wf-canvas {
  gap: 20px;
}
.stx-wf-canvas-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.08));
}
.stx-wf-name {
  font-size: 22px;
}

/* 运行条更像一个真正的"启动区" */
.stx-wf-runbar {
  padding: 14px 16px;
  border-radius: 16px;
  gap: 12px;
}
.stx-wf-runbtn {
  min-width: 116px;
  justify-content: center;
}

/* 流水线整体内缩，节点不再贴着容器边缘 */
.stx-wf-flow {
  padding: 4px 0 8px;
}
.stx-wf-node {
  padding: 16px;
  gap: 14px;
}
.stx-wf-node-badge {
  width: 28px;
  height: 28px;
}
.stx-wf-node-prompt {
  -webkit-line-clamp: 3;
}
.stx-wf-node-thumb {
  width: 72px;
  height: 72px;
}

/* 编辑态字段独占一行排布，避免三个下拉挤成一坨 */
.stx-wf-node-fields {
  gap: 10px 14px;
}
.stx-wf-field {
  flex: 1 1 150px;
  justify-content: space-between;
}
.stx-wf-field select {
  flex: 1 1 auto;
  min-width: 0;
}

/* 删除二次确认 */
.stx-wf-confirm {
  font-size: 12px;
  color: var(--color-text-secondary, #666);
  margin-right: 2px;
}

@media (max-width: 1100px) {
  .stx-wf-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
}

/* ---------------- 工作流产出图展示 ----------------
   产出图原来是节点右侧一个 72px 方块，点了还会弹去新标签页。
   现在铺在节点正文下方，点击就地放大，可在本次运行的所有产出之间翻页。 */

.stx-wf-output {
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stx-wf-output-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.08));
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.03));
  cursor: zoom-in;
  position: relative;
  line-height: 0;
}
.stx-wf-output-btn img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.03));
}
.stx-wf-output-zoom {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 13, 10, 0.62);
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
  opacity: 0;
  transition: opacity 140ms ease;
  backdrop-filter: blur(6px);
}
.stx-wf-output-btn:hover .stx-wf-output-zoom {
  opacity: 1;
}
.stx-wf-output-cap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--color-text-tertiary, #8b8b8b);
}
.stx-wf-output-link {
  color: var(--color-accent, #4f46e5);
  text-decoration: none;
  font-weight: 600;
}
.stx-wf-output-link:hover {
  text-decoration: underline;
}

/* 生成中的占位，让流程跑起来时每个节点都有反馈 */
.stx-wf-output-pending {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 18px 14px;
  border: 1px dashed var(--color-border-primary, rgba(0, 0, 0, 0.16));
  border-radius: 12px;
  font-size: 12px;
  color: var(--color-text-tertiary, #8b8b8b);
}
.stx-wf-output-spin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--color-accent, #4f46e5) 30%, transparent);
  border-top-color: var(--color-accent, #4f46e5);
  animation: stx-wf-spin 0.8s linear infinite;
}
@keyframes stx-wf-spin {
  to { transform: rotate(360deg); }
}

/* ---------------- 站内灯箱 ---------------- */

.stx-wf-lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(12, 12, 14, 0.78);
  backdrop-filter: blur(6px);
}
.stx-wf-lightbox-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: min(1100px, 92vw);
  max-height: 90vh;
  width: 100%;
}
.stx-wf-lightbox-head {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 13px;
}
.stx-wf-lightbox-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stx-wf-lightbox-count {
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}
.stx-wf-lightbox-dl {
  margin-left: auto;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.stx-wf-lightbox-dl:hover {
  background: rgba(255, 255, 255, 0.12);
}
.stx-wf-lightbox-close {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #fff;
  cursor: pointer;
  line-height: 1;
}
.stx-wf-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.12);
}
.stx-wf-lightbox-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stx-wf-lightbox-body img {
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}
.stx-wf-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(20, 20, 24, 0.55);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.stx-wf-lightbox-nav:hover {
  background: rgba(20, 20, 24, 0.85);
}
.stx-wf-lightbox-prev { left: -6px; }
.stx-wf-lightbox-next { right: -6px; }

@media (max-width: 720px) {
  .stx-wf-lightbox-prev { left: 2px; }
  .stx-wf-lightbox-next { right: 2px; }
  .stx-wf-lightbox-dl { display: none; }
}

/* ---------------- 并行流程图 / 参考图输入 / 重试 ----------------
   展示态按依赖分层：同一层的步骤互不依赖，并排显示，一眼看出哪里分叉。
   编辑态仍是线性列表（改顺序和来源最直观）。 */

.stx-wf-flow-graph {
  gap: 0;
}

/* 层与层之间的连接与说明 */
.stx-wf-levelgap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 6px 27px;
  min-height: 30px;
}
.stx-wf-levelgap-line {
  width: 2px;
  align-self: stretch;
  border-left: 2px solid color-mix(in srgb, var(--color-accent, #4f46e5) 45%, transparent);
}
.stx-wf-levelgap-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-tertiary, #8b8b8b);
}

/* 一层里的节点 */
.stx-wf-level {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.stx-wf-level-parallel {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.stx-wf-level-parallel .stx-wf-node {
  border-left: 3px solid color-mix(in srgb, var(--color-accent, #4f46e5) 40%, transparent);
}

.stx-wf-node-from {
  margin: 0;
  font-size: 11px;
  color: var(--color-text-tertiary, #8b8b8b);
}

/* 失败步骤的重试 */
.stx-wf-node-retry {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 2px;
}

/* ---------------- 运行条 ---------------- */

.stx-wf-runbar {
  flex-direction: column;
  align-items: stretch;
}
.stx-wf-runbar-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.stx-wf-runbar-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.stx-wf-parallel-tag {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-accent, #4f46e5);
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-accent, #4f46e5) 12%, transparent);
}

/* 参考图 */
.stx-wf-addimg {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px dashed var(--color-border-primary, rgba(0, 0, 0, 0.2));
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary, #666);
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}
.stx-wf-addimg:hover {
  border-color: var(--color-accent, #4f46e5);
  color: var(--color-accent, #4f46e5);
}
.stx-wf-inputimg {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.1));
  background: var(--color-bg-primary, #fff);
}
.stx-wf-inputimg img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.stx-wf-inputimg-name {
  font-size: 11px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-secondary, #666);
}
.stx-wf-inputimg-x {
  border: 0;
  background: transparent;
  color: var(--color-text-tertiary, #8b8b8b);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 2px;
}
.stx-wf-inputimg-x:hover {
  color: var(--color-text-primary, #111);
}
.stx-wf-origin-img {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: var(--color-accent, #4f46e5);
  background: color-mix(in srgb, var(--color-accent, #4f46e5) 12%, transparent);
}

@media (max-width: 700px) {
  .stx-wf-level-parallel {
    grid-template-columns: minmax(0, 1fr);
  }
  .stx-wf-parallel-tag {
    margin-left: 0;
  }
}

/* ---------------- 图形化流程编辑器 ----------------
   编辑态不再是"线性列表 + 来源下拉"，而是一张画布：
   拖节点排位置，从右侧圆点拉线到另一个节点的左侧圆点建立数据流。
   分支就是从同一个节点拉出两条线，所见即所得。 */

.stx-wf-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stx-wf-editor-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.stx-wf-editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
}
.stx-wf-canvas-scroll {
  overflow: auto;
  max-height: 62vh;
  border-radius: 16px;
  border: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.09));
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--color-text-primary, #111) 12%, transparent) 1px, transparent 0)
    0 0 / 22px 22px,
    var(--color-bg-secondary, rgba(0, 0, 0, 0.02));
}

.stx-wf-graph {
  position: relative;
  min-width: 100%;
  min-height: 320px;
  touch-action: none;
}
.stx-wf-edges {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.stx-wf-edge {
  fill: none;
  stroke: color-mix(in srgb, var(--color-accent, #4f46e5) 60%, transparent);
  stroke-width: 2;
}
.stx-wf-edge-topic {
  stroke: color-mix(in srgb, var(--color-text-primary, #111) 28%, transparent);
  stroke-dasharray: 5 4;
}
.stx-wf-edge-temp {
  stroke: var(--color-accent, #4f46e5);
  stroke-dasharray: 4 4;
}

/* ---------------- 节点 ---------------- */

.stx-wf-gnode {
  position: absolute;
  width: 216px;
  min-height: 92px;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.1));
  background: var(--color-bg-primary, #fff);
  box-shadow: 0 2px 10px rgba(16, 18, 27, 0.06);
  cursor: grab;
  user-select: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.stx-wf-gnode:hover {
  border-color: color-mix(in srgb, var(--color-accent, #4f46e5) 45%, transparent);
}
.stx-wf-gnode-selected {
  border-color: var(--color-accent, #4f46e5);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent, #4f46e5) 14%, transparent);
}
.stx-wf-gnode-dragging {
  cursor: grabbing;
  box-shadow: 0 10px 28px rgba(16, 18, 27, 0.18);
  z-index: 5;
}
.stx-wf-gnode-topic {
  width: 168px;
  min-height: 68px;
  cursor: default;
  border-style: dashed;
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.03));
}

.stx-wf-gnode-head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stx-wf-gnode-idx {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.06));
  color: var(--color-text-secondary, #666);
}
.stx-wf-gnode-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stx-wf-gnode-del {
  border: 0;
  background: transparent;
  color: var(--color-text-tertiary, #8b8b8b);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 120ms ease;
}
.stx-wf-gnode:hover .stx-wf-gnode-del {
  opacity: 1;
}
.stx-wf-gnode-del:hover {
  color: #ef4444;
  background: color-mix(in srgb, #ef4444 12%, transparent);
}
.stx-wf-gnode-sub {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--color-text-tertiary, #8b8b8b);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.stx-wf-gnode-tags {
  margin-top: 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.stx-wf-gnode-tags span {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.05));
  color: var(--color-text-tertiary, #8b8b8b);
}
.stx-wf-gnode-tag-model {
  background: color-mix(in srgb, var(--color-accent, #4f46e5) 12%, transparent) !important;
  color: var(--color-accent, #4f46e5) !important;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------- 端口 ---------------- */

.stx-wf-port {
  position: absolute;
  top: 27px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--color-bg-primary, #fff);
  background: var(--color-accent, #4f46e5);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-accent, #4f46e5) 50%, transparent);
}
.stx-wf-port-in {
  left: -7px;
}
.stx-wf-port-out {
  right: -7px;
  cursor: crosshair;
}
.stx-wf-port-out:hover {
  transform: scale(1.25);
}
/* 拉线时把所有输入端口放大，明确可以往哪儿放 */
.stx-wf-graph-linking .stx-wf-port-in {
  transform: scale(1.35);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--color-accent, #4f46e5) 22%, transparent);
}
.stx-wf-graph-linking .stx-wf-gnode {
  cursor: copy;
}

/* ---------------- 属性面板 ---------------- */

.stx-wf-inspector {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.09));
  background: var(--color-bg-primary, #fff);
  position: sticky;
  top: 8px;
}
.stx-wf-inspector-empty {
  color: var(--color-text-tertiary, #8b8b8b);
  font-size: 12px;
  line-height: 1.7;
}
.stx-wf-inspector-empty p {
  margin: 0;
}
.stx-wf-inspector-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.stx-wf-inspector-head .stx-input {
  flex: 1 1 auto;
  min-width: 0;
}
.stx-wf-inspector-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-tertiary, #8b8b8b);
}
.stx-wf-inspector-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stx-wf-inspector-grid .stx-wf-field {
  justify-content: space-between;
}
.stx-wf-inspector-grid .stx-wf-field select {
  max-width: 170px;
}

@media (max-width: 1000px) {
  .stx-wf-editor-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .stx-wf-inspector {
    position: static;
  }
}

/* ============================================================================
   工作台布局 v2
   之前：页面按文档流从上往下堆（大标题 + 卡片式流程栏 + 固定高度画布），
   画布跑完就留下一大片空白，右侧属性面板被拉满高度、字段之间被撑开。
   现在：整页占满可用高度，画布是主体并自己滚动，两侧栏各自独立滚动。
   本段放在最后，用来覆盖前面几轮追加的旧规则。
   ============================================================================ */

/* 承载容器不再整页滚动，改由内部区域各自滚动 */
.stx-view-host:has(.stx-page-wf) {
  overflow: hidden;
}

.stx-page-wf {
  max-width: none;
  height: 100%;
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 页头压扁成一行，把纵向空间让给画布 */
.stx-page-wf .stx-page-head {
  margin-bottom: 0;
  align-items: baseline;
  gap: 12px;
}
.stx-page-wf .stx-page-title {
  font-size: 17px;
}
.stx-page-wf .stx-page-sub {
  font-size: 12px;
  margin: 0;
}

.stx-wf-shell {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: 208px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
}

/* ---------------- 左侧流程列表：贴边、通栏、像导航而不是卡片 -------------- */

.stx-wf-rail {
  position: static;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 12px 0 0;
  border: 0;
  border-right: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.08));
  border-radius: 0;
  background: transparent;
}
.stx-wf-rail-head {
  padding: 0 4px 4px;
}
.stx-wf-rail-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  gap: 2px;
}
.stx-wf-rail-item {
  border-radius: 8px;
  padding: 7px 9px;
}
.stx-wf-rail-new {
  flex-shrink: 0;
}

/* ---------------- 中间主区 ---------------- */

.stx-wf-canvas {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 标题行压缩：名称/描述/整体模型收进一行两列，不再各占一大行 */
.stx-wf-canvas-head {
  padding-bottom: 10px;
  gap: 10px;
  align-items: center;
}
.stx-wf-canvas-title {
  gap: 4px;
  flex: 1 1 320px;
}
.stx-wf-name {
  font-size: 18px;
}
.stx-wf-desc {
  font-size: 12px;
}
.stx-wf-flowmodel {
  gap: 6px;
  font-size: 11px;
}
.stx-wf-flowmodel select {
  max-width: 190px;
  height: 30px;
}
.stx-wf-flowmodel .stx-hint {
  font-size: 11px;
}

/* 展示态：流水线区域自己滚动，不把页面撑高 */
.stx-wf-flow {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.stx-wf-runs {
  flex-shrink: 0;
}

/* ---------------- 编辑态：画布占满剩余空间 ---------------- */

.stx-wf-editor {
  flex: 1 1 auto;
  min-height: 0;
  gap: 8px;
}
.stx-wf-editor-bar {
  flex-shrink: 0;
}
.stx-wf-editor-body {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) 272px;
  gap: 12px;
  align-items: stretch;
}
.stx-wf-canvas-scroll {
  height: 100%;
  max-height: none;
  min-height: 0;
}

/* ---------------- 属性面板：紧凑，不再被拉扯 ---------------- */

.stx-wf-inspector {
  position: static;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  gap: 6px;
  padding: 12px;
  align-self: stretch;
}
.stx-wf-inspector-head {
  flex-shrink: 0;
}
.stx-wf-inspector-label {
  margin-top: 2px;
}
.stx-wf-inspector textarea {
  flex: 0 0 auto;
  min-height: 132px;
  resize: vertical;
}
.stx-wf-inspector-grid {
  gap: 6px;
  margin-top: 4px;
}
/* 关键修复：字段在纵向 flex 里曾经 flex:1 1 150px，于是被均分整列高度 */
.stx-wf-inspector .stx-wf-field {
  flex: 0 0 auto;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
}
.stx-wf-inspector .stx-wf-field select {
  flex: 0 0 auto;
  width: 150px;
  max-width: 150px;
  height: 30px;
}
.stx-wf-inspector-src {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.08));
}
.stx-wf-unlink {
  flex-shrink: 0;
  border: 1px solid var(--color-border-primary, rgba(0, 0, 0, 0.16));
  background: transparent;
  color: var(--color-text-secondary, #666);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
}
.stx-wf-unlink:hover {
  border-color: #ef4444;
  color: #ef4444;
}
.stx-wf-inspector-tip {
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
}
.stx-wf-inspector-empty {
  justify-content: flex-start;
}

/* ---------------- 连线：可点击断开 ---------------- */

.stx-wf-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  pointer-events: stroke;
  cursor: pointer;
}
.stx-wf-edges {
  pointer-events: none;
}
.stx-wf-edge-hit {
  pointer-events: stroke;
}
.stx-wf-edge-hit:hover + .stx-wf-edge,
.stx-wf-edge-hit:hover {
  stroke-linecap: round;
}
.stx-wf-graph:not(.stx-wf-graph-linking) .stx-wf-edge-hit:hover ~ .stx-wf-edge {
  stroke: #ef4444;
}

/* 运行条与画布之间不要留大段空隙 */
.stx-wf-runbar {
  flex-shrink: 0;
  padding: 12px 14px;
}

@media (max-width: 1100px) {
  .stx-wf-shell {
    grid-template-columns: 180px minmax(0, 1fr);
  }
}
@media (max-width: 900px) {
  .stx-view-host:has(.stx-page-wf) {
    overflow-y: auto;
  }
  .stx-page-wf {
    height: auto;
  }
  .stx-wf-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .stx-wf-rail {
    border-right: 0;
    border-bottom: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.08));
    padding: 0 0 10px;
  }
  .stx-wf-rail-list {
    flex-direction: row;
    overflow-x: auto;
  }
  .stx-wf-editor-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .stx-wf-canvas-scroll {
    height: 52vh;
  }
  .stx-wf-inspector {
    height: auto;
  }
}

/* 整体模型那一行同时带了 stx-wf-field，继承了"两端对齐 + 等分撑开"，
   于是标签、下拉、说明被推到一行的三个角落。这里收回来。 */
.stx-wf-canvas-title .stx-wf-flowmodel {
  flex: 0 0 auto;
  justify-content: flex-start;
  align-items: center;
  padding: 0;
  margin-top: 2px;
}
.stx-wf-canvas-title .stx-wf-flowmodel > span:first-child {
  color: var(--color-text-tertiary, #8b8b8b);
}


/* ============================================================================
   修正 v3
   1) 下拉里的文字被压扁/遮住：上一轮给紧凑区域的 select 强制了 height:30px，
      而基础样式是 padding:9px + line-height:1.5（约 40px 自然高），
      文字被挤出行框。改成收内边距、不锁死高度。
   2) 属性面板新增"输入来自"下拉，可以直接选上游，不必只靠拖线。
   3) 流程删除挪到左栏每一行上。
   ============================================================================ */

/* ---------- 1. 下拉不再被压扁 ---------- */

.stx-wf-inspector .stx-wf-field select,
.stx-wf-canvas-title .stx-wf-flowmodel select,
.stx-wf-flowmodel select {
  height: auto;
  min-height: 0;
  padding: 6px 10px;
  line-height: 1.45;
  font-size: 12px;
  text-overflow: ellipsis;
}
.stx-wf-inspector .stx-wf-field select {
  width: 148px;
  max-width: 148px;
}
.stx-wf-canvas-title .stx-wf-flowmodel select {
  max-width: 210px;
}
/* 输入来自的选项比较长，给它整行 */
.stx-wf-inspector .stx-wf-srcfield {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.stx-wf-inspector .stx-wf-srcfield > span {
  color: var(--color-text-tertiary, #8b8b8b);
}
.stx-wf-inspector .stx-wf-srcfield select {
  width: 100%;
  max-width: none;
}

/* 属性面板里的输入框同样别锁高 */
.stx-wf-inspector .stx-input {
  padding: 7px 10px;
  font-size: 13px;
}

/* ---------- 2. 输入来源区块 ---------- */

.stx-wf-inspector-src {
  display: block;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.08));
}

/* ---------- 3. 左栏：每一行自带删除 ---------- */

.stx-wf-rail-row {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background 140ms ease, border-color 140ms ease;
}
.stx-wf-rail-row:hover {
  background: var(--color-bg-primary, #fff);
}
.stx-wf-rail-row.stx-active {
  background: var(--color-bg-primary, #fff);
  border-color: color-mix(in srgb, var(--color-accent, #4f46e5) 40%, transparent);
  box-shadow: inset 2px 0 0 var(--color-accent, #4f46e5);
}
/* 行内按钮不再自己画背景，交给外层的行 */
.stx-wf-rail-row .stx-wf-rail-item {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
.stx-wf-rail-del {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-right: 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-tertiary, #8b8b8b);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease, background 120ms ease;
}
.stx-wf-rail-row:hover .stx-wf-rail-del,
.stx-wf-rail-row.stx-active .stx-wf-rail-del {
  opacity: 1;
}
.stx-wf-rail-del:hover {
  color: #ef4444;
  background: color-mix(in srgb, #ef4444 12%, transparent);
}
.stx-wf-rail-confirm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
  flex-shrink: 0;
}
.stx-wf-rail-yes,
.stx-wf-rail-no {
  border: 0;
  border-radius: 6px;
  font-size: 11px;
  padding: 3px 7px;
  cursor: pointer;
  line-height: 1.2;
}
.stx-wf-rail-yes {
  background: #ef4444;
  color: #fff;
}
.stx-wf-rail-no {
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.06));
  color: var(--color-text-secondary, #666);
}
.stx-wf-rail-row.stx-confirming {
  border-color: color-mix(in srgb, #ef4444 45%, transparent);
}
/* 确认状态下名称收窄，给按钮让位 */
.stx-wf-rail-row.stx-confirming .stx-wf-rail-meta {
  display: none;
}

/* ============================================================================
   工作台头部压缩 v4
   名称 / 描述 / 整体模型原来是三行竖排，加上运行条的大内边距和各区块间距，
   节点还没开始就吃掉了半屏。这里收成一行，并把区块间距压紧。
   ============================================================================ */

/* 名称 · 描述 · 整体模型 排成一行，编辑流程留在右侧 */
.stx-wf-canvas-head {
  padding-bottom: 8px;
}
.stx-wf-canvas-title {
  flex-direction: row;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.stx-wf-name {
  font-size: 17px;
}
.stx-wf-desc,
.stx-wf-flowmodel-view {
  font-size: 12px;
  color: var(--color-text-tertiary, #8b8b8b);
}
/* 描述与整体模型之间加一个分隔点，一行里也能读清 */
.stx-wf-flowmodel-view::before {
  content: "·";
  margin-right: 8px;
  opacity: 0.5;
}

/* 编辑态：名称和描述并排，不再各占一整行 */
.stx-wf-titleinput {
  flex: 1 1 220px;
  min-width: 180px;
  font-size: 14px;
}
.stx-wf-descinput {
  flex: 2 1 260px;
  min-width: 200px;
}
.stx-wf-canvas-title .stx-wf-flowmodel {
  flex-basis: 100%;
  margin-top: 0;
}

/* 运行区收紧 */
.stx-wf-canvas {
  gap: 10px;
}
.stx-wf-runbar {
  padding: 10px 12px;
  gap: 8px;
}
.stx-wf-runbar-main {
  gap: 10px;
}
.stx-wf-runinput {
  padding-top: 8px;
  padding-bottom: 8px;
}
.stx-wf-runbar-sub {
  gap: 8px;
}
.stx-wf-addimg {
  padding: 5px 10px;
}

/* 流水线区不再从大间距开始 */
.stx-wf-flow-graph .stx-wf-origin {
  margin-bottom: 2px;
}
.stx-wf-levelgap {
  min-height: 24px;
  padding-top: 4px;
  padding-bottom: 4px;
}


/* ============================================================================
   工作台视觉层次 v5
   之前整块都是白底 + 细灰线，节点、层级、连接线全是同一个明度，
   看不出哪里是一层、哪一步接哪一步。这里用底色、色带和深度着色把层级立起来。
   ============================================================================ */

/* ---------- 流水线整体放进一个有底色的画板 ---------- */

.stx-wf-flow-graph {
  padding: 16px 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.08));
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--color-text-primary, #111) 7%, transparent) 1px, transparent 0)
    0 0 / 20px 20px,
    linear-gradient(180deg,
      color-mix(in srgb, var(--color-accent, #4f46e5) 4%, transparent) 0%,
      transparent 220px),
    var(--color-bg-secondary, rgba(0, 0, 0, 0.02));
}

/* 主题起点：实心强调色，和步骤明确区分 */
.stx-wf-flow-graph .stx-wf-origin {
  border: 0;
  background: var(--color-accent, #4f46e5);
  color: #fff;
  font-weight: 600;
  padding: 8px 16px;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--color-accent, #4f46e5) 28%, transparent);
}
.stx-wf-flow-graph .stx-wf-origin-dot {
  background: #fff;
}
.stx-wf-origin-img {
  background: rgba(255, 255, 255, 0.22) !important;
  color: #fff !important;
}

/* ---------- 层级：标签做成色块，连接线加粗 ---------- */

.stx-wf-levelgap {
  padding-left: 30px;
  min-height: 30px;
}
.stx-wf-levelgap-line {
  border-left-width: 3px;
  border-radius: 2px;
}
.stx-wf-levelgap-label {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--color-bg-primary, #fff);
  border: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.1));
  color: var(--color-text-secondary, #666);
}
/* 并行那一层用强调色点出来 */
.stx-wf-level-parallel {
  gap: 14px;
}
.stx-wf-levelgap[data-level]:has(+ .stx-wf-level-parallel) .stx-wf-levelgap-label {
  background: var(--color-accent, #4f46e5);
  border-color: var(--color-accent, #4f46e5);
  color: #fff;
}

/* ---------- 节点：白卡 + 真实投影 + 按深度着色的左侧色带 ---------- */

.stx-wf-flow-graph .stx-wf-node {
  position: relative;
  border: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.07));
  border-radius: 14px;
  background: var(--color-bg-primary, #fff);
  box-shadow: 0 1px 2px rgba(16, 18, 27, 0.04), 0 8px 24px rgba(16, 18, 27, 0.06);
  overflow: hidden;
  padding-left: 18px;
}
/* 左侧色带：层越深颜色越浓，一眼看出处在第几段 */
.stx-wf-flow-graph .stx-wf-node::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--stx-node-accent, color-mix(in srgb, var(--color-accent, #4f46e5) 55%, transparent));
}
.stx-wf-level[data-level="0"] { --stx-node-accent: #6366f1; }
.stx-wf-level[data-level="1"] { --stx-node-accent: #8b5cf6; }
.stx-wf-level[data-level="2"] { --stx-node-accent: #ec4899; }
.stx-wf-level[data-level="3"] { --stx-node-accent: #f59e0b; }
.stx-wf-level[data-level="4"] { --stx-node-accent: #10b981; }
.stx-wf-level[data-level="5"] { --stx-node-accent: #06b6d4; }

.stx-wf-flow-graph .stx-wf-node:hover {
  box-shadow: 0 2px 4px rgba(16, 18, 27, 0.05), 0 14px 34px rgba(16, 18, 27, 0.1);
}
/* 并行分支的额外左边框会和色带打架，去掉 */
.stx-wf-level-parallel .stx-wf-node {
  border-left: 1px solid var(--color-border-secondary, rgba(0, 0, 0, 0.07));
}

/* 序号跟随该层的颜色 */
.stx-wf-flow-graph .stx-wf-node-badge {
  background: color-mix(in srgb, var(--stx-node-accent, #6366f1) 14%, transparent);
  color: var(--stx-node-accent, #6366f1);
  font-weight: 800;
}

/* 步骤名更醒目，参数与来源退到次要 */
.stx-wf-flow-graph .stx-wf-node-name {
  font-size: 15px;
  font-weight: 700;
}
.stx-wf-flow-graph .stx-wf-node-prompt {
  color: var(--color-text-secondary, #666);
  background: var(--color-bg-secondary, rgba(0, 0, 0, 0.025));
  padding: 8px 10px;
  border-radius: 9px;
}
.stx-wf-flow-graph .stx-wf-node-from {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--stx-node-accent, #6366f1) 10%, transparent);
  color: var(--stx-node-accent, #6366f1);
  font-weight: 600;
}

/* 运行状态压过深度色带，状态才是此刻最重要的信息 */
.stx-wf-flow-graph .stx-wf-node-running::before { background: #6366f1; }
.stx-wf-flow-graph .stx-wf-node-succeeded::before { background: #10b981; }
.stx-wf-flow-graph .stx-wf-node-failed::before { background: #ef4444; }
.stx-wf-flow-graph .stx-wf-node-running {
  box-shadow: 0 0 0 3px color-mix(in srgb, #6366f1 14%, transparent), 0 8px 24px rgba(16, 18, 27, 0.08);
}

/* 运行条与画板拉开关系 */
.stx-wf-runbar {
  border-radius: 16px;
  background: var(--color-bg-primary, #fff);
  border-color: var(--color-border-secondary, rgba(0, 0, 0, 0.08));
  box-shadow: 0 1px 2px rgba(16, 18, 27, 0.03);
}

/* ---------- 编辑画布同样加底色，和展示态保持一致语言 ---------- */

.stx-wf-canvas-scroll {
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--color-text-primary, #111) 9%, transparent) 1px, transparent 0)
    0 0 / 22px 22px,
    linear-gradient(180deg, color-mix(in srgb, var(--color-accent, #4f46e5) 3%, transparent), transparent 200px),
    var(--color-bg-secondary, rgba(0, 0, 0, 0.02));
}
.stx-wf-gnode {
  box-shadow: 0 1px 2px rgba(16, 18, 27, 0.05), 0 6px 18px rgba(16, 18, 27, 0.07);
}
.stx-wf-gnode-topic {
  background: var(--color-accent, #4f46e5);
  border-color: var(--color-accent, #4f46e5);
  color: #fff;
}
.stx-wf-gnode-topic .stx-wf-gnode-title {
  color: #fff;
}
.stx-wf-gnode-topic .stx-wf-gnode-sub {
  color: rgba(255, 255, 255, 0.8);
}

/* 工作台整页高度的兜底：
   .stx-view-host 在某些父级链下不一定拿得到确定高度，
   height:100% 会退化成内容高度，页面底部就多出一大片空白。
   用 dvh 兜住，并限制最大高度，避免"页面下面还有一页"。 */
.stx-page-wf {
  max-height: calc(100dvh - 4px);
}
@supports not (height: 100dvh) {
  .stx-page-wf {
    max-height: calc(100vh - 4px);
  }
}
.stx-view-host:has(.stx-page-wf) {
  max-height: 100%;
}
