:root {
  --bg: #f8f9fb;
  --sidebar-bg: #ffffff;
  --card-bg: #ffffff;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --success: #10b981;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* 左侧菜单 */
.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
}

.brand {
  padding: 28px 24px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.menu {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.menu-item:hover {
  background: #f3f4f6;
  color: var(--text);
}

.menu-item.active {
  background: #eef2ff;
  color: var(--primary);
  font-weight: 500;
}

.menu-icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-toggle {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.15s;
}

.sidebar-toggle:hover {
  background: #f3f4f6;
  color: var(--text);
}

/* 侧边栏收起状态 */
.sidebar {
  transition: width 0.2s ease;
}

.main {
  transition: margin-left 0.2s ease;
}

.sidebar.collapsed {
  width: 70px;
}

.sidebar.collapsed + .main {
  margin-left: 70px;
}

.sidebar.collapsed .menu-label,
.sidebar.collapsed .brand-sub,
.sidebar.collapsed .sidebar-version {
  display: none;
}

.sidebar.collapsed .menu-item {
  justify-content: center;
  padding: 14px;
}

.sidebar.collapsed .brand {
  padding: 20px 10px;
  text-align: center;
}

.sidebar.collapsed .brand-logo {
  font-size: 14px;
}

.sidebar.collapsed .sidebar-footer {
  justify-content: center;
  padding: 16px 10px;
}

/* 主内容区 */
.main {
  flex: 1;
  margin-left: 220px;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 70px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 600;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-save-hint {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.topbar-wf-group {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 16px;
}

.topbar-wf-name {
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  outline: none;
  min-width: 200px;
  transition: all 0.15s;
}

.topbar-wf-name:hover {
  border-color: var(--border);
  background: #fff;
}

.topbar-wf-name:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.topbar-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.topbar-btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.topbar-btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.content {
  flex: 1;
  padding: 0;
}

/* 页面切换 */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* 卡片 */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 600;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  background: var(--primary-hover);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: #f3f4f6;
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* 输入框 */
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.textarea {
  resize: vertical;
  font-family: inherit;
}

.cron-input {
  font-family: "SF Mono", Consolas, monospace;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.cron-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.cron-preset {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.cron-preset:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eef2ff;
}

.schedule-panel {
  margin-bottom: 16px;
}

.interval-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.interval-row .input[type="number"] {
  flex: 1;
}

.interval-row select.input {
  flex: 0 0 120px;
}

#task-cron-preview[readonly] {
  background: #f9fafb;
  color: var(--text-secondary);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* 工具栏 */
.toolbar {
  padding: 16px 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.toolbar .input {
  width: 260px;
}

/* 表格 */
.table-wrapper {
  padding: 0 24px 24px;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  color: var(--text);
  font-size: 13px;
}

.data-table tr:hover td {
  background: #f9fafb;
}

.data-table .empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 0;
}

/* 抽屉 */
.drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 520px;
  max-width: 90vw;
  background: var(--card-bg);
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);
  z-index: 200;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 199;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.drawer-mask.open {
  opacity: 1;
  visibility: visible;
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.drawer-body {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.drawer-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.output-log {
  flex: 1;
  padding: 20px 24px;
  min-height: 400px;
  max-height: 70vh;
  overflow-y: auto;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  background: #0f172a;
  color: #e2e8f0;
}

.output-placeholder {
  color: #64748b;
  text-align: center;
  padding: 40px 0;
}

.output-entry {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #1e293b;
}

.output-entry:last-child {
  border-bottom: none;
}

.output-title {
  color: #94a3b8;
  font-size: 12px;
  margin-bottom: 6px;
}

.output-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.output-image {
  max-width: 100%;
  border-radius: 8px;
  margin-top: 8px;
}

.output-error {
  color: #f87171;
}

/* 设备详情页：左侧截图 + 右侧指令面板 */
.hidden {
  display: none !important;
}

.device-detail-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
}

.device-screenshot {
  min-height: 320px;
  max-height: 50vh;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.device-screenshot img {
  max-width: 100%;
  max-height: 48vh;
  border-radius: 8px;
}

.device-screenshot-placeholder {
  color: #94a3b8;
  font-size: 13px;
}

.device-command-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
}

.device-command-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.device-command-form .input {
  flex: 1;
  min-width: 140px;
}

.device-command-form select.input {
  flex: 0 0 160px;
}

.device-output {
  flex: 1;
  min-height: 220px;
  max-height: 40vh;
  overflow-y: auto;
  background: #0f172a;
  color: #e2e8f0;
  padding: 16px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 13px;
  border-radius: 8px;
}

/* AI 助手模型配置表单 */
.model-form {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 560px;
}

.input-secret {
  position: relative;
}

.input-secret .input {
  padding-right: 42px;
}

.secret-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1;
}

.secret-toggle:hover {
  background: #f3f4f6;
  color: var(--text);
}

.model-tip {
  margin-top: 16px;
  padding: 0 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* 状态标签 */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

/* 浏览器标识标签（设备列表区分 Chrome/Edge） */
.badge-browser {
  background: #e0e7ff;
  color: #3730a3;
  margin-left: 4px;
}

/* 接入码等宽显示 */
.code-inline {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 4px;
  color: #374151;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

/* 设备 ID 标签 */
.id-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #eef2ff;
  color: var(--primary);
  font-family: "SF Mono", Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
}

/* 设备管理指令结果输出区 */
.card .output-log {
  border-radius: 0 0 var(--radius) var(--radius);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

/* 响应式 */
@media (max-width: 1024px) {
  .sidebar {
    width: 70px;
  }

  .menu-label,
  .brand-sub,
  .sidebar-footer {
    display: none;
  }

  .menu-item {
    justify-content: center;
    padding: 14px;
  }

  .main {
    margin-left: 70px;
  }

  .brand {
    padding: 20px 10px;
    text-align: center;
  }

  .brand-logo {
    font-size: 14px;
  }
}

/* 加载动画 */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  z-index: 300;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 70vw;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: var(--success);
}

.toast-error {
  background: var(--danger);
}

.toast-action {
  margin-left: 12px;
  padding: 3px 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ==================== 节点工作流画布 ==================== */
.workflow-stage {
  height: calc(100vh - 70px);
  min-height: 560px;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.workflow-canvas {
  position: absolute;
  inset: 0;
  background-color: #f7f8fa;
  background-image: radial-gradient(circle, #dfe3ea 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  overflow: hidden;
  cursor: default;
}

.workflow-canvas.panning {
  cursor: grabbing;
}

/* 手模式（工具栏切换或按住空格）：拖动平移画布 */
.workflow-canvas.hand-mode {
  cursor: grab;
}

/* 可缩放/平移的视口层 */
.canvas-viewport {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
}

.workflow-connections {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}

.workflow-nodes {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
}

/* ==================== 插入模式：幽灵节点跟随鼠标 ==================== */
/* 插入模式下画布显示十字光标（优先级高于手模式抓手） */
.workflow-canvas.insert-mode {
  cursor: crosshair;
}

/* 幽灵节点：半透明卡片，跟随鼠标移动，点击画布放置 */
.workflow-node.node-ghost {
  pointer-events: none; /* 不拦截点击，点击落在画布上 */
  cursor: crosshair;
  opacity: 0.45;
  background: var(--node-accent-soft);
  border: 1.5px dashed var(--node-accent);
  box-shadow: none;
  z-index: 99999; /* 浮在所有节点之上 */
  display: flex;
  align-items: center;
  justify-content: center;
}

.workflow-node.node-ghost::before {
  opacity: 0.6;
}

.node-ghost-inner {
  text-align: center;
  color: var(--node-accent);
  user-select: none;
  -webkit-user-select: none;
}

.node-ghost-icon {
  font-size: 20px;
}

.node-ghost-title {
  font-size: 13px;
  font-weight: 600;
  margin-top: 2px;
}

.node-ghost-hint {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 2px;
}

/* 插入节点按钮激活态 */
.toolbar-btn.active {
  background: #eef2ff;
  border-color: var(--primary);
  color: var(--primary);
}

.toolbar-btn.active:hover {
  background: #e0e7ff;
  color: var(--primary);
}

/* ==================== 组合卡片 ==================== */
.workflow-groups {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
}

/* 组合容器：包住子节点的框架 */
.wf-group {
  position: absolute;
  border: 2px solid #c7d2fe;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.04);
  box-sizing: border-box;
  z-index: 1;
  pointer-events: auto; /* 组合区域可点击选中（头部/端口各自可交互） */
  cursor: grab; /* 组合区域可拖动整组（头部/端口各自覆盖光标） */
  user-select: none;
  -webkit-user-select: none;
}

.wf-group:active {
  cursor: grabbing;
}

/* 组合选中高亮 */
.wf-group.box-selected {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
}

/* 拖拽悬停：外部节点拖到组合上方时，组合高亮 + 底部显示「添加区域」条 */
.wf-group.group-drop-target {
  border-color: var(--primary, #4f46e5);
  border-style: dashed;
  background: rgba(79, 70, 229, 0.1);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2), inset 0 0 0 1px rgba(79, 70, 229, 0.15);
}
.wf-group.group-drop-target::after {
  content: '＋ 添加到此组合';
  position: absolute;
  bottom: -26px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary, #4f46e5);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  pointer-events: none;
  z-index: 60;
}

/* 组合头部（可拖动整组、点击打开配置） */
.wf-group-header {
  position: absolute;
  top: -15px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #4338ca;
  cursor: grab;
  user-select: none;
  white-space: nowrap;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
}

.wf-group-header:active {
  cursor: grabbing;
}

.wf-group-icon {
  font-size: 12px;
}

.wf-group-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-group-badge {
  font-size: 11px;
  font-weight: 500;
  color: #6366f1;
  background: #fff;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid #e0e7ff;
  white-space: nowrap;
}

/* 组合输入/输出端口（容器左右边缘中点） */
.wf-group-port {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 40px;
  background: #6366f1;
  cursor: crosshair;
  z-index: 5;
  pointer-events: auto;
  transition: background 0.15s, width 0.15s;
}

.wf-group-port:hover {
  background: #4f46e5;
  width: 12px;
}

.wf-group-port-in {
  left: 0;
  border-radius: 0 4px 4px 0;
}

.wf-group-port-out {
  right: 0;
  border-radius: 4px 0 0 4px;
}

/* 组合配置抽屉：输入分配列表 */
.group-assign-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dashed #eef1f5;
}

.group-assign-row:last-child {
  border-bottom: none;
}

.group-assign-src {
  font-size: 12px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.group-assign-child {
  width: 160px;
}

/* 输入/输出结果：子节点行（添加/移除结果开关） */
.group-child-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
}
.group-child-row.active {
  border-color: var(--primary);
  background: #eef2ff;
}
.group-child-name {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-input-toggle,
.group-output-toggle {
  flex-shrink: 0;
}

/* ==================== 批注层 ==================== */
.workflow-annotations {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
}

/* 批注框：虚线框住需要标记的节点，可拖动移动、右下角缩放、输入文字、修改颜色 */
.annotation {
  position: absolute;
  border: 2px dashed var(--ann-color, #f59e0b);
  background: color-mix(in srgb, var(--ann-color, #f59e0b) 6%, transparent);
  border-radius: 10px;
  min-width: 120px;
  min-height: 80px;
  cursor: move;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  --ann-color: #f59e0b;
}

.annotation:hover {
  border-color: color-mix(in srgb, var(--ann-color, #f59e0b) 78%, #000);
  background: color-mix(in srgb, var(--ann-color, #f59e0b) 11%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ann-color, #f59e0b) 15%, transparent);
}

.annotation-label {
  position: absolute;
  top: 6px;
  left: 10px;
  right: 64px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--ann-color, #b45309);
  outline: none;
  padding: 2px 4px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.annotation-label:focus {
  background: rgba(255, 255, 255, 0.7);
}

/* 颜色按钮与色板 */
.annotation-color-btn {
  position: absolute;
  top: 4px;
  right: 26px;
  width: 20px;
  height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  font-size: 12px;
  line-height: 1;
  border-radius: 5px;
  cursor: pointer;
  padding: 0;
}

.annotation:hover .annotation-color-btn {
  display: inline-flex;
}

.annotation-color-btn:hover {
  background: rgba(255, 255, 255, 0.7);
}

.annotation-palette {
  position: absolute;
  bottom: calc(100% + 6px); /* 批注框上方展开 */
  right: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 108px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.14);
  z-index: 20;
}

.annotation-palette.hidden {
  display: none;
}

.annotation-color-swatch {
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 5px;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.annotation-color-swatch:hover {
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.3);
}

.annotation-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ann-color, #d97706);
  font-size: 12px;
  line-height: 1;
  border-radius: 5px;
  cursor: pointer;
  padding: 0;
}

.annotation:hover .annotation-delete {
  display: inline-flex;
}

.annotation-delete:hover {
  background: #fef2f2;
  color: var(--danger);
}

/* 右下角缩放手柄 */
.annotation-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 2;
}

.annotation-resize-handle::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--ann-color, #d97706);
  border-bottom: 2px solid var(--ann-color, #d97706);
  border-radius: 0 0 2px 0;
  opacity: 0.6;
}

.annotation:hover .annotation-resize-handle::after {
  opacity: 1;
}

/* 缩放控件（位于底部执行工具栏内） */
.canvas-zoom {
  display: flex;
  align-items: center;
  gap: 2px;
}

.zoom-btn,
.zoom-label {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 7px;
  cursor: pointer;
  line-height: 1;
}

.zoom-btn:hover,
.zoom-label:hover {
  background: #f3f4f6;
  color: var(--text);
}

.zoom-label {
  font-size: 12px;
  min-width: 46px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.canvas-hint {
  position: absolute;
  top: 46%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  user-select: none;
}

.canvas-hint-title {
  font-size: 15px;
  font-weight: 600;
  color: #9ca3af;
}

.canvas-hint-desc {
  margin-top: 6px;
  font-size: 12px;
  color: #b6bcc8;
}

.canvas-hint.hidden {
  display: none;
}

/* 底部浮动工具栏 */
.canvas-toolbar {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.12);
  z-index: 30;
}

.toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.toolbar-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.12);
}

.toolbar-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.toolbar-btn-icon {
  font-size: 15px;
}

.toolbar-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.toolbar-btn-ghost:hover {
  background: #f3f4f6;
  color: var(--text);
  box-shadow: none;
}

.toolbar-btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  padding: 8px 18px;
}

.toolbar-btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.toolbar-btn.running {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.toolbar-btn.running:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.toolbar-btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.toolbar-btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

/* 工具模式切换按钮（指针 / 手） */
.tool-mode-btn.active {
  background: #eef2ff;
  border-color: var(--primary);
  color: var(--primary);
}

.tool-mode-btn.active:hover {
  background: #e0e7ff;
  color: var(--primary);
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 2px;
}

/* 框选操作条：显示选中数量与删除/取消按钮 */
.selection-bar {
  position: absolute;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  z-index: 29;
  font-size: 12px;
}

.selection-bar.hidden {
  display: none;
}

.selection-count {
  color: var(--text-secondary);
  white-space: nowrap;
  padding: 0 4px;
}

.autosave-hint {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
  min-width: 0;
}

/* 左侧已保存工作流面板 */
.wf-panel {
  position: absolute;
  top: 14px;
  left: 14px;
  bottom: 86px;
  width: 240px;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14);
  z-index: 25;
  transform: translateX(calc(-100% - 24px));
  opacity: 0;
  visibility: hidden;
  transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
}

.wf-panel.open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
}

.wf-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.wf-panel-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
}

.wf-panel-close {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.wf-panel-close:hover {
  background: #f3f4f6;
  color: var(--text);
}

.wf-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wf-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
}

.wf-item:hover {
  border-color: var(--primary);
  background: #f8faff;
}

.wf-item.active {
  border-color: var(--primary);
  background: #eef2ff;
}

.wf-item-info {
  flex: 1;
  min-width: 0;
}

.wf-item-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wf-item-id {
  flex-shrink: 0;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
  background: #eef2ff;
  padding: 2px 6px;
  border-radius: 5px;
}

.wf-item-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

.wf-item-delete {
  border: none;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px;
  flex-shrink: 0;
}

.wf-item-delete:hover {
  background: #fef2f2;
  color: var(--danger);
}

.wf-item-copy {
  border: none;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px;
  flex-shrink: 0;
}

.wf-item-copy:hover {
  background: #eef2ff;
  color: var(--primary);
}

.wf-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 12px;
  padding: 30px 0;
}

/* ==================== 节点卡片 ==================== */
.workflow-node {
  position: absolute;
  width: 264px;
  height: 80px;
  background: #fff;
  border: 1px solid #e6eaf1;
  border-radius: 0 13px 13px 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 6px 18px rgba(15, 23, 42, 0.07);
  /* 卡片区域统一光标：抓手提示可拖动；按住时抓握（端口/按钮等交互元素各自覆盖） */
  cursor: grab;
  z-index: 2;
  transition: box-shadow 0.18s, border-color 0.18s;
  display: flex;
  flex-direction: column;
  /* 卡片内文字禁止文本选择：点击/框选作用于节点本身，避免拖动时误选文字 */
  user-select: none;
  -webkit-user-select: none;
  /* 节点类型主题色：左侧色条 / 图标底 / 头部底色 / 选中描边统一取色 */
  --node-accent: #6366f1;
  --node-accent-soft: #e0e7ff;
  --node-accent-tint: rgba(99, 102, 241, 0.09);
}

/* 左侧类型色条（Dify 风格）：一眼区分节点类型，左侧直角贴合卡片边缘 */
.workflow-node::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  border-radius: 0;
  background: var(--node-accent);
}

/* 各节点类型的主题色 */
.workflow-node[data-type="start"] { --node-accent: #10b981; --node-accent-soft: #d1fae5; --node-accent-tint: rgba(16, 185, 129, 0.09); }
.workflow-node[data-type="end"] { --node-accent: #ef4444; --node-accent-soft: #fee2e2; --node-accent-tint: rgba(239, 68, 68, 0.09); }
.workflow-node[data-type="ai"] { --node-accent: #6366f1; --node-accent-soft: #e0e7ff; --node-accent-tint: rgba(99, 102, 241, 0.09); }
.workflow-node[data-type="device"] { --node-accent: #0ea5e9; --node-accent-soft: #e0f2fe; --node-accent-tint: rgba(14, 165, 233, 0.09); }
.workflow-node[data-type="article"] { --node-accent: #8b5cf6; --node-accent-soft: #ede9fe; --node-accent-tint: rgba(139, 92, 246, 0.09); }
.workflow-node[data-type="workflow"] { --node-accent: #14b8a6; --node-accent-soft: #ccfbf1; --node-accent-tint: rgba(20, 184, 166, 0.09); }
.workflow-node[data-type="json"] { --node-accent: #f59e0b; --node-accent-soft: #fef3c7; --node-accent-tint: rgba(245, 158, 11, 0.09); }
.workflow-node[data-type="text"] { --node-accent: #64748b; --node-accent-soft: #f1f5f9; --node-accent-tint: rgba(100, 116, 139, 0.09); }
.workflow-node[data-type="html"] { --node-accent: #f97316; --node-accent-soft: #ffedd5; --node-accent-tint: rgba(249, 115, 22, 0.09); }
.workflow-node[data-type="deepseek.chat"] { --node-accent: #6366f1; --node-accent-soft: #e0e7ff; --node-accent-tint: rgba(99, 102, 241, 0.09); }
.workflow-node[data-type="stepfun.image"] { --node-accent: #d946ef; --node-accent-soft: #fae8ff; --node-accent-tint: rgba(217, 70, 239, 0.09); }

/* 拖拽节点时临时禁用文本选择，避免拖动过程中出现选区 */
.workflow-node.dragging {
  user-select: none;
}

body.no-user-select {
  user-select: none !important;
}

.workflow-node .node-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

/* 右下角拖拽缩放手柄（统一尺寸后禁用） */
.node-resize {
  display: none;
}

/* 磁吸对齐参考线 */
.snap-guide {
  position: absolute;
  z-index: 50;
  pointer-events: none;
  display: none;
}

.snap-guide-v {
  top: -10000px;
  bottom: -10000px;
  width: 1px;
  background: #f43f5e;
  opacity: 0.55;
}

.snap-guide-h {
  left: -10000px;
  right: -10000px;
  height: 1px;
  background: #f43f5e;
  opacity: 0.55;
}

/* 左右间隔吸附参考线 */
.snap-guide-gap {
  height: 0;
  border-top: 1px dashed #f43f5e;
  opacity: 0.7;
}

/* 世界原点标记：用于实测视口渲染偏移（不可见、不拦截事件） */
.view-origin-marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* 指针模式框选矩形（画布坐标，随画布缩放平移） */
.selection-box {
  position: absolute;
  border: 1px dashed #6366f1;
  background: rgba(99, 102, 241, 0.08);
  z-index: 40;
  pointer-events: none;
  display: none;
}

.workflow-node input,
.workflow-node textarea,
.workflow-node select {
  user-select: text;
}

.workflow-node:hover {
  border-color: #dbe1ea;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05), 0 10px 28px rgba(15, 23, 42, 0.11);
}

.workflow-node.selected {
  border-color: var(--node-accent);
  box-shadow: 0 0 0 3px var(--node-accent-soft), 0 10px 28px rgba(15, 23, 42, 0.11);
}

/* 框选中的节点 */
.workflow-node.box-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.18), 0 10px 28px rgba(15, 23, 42, 0.11);
}

/* 按住节点：抓握光标（拖动中） */
.workflow-node:active {
  cursor: grabbing;
}

.workflow-node.dragging {
  border-color: var(--node-accent);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.18);
  z-index: 100;
  transition: none;
  cursor: grabbing;
}

/* ==================== 节点运行态动效 ==================== */
/* 运行中的卡片：靛蓝呼吸光环，一眼锁定当前执行节点 */
.workflow-node.running {
  border-color: var(--primary);
  animation: node-running-glow 1.3s ease-in-out infinite;
}

/* 左侧类型色条流光（活动感） */
.workflow-node.running::before {
  background: linear-gradient(90deg,
    var(--node-accent) 0%,
    var(--node-accent-soft) 50%,
    var(--node-accent) 100%);
  background-size: 200% 100%;
  animation: node-bar-flow 1.1s linear infinite;
}

/* 底部运行进度条：色条来回扫动，标识执行中 */
.workflow-node.running::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--node-accent) 45%,
    var(--node-accent) 55%,
    transparent 100%);
  background-size: 40% 100%;
  background-repeat: no-repeat;
  animation: node-progress-sweep 1s ease-in-out infinite;
  z-index: 11;
}

@keyframes node-running-glow {
  0%, 100% {
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16), 0 2px 8px rgba(15, 23, 42, 0.08);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(79, 70, 229, 0.10), 0 0 26px rgba(79, 70, 229, 0.5);
  }
}

@keyframes node-bar-flow {
  from { background-position: 0% 0; }
  to { background-position: -200% 0; }
}

@keyframes node-progress-sweep {
  0% { background-position: -40% 0; }
  100% { background-position: 140% 0; }
}

.node-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 12px;
  background: var(--node-accent-tint, #f8fafc);
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  border-radius: 0 13px 0 0;
  cursor: grab;
}

.node-header:active {
  cursor: grabbing;
}

.node-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--node-accent-soft, #eef2ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.node-name-static {
  flex: 1;
  border: none;
  background: transparent;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  outline: none;
  min-width: 0;
  padding: 1px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: grab; /* 与卡片整体一致：拖动节点 */
}

/* 状态徽章（Dify 风格胶囊）：未接入灰 / 已接入·完成绿 / 执行中主题色 / 失败红 / 已废弃琥珀 */
.node-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
  color: #6b7280;
  background: #f3f4f6;
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.node-status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #9ca3af;
}

/* 空状态（开始执行前）隐藏徽章 */
.node-status:empty {
  display: none;
}

.node-status.linked {
  color: #047857;
  background: #ecfdf5;
}

.node-status.linked::before {
  background: #10b981;
}

.node-status.unlinked {
  color: #6b7280;
  background: #f3f4f6;
}

.node-status.unlinked::before {
  background: #9ca3af;
}

.node-status.running {
  color: #3730a3;
  background: #eef2ff;
}

.node-status.running::before {
  background: var(--node-accent);
  animation: pulse 1s infinite;
}

.node-status.done {
  color: #047857;
  background: #ecfdf5;
}

.node-status.done::before {
  background: #10b981;
}

.node-status.error {
  color: #b91c1c;
  background: #fef2f2;
}

.node-status.error::before {
  background: var(--danger);
}

.node-status.skipped {
  color: #92400e;
  background: #fffbeb;
}

.node-status.skipped::before {
  background: #d97706;
}

.node-body {
  flex: 1;
  padding: 2px 10px 6px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* 紧凑卡片：隐藏原内联配置区（限定在节点卡片内） */
.workflow-node .node-section-config,
.workflow-node .node-section-subflow,
.workflow-node .node-device-detail,
.workflow-node .node-device-detail-toggle,
.workflow-node .node-options,
.workflow-node .node-field-role,
.workflow-node .node-section-title,
.workflow-node .node-field {
  display: none !important;
}

.workflow-node .node-section {
  padding: 0;
  border-bottom: none;
}

/* 配置抽屉内小节标题 */
.node-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* 节点配置抽屉内字段间距 */
#node-config-body .node-field {
  margin-bottom: 16px;
}

#node-config-body .node-section-subflow {
  margin-bottom: 16px;
}

/* 卡片第二行：配置摘要 + 点击展开（点击整行展开配置抽屉） */
.node-summary {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 0;
  padding: 2px 4px;
  border-radius: 8px;
  cursor: grab; /* 与卡片整体一致：拖动节点 */
  transition: background 0.15s;
}

.node-summary:hover {
  background: rgba(15, 23, 42, 0.03);
}

.node-summary-text {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-expand-hint {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--node-accent, var(--primary));
  white-space: nowrap;
}

/* 头部类型标签（标签列） */
.node-type-label {
  flex-shrink: 0;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--node-accent-soft, #f3f4f6);
  color: var(--node-accent, #64748b);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.node-subflow-info {
  padding: 6px 8px;
  background: #f3f4f6;
  border-radius: 7px;
  font-size: 11px;
  color: var(--text);
  word-break: break-word;
}

.node-field label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  color: #6b7280;
  font-weight: 500;
}

.node-field input,
.node-field textarea,
.node-field select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  font-size: 12px;
  color: var(--text);
  outline: none;
  font-family: inherit;
  background: #fafbfc;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.node-field input:focus,
.node-field textarea:focus,
.node-field select:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

/* 各节点类型的图标/徽章配色由 .workflow-node[data-type] 主题色变量统一控制（见节点卡片基础样式） */

.node-end-desc {
  font-size: 12px;
  color: #94a3b8;
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: 7px;
  padding: 8px 9px;
  line-height: 1.5;
}

/* JSON 处理节点：上游字段分析提示 */
.node-json-hint {
  color: var(--text-secondary);
  line-height: 1.7;
}

.node-json-hint code {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 0 4px;
  color: #b45309;
  word-break: break-all;
}

.node-json-hint-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.node-json-hint-src {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.node-json-hint-detail {
  font-size: 11px;
  color: var(--text-secondary);
}

.node-json-hint-usage-title {
  font-weight: 600;
  margin-top: 8px;
  margin-bottom: 2px;
  color: var(--text);
}

.node-json-hint-empty {
  color: #9ca3af;
}

/* HTML 渲染节点：实时预览 */
.node-html-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  max-height: 260px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  word-break: break-word;
}

.node-html-preview-empty {
  color: #9ca3af;
  font-size: 12px;
}

/* HTML 渲染节点：预览内容来源提示（真实结果 / 示例内容） */
.node-html-preview-src {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #eef1f5;
}

/* HTML 渲染节点：Markdown 标志 → 样式模板映射行 */
.node-html-map-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 4px 0;
}

.node-html-map-row .node-html-map-mark {
  flex: 0 0 90px;
  width: 90px;
  margin-top: 4px;
}

.node-html-map-row .node-html-map-tag {
  flex: 1;
  min-width: 0;
  resize: vertical;
}

.node-html-map-arrow {
  color: #9ca3af;
  flex: none;
  font-size: 12px;
  margin-top: 7px;
}

.node-html-map-row .node-html-map-del {
  flex: none;
  padding: 2px 8px;
  margin-top: 2px;
}

/* 判断节点：条件规则行 */
.cond-rule-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}

.cond-rule-row .cond-left {
  flex: 1;
  min-width: 0;
}

.cond-rule-row .cond-op {
  flex: 0 0 86px;
  width: 86px;
}

.cond-rule-row .cond-right {
  flex: 1;
  min-width: 0;
}

.cond-rule-row .cond-del {
  flex: none;
  padding: 2px 8px;
}

/* 结果节点：已储存结果（只读列表） */
.result-item-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px dashed #eef1f5;
}

.result-item-label-static {
  flex: none;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.result-item-row .result-item-type {
  flex: none;
  font-size: 11px;
  color: #64748b;
  background: #f1f5f9;
  border-radius: 999px;
  padding: 1px 8px;
}

.result-item-row .result-item-preview {
  flex: 1 1 100%;
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #eef1f5;
  border-radius: 6px;
  padding: 4px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.node-html-preview h1,
.node-html-preview h2,
.node-html-preview h3,
.node-html-preview h4,
.node-html-preview h5,
.node-html-preview h6 {
  margin: 8px 0 6px;
  line-height: 1.3;
}

.node-html-preview h1 { font-size: 20px; }
.node-html-preview h2 { font-size: 17px; }
.node-html-preview h3 { font-size: 15px; }

.node-html-preview p { margin: 6px 0; }

.node-html-preview ul,
.node-html-preview ol {
  margin: 6px 0;
  padding-left: 22px;
}

.node-html-preview blockquote {
  margin: 6px 0;
  padding: 4px 10px;
  border-left: 3px solid #c7d2fe;
  background: #f8fafc;
  color: #64748b;
}

.node-html-preview code {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 12px;
  background: #f1f5f9;
  border-radius: 4px;
  padding: 1px 4px;
  color: #b45309;
}

.node-html-preview pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  overflow: auto;
}

.node-html-preview pre code {
  background: none;
  color: inherit;
  padding: 0;
}

.node-html-preview img {
  max-width: 100%;
  border-radius: 6px;
}

.node-html-preview a {
  color: var(--primary);
}

.node-html-preview hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

/* JSON 处理节点：下游结果分配列表（实时匹配） */
.node-json-assign-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px dashed #eef1f5;
}

.node-json-assign-row:last-child {
  border-bottom: none;
}

.node-json-assign-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  min-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-json-assign-select,
.node-json-assign-input {
  flex: 1;
  min-width: 140px;
  padding: 4px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text);
  outline: none;
  background: #fafbfc;
}

.node-json-assign-select:focus,
.node-json-assign-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.node-json-assign-preview {
  width: 100%;
  font-size: 11px;
  color: #047857;
  line-height: 1.5;
  word-break: break-all;
}

.node-json-assign-preview.warn {
  color: #b45309;
}

.node-json-assign-preview.muted {
  color: #9ca3af;
}

/* 配置抽屉：关联结果区（上游节点 + {{prevN}} 标签） */
.node-section-links {
  margin-bottom: 16px;
}

.node-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 关联结果标签：两行式，上行名称+{{prevN}}，下行结果内容预览（状态非成功时为空） */
.node-input-chip {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid var(--node-accent-soft, #c7d2fe);
  background: var(--node-accent-soft, #eef2ff);
  color: var(--node-accent, var(--primary));
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  width: 100%;
}

.node-input-chip:hover {
  background: #fff;
  border-color: var(--node-accent, var(--primary));
  color: var(--node-accent, var(--primary));
}

.node-input-chip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.node-input-chip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-input-chip-tag {
  flex-shrink: 0;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 11px;
  font-weight: 400;
  background: rgba(255, 255, 255, 0.65);
  padding: 1px 6px;
  border-radius: 5px;
}

/* 结果内容预览行 */
.node-input-chip-result {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-input-chip.ok .node-input-chip-result { color: #047857; }
.node-input-chip.fail .node-input-chip-result { color: var(--danger); }
.node-input-chip.empty .node-input-chip-result { color: #9ca3af; }
.node-input-chip.pending .node-input-chip-result { color: var(--primary); }

.node-field textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
}

.node-field-check label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}

.node-field-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* 结束节点：工作流整体运行时长 */
.node-run-duration {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: linear-gradient(135deg, #eef2ff, #f5f3ff);
  border: 1px solid #e0e7ff;
  font-size: 12px;
  color: #4338ca;
}
.node-run-duration b {
  font-weight: 700;
  color: #3730a3;
  font-size: 13px;
}

/* ==================== 等待节点：循环检查 ==================== */
.node-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
.node-checkbox-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
}
.wait-loop-config {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 12px;
  margin-top: 4px;
  background: #fafafa;
}
.wait-loop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.wait-loop-row label {
  width: 90px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
}
.wait-loop-row input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
.wait-loop-row input:focus {
  outline: none;
  border-color: var(--primary, #4f46e5);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}
.wait-loop-check-row {
  background: #fff;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.wait-loop-check-row:hover {
  border-color: #c7d2fe;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}
.wait-loop-check-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.wait-loop-check-index {
  font-size: 12px;
  font-weight: 600;
  color: #4f46e5;
  background: #eef2ff;
  border-radius: 6px;
  padding: 2px 8px;
}
.wait-loop-check-del {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  font-size: 13px;
  border-radius: 6px;
  line-height: 1;
}
.wait-loop-check-del:hover {
  background: #fee2e2;
  color: #ef4444;
}
.wait-loop-check-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 10px;
}
.wait-loop-check-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.wait-loop-check-field-wide {
  grid-column: 1 / -1;
}
.wait-loop-check-label {
  font-size: 11px;
  color: #6b7280;
}
.wait-loop-check-field select,
.wait-loop-check-field input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #1f2937;
}
.wait-loop-check-field select:focus,
.wait-loop-check-field input:focus {
  outline: none;
  border-color: var(--primary, #4f46e5);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.12);
}
.wait-loop-check-desc {
  margin-top: 8px;
  font-size: 11px;
  color: #9ca3af;
}
.wait-loop-add {
  margin-top: 6px;
  width: 100%;
}

/* 浏览器插件节点：默认只显示设备选择，点击「配置指令」后展开指令/结果区 */
.node-device-detail-toggle {
  width: 100%;
  padding: 7px 9px;
  border: 1px dashed #c7d2fe;
  border-radius: 7px;
  background: #eef2ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.node-device-detail-toggle:hover {
  background: #e0e7ff;
  border-color: var(--primary);
}

.node-device-detail {
  display: none;
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
  margin-top: 10px;
}

/* 配置抽屉：步骤结果区（执行结果展示 + 复制按钮） */
.node-section-result {
  margin-bottom: 16px;
}

/* 结果状态徽章（成功 / 失败 / 执行中 / 未执行） */
.node-result-status {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #6b7280;
  vertical-align: middle;
}

.node-result-status.success { background: #ecfdf5; color: #047857; }
.node-result-status.error { background: #fef2f2; color: #b91c1c; }
.node-result-status.running { background: #eef2ff; color: #3730a3; }

.node-drawer-result {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.node-drawer-result-content {
  background: #f8fafc;
  border: 1px solid #eef1f5;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  max-height: 260px;
  overflow-y: auto;
  transition: border-color 0.15s;
}

.node-drawer-result-content img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
}

.node-drawer-result-content.error {
  color: var(--danger);
}

.node-drawer-result-content.skipped {
  color: #b45309;
}

.node-copy-result {
  align-self: flex-end;
  display: none;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
}

.node-copy-result.show {
  display: inline-flex;
}

.node-copy-result:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8faff;
}

.node-copy-result:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 结束节点：多结果项（文本/图片混合）与排序控件 */
.end-item {
  border: 1px solid #eef1f5;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: #fff;
}

.end-item:last-child {
  margin-bottom: 0;
}

.end-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.end-item-type {
  font-size: 11px;
  color: var(--text-secondary);
}

.end-item-move {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s;
}

.end-item-move:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8faff;
}

.end-item img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
}

.end-item-text {
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

/* HTML 结果：按样式渲染 */
.end-item-html {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
  overflow-x: auto;
}

.end-item-html img,
.end-item-html video,
.end-item-html iframe {
  max-width: 100%;
  border-radius: 6px;
}

.end-item-html table {
  border-collapse: collapse;
  width: 100%;
}

.end-item-html th,
.end-item-html td {
  border: 1px solid #e5e7eb;
  padding: 4px 8px;
}

.end-item-html a {
  color: var(--primary);
}

/* 端口：竖条连接点，紧贴卡片内边，纵向对齐标题栏高度，无边框纯色填充 */
.node-port {
  position: absolute;
  top: 22px;
  width: 4px;
  height: 14px;
  border-radius: 0;
  background: #cbd5e1;
  border: none;
  padding: 0;
  cursor: crosshair;
  transform: translateY(-50%);
  z-index: 10;
  transition: background 0.15s;
}

/* 端口命中区域：伪元素向外扩 3px，便于鼠标移入操作（视觉样式不变） */
.node-port::before,
.wf-group-port::before {
  content: '';
  position: absolute;
  inset: -3px;
}

.node-port.port-in {
  left: 0; /* 紧贴卡片内边（左） */
}

.node-port.port-out {
  right: 0; /* 紧贴卡片内边（右） */
}

/* 判断节点：两个输出分支端口（真在上、假在下） */
.node-port.port-out-false {
  top: 62px;
}

.node-port.port-out-true {
  background: #10b981;
}

.node-port.port-out-false {
  background: #f43f5e;
}

.node-port.port-out-true:hover,
.node-port.port-out-false:hover,
.node-port.port-out-true.connecting,
.node-port.port-out-false.connecting {
  background: var(--node-accent, var(--primary));
}

.node-port:hover {
  background: var(--node-accent, var(--primary));
}

.node-port.connecting {
  background: var(--node-accent, var(--primary));
}

.node-port.connected {
  background: #10b981;
}

/* 连线：流动虚线动画，流动方向即结果传递方向 */
.connection-line {
  fill: none;
  stroke: #94a3b8;
  stroke-width: 1.6;
  stroke-dasharray: 6 4;
  animation: dashflow 0.8s linear infinite;
  pointer-events: stroke;
  cursor: pointer;
}

.connection-line:hover {
  stroke: var(--primary);
  stroke-width: 2.2;
}

/* 框选中的连线 */
.connection-line.selected {
  stroke: var(--primary);
  stroke-width: 2.4;
}

/* 未接入节点连出的线：灰度静止，表示拿不到结果 */
.connection-line.disabled {
  stroke: #d4d9e1;
  stroke-dasharray: 4 5;
  animation: none;
}

.connection-line.disabled:hover {
  stroke: #9ca3af;
  stroke-width: 1.8;
}

.connection-line.pending {
  stroke: var(--primary);
  stroke-width: 1.8;
  stroke-dasharray: 6 4;
  animation: dashflow 0.4s linear infinite;
}

/* 组合接线线：输入/输出节点的可视化接线（点击取消），与普通连线同款流动动画 */
.wiring-line {
  fill: none;
  stroke: #818cf8;
  stroke-width: 1.6;
  stroke-dasharray: 6 4;
  animation: dashflow 0.8s linear infinite;
  opacity: 0.8;
  pointer-events: stroke;
  cursor: pointer;
}

.wiring-line:hover {
  stroke: var(--primary);
  stroke-width: 2;
  opacity: 1;
}

@keyframes dashflow {
  to {
    stroke-dashoffset: -10;
  }
}

/* 响应式 */
@media (max-width: 1024px) {
  .workflow-stage {
    height: calc(100vh - 70px);
  }
}

/* ==================== 子工作流选择弹窗 ==================== */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal.open {
  opacity: 1;
  visibility: visible;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 299;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
}

.modal-mask.open {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: #fff;
  border-radius: 12px;
  width: 420px;
  max-width: 90vw;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.12);
  z-index: 301;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.modal-body {
  padding: 12px;
  overflow-y: auto;
}

.subflow-picker-item {
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
}

.subflow-picker-item:hover {
  background: #f3f4f6;
}

.subflow-picker-item .id-badge {
  font-size: 11px;
  padding: 3px 8px;
}

/* ==================== 统一滚动条样式 ==================== */
/* 全站使用细小、统一的自定义滚动条 */
* {
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* 连接点断开选择弹窗 */
.conn-popup-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.conn-popup-mask.hidden {
  display: none;
}
.conn-popup {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.25);
  padding: 16px;
  min-width: 300px;
  max-width: 420px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.conn-popup-title {
  font-weight: 600;
  font-size: 14px;
}
.conn-popup-sub {
  font-size: 12px;
  color: #6b7280;
}
.conn-popup-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 40vh;
}
.conn-popup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.conn-popup-label {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conn-popup-disconnect {
  border: none;
  background: #fef2f2;
  color: var(--danger);
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  flex-shrink: 0;
}
.conn-popup-disconnect:hover {
  background: #fee2e2;
}
.conn-popup-empty {
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
  padding: 12px 0;
}
.conn-popup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==================== 节点配置抽屉：统一简洁样式 ==================== */
#node-config-drawer {
  width: 560px;
}

#node-config-drawer .drawer-header {
  padding: 14px 20px;
  background: linear-gradient(180deg, #fbfcfe, #fff);
  border-bottom: 1px solid #eef1f5;
}

#node-config-drawer .drawer-header h3 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

#node-config-drawer .drawer-header h3 .drawer-title-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#node-config-drawer .drawer-header h3 .drawer-title-type {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--primary);
  background: #eef2ff;
  border: 1px solid #e0e7ff;
  padding: 1px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

#node-config-drawer .drawer-header .btn-ghost {
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 14px;
}

#node-config-drawer .drawer-header .btn-ghost:hover {
  background: #f3f4f6;
}

#node-config-body {
  padding: 20px;
}

/* 字段统一 */
#node-config-body .node-field {
  margin-bottom: 14px;
}

#node-config-body .node-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  letter-spacing: 0.1px;
}

#node-config-body .node-field input,
#node-config-body .node-field textarea,
#node-config-body .node-field select {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

#node-config-body .node-field input:hover,
#node-config-body .node-field textarea:hover,
#node-config-body .node-field select:hover {
  border-color: #cbd5e1;
}

#node-config-body .node-field input:focus,
#node-config-body .node-field textarea:focus,
#node-config-body .node-field select:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

#node-config-body .node-field textarea {
  line-height: 1.55;
  resize: vertical;
}

/* 小节标题：左侧主题色竖条 */
#node-config-body .node-section-title {
  position: relative;
  padding-left: 10px;
  margin: 18px 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

#node-config-body .node-section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: var(--primary);
  opacity: 0.85;
}

#node-config-body .node-section:first-child > .node-section-title:first-child,
#node-config-body > .node-section-title:first-child {
  margin-top: 0;
}

/* 辅助说明 */
#node-config-body .node-end-desc {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #eef1f5;
  border-radius: 8px;
  padding: 8px 11px;
}

/* 复选框行：整行卡片 + hover */
#node-config-body .node-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

#node-config-body .node-checkbox-label:hover {
  border-color: var(--primary);
  background: #f8faff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.05);
}

#node-config-body .node-checkbox-label input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

/* 条件行：卡片化 + 输入统一 */
#node-config-body .cond-rule-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
  padding: 8px;
  background: #fafbfc;
  border: 1px solid #eef1f5;
  border-radius: 8px;
}

#node-config-body .cond-rule-row input,
#node-config-body .cond-rule-row select {
  padding: 7px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
  background: #fff;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#node-config-body .cond-rule-row input:focus,
#node-config-body .cond-rule-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

#node-config-body .cond-rule-row .cond-del {
  flex: none;
  padding: 2px 8px;
}

/* 添加按钮：虚线全宽 */
#node-config-body .node-html-map-add,
#node-config-body .cond-add,
#node-config-body .wait-loop-add {
  width: 100%;
  border: 1px dashed #c7d2fe;
  background: #f8faff;
  color: var(--primary);
  border-radius: 8px;
}

#node-config-body .node-html-map-add:hover,
#node-config-body .cond-add:hover,
#node-config-body .wait-loop-add:hover {
  background: #eef2ff;
  border-style: solid;
  color: var(--primary);
}

/* HTML 映射行微调 */
#node-config-body .node-html-map-row {
  margin: 6px 0;
}

#node-config-body .node-html-map-row .node-html-map-mark {
  margin-top: 0;
}

#node-config-body .node-html-map-row input,
#node-config-body .node-html-map-row textarea {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#node-config-body .node-html-map-row input:focus,
#node-config-body .node-html-map-row textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

/* 等待节点子卡片统一 */
#node-config-body .wait-loop-config {
  border: 1px solid #eef1f5;
  border-radius: 10px;
  padding: 12px;
  margin-top: 6px;
  background: #fafbfc;
}

#node-config-body .wait-loop-row input {
  border-radius: 8px;
}

/* JSON 分配行微调 */
#node-config-body .node-json-assign-row {
  padding: 8px 0;
}

#node-config-body .node-json-assign-select,
#node-config-body .node-json-assign-input {
  border-radius: 8px;
  background: #fff;
  padding: 6px 8px;
}

/* HTML 实时预览 */
#node-config-body .node-html-preview {
  border-radius: 10px;
  border-color: #eef1f5;
  background: #fbfcfe;
}

/* 步骤结果区 */
#node-config-body .node-drawer-result-content {
  background: #fbfcfe;
  border: 1px solid #eef1f5;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
}

/* 子工作流引用信息 */
#node-config-body .node-subflow-info {
  background: #f8fafc;
  border: 1px solid #eef1f5;
  border-radius: 8px;
}

#node-config-body .node-subflow-picker {
  border-radius: 8px;
}

/* ==================== 删除回收站 ==================== */
.wf-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wf-panel-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.wf-panel-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f8faff;
}

.trash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #eef1f5;
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
}

.trash-item-info {
  min-width: 0;
}

.trash-item-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trash-item-time {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 2px;
}

.trash-item-restore {
  flex-shrink: 0;
}

.modal-footer {
  padding: 10px 20px 14px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.trash-tip {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.5;
}

.trash-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
