/* ===== AGENT FLOW PAGE ===== */

/* Project Selector Bar */
.flow-project-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 8px 0;
  overflow-x: auto;
}

.flow-back-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: all 0.2s;
  flex-shrink: 0;
}

.flow-back-btn:hover {
  border-color: var(--primary);
  color: var(--text);
}

.flow-project-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.flow-project-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.2s;
}

.flow-project-tab:hover {
  border-color: var(--tab-color, var(--primary));
  color: var(--text);
}

.flow-project-tab.active {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--tab-color, var(--primary));
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 0 8px color-mix(in srgb, var(--tab-color, var(--primary)) 30%, transparent);
}

.flow-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.flow-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}
.flow-kpi-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.flow-kpi-lbl {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === CANVAS === */
.flow-canvas-wrapper {
  position: relative;
  min-height: 480px;
  background: linear-gradient(135deg, #0a0e27 0%, #0f1a3a 50%, #16213e 100%);
  border: 1px solid rgba(0, 212, 255, 0.15);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.flow-canvas-wrapper::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(0,212,255,0.06) 1px, transparent 0);
  background-size: 40px 40px;
  pointer-events: none;
}
.flow-canvas {
  position: relative;
  width: 2000px;
  height: 1200px;
  min-height: 560px;
  z-index: 2;
  transition: transform 0.05s linear;
}
.flow-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 2000px;
  height: 1200px;
  pointer-events: none;
  z-index: 1;
  transition: transform 0.05s linear;
  overflow: visible;
}

/* === NODES === */
.flow-node {
  position: absolute;
  background: rgba(16, 33, 62, 0.92);
  border: 2px solid rgba(0, 212, 255, 0.3);
  border-radius: 10px;
  padding: 14px 16px;
  min-width: 150px;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 3;
  backdrop-filter: blur(8px);
}
.flow-node:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 212, 255, 0.6);
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.2);
}
.flow-node.running {
  border-color: #00ff41;
  box-shadow: 0 0 25px rgba(0, 255, 65, 0.35);
}
.flow-node.running .flow-node-icon {
  animation: pulse-icon 2s ease-in-out infinite;
}
.flow-node.success {
  border-color: rgba(0, 255, 65, 0.4);
}
.flow-node.error {
  border-color: #ff4444;
  box-shadow: 0 0 15px rgba(255, 68, 68, 0.3);
}
.flow-node.idle {
  border-color: rgba(255, 255, 255, 0.1);
  opacity: 0.7;
}
.flow-node.idle:hover {
  opacity: 1;
}

.flow-node-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.flow-node-icon {
  font-size: 24px;
  line-height: 1;
}
.flow-node-name {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text);
}
.flow-node-role {
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}
.flow-node-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}
.flow-node-status.s-running {
  background: rgba(0, 255, 65, 0.15);
  color: #00ff41;
}
.flow-node-status.s-success {
  background: rgba(0, 255, 65, 0.1);
  color: rgba(0, 255, 65, 0.7);
}
.flow-node-status.s-error {
  background: rgba(255, 68, 68, 0.15);
  color: #ff4444;
}
.flow-node-status.s-idle {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
}
.flow-node-status.s-waiting {
  background: rgba(255, 170, 0, 0.15);
  color: #ffaa00;
}

/* Progress bar */
.flow-node-progress {
  width: 100%;
  height: 3px;
  background: rgba(0, 212, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin: 6px 0 4px;
}
.flow-node-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #00d4ff, #00ff41);
  border-radius: 2px;
  transition: width 0.5s ease;
  box-shadow: 0 0 6px rgba(0, 255, 65, 0.5);
}
.flow-node.running .flow-node-progress-bar {
  animation: progress-glow 1.5s ease-in-out infinite;
}

.flow-node-meta {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-dim);
}
.flow-node-eta {
  color: var(--primary);
  font-weight: 600;
}

/* === ANIMATIONS === */
@keyframes pulse-icon {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 25px rgba(0, 255, 65, 0.35); }
  50% { box-shadow: 0 0 40px rgba(0, 255, 65, 0.55); }
}
@keyframes progress-glow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* === COMMS FEED === */
.flow-comms {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.flow-comms-header {
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
}
.flow-comms-log {
  max-height: 200px;
  overflow-y: auto;
  padding: 8px 14px;
}
.flow-comm-entry {
  font-family: 'Courier New', monospace;
  font-size: 11px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  display: flex;
  gap: 8px;
  line-height: 1.4;
}
.flow-comm-time {
  color: var(--text-dim);
  flex-shrink: 0;
  min-width: 40px;
}
.flow-comm-from {
  color: var(--primary);
  font-weight: 600;
  flex-shrink: 0;
}
.flow-comm-arrow {
  color: var(--text-dim);
  flex-shrink: 0;
}
.flow-comm-to {
  color: #ffaa00;
  font-weight: 600;
  flex-shrink: 0;
}
.flow-comm-msg {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-comm-entry:last-child {
  border-bottom: none;
}
.flow-comms-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 20px;
  font-size: 12px;
}

/* === DETAIL MODAL === */
.flow-detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.flow-detail-modal.open {
  display: flex;
}
.flow-detail-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}
.flow-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.flow-detail-icon {
  font-size: 36px;
}
.flow-detail-name {
  font-size: 20px;
  font-weight: 700;
}
.flow-detail-role {
  font-size: 12px;
  color: var(--text-dim);
}
.flow-detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
}
.flow-detail-close:hover {
  color: var(--text);
}
.flow-detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.flow-detail-stat {
  background: rgba(0, 212, 255, 0.05);
  border: 1px solid rgba(0, 212, 255, 0.1);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.flow-detail-stat-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}
.flow-detail-stat-lbl {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.flow-detail-executions {
  margin-top: 16px;
}
.flow-detail-exec-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}
.flow-detail-exec-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 12px;
}
.flow-detail-exec-status {
  font-weight: 600;
}
.flow-detail-exec-status.s-success { color: #00ff41; }
.flow-detail-exec-status.s-error { color: #ff4444; }
.flow-detail-exec-status.s-running { color: #00d4ff; }

/* === WAVE 17 — RICH AGENT DETAIL (5 TABS) === */
.fd-rich { max-width: 700px !important; padding: 20px !important; }

/* Loading */
.fd-loading { text-align: center; color: var(--text-dim); padding: 40px 20px; font-size: 13px; }

/* Header live badge */
.fd-live-badge {
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.05em;
}
.fd-live-badge.fd-s-running { background: rgba(0,212,255,0.15); color: #00d4ff; border: 1px solid rgba(0,212,255,0.3); }
.fd-live-badge.fd-s-success { background: rgba(0,255,65,0.1); color: #00ff41; border: 1px solid rgba(0,255,65,0.2); }
.fd-live-badge.fd-s-error   { background: rgba(255,68,68,0.1); color: #ff4444; border: 1px solid rgba(255,68,68,0.2); }
.fd-live-badge.fd-s-idle    { background: rgba(255,255,255,0.05); color: var(--text-dim); border: 1px solid var(--border); }
.fd-live-badge.fd-s-waiting { background: rgba(255,170,0,0.1); color: #ffaa00; border: 1px solid rgba(255,170,0,0.2); }

/* Mini stats bar */
.fd-mini-stats {
  display: flex; gap: 8px; margin: 12px 0;
  background: rgba(0,212,255,0.03); border: 1px solid rgba(0,212,255,0.08);
  border-radius: 8px; padding: 10px 16px;
}
.fd-mini-stat { flex: 1; text-align: center; }
.fd-mini-stat span { display: block; font-size: 16px; font-weight: 700; color: var(--text); }
.fd-mini-stat small { font-size: 9px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }

/* Tab navigation */
.fd-tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin-bottom: 16px; overflow-x: auto; padding-bottom: 0;
}
.fd-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-dim); padding: 8px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
  margin-bottom: -1px;
}
.fd-tab:hover { color: var(--text); }
.fd-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Tab panels */
.fd-panels { min-height: 280px; }
.fd-panel { display: none; }
.fd-panel.active { display: block; }

/* Common section elements */
.fd-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.fd-empty { text-align: center; color: var(--text-dim); padding: 32px 16px; font-size: 12px; line-height: 1.6; }
.fd-badge { padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.fd-badge.fd-s-active  { background: rgba(0,255,65,0.15); color: #00ff41; }
.fd-badge.fd-s-planned { background: rgba(255,255,255,0.08); color: var(--text-dim); }

/* Profile tab */
.fd-profile-grid { display: flex; flex-direction: column; gap: 0; }
.fd-profile-row {
  display: flex; gap: 12px; padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 12px;
}
.fd-lbl { color: var(--text-dim); min-width: 110px; flex-shrink: 0; }
.fd-profile-desc { margin-top: 12px; padding: 10px; background: rgba(0,212,255,0.04); border-radius: 6px; font-size: 12px; color: var(--text-dim); line-height: 1.5; }

/* Status tab */
.fd-status-tab {}
.fd-status-hero { display: flex; align-items: center; gap: 12px; padding: 16px 0; }
.fd-status-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.fd-status-label { font-size: 22px; font-weight: 700; }
.fd-progress-block { margin: 12px 0; }
.fd-pb-label { font-size: 12px; margin-bottom: 6px; }
.fd-bar-track { height: 6px; background: rgba(255,255,255,0.08); border-radius: 3px; overflow: hidden; margin: 4px 0; }
.fd-bar-track.fd-bar-lg { height: 10px; border-radius: 5px; }
.fd-bar-fill { height: 100%; border-radius: inherit; transition: width 0.4s; }
.fd-stat-row { font-size: 12px; }
.fd-exec-list { margin-top: 8px; }
.fd-exec-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 11px; }
.fd-exec-time { color: var(--text-dim); min-width: 80px; }
.fd-exec-dur  { color: var(--text-dim); min-width: 40px; }
.fd-exec-model { color: var(--text-dim); font-size: 10px; flex: 1; overflow: hidden; text-overflow: ellipsis; }
.fd-exec-status { font-weight: 700; font-size: 10px; padding: 1px 6px; border-radius: 4px; }
.fd-exec-status.s-success { background: rgba(0,255,65,0.1); color: #00ff41; }
.fd-exec-status.s-error   { background: rgba(255,68,68,0.1); color: #ff4444; }
.fd-exec-status.s-running { background: rgba(0,212,255,0.1); color: #00d4ff; }
.fd-exec-status.s-idle    { background: rgba(255,255,255,0.05); color: var(--text-dim); }

/* Metrics tab */
.fd-metrics-tab {}
.fd-period-btns { display: flex; gap: 6px; margin-bottom: 16px; }
.fd-period-btn { background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text-dim); padding: 4px 12px; border-radius: 4px; font-size: 11px; font-weight: 600; cursor: pointer; }
.fd-period-btn.active { background: rgba(0,212,255,0.1); border-color: var(--primary); color: var(--primary); }
.fd-metrics-grid { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.fd-metric-row {}
.fd-metric-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.fd-metric-name { font-size: 11px; color: var(--text-dim); }
.fd-metric-val  { font-size: 13px; font-weight: 700; }
.fd-ms-grid { display: flex; gap: 8px; margin-top: 12px; }
.fd-ms-item { flex: 1; text-align: center; background: rgba(255,255,255,0.03); border-radius: 6px; padding: 8px 4px; }
.fd-ms-v { display: block; font-size: 18px; font-weight: 700; }
.fd-ms-item small { font-size: 10px; color: var(--text-dim); }

/* Conversations tab */
.fd-conv-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.fd-live-dot { font-size: 11px; color: #00ff41; }
.fd-conv-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.fd-conv-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.03); font-size: 11px; }
.fd-conv-time { color: var(--text-dim); min-width: 72px; font-size: 10px; }
.fd-conv-type { flex: 1; color: var(--text); }
.fd-conv-proj { color: var(--primary); font-size: 10px; font-weight: 600; }

/* Workflows tab */
.fd-wf-svg { display: block; width: 100%; margin-bottom: 12px; background: rgba(0,212,255,0.02); border-radius: 6px; border: 1px solid rgba(0,212,255,0.08); }
.fd-wf-summary { display: flex; flex-direction: column; gap: 4px; }
.fd-wf-row { display: flex; gap: 12px; font-size: 12px; padding: 4px 0; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .flow-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .flow-canvas-wrapper {
    min-height: 600px;
  }
  .flow-node {
    min-width: 120px;
    padding: 10px 12px;
  }
  .flow-node-name {
    font-size: 11px;
  }
  .flow-detail-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* === WAVE 16.3 — INLINE AGENT EDITOR === */
.fd-edit-btn {
  background: rgba(0,212,255,0.1);
  border: 1px solid rgba(0,212,255,0.3);
  color: var(--primary);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.fd-edit-btn:hover { background: rgba(0,212,255,0.2); }
.fd-edit-form { padding: 4px 0; }
.fd-edit-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.fd-edit-lbl {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.fd-edit-textarea, .fd-edit-input, .fd-edit-select {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.fd-edit-textarea:focus, .fd-edit-input:focus, .fd-edit-select:focus {
  outline: none;
  border-color: var(--primary);
}
.fd-edit-textarea { resize: vertical; }
.fd-edit-select { cursor: pointer; }
.fd-edit-actions { display: flex; gap: 8px; margin-top: 4px; }
.fd-btn-save {
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.fd-btn-save:hover { opacity: 0.85; }
.fd-btn-save:disabled { opacity: 0.5; cursor: not-allowed; }
.fd-btn-cancel {
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
.fd-btn-cancel:hover { background: rgba(255,255,255,0.1); color: var(--text); }

/* === WAVE 16.2 — NL COMMAND PANEL === */
.flow-cmd-fab {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: rgba(0,212,255,0.12);
  border: 1px solid rgba(0,212,255,0.35);
  color: var(--primary);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  transition: all 0.2s;
  box-shadow: 0 2px 12px rgba(0,212,255,0.15);
}
.flow-cmd-fab:hover {
  background: rgba(0,212,255,0.22);
  box-shadow: 0 4px 20px rgba(0,212,255,0.3);
  transform: scale(1.05);
}
.flow-cmd-panel {
  position: absolute;
  bottom: 76px;
  right: 24px;
  width: 360px;
  background: var(--surface);
  border: 1px solid rgba(0,212,255,0.25);
  border-radius: 12px;
  z-index: 31;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
}
.flow-cmd-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}
.flow-cmd-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}
.flow-cmd-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
}
.flow-cmd-close:hover { color: var(--text); }
.flow-cmd-body {
  display: flex;
  gap: 8px;
  padding: 12px;
}
.flow-cmd-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.flow-cmd-input:focus { outline: none; border-color: var(--primary); }
.flow-cmd-btn {
  background: var(--primary);
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.flow-cmd-btn:hover { opacity: 0.85; }
.flow-cmd-result {
  min-height: 20px;
  padding: 0 12px 4px;
  font-size: 12px;
}
.cmd-ok { color: #00ff41; }
.cmd-err { color: #ff4444; }
.cmd-warn { color: #ffaa00; }
.cmd-pending { color: var(--primary); }
.flow-cmd-hint {
  padding: 8px 12px 12px;
  font-size: 11px;
  color: var(--text-dim);
  border-top: 1px solid rgba(255,255,255,0.05);
}
.flow-cmd-hint code {
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
}

/* ================================================================
   P2.11-P2.14 — VISUAL FLOW EDITOR
   ================================================================ */

/* --- Editor Toolbar --- */
.flow-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.fe-toolbar-left,
.fe-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fe-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fe-btn:hover {
  border-color: var(--primary);
  color: var(--text);
  background: rgba(0, 212, 255, 0.08);
}

.fe-btn.fe-btn-active {
  background: rgba(0, 212, 255, 0.12);
  border-color: var(--primary);
  color: var(--primary);
}

.fe-btn.fe-btn-save {
  background: rgba(0, 255, 65, 0.1);
  border-color: rgba(0, 255, 65, 0.3);
  color: #00ff41;
}

.fe-btn.fe-btn-save:hover {
  background: rgba(0, 255, 65, 0.2);
}

.fe-btn.fe-btn-warn {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}

.fe-btn.fe-btn-warn:hover {
  background: rgba(245, 158, 11, 0.2);
}

.fe-btn.fe-btn-danger {
  background: rgba(255, 68, 68, 0.1);
  border-color: rgba(255, 68, 68, 0.3);
  color: #ff4444;
}

.fe-btn.fe-btn-danger:hover {
  background: rgba(255, 68, 68, 0.2);
}

.fe-separator {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.fe-zoom-label {
  font-size: 11px;
  color: var(--text-dim);
  min-width: 36px;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.fe-saved-label {
  font-size: 11px;
  color: rgba(0, 255, 65, 0.6);
  font-weight: 600;
}

/* --- Canvas transform support --- */
.flow-canvas-wrapper {
  cursor: grab;
}

.flow-canvas-wrapper:active {
  cursor: grabbing;
}

.flow-canvas-wrapper.fe-no-grid::before {
  display: none;
}

.flow-canvas-wrapper.fe-editing {
  border-color: rgba(0, 212, 255, 0.35);
  box-shadow: inset 0 0 40px rgba(0, 212, 255, 0.04);
}

.flow-canvas-wrapper.fe-editing::after {
  content: 'EDIT MODE';
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(0, 212, 255, 0.4);
  z-index: 50;
  pointer-events: none;
}

/* Allow SVG to receive pointer events in edit mode */
.fe-editing .flow-svg {
  pointer-events: all;
}

/* --- Node ports (connection anchors) --- */
.fe-node-port {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(0, 212, 255, 0.5);
  background: rgba(10, 14, 39, 0.9);
  cursor: crosshair;
  transition: all 0.2s;
  z-index: 10;
}

.fe-node-port:hover {
  border-color: var(--primary);
  background: rgba(0, 212, 255, 0.3);
  transform: scale(1.3);
  box-shadow: 0 0 8px rgba(0, 212, 255, 0.5);
}

.fe-port-out {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
}

.fe-port-out:hover {
  transform: translateY(-50%) scale(1.3);
}

.fe-port-in {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  border-color: rgba(124, 58, 237, 0.5);
}

.fe-port-in:hover {
  border-color: var(--accent);
  background: rgba(124, 58, 237, 0.3);
  transform: translateY(-50%) scale(1.3);
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.5);
}

/* --- Draggable nodes in edit mode --- */
.fe-editing .flow-node {
  cursor: move;
  user-select: none;
}

.fe-editing .flow-node:hover {
  transform: none;
  border-color: rgba(0, 212, 255, 0.7);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.25);
}

.fe-editing .flow-node:active {
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.35);
  z-index: 100;
}

/* --- Connection hit area --- */
.fe-editing .flow-svg path[data-from] {
  cursor: pointer;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .flow-editor-toolbar {
    flex-direction: column;
    gap: 8px;
  }
  .fe-toolbar-left,
  .fe-toolbar-right {
    flex-wrap: wrap;
    justify-content: center;
  }
}
