/* === CSS CUSTOM PROPERTIES === */
.modeler {
  all: revert;
  color: var(--modeler-color-text-primary);

  /* --- Text Colors --- */
  --modeler-color-text-primary: #374151;     /* gray-700: headings, labels, body text */
  --modeler-color-text-secondary: #4b5563;   /* gray-600: descriptions, muted text, placeholders */
  --modeler-color-text-tertiary: #6b7280;    /* gray-500: non-text icons, large-text captions */
  --modeler-color-text-emphasis: #111827;    /* gray-900: strong emphasis, result labels */
  --modeler-color-text-on-dark: #f9fafb;    /* gray-50: text on dark backgrounds */

  /* --- Background Colors --- */
  --modeler-color-bg-primary: #ffffff;       /* white: panels, cards, inputs */
  --modeler-color-bg-surface: #f9fafb;      /* gray-50: panel headers, subtle surfaces */
  --modeler-color-bg-muted: #f3f4f6;        /* gray-100: hover states, disabled fields */
  --modeler-color-bg-canvas: #f5f5f5;       /* light gray: main modeler background */
  --modeler-color-bg-overlay: rgba(0, 0, 0, 0.5); /* modal overlays */
  --modeler-color-bg-code: #1f2937;         /* gray-800: code blocks */

  /* --- Border Colors --- */
  --modeler-color-border-light: #e5e7eb;    /* gray-200: standard borders, dividers */
  --modeler-color-border-default: #d1d5db;  /* gray-300: form controls, panels */
  --modeler-color-border-hover: #6b7280;    /* gray-500: hover state borders */
  --modeler-color-border-input: #d1d5db;    /* gray-300: input field borders */

  /* --- Primary Blue --- */
  --modeler-color-primary: #2563eb;         /* blue-600: primary buttons, actions */
  --modeler-color-primary-hover: #1d4ed8;   /* blue-700: primary hover states */
  --modeler-color-primary-light: #dbeafe;   /* blue-100: active tab bg, highlight bg */
  --modeler-color-primary-text: #1e40af;    /* blue-800: text on primary-light bg */

  /* --- Interactive/Selection Blue --- */
  --modeler-color-interactive: #3b82f6;     /* blue-500: focus rings, selection, links */
  --modeler-color-interactive-ring: rgba(59, 130, 246, 0.1);  /* focus ring glow */
  --modeler-color-selection: #4099ff;       /* custom: node selection, handles */
  --modeler-color-selection-ring: rgba(64, 153, 255, 0.3);    /* selection glow */

  /* --- Danger / Error Red --- */
  --modeler-color-danger: #dc2626;          /* red-600: error text, danger buttons, locked */
  --modeler-color-danger-hover: #b91c1c;    /* red-700: danger hover states */
  --modeler-color-danger-light: #fee2e2;    /* red-100: error backgrounds */
  --modeler-color-danger-lighter: #fef2f2;  /* red-50: locked state bg */
  --modeler-color-danger-soft: #ef4444;     /* red-500: softer errors, replay ignore */
  --modeler-color-danger-text: #991b1b;     /* red-800: error message text */
  --modeler-color-danger-delete: #f44336;   /* material red: delete button hover */

  /* --- Warning / Amber --- */
  --modeler-color-warning: #f59e0b;         /* amber-500: annotations, search highlights */
  --modeler-color-warning-dark: #d97706;    /* amber-600: annotation icon */
  --modeler-color-warning-darker: #b45309;  /* amber-700: annotation icon hover */
  --modeler-color-warning-darkest: #92400e; /* amber-800: annotation text */
  --modeler-color-warning-light: #fef3c7;   /* amber-100: annotation backgrounds */
  --modeler-color-warning-border: #fcd34d;  /* amber-300: favorite borders */
  --modeler-color-warning-subtle: #fbbf24;  /* amber-400: subtle replace target highlight */

  /* --- Success / Green --- */
  --modeler-color-success: #10b981;         /* emerald-500: replay add-successor, status */
  --modeler-color-success-dark: #065f46;    /* emerald-800: status message text */
  --modeler-color-success-light: #d1fae5;   /* emerald-100: status message bg */
  --modeler-color-success-drop: #22c55e;    /* green-500: edge drop target */
  --modeler-color-success-drop-hover: #16a34a; /* green-600: hovered drop target */
  --modeler-color-success-subtle: #86efac;  /* green-300: subtle drop target highlight */
  --modeler-color-success-text: #047857;    /* emerald-700: data string color */

  /* --- Component Type Colors (Material palette) --- */
  --modeler-color-type-event: #ff9800;      /* orange: event/start nodes */
  --modeler-color-type-event-dark: #e65100; /* dark orange: event button */
  --modeler-color-type-event-darker: #bf360c; /* darker orange: event button hover */
  --modeler-color-type-event-btn: #bf360c;  /* 5.60:1 on white – WCAG AA ✓ */
  --modeler-color-type-event-btn-hover: #9a3412; /* 7.31:1 on white – WCAG AA ✓ */
  --modeler-color-type-action: #4caf50;     /* green: action nodes */
  --modeler-color-type-condition: #2196f3;  /* blue: condition/subprocess nodes */
  --modeler-color-type-gateway: #9c27b0;    /* purple: gateway nodes */

  /* --- Data Type Colors --- */
  --modeler-color-data-string: #047857;     /* emerald-700 */
  --modeler-color-data-number: #dc2626;     /* red-600 */
  --modeler-color-data-boolean: #7c3aed;    /* violet-600 */
  --modeler-color-data-null: #4b5563;       /* gray-600 */

  /* --- Token Colors --- */
  --modeler-color-token-bg: #e0f2fe;        /* sky-100: token background */
  --modeler-color-token-text: #0369a1;      /* sky-700: token text */
  --modeler-color-token-border: #bae6fd;    /* sky-200: token border */
  --modeler-color-token-hover-bg: #bae6fd;  /* sky-200: token hover bg */
  --modeler-color-token-hover-border: #0284c7; /* sky-600: token hover border */

  /* --- Edge Colors --- */
  --modeler-color-edge-default: #8b8b8b;    /* neutral gray: default edge stroke */
  --modeler-color-edge-locked: #767676;     /* darker gray: locked edge stroke */

  /* --- Shadows --- */
  --modeler-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --modeler-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --modeler-shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
  --modeler-shadow-panel: 2px 0 4px rgba(0, 0, 0, 0.05);
  --modeler-shadow-selection: 0 0 0 3px var(--modeler-color-selection-ring);

  /* --- Collapse Widget --- */
  --modeler-color-collapse-line: #adb5bd;   /* bootstrap gray-500 */
  --modeler-color-collapse-hover: #495057;  /* bootstrap gray-700 */
  --modeler-color-collapse-label: #6c757d;  /* bootstrap gray-600 */

  /* --- Transitions --- */
  --modeler-transition-fast: all 0.15s ease;
  --modeler-transition-default: all 0.2s ease;
  --modeler-transition-slow: all 0.3s ease;
  --modeler-duration-fast: 0.15s;
  --modeler-duration-default: 0.2s;
  --modeler-duration-slow: 0.3s;

  /* --- Component Type Light Backgrounds --- */
  --modeler-color-type-event-light: #fff3e0;   /* orange-50: event header bg */
  --modeler-color-type-event-lighter: #ffe0b2; /* orange-200: event gradient end */
  --modeler-color-type-event-border: #ffb74d;  /* orange-300: event hover border */
  --modeler-color-type-action-light: #e8f5e9;  /* green-50: action indicator bg */
  --modeler-color-type-condition-light: #e3f2fd; /* blue-50: condition indicator bg */
  --modeler-color-type-gateway-light: #f3e5f5; /* purple-50: gateway indicator bg */

  /* --- Additional Accent Colors --- */
  --modeler-color-accent-indigo: #6366f1;      /* indigo-500: condition button hover */
  --modeler-color-accent-violet: #8b5cf6;      /* violet-500: add-successor step icon */
  --modeler-color-favorite-bg: #fffbeb;       /* amber-50: favorite item bg */
  --modeler-color-info-light: #f0f9ff;         /* sky-50: blockquote bg */
  --modeler-color-result-edge-bg: #f3e8ff;     /* purple-100: edge result type badge */

  /* --- Interactive Glow --- */
  --modeler-color-interactive-glow: rgba(59, 130, 246, 0.5);  /* drag-over glow on edge badges */

  /* --- Danger Glow --- */
  --modeler-shadow-danger-glow: 0 0 10px rgba(239, 68, 68, 0.5);  /* replay "access denied" highlighting */

  /* --- MiniMap Colors --- */
  --modeler-color-minimap-bg: #f8f9fa;           /* MiniMap background */
  --modeler-color-minimap-border: #e0e0e0;       /* MiniMap border */
  --modeler-color-minimap-node: #767676;         /* MiniMap default node color */
  --modeler-color-minimap-selected: #1976d2;     /* MiniMap selected node color */
  --modeler-color-minimap-locked: #f57c00;       /* MiniMap locked node color */
  --modeler-color-minimap-mask: rgba(255, 255, 255, 0.8);  /* MiniMap mask overlay */

  /* --- Edge Default Stroke --- */
  --modeler-color-edge-stroke: #595959;          /* default edge marker/stroke color */

  /* --- Repeated RGBA values --- */
  --modeler-color-shadow-light: rgba(0, 0, 0, 0.1);
  --modeler-color-shadow-medium: rgba(0, 0, 0, 0.15);
  --modeler-color-shadow-strong: rgba(0, 0, 0, 0.2);

  /* --- Font Sizes --- */
  --modeler-font-size-xxs: 9px;
  --modeler-font-size-xs: 10px;
  --modeler-font-size-sm: 11px;
  --modeler-font-size-md: 12px;
  --modeler-font-size-base: 13px;
  --modeler-font-size-lg: 14px;
  --modeler-font-size-xl: 16px;
  --modeler-font-size-2xl: 18px;
  --modeler-font-size-3xl: 20px;
  --modeler-font-size-4xl: 24px;

  /* --- Border Radius --- */
  --modeler-radius-xs: 2px;
  --modeler-radius-sm: 3px;
  --modeler-radius-md: 4px;
  --modeler-radius-lg: 6px;
  --modeler-radius-xl: 8px;
  --modeler-radius-2xl: 12px;
  --modeler-radius-full: 50%;

  /* --- Spacing (used for padding, gap, margin) --- */
  --modeler-spacing-xs: 4px;
  --modeler-spacing-sm: 6px;
  --modeler-spacing-md: 8px;
  --modeler-spacing-lg: 12px;
  --modeler-spacing-xl: 16px;
  --modeler-spacing-2xl: 20px;
  --modeler-spacing-3xl: 24px;
  --modeler-spacing-4xl: 32px;

  /* --- Icon Sizes --- */
  --modeler-icon-size: 16px;
}

/* === DARK MODE OVERRIDES === */
.modeler.dark-mode {
  background-color: var(--modeler-color-bg-canvas);

  /* --- Text Colors --- */
  --modeler-color-text-primary: #e5e7eb;     /* gray-200: headings, labels, body text */
  --modeler-color-text-secondary: #d1d5db;   /* gray-300: descriptions, muted text */
  --modeler-color-text-tertiary: #9ca3af;    /* gray-400: non-text icons, captions */
  --modeler-color-text-emphasis: #f9fafb;    /* gray-50: strong emphasis */
  --modeler-color-text-on-dark: #f9fafb;     /* gray-50: unchanged */

  /* --- Background Colors --- */
  --modeler-color-bg-primary: #1f2937;       /* gray-800: panels, cards, inputs */
  --modeler-color-bg-surface: #111827;       /* gray-900: panel headers, subtle surfaces */
  --modeler-color-bg-muted: #374151;         /* gray-700: hover states, disabled fields */
  --modeler-color-bg-canvas: #0f172a;        /* slate-900: main modeler background */
  --modeler-color-bg-overlay: rgba(0, 0, 0, 0.7); /* darker modal overlay */
  --modeler-color-bg-code: #0f172a;          /* slate-900: code blocks */

  /* --- Border Colors --- */
  --modeler-color-border-light: #374151;     /* gray-700: standard borders */
  --modeler-color-border-default: #4b5563;   /* gray-600: form controls, panels */
  --modeler-color-border-hover: #9ca3af;     /* gray-400: hover state borders */
  --modeler-color-border-input: #4b5563;     /* gray-600: input field borders */

  /* --- Primary Blue --- */
  --modeler-color-primary: #2563eb;          /* blue-600: WCAG AA with white text (4.58:1) */
  --modeler-color-primary-hover: #1d4ed8;    /* blue-700: hover */
  --modeler-color-primary-light: #1e3a5f;    /* dark blue: active tab bg */
  --modeler-color-primary-text: #93c5fd;     /* blue-300: text on primary-light bg */

  /* --- Interactive/Selection Blue --- */
  --modeler-color-interactive: #60a5fa;      /* blue-400: brighter focus rings */
  --modeler-color-interactive-ring: rgba(96, 165, 250, 0.2);
  --modeler-color-selection: #60a5fa;        /* brighter selection */
  --modeler-color-selection-ring: rgba(96, 165, 250, 0.3);

  /* --- Danger / Error Red --- */
  --modeler-color-danger: #f87171;           /* red-400: brighter on dark */
  --modeler-color-danger-hover: #ef4444;     /* red-500 */
  --modeler-color-danger-light: #451a1a;     /* dark red bg */
  --modeler-color-danger-lighter: #3b1111;   /* darker red bg */
  --modeler-color-danger-soft: #f87171;      /* red-400 */
  --modeler-color-danger-text: #fca5a5;      /* red-300: readable on dark */
  --modeler-color-danger-delete: #ef4444;    /* red-500 */

  /* --- Warning / Amber --- */
  --modeler-color-warning: #fbbf24;          /* amber-400 */
  --modeler-color-warning-dark: #f59e0b;     /* amber-500 */
  --modeler-color-warning-darker: #fbbf24;   /* amber-400 */
  --modeler-color-warning-darkest: #fcd34d;  /* amber-300: readable on dark */
  --modeler-color-warning-light: #3b2f0a;    /* dark amber bg */
  --modeler-color-warning-border: #92400e;   /* amber-800: muted border */
  --modeler-color-warning-subtle: #d97706;   /* amber-600 */

  /* --- Success / Green --- */
  --modeler-color-success: #34d399;          /* emerald-400 */
  --modeler-color-success-dark: #6ee7b7;     /* emerald-300: readable on dark */
  --modeler-color-success-light: #0a3b2a;    /* dark green bg */
  --modeler-color-success-drop: #22c55e;     /* green-500: unchanged */
  --modeler-color-success-drop-hover: #16a34a;
  --modeler-color-success-subtle: #166534;   /* green-800: subtle on dark */
  --modeler-color-success-text: #6ee7b7;     /* emerald-300 */

  /* --- Component Type Colors --- */
  --modeler-color-type-event: #fb923c;       /* orange-400 */
  --modeler-color-type-event-dark: #f97316;  /* orange-500 */
  --modeler-color-type-event-darker: #ea580c;/* orange-600 */
  --modeler-color-type-event-btn: #c2410c;   /* 5.18:1 on white – WCAG AA ✓ */
  --modeler-color-type-event-btn-hover: #b45309; /* 5.02:1 on white – WCAG AA ✓ */
  --modeler-color-type-action: #4ade80;      /* green-400 */
  --modeler-color-type-condition: #60a5fa;   /* blue-400 */
  --modeler-color-type-gateway: #c084fc;     /* purple-400 */

  /* --- Data Type Colors --- */
  --modeler-color-data-string: #6ee7b7;      /* emerald-300 */
  --modeler-color-data-number: #fca5a5;      /* red-300 */
  --modeler-color-data-boolean: #a78bfa;     /* violet-400 */
  --modeler-color-data-null: #9ca3af;        /* gray-400 */

  /* --- Token Colors --- */
  --modeler-color-token-bg: #1e3a5f;         /* dark blue bg */
  --modeler-color-token-text: #7dd3fc;       /* sky-300 */
  --modeler-color-token-border: #1e3a5f;     /* matching bg */
  --modeler-color-token-hover-bg: #1e4976;   /* slightly lighter */
  --modeler-color-token-hover-border: #38bdf8; /* sky-400 */

  /* --- Edge Colors --- */
  --modeler-color-edge-default: #6b7280;     /* gray-500 */
  --modeler-color-edge-locked: #9ca3af;      /* gray-400 */
  --modeler-color-edge-stroke: #9ca3af;      /* gray-400 */

  /* --- Shadows (lighter for dark mode, use lighter rgba) --- */
  --modeler-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --modeler-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --modeler-shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.4);
  --modeler-shadow-panel: 2px 0 4px rgba(0, 0, 0, 0.2);
  --modeler-shadow-danger-glow: 0 0 10px rgba(248, 113, 113, 0.5);
  --modeler-color-shadow-light: rgba(0, 0, 0, 0.2);
  --modeler-color-shadow-medium: rgba(0, 0, 0, 0.3);
  --modeler-color-shadow-strong: rgba(0, 0, 0, 0.4);

  /* --- Collapse Widget --- */
  --modeler-color-collapse-line: #4b5563;    /* gray-600 */
  --modeler-color-collapse-hover: #d1d5db;   /* gray-300 */
  --modeler-color-collapse-label: #9ca3af;   /* gray-400 */

  /* --- Component Type Light Backgrounds --- */
  --modeler-color-type-event-light: #3b2508;  /* dark orange bg */
  --modeler-color-type-event-lighter: #4a2e0a;/* dark orange gradient */
  --modeler-color-type-event-border: #92400e; /* amber-800 */
  --modeler-color-type-action-light: #0a2e14; /* dark green bg */
  --modeler-color-type-condition-light: #0c1e3a; /* dark blue bg */
  --modeler-color-type-gateway-light: #2e1044;/* dark purple bg */

  /* --- Additional Accent Colors --- */
  --modeler-color-accent-indigo: #818cf8;    /* indigo-400 */
  --modeler-color-accent-violet: #a78bfa;    /* violet-400 */
  --modeler-color-favorite-bg: #3b2f0a;     /* dark amber bg */
  --modeler-color-info-light: #0c1e3a;       /* dark blue bg */
  --modeler-color-result-edge-bg: #2e1044;   /* dark purple bg */
  --modeler-color-interactive-glow: rgba(96, 165, 250, 0.5);

  /* --- MiniMap Colors --- */
  --modeler-color-minimap-bg: #1f2937;       /* gray-800 */
  --modeler-color-minimap-border: #374151;   /* gray-700 */
  --modeler-color-minimap-node: #9ca3af;     /* gray-400 */
  --modeler-color-minimap-selected: #60a5fa; /* blue-400 */
  --modeler-color-minimap-locked: #fb923c;   /* orange-400 */
  --modeler-color-minimap-mask: rgba(15, 23, 42, 0.8); /* dark mask */
}

/* === CURSOR STYLES === */
/* Selection cursor when Shift is pressed */
.react-flow.shift-pressed {
  cursor: crosshair !important;
}

.react-flow.shift-pressed .react-flow__pane {
  cursor: crosshair !important;
}

/* Vertical pan cursor when Ctrl is pressed */
.react-flow.ctrl-pressed {
  cursor: ns-resize !important;
}

.react-flow.ctrl-pressed .react-flow__pane {
  cursor: ns-resize !important;
}

/* Horizontal pan cursor when Ctrl+Alt is pressed */
.react-flow.ctrl-alt-pressed {
  cursor: ew-resize !important;
}

.react-flow.ctrl-alt-pressed .react-flow__pane {
  cursor: ew-resize !important;
}

/* Replay transition edge highlight animation */
.replay-transition-highlighted {
  animation: transition-pulse 1.0s ease-in-out;
}

/* Target the SVG path directly for transition highlighting */
.react-flow__edge.replay-transition-highlighted path {
  stroke: var(--modeler-color-interactive) !important;
  stroke-width: 6 !important;
  opacity: 1 !important;
}

/* Ensure the g element also gets the color for wrapped edges */
g.replay-transition-highlighted path {
  stroke: var(--modeler-color-interactive) !important;
  stroke-width: 6 !important;
  opacity: 1 !important;
}

/* Replay edge highlighting for add successor (green) */
.react-flow__edge.replay-add path,
.react-flow__edge.replay-highlighted.replay-add path {
  stroke: var(--modeler-color-success) !important;
  stroke-width: 3 !important;
  opacity: 1 !important;
}

/* Replay edge highlighting for ignore successor (red) */
.react-flow__edge.replay-ignore path,
.react-flow__edge.replay-highlighted.replay-ignore path {
  stroke: var(--modeler-color-danger-soft) !important;
  stroke-width: 3 !important;
  opacity: 1 !important;
}

@keyframes transition-pulse {
  0% {
    stroke: var(--modeler-color-interactive) !important;
    stroke-width: 3 !important;
    opacity: 0.7;
  }
  50% {
    stroke: var(--modeler-color-primary-hover) !important;
    stroke-width: 6 !important;
    opacity: 1;
  }
  100% {
    stroke: var(--modeler-color-interactive) !important;
    stroke-width: 4 !important;
    opacity: 0.8;
  }
}


/* Loading overlay styles */
.modeler-loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--modeler-color-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modeler-loading-content {
  background: var(--modeler-color-bg-primary);
  padding: 40px;
  border-radius: var(--modeler-radius-xl);
  box-shadow: var(--modeler-shadow-lg);
  text-align: center;
}

.modeler-loading-text {
  font-size: var(--modeler-font-size-2xl);
  color: var(--modeler-color-text-primary);
  font-weight: 500;
}

/* Minimized state styles - not needed anymore since we hide with display:none */

/* Restore bar - only shown when minimized.
   Uses hardcoded values because this element is appended to document.body,
   outside the .modeler container where CSS custom properties are defined. */
.workflow-restore-bar {
  position: fixed;
  bottom: 20px;
  right: 20px;
  height: 40px;
  background: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  z-index: 10000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  border-radius: 20px;
  min-width: 200px;
}

.workflow-restore-bar .restore-btn {
  background: none;
  border: none;
  color: white;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s;
}

.workflow-restore-bar .restore-btn:hover {
  opacity: 0.9;
}

.workflow-restore-bar .restore-btn svg {
  width: 16px;
  height: 16px;
}

.workflow-modeler {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: var(--modeler-color-bg-canvas);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  transition: transform var(--modeler-duration-slow);
}

/*
 * Restored (windowed) mode — Drupal modeler only.
 * Position and size are applied via inline styles by useViewMode.
 * The base .workflow-modeler rules supply position: fixed and z-index,
 * but we override right/bottom to auto so the element is sized by
 * width/height rather than stretching to viewport edges.
 */
.workflow-modeler.restored {
  right: auto;
  bottom: auto;
  border-radius: var(--modeler-radius-lg, 8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 2px 8px rgba(0, 0, 0, 0.12);
  overflow: hidden;       /* clip child content to rounded corners */
}

/* Dragging / resizing: disable pointer-events on children and transitions */
.workflow-modeler.restored.is-dragging,
.workflow-modeler.restored.is-resizing {
  transition: none;
  user-select: none;
}

/* Resize handle in the bottom-right corner */
.workflow-modeler.restored .modeler-resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  z-index: 10;
  /* Diagonal lines affordance */
  background:
    linear-gradient(135deg, transparent 50%, var(--modeler-color-border-light) 50%, var(--modeler-color-border-light) 55%, transparent 55%),
    linear-gradient(135deg, transparent 65%, var(--modeler-color-border-light) 65%, var(--modeler-color-border-light) 70%, transparent 70%),
    linear-gradient(135deg, transparent 80%, var(--modeler-color-border-light) 80%, var(--modeler-color-border-light) 85%, transparent 85%);
}

/* Standalone mode: fill the parent container instead of covering the viewport */
.workflow-modeler.standalone {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: auto;
  width: 100%;
  height: 100%;
}

/* Standalone fullscreen: override back to fixed viewport overlay */
.workflow-modeler.standalone.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  width: auto;
  height: auto;
  border-radius: 0;
  box-shadow: none;
}

.modeler.standalone {
  height: 100%;
}

.workflow-modeler-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Component Panel */
.workflow-component-panel {
  position: relative; /* Required for absolutely positioned resize handle */
  width: 280px;
  background: var(--modeler-color-bg-primary);
  border-right: 1px solid var(--modeler-color-border-light);
  display: flex;
  flex-direction: column;
  box-shadow: var(--modeler-shadow-panel);
}

.component-type-selector {
  display: flex;
  background: var(--modeler-color-bg-surface);
  border-bottom: 1px solid var(--modeler-color-border-light);
  padding: 0;
}

.type-selector-btn {
  flex: 1;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-secondary);
  transition: var(--modeler-transition-default);
  position: relative;
}

.type-selector-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--modeler-color-text-primary);
}

.type-selector-btn.active {
  background: var(--modeler-color-bg-primary);
  color: var(--modeler-color-type-condition);
  border-bottom-color: var(--modeler-color-type-condition);
  font-weight: 600;
}

.type-selector-btn svg {
  font-size: var(--modeler-font-size-2xl);
}

.type-selector-btn span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.type-selector-btn .component-count {
  font-size: var(--modeler-font-size-xxs);
  opacity: 0.8;
  font-weight: normal;
  margin-top: -2px;
}

.panel-header {
  padding: 12px;
  border-bottom: 1px solid var(--modeler-color-border-light);
  background: var(--modeler-color-bg-surface);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 8px 32px 8px 32px;
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-lg);
  box-sizing: border-box;
  background: var(--modeler-color-bg-primary);
  color: var(--modeler-color-text-primary);
}

/* Component panel search icon (left side) */
.search-icon.component-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--modeler-color-text-tertiary);
  pointer-events: none;
}

/* Toolbar search icon (left side) - handled in separate search bar component */
.search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--modeler-color-text-tertiary);
}

.provider-filter-container {
  width: 100%;
}

.filter-toggle {
  width: 100%;
  padding: 8px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-base);
  color: var(--modeler-color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--modeler-transition-default);
}

.filter-toggle:hover {
  background: var(--modeler-color-bg-surface);
  border-color: var(--modeler-color-border-hover);
}

.filter-toggle.active {
  border-color: var(--modeler-color-selection);
  color: var(--modeler-color-text-primary);
}

.filter-count {
  margin-left: auto;
  background: var(--modeler-color-primary);
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: var(--modeler-font-size-sm);
  font-weight: 600;
}

.provider-checkboxes {
  margin-top: 8px;
  padding: 8px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  max-height: 200px;
  overflow-y: auto;
}

.provider-checkbox {
  display: flex;
  align-items: center;
  padding: 4px 0;
  cursor: pointer;
  font-size: var(--modeler-font-size-base);
  color: var(--modeler-color-text-primary);
  transition: background var(--modeler-duration-default);
}

.provider-checkbox:hover {
  background: var(--modeler-color-bg-surface);
}

.provider-checkbox input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
}

.clear-filters-btn {
  width: 100%;
  margin-top: 8px;
  padding: 6px;
  background: var(--modeler-color-bg-surface);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
  cursor: pointer;
  transition: var(--modeler-transition-default);
}

.clear-filters-btn:hover {
  background: var(--modeler-color-bg-muted);
  color: var(--modeler-color-text-primary);
}

.component-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.no-components {
  text-align: center;
  padding: 20px;
  color: var(--modeler-color-text-tertiary);
  font-size: var(--modeler-font-size-lg);
}


.component-item {
  display: flex;
  align-items: center;
  padding: 2px 6px;
  margin: 2px 0;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-lg);
  cursor: grab;
  transition: var(--modeler-transition-default);
  position: relative;
}

.component-item:hover {
  border-color: var(--modeler-color-selection);
  transform: translateX(2px);
  box-shadow: 0 2px 4px rgba(64, 153, 255, 0.1);
}

.component-item.event {
  border-left: 3px solid var(--modeler-color-type-event);
}

.component-item.action {
  border-left: 3px solid var(--modeler-color-type-action);
}

.component-item.condition {
  border-left: 3px solid var(--modeler-color-type-condition);
}

.component-item.gateway {
  border-left: 3px solid var(--modeler-color-type-gateway);
}

.component-icon {
  margin-right: 8px;
  font-size: var(--modeler-font-size-xl);
}

.component-info {
  flex: 1;
  min-width: 0;
}

.component-label {
  font-weight: 500;
  font-size: var(--modeler-font-size-base);
  color: var(--modeler-color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.component-description-indicator {
  margin-left: auto;
  padding-left: 8px;
  color: var(--modeler-color-text-tertiary);
  display: flex;
  align-items: center;
  transition: color var(--modeler-duration-default);
}

.component-item.has-description:hover .component-description-indicator {
  color: var(--modeler-color-selection);
}

/* Favorite components styling */
.component-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: var(--modeler-font-size-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--modeler-color-text-secondary);
}

.component-section-header.favorites-header {
  color: var(--modeler-color-warning-dark);
  background: linear-gradient(to right, rgba(251, 191, 36, 0.1), transparent);
  border-radius: var(--modeler-radius-md);
  margin-bottom: 4px;
}

.component-section-header.favorites-header svg {
  fill: #fbbf24;
  stroke: var(--modeler-color-warning-dark);
}

.component-section-divider {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin: 8px 0;
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-tertiary);
}

.component-section-divider::before,
.component-section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--modeler-color-border-light);
}

.component-item.favorite {
  background: linear-gradient(to right, rgba(251, 191, 36, 0.08), var(--modeler-color-bg-primary));
  border-color: var(--modeler-color-warning-border);
}

.component-item.favorite:hover {
  border-color: var(--modeler-color-warning);
  background: linear-gradient(to right, rgba(251, 191, 36, 0.15), var(--modeler-color-bg-primary));
}

.favorite-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  color: var(--modeler-color-warning);
}

.favorite-indicator svg {
  fill: var(--modeler-color-warning-border);
}


/* Canvas */
.workflow-modeler-canvas {
  flex: 1;
  position: relative;
}

.reactflow-wrapper {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

/* Property Panel */
.workflow-property-panel {
  background: var(--modeler-color-bg-primary);
  border-left: 1px solid var(--modeler-color-border-light);
  display: flex;
  flex-direction: column;
  box-shadow: var(--modeler-shadow-panel);
  position: relative;
  transition: width var(--modeler-duration-default);
  height: 100%;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.panel-content.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--modeler-color-text-tertiary);
  text-align: center;
}

.panel-content.multi-selection {
  padding: 12px;
}

/* Panel error boundary fallback */
.panel-error-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 120px;
  padding: 20px;
  color: var(--modeler-color-text-secondary);
  text-align: center;
}

.panel-error-fallback.canvas-error {
  width: 100%;
  height: 100%;
  background: var(--modeler-color-bg-surface);
}

.panel-error-content {
  max-width: 300px;
}

.panel-error-icon {
  font-size: 28px;
  color: var(--modeler-color-warning-dark);
  margin-bottom: 8px;
}

.panel-error-content h4 {
  margin: 0 0 6px 0;
  font-size: var(--modeler-font-size-lg);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
}

.panel-error-content p {
  margin: 0 0 12px 0;
  font-size: var(--modeler-font-size-md);
  line-height: 1.4;
  color: var(--modeler-color-text-secondary);
}

.panel-error-retry {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  font-size: var(--modeler-font-size-md);
  font-weight: 500;
  color: white;
  background: var(--modeler-color-primary);
  border: none;
  border-radius: var(--modeler-radius-md);
  cursor: pointer;
  transition: background var(--modeler-duration-fast);
}

.panel-error-retry:hover {
  background: var(--modeler-color-primary-hover);
}

.panel-error-auto-retry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
}

@keyframes panel-error-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.panel-error-spinner {
  animation: panel-error-spin 1s linear infinite;
  font-size: 14px;
}

.panel-error-exhausted {
  margin: 0 0 8px 0;
  font-size: var(--modeler-font-size-md);
  font-weight: 500;
  color: var(--modeler-color-danger);
}

.panel-error-retry-count {
  margin: 6px 0 0 0;
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-tertiary);
}

.panel-error-details {
  margin-top: 12px;
  text-align: left;
  font-size: var(--modeler-font-size-sm);
}

.panel-error-details summary {
  cursor: pointer;
  color: var(--modeler-color-text-tertiary);
  user-select: none;
}

.panel-error-details pre {
  margin-top: 6px;
  padding: 8px;
  background: var(--modeler-color-bg-canvas);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-sm);
  font-size: var(--modeler-font-size-sm);
  overflow: auto;
  max-height: 120px;
  white-space: pre-wrap;
  word-break: break-word;
}

.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--modeler-color-text-secondary);
}

.close-btn:hover {
  color: var(--modeler-color-text-primary);
}

.property-section {
  margin-bottom: 24px;
}

.property-section h4 {
  margin: 0 0 12px 0;
  font-size: var(--modeler-font-size-base);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--modeler-color-text-secondary);
  letter-spacing: 0.5px;
}

.property-item {
  margin-bottom: 12px;
  padding: 0 16px;
  margin-top: 12px;
}

.property-item label {
  display: block;
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
  margin-bottom: 4px;
}

.property-value {
  font-size: var(--modeler-font-size-lg);
  color: var(--modeler-color-text-primary);
  padding: 8px;
  background: var(--modeler-color-bg-surface);
  border-radius: var(--modeler-radius-md);
}

.property-value.editable {
  display: flex;
  align-items: center;
  padding: 0;
  background: none;
}

.property-value.editable input,
.property-value.editable textarea {
  flex: 1;
  padding: 8px 16px;
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-lg);
  background: var(--modeler-color-bg-primary);
  color: var(--modeler-color-text-primary);
}

.property-value.editable textarea {
  resize: vertical;
  min-height: 60px;
}

.edit-icon {
  margin-left: 8px;
  color: var(--modeler-color-text-tertiary);
}

.property-value.description {
  font-size: var(--modeler-font-size-base);
  line-height: 1.4;
}

/* Lock toggle button */
.lock-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-md);
  cursor: pointer;
  font-size: var(--modeler-font-size-base);
  color: var(--modeler-color-text-primary);
  transition: var(--modeler-transition-default);
}

.lock-toggle-btn:hover:not(:disabled) {
  background: var(--modeler-color-bg-muted);
  border-color: var(--modeler-color-text-tertiary);
}

.lock-toggle-btn.locked {
  background: var(--modeler-color-danger-lighter);
  border-color: var(--modeler-color-danger);
  color: var(--modeler-color-danger);
}

.lock-toggle-btn.locked:hover:not(:disabled) {
  background: var(--modeler-color-danger-light);
  border-color: var(--modeler-color-danger-hover);
}

.lock-toggle-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.lock-toggle-btn svg {
  width: 14px;
  height: 14px;
}

.property-actions {
  padding-top: 16px;
  border-top: 1px solid var(--modeler-color-border-light);
}

.configure-btn {
  width: 100%;
  padding: 10px;
  background: var(--modeler-color-primary);
  color: white;
  border: none;
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-lg);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.configure-btn:hover {
  background: var(--modeler-color-primary-hover);
}

/* Toolbar */
.workflow-toolbar {
  background: var(--modeler-color-bg-primary);
  border-bottom: 1px solid var(--modeler-color-border-light);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  padding: 4px 24px;
  min-height: 40px;
}

.toolbar-left,
.toolbar-center,
.toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1 1 33.333%;
  min-width: 0;
  overflow: hidden;
}

/* Ensure left and right regions stack above toolbar-center
   (which has overflow: visible for the message actions). */
.toolbar-left {
  z-index: 1;
  overflow: visible;
}

.toolbar-center {
  justify-content: center;
  gap: 12px;
  padding: 0 40px;
  position: relative;
  overflow: visible;
}

/* In restored (windowed) Drupal mode the toolbar acts as a drag handle.
   Standalone restored mode is not draggable — no cursor change. */
.workflow-modeler.restored:not(.standalone) .toolbar-center {
  cursor: grab;
}
.workflow-modeler.restored.is-dragging:not(.standalone) .toolbar-center {
  cursor: grabbing;
}

/* Override overflow: hidden so the overflow dropdown can escape the region.
   z-index ensures toolbar-center (overflow: visible for message actions)
   doesn't overlap clickable buttons in toolbar-right. */
.toolbar-right {
  justify-content: flex-end;
  overflow: visible;
  z-index: 1;
}

/* ── Compact toolbar (very narrow screens) ────────────────────────────
   Two-row layout:
     Row 1: center region (left-aligned) + right region (Save/Close/overflow)
     Row 2: left region spans the full width
   Activated via the `.toolbar-compact` class set by useToolbarOverflow. */

.workflow-toolbar.toolbar-compact {
  flex-wrap: wrap;
}

/* Row 1: center comes first (left-aligned), right stays right */
.toolbar-compact .toolbar-center {
  flex: 1 1 auto;
  justify-content: flex-start;
  padding: 0;
  order: 0;
}

.toolbar-compact .toolbar-right {
  flex: 0 0 auto;
  order: 1;
}

/* Row 2: left region spans full width on its own line */
.toolbar-compact .toolbar-left {
  flex: 1 0 100%;
  order: 2;
  padding-top: 4px;
}

/* In compact mode the messages-actions overlay positions relative to
   the center region which is now left-aligned and in a wrapped row,
   so use left: auto positioning anchored to the title. */
.toolbar-compact .messages-actions {
  left: auto;
  right: 0;
  transform: translate(50%, -50%);
}

/* Message indicator + delete icon: centered on the bottom edge of
   the toolbar so it peeks halfway into the canvas area. */
.messages-actions {
  position: absolute;
  top: 180%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}

.messages-toggle-btn {
  background: var(--modeler-color-primary);
  color: white;
  border: none;
  border-radius: var(--modeler-radius-full);
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: var(--modeler-transition-default);
}

.messages-toggle-btn:hover {
  background: var(--modeler-color-primary-hover);
  transform: scale(1.05);
}

.messages-toggle-btn.inactive {
  background: var(--modeler-color-text-disabled);
  opacity: 0.5;
  cursor: pointer;
}

.messages-toggle-btn.inactive:hover {
  background: var(--modeler-color-text-muted);
  opacity: 0.7;
}

.messages-clear-btn {
  background: var(--modeler-color-bg-primary);
  color: var(--modeler-color-text-secondary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--modeler-transition-default);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.messages-clear-btn svg {
  width: 12px;
  height: 12px;
}

.messages-clear-btn:hover {
  background: var(--modeler-color-danger-delete);
  color: white;
  border-color: var(--modeler-color-danger-delete);
  transform: scale(1.1);
}

/* Messages container - positioned at top center, fades out */
.workflow-messages-container {
  position: absolute;
  top: 56px; /* Below toolbar */
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  max-width: 600px;
  width: auto;
  min-width: 300px;
  padding: 0 16px;
  pointer-events: auto;
  transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.workflow-messages-container.visible {
  opacity: 1;
  visibility: visible;
}

.workflow-messages-container.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Style the messages inside the container */
.workflow-messages-container .messages-list {
  margin: 0;
  padding: 0;
}

.workflow-messages-container .messages-list .messages {
  margin: 8px 0;
  padding: 12px 16px;
  border-radius: var(--modeler-radius-xl);
  box-shadow: var(--modeler-shadow-md);
  font-size: var(--modeler-font-size-lg);
  line-height: 1.5;
}

.workflow-messages-container .messages-list .messages--status {
  background: var(--modeler-color-success-light);
  border-left: 4px solid var(--modeler-color-success);
  color: var(--modeler-color-success-dark);
}

.workflow-messages-container .messages-list .messages--warning {
  background: var(--modeler-color-warning-light);
  border-left: 4px solid var(--modeler-color-warning);
  color: var(--modeler-color-warning-darkest);
}

.workflow-messages-container .messages-list .messages--error {
  background: var(--modeler-color-danger-light);
  border-left: 4px solid var(--modeler-color-danger-soft);
  color: var(--modeler-color-danger-text);
}

.model-title {
  margin: 0;
  font-size: var(--modeler-font-size-xl);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  max-width: 100%;
}

.unsaved-indicator {
  color: var(--modeler-color-warning);
  font-size: var(--modeler-font-size-3xl);
  line-height: 1;
}

.toolbar-btn {
  padding: 4px 10px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--modeler-font-size-base);
  color: var(--modeler-color-text-primary);
  transition: var(--modeler-transition-default);
}

.toolbar-btn:hover {
  background: var(--modeler-color-bg-surface);
  border-color: var(--modeler-color-text-tertiary);
}

.toolbar-btn.primary {
  background: var(--modeler-color-primary);
  color: white;
  border-color: var(--modeler-color-primary);
}

.toolbar-btn.primary:hover {
  background: var(--modeler-color-primary-hover);
}

.toolbar-btn.active {
  background: var(--modeler-color-primary-light);
  border-color: var(--modeler-color-type-condition);
  color: var(--modeler-color-type-condition);
}

.toolbar-btn.active:hover {
  background: var(--modeler-color-type-condition-light);
}

.toolbar-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.toolbar-btn:disabled:hover {
  background: var(--modeler-color-bg-primary);
  border-color: var(--modeler-color-border-light);
}

.toolbar-btn.primary:disabled {
  background: var(--modeler-color-primary);
  border-color: var(--modeler-color-primary);
  color: white;
  opacity: 0.5;
}

.toolbar-btn.primary:disabled:hover {
  background: var(--modeler-color-primary);
  border-color: var(--modeler-color-primary);
}

/* Custom Nodes */
.custom-node {
  background: var(--modeler-color-bg-primary);
  border: 2px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-xl);
  min-width: 150px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: var(--modeler-transition-default);
}


/* Locked node styles */
.node-locked {
  filter: saturate(0.5) brightness(1.03);
}

.node-locked .node-handle {
  pointer-events: none;
  background: var(--modeler-color-edge-locked);
}

.node-locked .node-header {
  background: var(--modeler-color-bg-muted);
}

.lock-icon {
  margin-left: auto;
  color: var(--modeler-color-text-secondary);
  font-size: var(--modeler-font-size-md);
}

.node-header {
  padding: 8px 12px;
  background: var(--modeler-color-bg-surface);
  border-bottom: 1px solid var(--modeler-color-border-light);
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--modeler-font-size-sm);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--modeler-color-text-secondary);
}

.node-icon {
  font-size: var(--modeler-font-size-lg);
}

.node-body {
  padding: 12px;
  text-align: center;
}

.node-label {
  font-size: var(--modeler-font-size-lg);
  font-weight: 500;
  color: var(--modeler-color-text-primary);
  margin-bottom: 4px;
}

.node-plugin {
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-secondary);
}

.node-handle {
  width: 10px;
  height: 10px;
  background: var(--modeler-color-selection);
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--modeler-color-border-light);
}

.node-status {
  position: absolute;
  top: 8px;
  right: 8px;
}

.configured-icon {
  color: var(--modeler-color-type-action);
  font-size: var(--modeler-font-size-lg);
}

.node-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  color: var(--modeler-color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--modeler-duration-default), background var(--modeler-duration-default), color var(--modeler-duration-default), transform var(--modeler-duration-default);
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.custom-node:hover .node-delete-btn,
.start-node:hover .node-delete-btn,
.gateway-node:hover .node-delete-btn,
.subprocess-node:hover .node-delete-btn {
  opacity: 1;
}

.node-delete-btn:hover {
  background: var(--modeler-color-danger-delete);
  color: white;
  border-color: var(--modeler-color-danger-delete);
  transform: scale(1.1);
}

.node-delete-btn svg {
  width: 12px;
  height: 12px;
}

/* Quick Add Button - appears on node hover to add successor nodes */
.quick-add-button {
  position: absolute;
  bottom: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  padding: 0;
  background: var(--modeler-color-primary);
  border: 2px solid white;
  border-radius: var(--modeler-radius-full);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--modeler-duration-default), transform var(--modeler-duration-default), background var(--modeler-duration-default);
  z-index: 15;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}

.custom-node:hover .quick-add-button,
.start-node:hover .quick-add-button,
.gateway-node:hover .quick-add-button,
.subprocess-node:hover .quick-add-button {
  opacity: 1;
}

.quick-add-button:hover {
  background: var(--modeler-color-primary);
  transform: scale(1.15);
}

.quick-add-button svg {
  width: 14px;
  height: 14px;
}

/* Quick Add Condition Button - on edges */
.edge-quick-add-wrapper {
  position: absolute;
  pointer-events: all;
  transition: transform var(--modeler-duration-default);
}

.edge-quick-add-wrapper:hover {
  transform: scale(1.1);
}

.quick-add-condition-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--modeler-radius-full);
  background: var(--modeler-color-border-light);
  color: var(--modeler-color-text-primary);
  border: 2px solid white;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: var(--modeler-transition-default);
}

.quick-add-condition-button:hover {
  background: var(--modeler-color-accent-indigo);
  color: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.quick-add-condition-button svg {
  width: 12px;
  height: 12px;
}

/* Condition-specific popup styling */
.quick-add-condition-popup {
  width: 280px;
  max-height: 380px;
}

/* Quick Add Popup */
.quick-add-popup {
  position: fixed;
  width: 320px;
  max-height: 450px;
  background: var(--modeler-color-bg-primary);
  border-radius: var(--modeler-radius-xl);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.quick-add-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--modeler-color-bg-surface);
  border-bottom: 1px solid var(--modeler-color-border-light);
}

.quick-add-popup-header h2 {
  margin: 0;
  font-size: var(--modeler-font-size-lg);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
}

.quick-add-popup-close {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--modeler-color-text-secondary);
  border-radius: var(--modeler-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--modeler-duration-default), color var(--modeler-duration-default);
}

.quick-add-popup-close:hover {
  background: var(--modeler-color-border-light);
  color: var(--modeler-color-text-primary);
}

.quick-add-popup-search {
  position: relative;
  padding: 8px 12px;
  border-bottom: 1px solid var(--modeler-color-border-light);
}

.quick-add-popup-search .search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--modeler-color-text-tertiary);
  pointer-events: none;
}

.quick-add-popup-search input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-lg);
  outline: none;
  font-size: var(--modeler-font-size-base);
  padding: 8px 12px 8px 32px;
  background: var(--modeler-color-bg-surface);
}

.quick-add-popup-search input:focus {
  border-color: var(--modeler-color-selection);
  background: var(--modeler-color-bg-primary);
}

.quick-add-popup-search input::placeholder {
  color: var(--modeler-color-text-tertiary);
}

.quick-add-popup-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--modeler-color-border-light);
  background: var(--modeler-color-bg-surface);
}

.quick-add-popup-categories .category-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-secondary);
  cursor: pointer;
  transition: var(--modeler-transition-default);
}

.quick-add-popup-categories .category-btn:hover {
  border-color: var(--modeler-color-selection);
  color: var(--modeler-color-selection);
}

.quick-add-popup-categories .category-btn.active {
  background: var(--modeler-color-primary);
  border-color: var(--modeler-color-primary);
  color: white;
}

.quick-add-popup-components {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  max-height: 280px;
}

.quick-add-popup-empty {
  padding: 24px;
  text-align: center;
  color: var(--modeler-color-text-tertiary);
  font-size: var(--modeler-font-size-base);
}

.quick-add-component-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 2px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-lg);
  margin-bottom: 4px;
  cursor: pointer;
  transition: var(--modeler-transition-fast);
  text-align: left;
}

.quick-add-component-item:hover {
  border-color: var(--modeler-color-selection);
  background: var(--modeler-color-info-light);
}

.quick-add-component-item .component-category-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--modeler-radius-md);
  background: var(--modeler-color-bg-muted);
  color: var(--modeler-color-text-secondary);
  flex-shrink: 0;
}

.quick-add-component-item .component-category-indicator[data-category="Actions"] {
  background: var(--modeler-color-type-action-light);
  color: var(--modeler-color-type-action);
}

.quick-add-component-item .component-category-indicator[data-category="Conditions"],
.quick-add-component-item .component-category-indicator[data-category="Decisions"] {
  background: var(--modeler-color-primary-light);
  color: var(--modeler-color-type-condition);
}

.quick-add-component-item .component-category-indicator[data-category="Gateways"] {
  background: var(--modeler-color-type-gateway-light);
  color: var(--modeler-color-type-gateway);
}

.quick-add-component-item .component-label {
  flex: 1;
  font-size: var(--modeler-font-size-base);
  color: var(--modeler-color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-add-component-item.favorite {
  background: var(--modeler-color-favorite-bg);
  border-color: var(--modeler-color-warning-border);
}

.quick-add-component-item.favorite:hover {
  background: var(--modeler-color-warning-light);
  border-color: var(--modeler-color-warning);
}

.quick-add-component-item .favorite-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--modeler-color-warning);
  flex-shrink: 0;
}

.quick-add-component-item .favorite-indicator svg {
  fill: var(--modeler-color-warning);
}

.quick-add-divider {
  height: 1px;
  background: var(--modeler-color-border-light);
  margin: 8px 0;
}

/* Documentation button in quick-add popups */
.quick-add-documentation-btn {
  margin-left: auto;
  padding: 2px;
  background: transparent;
  border: none;
  color: var(--modeler-color-text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--modeler-radius-md);
  transition: var(--modeler-transition-fast);
  flex-shrink: 0;
}

.quick-add-documentation-btn:hover {
  color: var(--modeler-color-selection);
  background: rgba(64, 153, 255, 0.1);
}

/* Quick Add Event Button - toolbar button style
 * Uses --modeler-color-type-event-btn(-hover) which are tuned
 * for white foreground text (WCAG AA ≥ 4.5:1 in both modes). */
.quick-add-event-button {
  background: var(--modeler-color-type-event-btn);
  color: white;
  border-color: var(--modeler-color-type-event-btn);
  white-space: nowrap;
}

.quick-add-event-button:hover {
  background: var(--modeler-color-type-event-btn-hover);
  border-color: var(--modeler-color-type-event-btn-hover);
}

.quick-add-event-button:active {
  opacity: 0.9;
}

/* Event-specific popup styling */
.quick-add-event-popup {
  width: 320px;
  max-height: 420px;
}

.quick-add-event-popup .quick-add-popup-header {
  background: linear-gradient(135deg, var(--modeler-color-type-event-light) 0%, var(--modeler-color-type-event-lighter) 100%);
}

.quick-add-event-popup .quick-add-popup-header h2 {
  color: var(--modeler-color-type-event-dark);
}

.quick-add-event-popup .quick-add-component-item:hover {
  background: var(--modeler-color-type-event-light);
  border-color: var(--modeler-color-type-event-border);
}

.quick-add-event-popup .component-category-indicator {
  color: var(--modeler-color-type-event);
}

/* Start Node */
.start-node {
  border-color: var(--modeler-color-type-event);
}


.start-node .node-header {
  background: var(--modeler-color-type-event-light);
  color: var(--modeler-color-warning-darker);
}

.start-icon {
  font-size: var(--modeler-font-size-4xl);
  color: var(--modeler-color-type-event);
  margin-bottom: 8px;
}

/* Gateway Node */
.gateway-node {
  min-width: auto;
  background: transparent;
  border: none;
  box-shadow: none;
}


.gateway-diamond {
  background: var(--modeler-color-bg-primary);
  border: 2px solid var(--modeler-color-type-gateway);
  transform: rotate(45deg);
  margin: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 10px;
  position: relative;
  box-sizing: border-box;
}


.gateway-diamond .node-body {
  transform: rotate(-45deg);
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 100%;
  height: 100%;
}

.gateway-diamond .lock-icon-rotated {
  transform: rotate(-45deg);
  position: absolute;
  top: 5px;
  right: 5px;
  color: var(--modeler-color-text-secondary);
  font-size: var(--modeler-font-size-md);
}

.gateway-diamond .node-label {
  font-size: var(--modeler-font-size-sm);
  font-weight: 500;
  color: var(--modeler-color-text-primary);
  text-align: center;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 90%;
  line-height: 1.2;
}


/* Subprocess Node */
.subprocess-node {
  border-style: dashed;
  border-color: var(--modeler-color-type-condition);
}


.subprocess-body {
  padding: 16px;
}

.subprocess-icon {
  font-size: var(--modeler-font-size-4xl);
  color: var(--modeler-color-type-condition);
  margin-bottom: 8px;
}

.subflow-count {
  margin-top: 8px;
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-secondary);
  background: var(--modeler-color-bg-muted);
  padding: 4px 8px;
  border-radius: var(--modeler-radius-2xl);
  display: inline-block;
}

/* Metadata Modal */
.metadata-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--modeler-color-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.metadata-modal {
  background: var(--modeler-color-bg-primary);
  border-radius: var(--modeler-radius-xl);
  box-shadow: var(--modeler-shadow-lg);
  width: 600px;
  max-width: 90vw;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.metadata-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--modeler-color-border-light);
  background: var(--modeler-color-bg-surface);
}

.metadata-modal-header h2 {
  margin: 0;
  font-size: var(--modeler-font-size-2xl);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
}

.metadata-form {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  box-sizing: border-box;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: var(--modeler-font-size-lg);
  font-weight: 500;
  color: var(--modeler-color-text-primary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-lg);
  font-family: inherit;
  box-sizing: border-box;
  background: var(--modeler-color-bg-primary);
  color: var(--modeler-color-text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--modeler-color-selection);
  box-shadow: 0 0 0 2px var(--modeler-color-selection-ring);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group small {
  display: block;
  margin-top: 4px;
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
}

.form-value-display {
  padding: 10px;
  background: var(--modeler-color-bg-canvas);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-lg);
  font-family: monospace;
  color: var(--modeler-color-text-secondary);
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
}

.checkbox-group label {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  margin-bottom: 0;
  font-weight: normal;
}

.checkbox-group input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  margin-top: 2px;
}

.checkbox-group .checkmark {
  flex-shrink: 0;
}

.checkbox-group small {
  margin-left: 20px;
  margin-top: 4px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 20px;
  border-top: 1px solid var(--modeler-color-border-light);
  margin-top: 20px;
}

.btn {
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-lg);
  font-weight: 500;
  cursor: pointer;
  transition: var(--modeler-transition-default);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-secondary {
  background: var(--modeler-color-bg-canvas);
  color: var(--modeler-color-text-primary);
  border: 1px solid var(--modeler-color-border-light);
}

.btn-secondary:hover {
  background: var(--modeler-color-bg-muted);
}

.btn-primary {
  background: var(--modeler-color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--modeler-color-primary-hover);
}

/* React Flow Overrides */
.react-flow__node {
  font-family: inherit;
}

.react-flow__edge-path {
  stroke: var(--modeler-color-edge-default);
  stroke-width: 2;
}

.react-flow__edge.selected .react-flow__edge-path {
  stroke: var(--modeler-color-selection);
  stroke-width: 3;
  filter: drop-shadow(0 0 4px rgba(64, 153, 255, 0.4));
}

/* Locked edge styles */
.react-flow__edge.edge-locked path {
  stroke: var(--modeler-color-edge-locked) !important;
  stroke-width: 1 !important;
  opacity: 0.6;
}

.react-flow__handle {
  width: 10px;
  height: 10px;
}

.react-flow__controls {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: var(--modeler-radius-xl);
}

.react-flow__minimap {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: var(--modeler-radius-xl);
}

/* ReactFlow attribution link – override upstream #999 text color
   which fails WCAG AA contrast (2.85:1 on light backgrounds).
   gray-500 (#6b7280) achieves ≥ 4.6:1 on the semi-transparent white
   attribution background in both light and dark mode. */
.react-flow__attribution a {
  color: var(--modeler-color-text-tertiary);
}

/* Configuration Form */
.loading {
  text-align: center;
  color: var(--modeler-color-text-secondary);
  font-style: italic;
  padding: 20px;
}

.configuration-form {
  background: var(--modeler-color-bg-surface);
  padding: 16px;
  border-radius: var(--modeler-radius-lg);
  border: 1px solid var(--modeler-color-border-light);
  margin-top: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.form-field {
  margin-bottom: 16px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--modeler-font-size-base);
  font-weight: 500;
  color: var(--modeler-color-text-primary);
}

.field-label .required {
  color: var(--modeler-color-danger);
  margin-left: 2px;
}

.field-input {
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-lg);
  background: var(--modeler-color-bg-primary);
  color: var(--modeler-color-text-primary);
  box-sizing: border-box;
}

.form-control:focus {
  outline: none;
  border-color: var(--modeler-color-selection);
  box-shadow: 0 0 0 1px var(--modeler-color-selection);
}

.checkbox-wrapper,
.radio-wrapper {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  cursor: pointer;
}

.checkbox-wrapper input,
.radio-wrapper input {
  margin-right: 8px;
  cursor: pointer;
}

.checkbox-label,
.radio-label {
  font-size: var(--modeler-font-size-lg);
  color: var(--modeler-color-text-primary);
  cursor: pointer;
}

.checkbox-group,
.radio-group {
  padding: 8px 0;
}

.field-description {
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.no-configuration {
  text-align: center;
  color: var(--modeler-color-text-secondary);
  font-style: italic;
  padding: 16px;
}

/* Markup Field Styling */
.markup-title {
  font-size: var(--modeler-font-size-lg);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
  margin: 0 0 8px 0;
}

.markup-content {
  padding: 12px;
  border-radius: var(--modeler-radius-md);
  line-height: 1.5;
  color: var(--modeler-color-text-primary);
}

.markup-content p {
  margin: 0 0 8px 0;
}

.markup-content p:last-child {
  margin-bottom: 0;
}

.markup-content a {
  color: var(--modeler-color-selection);
  text-decoration: none;
}

.markup-content a:hover {
  text-decoration: underline;
}

.markup-content strong {
  font-weight: 600;
}

.markup-content em {
  font-style: italic;
}

.markup-content code {
  background: var(--modeler-color-bg-muted);
  padding: 2px 4px;
  border-radius: var(--modeler-radius-sm);
  font-family: monospace;
  font-size: var(--modeler-font-size-base);
}

/* Property Panel Header */
.workflow-property-panel .panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 48px;
  position: relative;
}

.component-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.component-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.component-info svg {
  font-size: var(--modeler-font-size-2xl);
  color: var(--modeler-color-text-primary);
}

.component-type {
  font-size: var(--modeler-font-size-xl);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
}

.empty-header {
  width: 100%;
}

/* Header actions area */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Info button in header */
.header-info-btn {
  padding: 6px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--modeler-transition-default);
  width: 28px;
  height: 28px;
  color: var(--modeler-color-text-secondary);
}

.header-info-btn:hover {
  background: var(--modeler-color-bg-muted);
  border-color: var(--modeler-color-text-tertiary);
  color: var(--modeler-color-text-primary);
}

.header-info-btn svg {
  width: 16px;
  height: 16px;
}

/* Info Popup */
.info-popup {
  position: absolute;
  top: 48px;
  right: 12px;
  z-index: 100;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  max-width: 320px;
}

.info-popup-content {
  padding: 12px;
}

.info-popup-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 4px 0;
  font-size: var(--modeler-font-size-md);
}

.info-popup-item:not(:last-child) {
  border-bottom: 1px solid var(--modeler-color-border-light);
  padding-bottom: 6px;
  margin-bottom: 2px;
}

.info-popup-label {
  color: var(--modeler-color-text-secondary);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.info-popup-value {
  color: var(--modeler-color-text-primary);
  text-align: right;
  word-break: break-all;
  flex: 1;
}

.info-popup-value.error {
  color: var(--modeler-color-danger);
  font-weight: 500;
}

/* Lock button in header */
.header-lock-btn {
  padding: 6px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--modeler-transition-default);
  width: 28px;
  height: 28px;
}

.header-lock-btn:hover:not(:disabled) {
  background: var(--modeler-color-bg-muted);
  border-color: var(--modeler-color-text-tertiary);
}

.header-lock-btn.locked {
  background: var(--modeler-color-danger-lighter);
  border-color: var(--modeler-color-danger);
  color: var(--modeler-color-danger);
}

.header-lock-btn.locked:hover:not(:disabled) {
  background: var(--modeler-color-danger-light);
  border-color: var(--modeler-color-danger-hover);
}

.header-lock-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.header-lock-btn svg {
  width: 16px;
  height: 16px;
}

/* Replay load button in property panel header */
.header-replay-btn {
  padding: 6px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--modeler-transition-default);
  width: 28px;
  height: 28px;
  color: var(--modeler-color-text-secondary);
}

.header-replay-btn:hover:not(:disabled) {
  background: var(--modeler-color-primary-lighter);
  border-color: var(--modeler-color-primary);
  color: var(--modeler-color-primary);
}

.header-replay-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.header-replay-btn svg {
  width: 16px;
  height: 16px;
}

.header-replay-btn .spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loading-indicator {
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
  font-style: italic;
}

/* Component Description */
.component-description {
  background: var(--modeler-color-bg-surface);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-lg);
  padding: 12px;
  margin: 16px 0;
  font-size: var(--modeler-font-size-base);
  line-height: 1.4;
  color: var(--modeler-color-text-secondary);
}

/* Property Panel Resize Handle */
.resize-handle {
  position: absolute;
  left: 0; /* Default to left side */
  top: 0;
  bottom: 0;
  width: 4px;
  cursor: ew-resize;
  background: transparent;
  z-index: 10;
}

/* Right side resize handle */
.resize-handle-right {
  right: 0;
  left: auto;
}

.resize-handle:hover {
  background: var(--modeler-color-selection);
}

.workflow-property-panel.resizing {
  transition: none;
  user-select: none;
}

.workflow-property-panel.resizing * {
  pointer-events: none;
}

/* Component Panel and Replay Panel resize states */
.workflow-component-panel.resizing,
.replay-panel.resizing {
  transition: none;
  user-select: none;
}

.workflow-component-panel.resizing *,
.replay-panel.resizing * {
  pointer-events: none;
}

/* Disabled state for locked mode */
.workflow-property-panel input:disabled,
.workflow-property-panel textarea:disabled,
.workflow-property-panel select:disabled {
  background-color: var(--modeler-color-bg-muted);
  color: var(--modeler-color-text-secondary);
  cursor: not-allowed;
  opacity: 0.8;
}

.workflow-property-panel input[type="checkbox"]:disabled,
.workflow-property-panel input[type="radio"]:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}



/* Configuration Section */
.configuration-section {
  margin-top: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Confirmation Dialog Styles */
.confirm-dialog-overlay {
  position: fixed;
  inset: 0;
  background: var(--modeler-color-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.confirm-dialog {
  background: var(--modeler-color-bg-primary);
  border-radius: var(--modeler-radius-xl);
  box-shadow: var(--modeler-shadow-lg);
  width: 500px;
  max-width: 90vw;
  overflow: hidden;
}

.confirm-dialog-header {
  display: flex;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--modeler-color-border-light);
  background: var(--modeler-color-bg-surface);
  gap: 12px;
}

.confirm-dialog-icon {
  color: var(--modeler-color-warning);
  font-size: var(--modeler-font-size-4xl);
  display: flex;
  align-items: center;
}

.confirm-dialog-header h2 {
  margin: 0;
  font-size: var(--modeler-font-size-2xl);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
}

.confirm-dialog-body {
  padding: 20px;
}

.confirm-dialog-body p {
  margin: 0;
  font-size: var(--modeler-font-size-lg);
  color: var(--modeler-color-text-secondary);
  line-height: 1.5;
}

.confirm-dialog-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 20px;
  border-top: 1px solid var(--modeler-color-border-light);
  background: var(--modeler-color-bg-surface);
}

.btn-danger {
  background: var(--modeler-color-danger);
  color: white;
}

.modeler.dark-mode .btn-danger {
  background: #dc2626;
}

.btn-danger:hover {
  background: var(--modeler-color-danger-hover);
}

.modeler.dark-mode .btn-danger:hover {
  background: #b91c1c;
}

/* ===== Export Dialog ===== */

.export-dialog-overlay {
  position: fixed;
  inset: 0;
  background: var(--modeler-color-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
}

.export-dialog {
  background: var(--modeler-color-bg-primary);
  border-radius: var(--modeler-radius-xl);
  box-shadow: var(--modeler-shadow-lg);
  width: 520px;
  max-width: 90vw;
  overflow: hidden;
}

.export-dialog-header {
  display: flex;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--modeler-color-border-light);
  background: var(--modeler-color-bg-surface);
}

.export-dialog-header h2 {
  margin: 0;
  font-size: var(--modeler-font-size-2xl);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
}

.export-dialog-body {
  padding: 20px;
}

.export-dialog-instruction {
  margin: 0 0 16px;
  font-size: var(--modeler-font-size-lg);
  color: var(--modeler-color-text-secondary);
}

.export-format-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-format-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--modeler-color-bg-primary);
  border: 2px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-lg);
  cursor: pointer;
  transition: var(--modeler-transition-default);
  text-align: left;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
}

.export-format-option:hover {
  border-color: var(--modeler-color-primary);
  background: var(--modeler-color-bg-hover);
}

.export-format-option.selected {
  border-color: var(--modeler-color-primary);
  background: var(--modeler-color-bg-selected);
  box-shadow: 0 0 0 1px var(--modeler-color-primary);
}

.export-format-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--modeler-radius-md);
  background: var(--modeler-color-bg-surface);
  color: var(--modeler-color-primary);
  font-size: var(--modeler-font-size-2xl);
}

.export-format-option.selected .export-format-icon {
  background: var(--modeler-color-primary);
  color: white;
}

.export-format-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.export-format-label {
  font-weight: 600;
  font-size: var(--modeler-font-size-lg);
  color: var(--modeler-color-text-primary);
}

.export-format-description {
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-secondary);
  line-height: 1.4;
}

.export-options {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--modeler-color-bg-surface);
  border-radius: var(--modeler-radius-lg);
  border: 1px solid var(--modeler-color-border-light);
}

.export-option-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: var(--modeler-font-size-base);
  color: var(--modeler-color-text-primary);
}

.export-option-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--modeler-color-primary);
}

.export-required-modules {
  margin-top: 12px;
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-secondary);
  line-height: 1.5;
}

.export-modules-label {
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
  color: var(--modeler-color-text-primary);
}

.export-modules-list {
  font-family: monospace;
  font-size: var(--modeler-font-size-xs);
  word-break: break-word;
}

.export-dialog-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 20px;
  border-top: 1px solid var(--modeler-color-border-light);
  background: var(--modeler-color-bg-surface);
}

/* Edge highlighting during condition drag */
.react-flow__edge.workflow-edge-drop-target path {
  stroke: var(--modeler-color-success-drop) !important;
  stroke-width: 6px !important;
  stroke-dasharray: 8,4 !important;
  animation: workflow-edge-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes workflow-edge-pulse {
  0% {
    stroke: var(--modeler-color-success-drop);
    stroke-width: 6px;
  }
  100% {
    stroke: var(--modeler-color-success);
    stroke-width: 8px;
  }
}

.react-flow__edge.workflow-edge-drop-target .react-flow__edge-path {
  stroke: var(--modeler-color-success-drop) !important;
  stroke-width: 6px !important;
  stroke-dasharray: 8,4 !important;
}

/* Special highlighting for the currently hovered drop target */
.react-flow__edge.workflow-edge-hovered-target path {
  stroke: var(--modeler-color-success-drop-hover) !important;
  stroke-width: 10px !important;
  stroke-dasharray: 15,5 !important;
  animation: workflow-edge-hover-pulse 0.8s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 8px rgba(22, 163, 74, 0.6));
}

.react-flow__edge.workflow-edge-hovered-target .react-flow__edge-path {
  stroke: var(--modeler-color-success-drop-hover) !important;
  stroke-width: 10px !important;
  stroke-dasharray: 15,5 !important;
}

@keyframes workflow-edge-hover-pulse {
  0% {
    stroke: var(--modeler-color-success-drop-hover);
    stroke-width: 10px;
  }
  100% {
    stroke: #15803d;
    stroke-width: 12px;
  }
}

/* Canvas styling during condition drag */
.workflow-modeler-canvas.condition-drag-active {
  background: rgba(34, 197, 94, 0.05);
  cursor: crosshair;
}

.workflow-modeler-canvas.condition-drag-active .react-flow__pane {
  cursor: crosshair !important;
}

/* Visual overlay during condition drag */
.condition-drag-overlay {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(34, 197, 94, 0.9);
  color: white;
  padding: 12px 24px;
  border-radius: var(--modeler-radius-xl);
  font-weight: 600;
  font-size: var(--modeler-font-size-lg);
  pointer-events: none;
  z-index: 1000;
  box-shadow: var(--modeler-shadow-md);
  animation: workflow-overlay-pulse 2s ease-in-out infinite;
}

@keyframes workflow-overlay-pulse {
  0%, 100% {
    background: rgba(34, 197, 94, 0.9);
    transform: translateX(-50%) scale(1);
  }
  50% {
    background: rgba(16, 185, 129, 0.95);
    transform: translateX(-50%) scale(1.05);
  }
}

.drag-instruction {
  text-align: center;
  white-space: nowrap;
}

/* Condition edge label with delete button */
.condition-edge-label:hover .condition-delete-btn {
  opacity: 1 !important;
}

.condition-delete-btn:hover {
  background: var(--modeler-color-danger-delete) !important;
  color: white !important;
}

.react-flow__edge.selected path {
  stroke: var(--modeler-color-interactive) !important;
  stroke-width: 3 !important;
}

/* Selection box (lasso) styles */
.react-flow__selection {
  background: rgba(59, 130, 246, 0.08);
  border: 2px dashed var(--modeler-color-interactive);
  pointer-events: none;
}

/* Ensure selection container doesn't interfere after selection */
.react-flow__nodesselection {
  pointer-events: none !important;
}

/* Hide empty selection containers */
.react-flow__nodesselection:empty {
  display: none !important;
}

/* Force hide selection containers when they shouldn't be visible */
.react-flow__pane:not(.selection) .react-flow__nodesselection {
  visibility: hidden !important;
  opacity: 0 !important;
  display: none !important;
}

/* Multi-selection handled by individual node selection styles above */


/* Replacement target styles */
.react-flow__node.replace-target {
  box-shadow: 0 0 0 4px var(--modeler-color-warning), 0 0 0 8px rgba(245, 158, 11, 0.5) !important;
  background-color: rgba(245, 158, 11, 0.1);
  animation: replacePulse 1.5s infinite;
}

.workflow-edge-replace-target path {
  stroke: var(--modeler-color-warning) !important;
  stroke-width: 8 !important;
  animation: replacePulse 1.5s infinite;
}

@keyframes replacePulse {
  0%, 100% {
    opacity: 0.8;
  }
  50% {
    opacity: 1;
  }
}

/* Annotation styles */
.node-has-annotation .annotation-label {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--modeler-color-warning-light);
  border: 1px solid var(--modeler-color-warning);
  border-radius: var(--modeler-radius-md);
  padding: 4px 8px;
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-warning-darkest);
  white-space: nowrap;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 2px 4px var(--modeler-color-shadow-light);
}

.node-has-annotation .annotation-label::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--modeler-color-warning);
}

.edge-label-container .annotation-label {
  position: relative;
  margin-top: 4px;
  background: var(--modeler-color-warning-light);
  border: 1px solid var(--modeler-color-warning);
  border-radius: var(--modeler-radius-md);
  padding: 4px 8px;
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-warning-darkest);
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: all;
  z-index: 10;
  box-shadow: 0 2px 4px var(--modeler-color-shadow-light);
  cursor: help;
}

/* Annotation label positioned above condition label */
.edge-label-container .annotation-label-offset {
  position: absolute;
  bottom: 100%;
  margin-bottom: var(--modeler-spacing-md);
  left: 50%;
  transform: translateX(-50%);
}

.annotation-icon {
  position: absolute;
  top: 0;
  right: calc(-1 * var(--modeler-icon-size) - var(--modeler-spacing-xs));
  width: var(--modeler-icon-size);
  height: var(--modeler-icon-size);
  background: none;
  border: none;
  border-radius: var(--modeler-radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--modeler-color-warning-dark);
  font-size: var(--modeler-font-size-xs);
  font-weight: bold;
  cursor: pointer;
  z-index: 11;
  padding: 0;
  transition: background-color var(--modeler-duration-default), color var(--modeler-duration-default);
}

.annotation-icon:hover {
  color: var(--modeler-color-warning-darker);
}

.annotation-icon.active {
  background: var(--modeler-color-warning-darkest);
  color: var(--modeler-color-text-on-dark);
}

.annotation-icon.active:hover {
  background: var(--modeler-color-warning-darker);
  color: var(--modeler-color-text-on-dark);
}

.node-has-annotation {
  position: relative;
}

.node-has-annotation .annotation-icon {
  display: flex;
}

/* Gateway nodes: position icon to the right of the diamond's top center */
.gateway-node.node-has-annotation .annotation-icon {
  top: 10px;
  right: calc(50% - var(--modeler-icon-size) - var(--modeler-spacing-xs));
}

/* Show full annotation on hover */
.node-has-annotation .annotation-label:hover,
.edge-label-container .annotation-label:hover {
  max-width: none;
  white-space: normal;
  word-wrap: break-word;
  z-index: 1000;
}

/* Search highlighting styles */
.react-flow__node.search-highlighted {
  box-shadow: 0 0 0 4px var(--modeler-color-warning), 0 0 0 8px rgba(245, 158, 11, 0.3) !important;
  animation: searchPulse 2s infinite;
}

.react-flow__edge.search-highlighted path {
  stroke: var(--modeler-color-warning) !important;
  stroke-width: 4 !important;
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.5));
  animation: searchPulse 2s infinite;
}

@keyframes searchPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Toolbar separator */
.toolbar-separator {
  width: 1px;
  height: 24px;
  background: var(--modeler-color-border-light);
  margin: 0 8px;
  flex-shrink: 0;
}

/* Items collapsed into the overflow menu stay in the DOM (so the hook
   can measure them) but are hidden from view and layout. */
.toolbar-overflow-hidden {
  display: none !important;
}

/* ─── Toolbar Overflow Menu ─── */
.toolbar-overflow {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.toolbar-overflow-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 100;
  min-width: 200px;
  max-width: 280px;
  max-height: 400px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.toolbar-overflow-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-primary);
  transition: background 100ms ease;
  user-select: none;
}

.toolbar-overflow-item:hover {
  background: var(--modeler-color-bg-hover);
}

.toolbar-overflow-item:focus {
  outline: none;
  background: var(--modeler-color-bg-hover);
}

.toolbar-overflow-item.active {
  color: var(--modeler-color-type-condition);
  font-weight: 600;
}

.toolbar-overflow-item.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toolbar-overflow-item.disabled:hover {
  background: transparent;
}

.toolbar-overflow-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.toolbar-overflow-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Toolbar context selector */
.toolbar-context-select {
  padding: 4px 8px;
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-primary);
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  cursor: pointer;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: var(--modeler-transition-default);
}

.toolbar-context-select:hover {
  border-color: var(--modeler-color-border-hover);
}

.toolbar-context-select:focus {
  outline: none;
  border-color: var(--modeler-color-interactive);
  box-shadow: 0 0 0 2px var(--modeler-color-interactive-ring);
}

/* ─── Start Flow Filter ─── */
.start-flow-filter {
  position: relative;
  display: inline-flex;
}

.start-flow-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-primary);
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  cursor: pointer;
  max-width: 220px;
  white-space: nowrap;
  transition: var(--modeler-transition-default);
}

.start-flow-filter-toggle:hover {
  border-color: var(--modeler-color-border-hover);
}

.start-flow-filter-toggle:focus {
  outline: none;
  border-color: var(--modeler-color-interactive);
  box-shadow: 0 0 0 2px var(--modeler-color-interactive-ring);
}

.start-flow-filter-toggle.active {
  background: var(--modeler-color-primary-light);
  border-color: var(--modeler-color-type-condition);
  color: var(--modeler-color-text-primary);
}

.start-flow-filter-icon {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.start-flow-filter-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.start-flow-filter-chevron {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  transition: transform 150ms ease;
}

.start-flow-filter-chevron.open {
  transform: rotate(180deg);
}

.start-flow-filter-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  min-width: 200px;
  max-width: 300px;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.start-flow-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-primary);
  transition: background 100ms ease;
  user-select: none;
}

.start-flow-filter-option:hover {
  background: var(--modeler-color-bg-hover);
}

.start-flow-filter-option:focus {
  outline: none;
  background: var(--modeler-color-bg-hover);
}

.start-flow-filter-option.selected {
  font-weight: 600;
}

.start-flow-filter-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--modeler-color-interactive);
}

.start-flow-filter-option-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.start-flow-filter-divider {
  height: 1px;
  margin: 4px 8px;
  background: var(--modeler-color-border-light);
  list-style: none;
}

/* Replay highlighted edges - maintain color even when selected */
.react-flow__edge-path.replay-highlighted {
  stroke-opacity: 1 !important;
}

/* Override default ReactFlow selection styles for replay-highlighted edges */
.react-flow__edge.selected .react-flow__edge-path.replay-highlighted {
  stroke-opacity: 1 !important;
}

/* Force replay highlight colors to override selection */
.react-flow__edge.selected g[style*="stroke"] path {
  stroke: inherit !important;
}

/* Ensure replay-highlighted edges keep their color */
g[style*="#10b981"] path,
g[style*="#ef4444"] path {
  stroke: inherit !important;
}

/* Edge control point styles */
.edge-control-point {
  pointer-events: all;
}

.edge-control-point circle {
  transition: var(--modeler-transition-default);
}

.edge-control-point:hover circle:first-child {
  r: 10;
  stroke-width: 3;
}

/* === Edge Control Point Wrapper (extracted from inline styles) === */
.edge-control-point-wrapper {
  position: absolute;
  pointer-events: all;
  z-index: 1000;
  cursor: grab;
}

.edge-control-point-wrapper:active {
  cursor: grabbing;
}

.edge-control-point-wrapper svg {
  overflow: visible;
}

.edge-control-point-wrapper .control-point-outer {
  fill: var(--modeler-color-bg-primary);
  stroke: var(--modeler-color-interactive);
  stroke-width: 3;
  filter: drop-shadow(0 2px 4px var(--modeler-color-shadow-strong));
}

.edge-control-point-wrapper .control-point-inner {
  fill: var(--modeler-color-interactive);
}

/* Edge guide line (dashed line from center to control point) */
.edge-guide-line {
  stroke: var(--modeler-color-interactive);
  stroke-width: 1;
  stroke-dasharray: 3,3;
  opacity: 0.5;
}

/* === Condition Edge Label (extracted from inline styles) === */
.condition-edge-label {
  background: var(--modeler-color-bg-primary);
  color: var(--modeler-color-text-primary);
  padding: 4px 8px;
  border-radius: var(--modeler-radius-md);
  border: 1px solid var(--modeler-color-border-light);
  font-size: var(--modeler-font-size-md);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 4px var(--modeler-color-shadow-light);
  z-index: 100;
}

.condition-edge-label-locked {
  background: var(--modeler-color-bg-canvas);
  border-color: var(--modeler-color-edge-default);
  opacity: 0.7;
  color: var(--modeler-color-text-secondary);
}

/* Condition delete button (extracted from inline styles) */
.condition-delete-btn {
  background: none;
  border: none;
  color: var(--modeler-color-text-secondary);
  cursor: pointer;
  padding: 2px;
  border-radius: var(--modeler-radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--modeler-duration-default);
}

/* Edge label positioning container */
.edge-label-container {
  position: absolute;
  pointer-events: all;
  display: flex;
  align-items: flex-start;
  gap: var(--modeler-spacing-sm);
}

/* Annotation icon on edges (inline positioning) */
.edge-label-container .annotation-icon {
  position: relative;
  top: 0;
  right: 0;
  width: var(--modeler-icon-size);
  height: var(--modeler-icon-size);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--modeler-color-warning-dark);
}

.edge-label-container .annotation-icon:hover {
  color: var(--modeler-color-warning-darker);
}

.edge-label-container .annotation-icon.active {
  background: var(--modeler-color-warning-darkest);
  color: var(--modeler-color-text-on-dark);
  border-radius: var(--modeler-radius-full);
}

.edge-label-container .annotation-icon.active:hover {
  background: var(--modeler-color-warning-darker);
  color: var(--modeler-color-text-on-dark);
}

/* === Edge Order Badge (extracted from inline styles) === */
.edge-order-badge {
  background: var(--modeler-color-interactive);
  color: var(--modeler-color-text-on-dark);
  border-radius: var(--modeler-radius-full);
  width: 16px;
  height: 16px;
  font-size: var(--modeler-font-size-xs);
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--modeler-color-bg-primary);
  box-shadow: 0 1px 2px var(--modeler-color-shadow-strong);
  user-select: none;
}

/* Edge order number wrapper (extracted from inline styles) */
.edge-order-number {
  position: absolute;
  pointer-events: all;
  z-index: 2000;
  cursor: grab;
}

.edge-order-number.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.edge-order-number.drag-over {
  box-shadow: 0 0 8px var(--modeler-color-interactive-glow);
}

/* === Replay Indicator (extracted from inline styles) === */
.replay-indicator {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: var(--modeler-radius-full);
  border: 2px solid var(--modeler-color-bg-primary);
  box-shadow: 0 2px 4px var(--modeler-color-shadow-strong);
  z-index: 1000;
  pointer-events: none;
}

/* Replay access denied node highlight */
.replay-access-denied {
  border: 2px solid var(--modeler-color-danger-soft) !important;
  box-shadow: var(--modeler-shadow-danger-glow) !important;
}

/* === Error Boundary (extracted from App.tsx inline styles) === */
.modeler-error-boundary {
  padding: 40px 20px;
  text-align: center;
  color: var(--modeler-color-danger);
}

.modeler-error-boundary details {
  margin-top: 10px;
  text-align: left;
}

.modeler-error-boundary pre {
  font-size: var(--modeler-font-size-md);
  overflow: auto;
  max-height: 200px;
}

.modeler-error-retry {
  margin-top: 12px;
  margin-bottom: 4px;
}

/* Error boundary variants for additional panels */
.panel-error-fallback.toolbar-error {
  min-height: 48px;
  padding: 8px;
}

.panel-error-fallback.component-panel-error {
  min-height: 200px;
}

.panel-error-fallback.modals-error {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-lg);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  min-height: auto;
  padding: 24px;
}

/* Visual feedback during edge dragging */
.react-flow__edge-path.selected {
  animation: none;
}

/* Inline search container in toolbar */
/* Search button wrapper: holds the toggle and the dropdown popup */
.toolbar-search-wrapper {
  position: relative;
  display: inline-flex;
}

/* Search popup: drops below the search icon button */
.toolbar-search-popup {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 320px;
  z-index: 100;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  padding: 8px;
}

/* Search Bar Styles */
.search-bar {
  position: relative;
  margin: 0;
  z-index: 1000;
}

.search-input-container {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-lg);
  overflow: hidden;
  box-shadow: var(--modeler-shadow-sm);
  height: 36px;
}

.search-input-container:focus-within {
  border-color: var(--modeler-color-interactive);
  box-shadow: 0 0 0 3px var(--modeler-color-interactive-ring);
}

.search-input {
  flex: 1;
  padding: 6px 12px 6px 36px;
  border: none;
  outline: none;
  font-size: var(--modeler-font-size-lg);
  color: var(--modeler-color-text-primary);
  background: transparent;
  height: 32px;
}

.search-input::placeholder {
  color: var(--modeler-color-text-secondary);
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--modeler-color-text-secondary);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-clear-btn {
  padding: 4px;
  background: none;
  border: none;
  color: var(--modeler-color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
}

.search-clear-btn:hover {
  color: var(--modeler-color-text-primary);
}

.search-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: none;
  border: none;
  border-left: 1px solid var(--modeler-color-border-light);
  color: var(--modeler-color-text-secondary);
  cursor: pointer;
  font-size: var(--modeler-font-size-md);
}

.search-dropdown-toggle:hover {
  background: var(--modeler-color-bg-surface);
}

.result-count {
  font-weight: 500;
}

.dropdown-icon {
  width: 14px;
  height: 14px;
  transition: transform var(--modeler-duration-default);
}

.dropdown-icon.open {
  transform: rotate(180deg);
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 6px var(--modeler-color-shadow-light);
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
}

.search-results {
  padding: 4px 0;
}

.search-result-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--modeler-color-bg-muted);
  transition: background-color var(--modeler-duration-fast);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover,
.search-result-item.highlighted {
  background: var(--modeler-color-bg-surface);
}

.search-result-item.selected {
  background: var(--modeler-color-primary-light);
  border-color: var(--modeler-color-primary-light);
}

.result-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2px;
}

.result-label {
  font-size: var(--modeler-font-size-lg);
  font-weight: 500;
  color: var(--modeler-color-text-emphasis);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-type {
  font-size: var(--modeler-font-size-sm);
  padding: 2px 6px;
  border-radius: var(--modeler-radius-md);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 8px;
}

.result-type.node {
  background: var(--modeler-color-primary-light);
  color: var(--modeler-color-primary-text);
}

.result-type.edge {
  background: var(--modeler-color-result-edge-bg);
  color: var(--modeler-color-data-boolean);
}

.result-subtitle {
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Multi-selection summary styles */
.selection-summary .summary-section {
  margin-bottom: 24px;
}

.selection-summary h4 {
  margin: 0 0 12px 0;
  font-size: var(--modeler-font-size-lg);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
}

.selection-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.selection-item {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--modeler-color-border-light);
  position: relative;
}

.selection-item:last-child {
  border-bottom: none;
}

/* Individual lock button in selection list */
.selection-lock-btn {
  margin-left: auto;
  padding: 4px 8px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--modeler-transition-default);
}

.selection-lock-btn:hover:not(:disabled) {
  background: var(--modeler-color-bg-muted);
  border-color: var(--modeler-color-text-tertiary);
}

.selection-lock-btn.locked {
  background: var(--modeler-color-danger-lighter);
  border-color: var(--modeler-color-danger);
  color: var(--modeler-color-danger);
}

.selection-lock-btn.locked:hover:not(:disabled) {
  background: var(--modeler-color-danger-light);
}

.selection-lock-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.selection-lock-btn svg {
  width: 14px;
  height: 14px;
}

.selection-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 12px;
  color: var(--modeler-color-text-secondary);
}

.selection-item-info {
  flex: 1;
  min-width: 0;
}

.selection-item-label {
  font-size: var(--modeler-font-size-lg);
  font-weight: 500;
  color: var(--modeler-color-text-emphasis);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.selection-item-type {
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
  margin-top: 2px;
}

.summary-actions {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--modeler-color-border-light);
}

/* Bulk lock/unlock actions */
.bulk-lock-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.bulk-action-btn {
  flex: 1;
  padding: 8px 12px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-md);
  cursor: pointer;
  font-size: var(--modeler-font-size-base);
  font-weight: 500;
  color: var(--modeler-color-text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--modeler-transition-default);
}

.bulk-action-btn:hover:not(:disabled) {
  background: var(--modeler-color-bg-muted);
  border-color: var(--modeler-color-text-tertiary);
}

.bulk-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.bulk-action-btn svg {
  width: 14px;
  height: 14px;
}

/* Delete all button - danger styling, full width below lock actions */
.bulk-delete-btn {
  width: 100%;
  margin-top: 8px;
  background: var(--modeler-color-bg-primary);
  border-color: var(--modeler-color-danger);
  color: var(--modeler-color-danger);
}

.bulk-delete-btn:hover:not(:disabled) {
  background: var(--modeler-color-danger);
  border-color: var(--modeler-color-danger);
  color: white;
}

.summary-note {
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
  margin: 0;
  font-style: italic;
}

/* Replay Panel Styles - Side panel layout */
.replay-panel {
  width: 350px;
  background: var(--modeler-color-bg-primary);
  border-right: 1px solid var(--modeler-color-border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  height: 100%;
  overflow: visible;
  position: relative;
}

.replay-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--modeler-color-bg-surface);
  border-bottom: 1px solid var(--modeler-color-border-light);
  flex-shrink: 0;
}

.replay-panel-header h3 {
  margin: 0;
  font-size: var(--modeler-font-size-lg);
  font-weight: 600;
  color: var(--modeler-color-text-emphasis);
  display: flex;
  align-items: center;
  gap: 8px;
}

.replay-panel-header h3 svg {
  width: 16px;
  height: 16px;
}

/* Replay entry selector dropdown */
.replay-entry-selector {
  position: relative;
  padding: 8px 16px;
  background: var(--modeler-color-bg-surface);
  border-bottom: 1px solid var(--modeler-color-border-light);
  flex-shrink: 0;
}

.replay-entry-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  font-size: var(--modeler-font-size-md);
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-md);
  background: var(--modeler-color-bg-primary);
  color: var(--modeler-color-text-emphasis);
  cursor: pointer;
  transition: var(--modeler-transition-default);
  text-align: left;
}

.replay-entry-toggle:hover {
  border-color: var(--modeler-color-primary);
}

.replay-entry-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.replay-entry-toggle .toggle-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--modeler-color-text-tertiary);
}

.replay-entry-toggle .toggle-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--modeler-color-text-tertiary);
  transition: transform 0.2s ease;
}

.replay-entry-toggle .toggle-chevron.open {
  transform: rotate(180deg);
}

.replay-entry-list {
  position: absolute;
  top: 100%;
  left: 16px;
  right: 16px;
  z-index: 20;
  max-height: 280px;
  overflow-y: auto;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-md);
  box-shadow: var(--modeler-shadow-lg);
  margin-top: 2px;
}

.replay-entry-item {
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--modeler-color-border-light);
  transition: background 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.replay-entry-item:last-child {
  border-bottom: none;
}

.replay-entry-item:hover {
  background: var(--modeler-color-bg-muted);
}

.replay-entry-item:focus {
  outline: none;
  background: var(--modeler-color-bg-muted);
}

.replay-entry-item.selected {
  background: var(--modeler-color-primary-lighter);
}

.replay-entry-item.selected:hover {
  background: var(--modeler-color-primary-light);
}

.replay-entry-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.replay-entry-row .entry-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--modeler-color-text-tertiary);
}

.replay-entry-row .entry-value {
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replay-entry-row .entry-value.entry-url {
  color: var(--modeler-color-text-tertiary);
  font-size: 11px;
}

.panel-close-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--modeler-radius-md);
  transition: var(--modeler-transition-default);
}

.panel-close-btn:hover {
  background: var(--modeler-color-border-light);
}

.replay-panel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 32px;
  text-align: center;
}

.replay-panel-empty .empty-icon {
  width: 48px;
  height: 48px;
  color: var(--modeler-color-border-default);
  margin-bottom: 16px;
}

.replay-panel-empty p {
  font-size: var(--modeler-font-size-lg);
  color: var(--modeler-color-text-secondary);
  margin: 0 0 8px 0;
}

.replay-panel-empty small {
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
}

.replay-panel-empty .empty-separator {
  margin: 8px 0;
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-tertiary);
  font-style: italic;
}

/* Header actions container */
.replay-panel-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Test button in replay panel header */
.header-test-btn {
  padding: 4px 10px;
  background: var(--modeler-color-primary);
  color: white;
  border: 1px solid var(--modeler-color-primary);
  border-radius: var(--modeler-radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: var(--modeler-font-size-md);
  font-weight: 500;
  transition: var(--modeler-transition-default);
  height: 28px;
  white-space: nowrap;
}

.header-test-btn:hover {
  background: var(--modeler-color-primary-hover);
  border-color: var(--modeler-color-primary-hover);
}

.header-test-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.header-test-btn svg {
  width: 14px;
  height: 14px;
}

/* Test waiting state */
.replay-test-waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  gap: 12px;
  color: var(--modeler-color-text-secondary);
  flex: 1;
}

.replay-test-waiting .test-spinner {
  width: 32px;
  height: 32px;
  color: var(--modeler-color-primary);
  animation: spin 1s linear infinite;
}

.replay-test-waiting h4 {
  margin: 0;
  font-size: var(--modeler-font-size-lg);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
}

.replay-test-waiting p {
  margin: 0;
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
  line-height: 1.5;
  max-width: 280px;
}

.replay-test-waiting .test-cancel-btn {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.replay-test-waiting .test-cancel-btn svg {
  width: 14px;
  height: 14px;
}

.replay-count {
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
  font-weight: normal;
}

.replay-control-section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

/* Replay Panel overrides (standalone side panel differences from base styles) */
.replay-panel .replay-controls {
  padding: 12px 16px;
}

.replay-panel .replay-steps {
  max-height: 300px;
  flex-shrink: 0;
  overflow-y: auto;
}

.replay-panel .replay-step {
  border-bottom: 1px solid var(--modeler-color-border-light);
  border-radius: 0;
  margin-bottom: 0;
  background: transparent;
  gap: 0;
}

.replay-panel .replay-step:hover {
  background: var(--modeler-color-bg-surface);
  border-color: var(--modeler-color-border-light);
}

.replay-panel .replay-step.current {
  border-left: 3px solid var(--modeler-color-primary);
  border-color: var(--modeler-color-border-light);
}

.replay-panel .step-indicator {
  margin-right: 10px;
  width: auto;
  height: auto;
}

.replay-panel .step-icon {
  margin-right: 6px;
}

.step-number {
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-secondary);
  font-weight: 500;
}

.step-content {
  flex: 1;
  min-width: 0;
}

.step-details {
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-secondary);
  margin-top: 2px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* Step Data Section in Replay Panel */
.step-data-section {
  border-top: 1px solid var(--modeler-color-border-light);
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  position: relative;
}

.step-data-section .data-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--modeler-color-bg-surface);
  border-bottom: 1px solid var(--modeler-color-border-light);
  flex-shrink: 0;
}

.step-data-section .data-header h4 {
  margin: 0;
  font-size: var(--modeler-font-size-base);
  font-weight: 600;
  color: var(--modeler-color-text-emphasis);
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-data-section .data-header h4 svg {
  width: 14px;
  height: 14px;
}

.step-data-section .data-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--modeler-color-bg-primary);
  min-height: 0;
}

/* Global Tokens Section - smaller than step data */
.global-tokens-section {
  flex: 0 1 auto;
  max-height: 30%;
}

/* Data Panel Styles */
.data-panel {
  position: fixed;
  top: 70px;
  right: 20px;
  bottom: 20px;
  width: 400px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-xl);
  box-shadow: var(--modeler-shadow-md);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.data-panel-toggle.collapsed {
  position: fixed;
  top: 70px;
  right: 20px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-xl);
  padding: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px var(--modeler-color-shadow-light);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--modeler-font-size-lg);
  color: var(--modeler-color-text-primary);
  transition: var(--modeler-transition-default);
}

.data-panel-toggle.collapsed:hover {
  background: var(--modeler-color-bg-surface);
  border-color: var(--modeler-color-border-hover);
}

.data-panel .data-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--modeler-color-bg-surface);
  border-bottom: 1px solid var(--modeler-color-border-light);
  border-radius: 8px 8px 0 0;
}

.data-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--modeler-color-text-primary);
}

.data-toggle-btn {
  background: none;
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  padding: 4px;
  cursor: pointer;
  transition: var(--modeler-transition-default);
}

.data-toggle-btn:hover {
  background: var(--modeler-color-bg-muted);
}

.data-panel .data-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.data-section {
  margin-bottom: 16px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  cursor: pointer;
  font-weight: 500;
  color: var(--modeler-color-text-primary);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--modeler-color-border-light);
  font-size: var(--modeler-font-size-md);
  width: 100%;
}

.section-header:hover {
  color: var(--modeler-color-primary);
}

.section-content {
  padding: 4px 0 0 12px;
}

.overview-item {
  display: flex;
  margin-bottom: 3px;
  font-size: var(--modeler-font-size-sm);
}

.overview-label {
  font-weight: 500;
  color: var(--modeler-color-text-secondary);
  min-width: 80px;
}

.overview-value {
  color: var(--modeler-color-text-primary);
  word-break: break-word;
}

.overview-value.error {
  color: var(--modeler-color-danger);
  font-weight: 500;
}

.data-item {
  display: flex;
  margin-bottom: 3px;
  font-size: var(--modeler-font-size-sm);
  line-height: 1.3;
}

.data-key {
  font-weight: 500;
  color: var(--modeler-color-primary);
  margin-right: 4px;
  min-width: fit-content;
}

.data-object .data-header, .data-array .data-header {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 1px 0;
  font-size: var(--modeler-font-size-xs);
  color: var(--modeler-color-text-secondary);
  background: transparent;
  border: none;
}

.data-object .data-header:hover, .data-array .data-header:hover {
  color: var(--modeler-color-text-primary);
}

.data-object .data-content, .data-array .data-content {
  margin-left: 12px;
  margin-top: 1px;
}

.copy-btn {
  background: none;
  border: none;
  color: var(--modeler-color-text-secondary);
  cursor: pointer;
  font-size: var(--modeler-font-size-sm);
  padding: 2px 4px;
  border-radius: var(--modeler-radius-xs);
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--modeler-transition-default);
}

.copy-btn:hover {
  background: var(--modeler-color-bg-muted);
  color: var(--modeler-color-text-primary);
}

.copied {
  color: var(--modeler-color-success-drop-hover);
  font-size: var(--modeler-font-size-xs);
}

.data-null { color: var(--modeler-color-text-secondary); font-style: italic; font-size: var(--modeler-font-size-xs); white-space: nowrap; }
.data-undefined { color: var(--modeler-color-text-secondary); font-style: italic; font-size: var(--modeler-font-size-xs); white-space: nowrap; }
.data-boolean { color: var(--modeler-color-data-boolean); font-weight: 500; font-size: var(--modeler-font-size-xs); white-space: nowrap; }
.data-number { color: var(--modeler-color-danger); font-weight: 500; font-size: var(--modeler-font-size-xs); white-space: nowrap; }
.data-string { color: var(--modeler-color-success-text); font-size: var(--modeler-font-size-xs); white-space: nowrap; }
.data-truncated { color: var(--modeler-color-text-secondary); font-size: var(--modeler-font-size-xxs); white-space: nowrap; }
.data-unknown { color: var(--modeler-color-text-secondary); font-size: var(--modeler-font-size-xs); white-space: nowrap; }

.no-data {
  text-align: center;
  padding: 20px;
  color: var(--modeler-color-text-secondary);
  font-style: italic;
}

/* Token Data Hierarchical Display */
.token-item, .token-group {
  margin: 2px 0;
}

.token-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 1px 2px;
  border-radius: var(--modeler-radius-xs);
  transition: background-color var(--modeler-duration-default);
  font-size: var(--modeler-font-size-sm);
  line-height: 1.3;
}

.token-header:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.token-label-group {
  display: flex;
  align-items: center;
  min-width: 0;
  flex-shrink: 0;
}

.token-label-group > div {
  display: flex;
  align-items: center;
  gap: 2px;
}

.token-label-spacer {
  display: inline-block;
  width: 10px; /* Same width as the chevron icon */
  flex-shrink: 0;
}

.token-label {
  font-weight: 500;
  color: var(--modeler-color-text-secondary);
  font-size: var(--modeler-font-size-sm);
  white-space: nowrap;
}

.token-string {
  color: var(--modeler-color-text-secondary);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: var(--modeler-font-size-xxs);
  margin-left: 2px;
}

.token-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--modeler-font-size-sm);
  text-align: right;
  white-space: nowrap;
  min-width: 0;
}

.token-value .data-string,
.token-value .data-number,
.token-value .data-boolean,
.token-value .data-null,
.token-value .data-undefined {
  font-size: var(--modeler-font-size-sm);
  white-space: nowrap;
}

.token-count {
  color: var(--modeler-color-text-secondary);
  font-size: var(--modeler-font-size-xs);
  margin-left: 2px;
  white-space: nowrap;
}

.token-content {
  margin-left: 12px;
  margin-top: 1px;
  border-left: 1px solid var(--modeler-color-border-light);
  padding-left: 6px;
}

.token-array-item, .token-object-item {
  margin: 1px 0;
}

/* Remove extra spacing when token items are direct children of section-content */
.section-content > div {
  margin: 1px 0;
}

/* Nested token groups */
.token-content .token-group {
  background: rgba(0, 0, 0, 0.005);
  border-radius: var(--modeler-radius-xs);
  padding: 1px;
}

.token-content .token-content {
  border-left-color: var(--modeler-color-border-default);
  margin-left: 10px;
  padding-left: 4px;
}

/* Make chevrons smaller */
.token-header svg {
  width: 10px;
  height: 10px;
}

/* Panel Tabs */
.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--modeler-color-border-light);
  background-color: var(--modeler-color-bg-surface);
  padding: 0;
  margin: 0;
}

.panel-tab {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--modeler-color-text-secondary);
  font-size: var(--modeler-font-size-lg);
  font-weight: 500;
  cursor: pointer;
  transition: var(--modeler-transition-default);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
}

.panel-tab:hover {
  background-color: var(--modeler-color-bg-muted);
  color: var(--modeler-color-text-primary);
}

.panel-tab.active {
  color: var(--modeler-color-interactive);
  border-bottom-color: var(--modeler-color-interactive);
  background-color: var(--modeler-color-bg-primary);
}

.panel-tab svg {
  width: 16px;
  height: 16px;
}

.panel-tab .tab-badge {
  background-color: var(--modeler-color-border-light);
  color: var(--modeler-color-text-secondary);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: var(--modeler-font-size-sm);
  font-weight: 600;
  line-height: 1;
  margin-left: 4px;
}

.panel-tab.active .tab-badge {
  background-color: var(--modeler-color-primary-light);
  color: var(--modeler-color-interactive);
}

/* Replay Tab */
.replay-tab {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.replay-tab-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 40px 20px;
  text-align: center;
}

.replay-tab-empty .empty-icon {
  width: 48px;
  height: 48px;
  color: var(--modeler-color-border-default);
  margin-bottom: 16px;
}

.replay-tab-empty p {
  font-size: var(--modeler-font-size-xl);
  color: var(--modeler-color-text-secondary);
  margin: 0 0 8px 0;
}

.replay-tab-empty small {
  font-size: var(--modeler-font-size-base);
  color: var(--modeler-color-text-secondary);
}

/* Replay Control Panel */
.replay-control-panel {
  flex: 0 0 auto;
  max-height: 50%;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--modeler-color-border-light);
  background-color: var(--modeler-color-bg-primary);
  overflow-y: auto;
  position: relative;
}

.replay-control-panel .replay-header {
  padding: 12px;
  border-bottom: 1px solid var(--modeler-color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--modeler-color-bg-surface);
}

.replay-control-panel .replay-header h3 {
  margin: 0;
  font-size: var(--modeler-font-size-lg);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.replay-control-panel .replay-header h3 svg {
  width: 16px;
  height: 16px;
  color: var(--modeler-color-text-secondary);
}

.replay-control-panel .replay-count {
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
  font-weight: normal;
  margin-left: 4px;
}


/* Replay Controls */
.replay-controls {
  padding: 8px 12px;
  background-color: var(--modeler-color-bg-surface);
  border-bottom: 1px solid var(--modeler-color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.playback-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.control-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--modeler-radius-md);
  border: 1px solid var(--modeler-color-border-light);
  background-color: var(--modeler-color-bg-primary);
  color: var(--modeler-color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--modeler-transition-default);
  flex-shrink: 0;
}

.control-btn:hover:not(:disabled) {
  background-color: var(--modeler-color-bg-muted);
  border-color: var(--modeler-color-border-default);
  color: var(--modeler-color-text-primary);
}

.control-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.control-btn.play-btn.playing {
  background-color: var(--modeler-color-danger-soft);
  border-color: var(--modeler-color-danger-soft);
  color: white;
}

.modeler.dark-mode .control-btn.play-btn.playing {
  background-color: #dc2626;
  border-color: #dc2626;
}

.control-btn.play-btn.playing:hover {
  background-color: var(--modeler-color-danger);
  border-color: var(--modeler-color-danger);
}

.modeler.dark-mode .control-btn.play-btn.playing:hover {
  background-color: #b91c1c;
  border-color: #b91c1c;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 1;
  min-width: 0;
}

.speed-control .speed-icon {
  width: 14px;
  height: 14px;
  color: var(--modeler-color-text-secondary);
  flex-shrink: 0;
}

.speed-control select {
  padding: 4px 6px;
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-primary);
  background-color: var(--modeler-color-bg-primary);
  cursor: pointer;
  min-width: 0;
  width: 55px;
}

/* Replay Progress */
.replay-progress {
  padding: 12px 16px;
  background-color: var(--modeler-color-bg-primary);
  border-bottom: 1px solid var(--modeler-color-border-light);
}

.progress-bar {
  width: 100%;
  height: 6px;
  background-color: var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-sm);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background-color: var(--modeler-color-interactive);
  transition: width var(--modeler-duration-slow);
}

.progress-label {
  font-size: var(--modeler-font-size-md);
  color: var(--modeler-color-text-secondary);
  text-align: center;
}

/* Replay Steps */

.replay-step {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 4px;
  background-color: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-lg);
  cursor: pointer;
  transition: var(--modeler-transition-default);
  gap: 12px;
}

.replay-step:hover {
  background-color: var(--modeler-color-bg-surface);
  border-color: var(--modeler-color-border-default);
}

.replay-step.current {
  background-color: var(--modeler-color-primary-light);
  border-color: var(--modeler-color-interactive);
}

.replay-step.completed {
  opacity: 0.8;
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  position: relative;
}

.step-icon {
  width: 16px;
  height: 16px;
}

.step-icon.started {
  color: var(--modeler-color-success);
}

.step-icon.execute {
  color: var(--modeler-color-interactive);
}

.step-icon.add-successor {
  color: var(--modeler-color-accent-violet);
}

.step-icon.ignore-successor {
  color: var(--modeler-color-text-tertiary);
}

.step-icon.access-denied {
  color: var(--modeler-color-danger-soft);
}

.step-icon.default {
  color: var(--modeler-color-text-secondary);
}

.step-label {
  flex: 1;
  font-size: var(--modeler-font-size-base);
  color: var(--modeler-color-text-primary);
  font-weight: 500;
}

.replay-step.current .step-label {
  color: var(--modeler-color-primary-text);
}

/* Step Data Panel */
.step-data-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--modeler-color-bg-primary);
  overflow: hidden;
  min-height: 0;
}

.step-data-panel .data-header {
  padding: 12px;
  border-bottom: 1px solid var(--modeler-color-border-light);
  background-color: var(--modeler-color-bg-surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.step-data-panel .data-header h3 {
  margin: 0;
  font-size: var(--modeler-font-size-lg);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.step-data-panel .data-header h3 svg {
  width: 16px;
  height: 16px;
  color: var(--modeler-color-text-secondary);
}

.step-data-panel .copy-btn {
  padding: 4px 8px;
  background-color: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-md);
  color: var(--modeler-color-text-secondary);
  font-size: var(--modeler-font-size-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: var(--modeler-transition-default);
  position: relative;
}

.step-data-panel .copy-btn:hover {
  background-color: var(--modeler-color-bg-muted);
  border-color: var(--modeler-color-border-default);
  color: var(--modeler-color-text-primary);
}

.step-data-panel .copy-btn svg {
  width: 14px;
  height: 14px;
}

.step-data-panel .copy-btn .copied {
  position: absolute;
  right: calc(100% + 8px);
  background-color: var(--modeler-color-success);
  color: white;
  padding: 2px 6px;
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-sm);
  white-space: nowrap;
  animation: fadeInOut 2s forwards;
}

@keyframes fadeInOut {
  0% { opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { opacity: 0; }
}

.step-data-panel .data-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.step-data-panel .data-section {
  margin-bottom: 16px;
}

.step-data-panel .section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background-color: var(--modeler-color-bg-surface);
  border-radius: var(--modeler-radius-lg);
  cursor: pointer;
  transition: background-color var(--modeler-duration-default);
  font-size: var(--modeler-font-size-base);
  font-weight: 600;
  color: var(--modeler-color-text-primary);
  margin-bottom: 8px;
}

.step-data-panel .section-header:hover {
  background-color: var(--modeler-color-bg-muted);
}

.step-data-panel .section-header svg {
  width: 14px;
  height: 14px;
  color: var(--modeler-color-text-secondary);
}

.step-data-panel .section-content {
  padding: 8px;
  background-color: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-light);
  border-radius: var(--modeler-radius-lg);
}

.step-data-panel .overview-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 8px;
  font-size: var(--modeler-font-size-base);
}

.step-data-panel .overview-label {
  font-weight: 500;
  color: var(--modeler-color-text-secondary);
  margin-right: 8px;
  min-width: 100px;
}

.step-data-panel .overview-value {
  color: var(--modeler-color-text-primary);
  word-break: break-word;
}

.step-data-panel .overview-value.error {
  color: var(--modeler-color-danger-soft);
}

.step-data-panel .data-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 6px;
  font-size: var(--modeler-font-size-base);
}

.step-data-panel .data-key {
  font-weight: 500;
  color: var(--modeler-color-text-secondary);
  margin-right: 8px;
  min-width: 80px;
  word-break: break-word;
}

.step-data-panel .data-string {
  color: var(--modeler-color-success-text);
}

.step-data-panel .data-number {
  color: var(--modeler-color-danger);
}

.step-data-panel .data-boolean {
  color: var(--modeler-color-data-boolean);
}

.step-data-panel .data-null,
.step-data-panel .data-undefined {
  color: var(--modeler-color-text-secondary);
  font-style: italic;
}

.step-data-panel .data-array,
.step-data-panel .data-object {
  color: var(--modeler-color-text-primary);
}

.step-data-panel .data-truncated {
  color: var(--modeler-color-text-secondary);
  font-size: var(--modeler-font-size-md);
  font-style: italic;
  margin-left: 4px;
}


.step-data-panel .data-content.nested {
  margin-left: 16px;
  padding-left: 12px;
  border-left: 1px solid var(--modeler-color-border-light);
  margin-top: 4px;
}

/* Token Data Container */
.token-data-container {
  padding: 8px 12px;
  flex: 1;
  overflow-y: auto;
}



/* ContentEditable Wrapper */
.contenteditable-wrapper {
  position: relative;
}

/* ContentEditable Field Styling */
.contenteditable-field {
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-md);
  padding: 8px 12px;
  background-color: var(--modeler-color-bg-primary);
  font-size: var(--modeler-font-size-lg);
  line-height: 1.4;
  color: var(--modeler-color-text-primary);
  transition: border-color var(--modeler-duration-fast), box-shadow var(--modeler-duration-fast);
  outline: none;
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.contenteditable-field:focus {
  border-color: var(--modeler-color-interactive);
  box-shadow: 0 0 0 3px var(--modeler-color-interactive-ring);
}

.contenteditable-field.disabled {
  background-color: var(--modeler-color-bg-muted);
  color: var(--modeler-color-text-secondary);
  cursor: not-allowed;
}

.contenteditable-field.singleline {
  min-height: 32px;
  white-space: nowrap;
  overflow: hidden;
  resize: none;
}

.contenteditable-field.multiline {
  white-space: pre-wrap;
  resize: vertical;
  min-height: 60px;
  max-height: 200px;
  overflow-y: auto;
}

.contenteditable-field:empty:before {
  content: attr(data-placeholder);
  color: var(--modeler-color-text-secondary);
  pointer-events: none;
  position: absolute;
}

.contenteditable-field:focus:empty:before {
  content: "";
}

/* Ensure consistent styling with existing form controls */
.form-control.contenteditable-field {
  display: block;
  width: 100%;
  padding: 8px 12px;
  margin: 0;
}

/* Config Token Styling */
.config-token {
  display: inline;
  background-color: var(--modeler-color-token-bg);
  color: var(--modeler-color-token-text);
  border: 1px solid var(--modeler-color-token-border);
  border-radius: var(--modeler-radius-xl);
  padding: 1px 6px;
  margin: 0 1px;
  font-size: var(--modeler-font-size-md);
  font-weight: 500;
  cursor: grab;
  user-select: all;
  vertical-align: baseline;
  line-height: 1.3;
  white-space: nowrap;
  position: relative;
}

.config-token:active {
  cursor: grabbing;
}

.config-token:hover {
  background-color: var(--modeler-color-token-hover-bg);
  border-color: var(--modeler-color-token-hover-border);
}

.config-token:focus {
  outline: 2px solid var(--modeler-color-interactive);
  outline-offset: 1px;
}

/* Whole-pill selection: applied via JS when the selection intersects the token */
.config-token.selected {
  background-color: var(--modeler-color-interactive);
  border-color: var(--modeler-color-interactive);
  color: white;
}

/* Hide the default text selection highlight inside selected tokens */
.config-token.selected::selection {
  background-color: transparent;
  color: white;
}

/* Default text selection for non-JS-selected tokens (fallback) */
.config-token::selection {
  background-color: var(--modeler-color-interactive);
  color: white;
}

/* Token Edit Icon */
.token-edit-icon {
  position: absolute;
  transform: translate(-50%, -100%) translateY(-4px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-md);
  background: var(--modeler-color-bg-primary);
  color: var(--modeler-color-text-secondary);
  cursor: pointer;
  box-shadow: var(--modeler-shadow-sm);
  transition: var(--modeler-transition-fast);
  pointer-events: auto;
}

.token-edit-icon:hover {
  background: var(--modeler-color-primary-light);
  color: var(--modeler-color-primary);
  border-color: var(--modeler-color-primary);
}

/* Token Edit Popup */
.token-edit-popup {
  position: absolute;
  transform: translate(-50%, -100%) translateY(-4px);
  z-index: 20;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-lg);
  box-shadow: var(--modeler-shadow-md);
  padding: var(--modeler-spacing-md);
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: var(--modeler-spacing-sm);
}

/* When there's not enough space above, flip popup below the token */
.token-edit-popup.token-edit-popup-below {
  transform: translate(-50%, 4px);
}

.token-edit-input {
  width: 100%;
  padding: var(--modeler-spacing-xs) var(--modeler-spacing-md);
  border: 1px solid var(--modeler-color-border-default);
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-md);
  font-family: var(--modeler-font-mono);
  background: var(--modeler-color-bg-primary);
  color: var(--modeler-color-text-primary);
  outline: none;
  box-sizing: border-box;
}

.token-edit-input:focus {
  border-color: var(--modeler-color-interactive);
  box-shadow: 0 0 0 2px var(--modeler-color-interactive-ring);
}

.token-edit-actions {
  display: flex;
  gap: var(--modeler-spacing-xs);
  justify-content: flex-end;
}

.token-edit-save,
.token-edit-cancel {
  padding: var(--modeler-spacing-xs) var(--modeler-spacing-md);
  border-radius: var(--modeler-radius-md);
  font-size: var(--modeler-font-size-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--modeler-transition-fast);
}

.token-edit-save {
  background: var(--modeler-color-primary);
  color: white;
}

.token-edit-save:hover {
  background: var(--modeler-color-primary-hover);
}

.token-edit-cancel {
  background: var(--modeler-color-bg-secondary);
  color: var(--modeler-color-text-secondary);
  border-color: var(--modeler-color-border-default);
}

.token-edit-cancel:hover {
  background: var(--modeler-color-bg-tertiary);
  color: var(--modeler-color-text-primary);
}

/* Draggable Token Labels */
.token-label.draggable {
  cursor: grab;
  transition: var(--modeler-transition-default);
  border-radius: var(--modeler-radius-sm);
  padding: 1px 3px;
  margin: -1px -3px;
}

.token-label.draggable:hover {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--modeler-color-primary);
  font-weight: 600;
}

.token-label.draggable:active {
  cursor: grabbing;
  transform: scale(0.95);
}

/* Token expand/collapse button (used in ReplayDataRenderer) */
.token-expand-btn {
  display: flex;
  align-items: center;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--modeler-color-text-primary);
}

/* Expandable Token Labels (non-draggable) */
.token-header .token-label:not(.draggable) {
  cursor: inherit;
  transition: color var(--modeler-duration-default);
}

.token-header .token-label:not(.draggable):hover {
  color: var(--modeler-color-text-emphasis);
  font-weight: 600;
}

/* Drop zone indication for contenteditable fields */
.contenteditable-field.drag-over {
  border-color: var(--modeler-color-interactive);
  background-color: rgba(59, 130, 246, 0.05);
  box-shadow: 0 0 0 3px var(--modeler-color-interactive-ring);
}

/* Drop cursor animation */
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.drop-cursor {
  position: absolute;
  width: 2px;
  background-color: var(--modeler-color-interactive);
  pointer-events: none;
  z-index: 10;
  animation: blink 1s infinite;
  box-shadow: 0 0 1px rgba(59, 130, 246, 0.5);
}

/* Grip icon for draggable token labels */
.token-drag-icon {
  display: inline-flex;
  align-items: center;
  color: var(--modeler-color-text-muted);
  font-size: 12px;
  margin-right: 2px;
  opacity: 0.5;
  transition: opacity var(--modeler-duration-default);
  flex-shrink: 0;
}

.token-label-group:hover .token-drag-icon {
  opacity: 1;
  color: var(--modeler-color-primary);
}

/* Help text hint in Step Data section */
.token-drag-hint {
  margin: 0 0 8px 0;
  padding: 6px 10px;
  font-size: var(--modeler-font-size-sm);
  color: var(--modeler-color-text-secondary);
  background-color: var(--modeler-color-bg-secondary);
  border-radius: var(--modeler-radius-sm);
  border-left: 3px solid var(--modeler-color-interactive);
  line-height: 1.4;
}

/* Token-eligible field highlight during active token drag */
.contenteditable-field.token-drop-target {
  border-color: var(--modeler-color-interactive);
  box-shadow: 0 0 0 2px var(--modeler-color-interactive-ring);
  transition: border-color var(--modeler-duration-default), box-shadow var(--modeler-duration-default);
}

/* Non-eligible field dimming during active token drag */
.contenteditable-field.token-drop-rejected {
  cursor: not-allowed;
  border-color: var(--modeler-color-border-light);
  background-color: var(--modeler-color-bg-muted);
  color: var(--modeler-color-text-secondary);
}

/* Form field wrapper states during token drag */
.form-field.token-drop-enabled {
  /* Subtle positive indicator for the whole field group */
}

.form-field.token-drop-disabled {
  opacity: 0.6;
  transition: opacity var(--modeler-duration-default);
}

/* Native fields (label, annotation) disabled during token drag */
.modeler-native-field.token-drop-disabled {
  opacity: 0.6;
  transition: opacity var(--modeler-duration-default);
}

.modeler-native-field.token-drop-disabled input,
.modeler-native-field.token-drop-disabled textarea {
  cursor: not-allowed;
  pointer-events: none;
}

.step-data-panel .no-data {
  text-align: center;
  padding: 32px 16px;
  color: var(--modeler-color-text-secondary);
  font-size: var(--modeler-font-size-lg);
}

.step-data-panel .no-data p {
  margin: 0;
}

/* === CLEAN NODE SELECTION SYSTEM === */
/* Remove all ReactFlow default selection styling */
.react-flow__node.selected {
  box-shadow: none !important;
}

/* Single selection indicator for each node type */
.react-flow__node.selected .custom-node:not(.gateway-node) {
  border-color: var(--modeler-color-selection) !important;
  box-shadow: var(--modeler-shadow-selection) !important;
}

.react-flow__node.selected .start-node {
  border-color: var(--modeler-color-selection) !important;
  box-shadow: var(--modeler-shadow-selection) !important;
}

.react-flow__node.selected .gateway-diamond {
  border-color: var(--modeler-color-selection) !important;
  box-shadow: var(--modeler-shadow-selection) !important;
}

.react-flow__node.selected .subprocess-node {
  border-color: var(--modeler-color-selection) !important;
  box-shadow: var(--modeler-shadow-selection) !important;
}

/* Selection indication for edge conditions */
.condition-edge-label.selected {
  border-color: var(--modeler-color-selection) !important;
  box-shadow: var(--modeler-shadow-selection) !important;
}

/* Panel collapse handle indicators and collapsed states */
.panel-collapse-widget {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 40px;
  background: var(--modeler-color-bg-primary);
  border: 1px solid var(--modeler-color-collapse-line);
  border-radius: 4px;
  cursor: pointer;
  z-index: 15;
  opacity: 0.9;
  transition: width var(--modeler-duration-slow) ease,
              height var(--modeler-duration-slow) ease,
              background var(--modeler-duration-slow) ease,
              border-color var(--modeler-duration-slow) ease,
              opacity var(--modeler-duration-slow) ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--modeler-color-collapse-line);
  font-size: 10px;
  overflow: hidden;
  padding: 0;
}

.panel-collapse-widget:hover {
  width: 14px;
  height: 44px;
  background: var(--modeler-color-bg-surface);
  border-color: var(--modeler-color-collapse-hover);
  color: var(--modeler-color-collapse-hover);
  opacity: 1;
}

/* Arrow icon always visible, brightens on hover */
.collapse-icon {
  opacity: 0.6;
  transition: opacity var(--modeler-duration-slow);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.panel-collapse-widget:hover .collapse-icon {
  opacity: 1;
}

/* Collapsed panel states */
.workflow-component-panel.collapsed .panel-content,
.replay-panel.collapsed .panel-content,
.workflow-property-panel.collapsed .panel-content {
  display: none;
}

.workflow-component-panel.collapsed,
.replay-panel.collapsed,
.workflow-property-panel.collapsed {
  min-width: 40px;
  max-width: 40px;
  cursor: pointer;
}

.workflow-component-panel.collapsed:hover,
.replay-panel.collapsed:hover,
.workflow-property-panel.collapsed:hover {
  background: var(--modeler-color-bg-surface);
}

/* Position collapse handles on outer edges, straddling the panel border */
.workflow-component-panel .panel-collapse-widget {
  right: -6px;
  left: auto;
}

.replay-panel .panel-collapse-widget {
  left: -6px;
  right: auto;
}

.workflow-property-panel .panel-collapse-widget {
  left: -6px;
  right: auto;
}

/* Ensure collapsed panels still have proper borders and background */
.workflow-component-panel.collapsed {
  border-right: 1px solid var(--modeler-color-border-light);
  background: var(--modeler-color-bg-primary);
}

.replay-panel.collapsed {
  border-right: 1px solid var(--modeler-color-border-light);
  background: var(--modeler-color-bg-primary);
}

.workflow-property-panel.collapsed {
  border-left: 1px solid var(--modeler-color-border-light);
  background: var(--modeler-color-bg-primary);
}

/* Collapsed panel vertical labels */
.panel-collapsed-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  font-size: var(--modeler-font-size-sm);
  font-weight: 500;
  color: var(--modeler-color-collapse-label);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

/* Hide the collapse widget when panel is collapsed - the whole panel is clickable */
.workflow-component-panel.collapsed .panel-collapse-widget,
.replay-panel.collapsed .panel-collapse-widget,
.workflow-property-panel.collapsed .panel-collapse-widget {
  opacity: 0;
  pointer-events: none;
}

/* === MODAL STYLES === */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--modeler-color-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: var(--modeler-color-bg-primary);
  border-radius: var(--modeler-radius-xl);
  box-shadow: 0 10px 25px var(--modeler-color-shadow-strong);
  max-width: 90vw;
  max-height: 90vh;
  overflow: auto;
  animation: modalAppear 0.2s ease-out;
}

.search-modal {
  width: 600px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--modeler-color-border-light);
}

.modal-header h3 {
  margin: 0;
  color: var(--modeler-color-text-primary);
  font-size: var(--modeler-font-size-3xl);
  font-weight: 600;
}

.close-button {
  background: none;
  border: none;
  font-size: var(--modeler-font-size-4xl);
  color: var(--modeler-color-text-secondary);
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  border-radius: var(--modeler-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--modeler-transition-default);
}

.close-button:hover {
  background: var(--modeler-color-bg-canvas);
  color: var(--modeler-color-text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--modeler-color-border-light);
  background: var(--modeler-color-bg-surface);
}

/* .btn, .btn-secondary, .btn-secondary:hover defined in Metadata section above */

@keyframes modalAppear {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* =====================================================
   Documentation Popup Styles
   ===================================================== */

/* Documentation Button */
.documentation-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--modeler-color-text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--modeler-radius-md);
  transition: var(--modeler-transition-fast);
}

.documentation-btn:hover {
  color: var(--modeler-color-interactive);
  background: rgba(59, 130, 246, 0.1);
}

/* Documentation button in property panel header */
.header-documentation-btn {
  width: 28px;
  height: 28px;
  padding: 6px;
  color: var(--modeler-color-text-secondary);
}

.header-documentation-btn:hover {
  color: var(--modeler-color-interactive);
  background: rgba(59, 130, 246, 0.1);
}

/* Documentation button in component panel */
.component-documentation-btn {
  margin-left: auto;
  flex-shrink: 0;
}

.component-item .component-documentation-btn {
  opacity: 0;
  transition: opacity var(--modeler-duration-fast);
}

.component-item:hover .component-documentation-btn {
  opacity: 1;
}



/* Documentation Popup Overlay */
.documentation-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--modeler-color-bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Documentation Popup Container */
.documentation-popup {
  background: var(--modeler-color-bg-primary);
  border-radius: var(--modeler-radius-2xl);
  box-shadow: 0 25px 50px -12px var(--modeler-color-shadow-strong);
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Documentation Popup Header */
.documentation-popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--modeler-color-border-light);
  background: var(--modeler-color-bg-surface);
  border-radius: 12px 12px 0 0;
}

.documentation-popup-header h3 {
  margin: 0;
  font-size: var(--modeler-font-size-2xl);
  font-weight: 600;
  color: var(--modeler-color-text-emphasis);
}

.documentation-popup-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.documentation-external-link,
.documentation-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--modeler-radius-lg);
  border: none;
  background: none;
  color: var(--modeler-color-text-secondary);
  cursor: pointer;
  transition: var(--modeler-transition-fast);
  text-decoration: none;
}

.documentation-external-link:hover,
.documentation-close-btn:hover {
  background: var(--modeler-color-bg-muted);
  color: var(--modeler-color-text-emphasis);
}

/* Documentation Popup Content */
.documentation-popup-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  min-height: 200px;
}

/* Loading State */
.documentation-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--modeler-color-text-secondary);
  gap: 12px;
}

.documentation-loading .spinning {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Error State */
.documentation-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  color: var(--modeler-color-text-secondary);
}

.documentation-error p {
  margin: 0 0 16px 0;
}

.documentation-fallback-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--modeler-color-interactive);
  color: white;
  border-radius: var(--modeler-radius-lg);
  text-decoration: none;
  font-size: var(--modeler-font-size-lg);
  font-weight: 500;
  transition: background var(--modeler-duration-fast);
}

.documentation-fallback-link:hover {
  background: var(--modeler-color-primary);
}

/* Documentation Body Content */
.documentation-body {
  font-size: var(--modeler-font-size-lg);
  line-height: 1.6;
  color: var(--modeler-color-text-primary);
}

/* Style the documentation content */
.documentation-body h1,
.documentation-body h2,
.documentation-body h3,
.documentation-body h4,
.documentation-body h5,
.documentation-body h6 {
  color: var(--modeler-color-text-emphasis);
  margin-top: 24px;
  margin-bottom: 12px;
  font-weight: 600;
}

.documentation-body h1 {
  font-size: var(--modeler-font-size-4xl);
  border-bottom: 1px solid var(--modeler-color-border-light);
  padding-bottom: 8px;
}

.documentation-body h2 {
  font-size: var(--modeler-font-size-3xl);
}

.documentation-body h3 {
  font-size: var(--modeler-font-size-xl);
}

.documentation-body p {
  margin: 12px 0;
}

.documentation-body ul,
.documentation-body ol {
  margin: 12px 0;
  padding-left: 24px;
}

.documentation-body li {
  margin: 6px 0;
}

.documentation-body code {
  background: var(--modeler-color-bg-muted);
  padding: 2px 6px;
  border-radius: var(--modeler-radius-md);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: var(--modeler-font-size-base);
  color: var(--modeler-color-danger-text);
}

.documentation-body pre {
  background: var(--modeler-color-bg-code);
  color: var(--modeler-color-text-on-dark);
  padding: 16px;
  border-radius: var(--modeler-radius-xl);
  overflow-x: auto;
  margin: 16px 0;
}

.documentation-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.documentation-body a {
  color: var(--modeler-color-interactive);
  text-decoration: none;
}

.documentation-body a:hover {
  text-decoration: underline;
}

.documentation-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.documentation-body th,
.documentation-body td {
  border: 1px solid var(--modeler-color-border-light);
  padding: 8px 12px;
  text-align: left;
}

.documentation-body th {
  background: var(--modeler-color-bg-surface);
  font-weight: 600;
}

.documentation-body blockquote {
  border-left: 4px solid var(--modeler-color-interactive);
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--modeler-color-info-light);
  color: var(--modeler-color-primary-text);
}

.documentation-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--modeler-radius-xl);
  margin: 16px 0;
}

/* ===== Screen reader only (visually hidden, accessible to AT) ===== */
.modeler .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
