/* Chatterfy Flow Editor — Exact 1-to-1 tokens from index-DhekPcK3.css & flow-BnuhLJ6X.css */
:root {
  --flow-bg: #000000;
  --flow-text: #ecedee;
  --flow-white: #ffffff;
  --flow-muted: #a1a1aa;
  --flow-surface: #1c2236;
  --flow-surface-active: #2c3554;
  --flow-overlay: #0f1b2b;
  --flow-overlay-shadow: 0 0 1px 0 #ffffff4d inset;
  --flow-tooltip: #18181b;
  --flow-border: #ffffff26;
  --flow-line: #ffffff1f;
  --flow-default: #3f3f46;
  --flow-primary: #0384f6;
  --flow-primary-hover: #1c92fa;
  --flow-success: #17c964;
  --flow-warning: #f5a524;
  --flow-danger: #f31260;
  --flow-danger-soft: rgba(243, 18, 96, 0.15);
  --flow-secondary: #9353d3;
  --flow-edge: #b1b1b7;
  --flow-edge-dark: #3e3e3e;
  --flow-edge-selected: #727272;
  --flow-blue-500: #2b7fff;
  --flow-red-500: #fb2c36;
  --flow-pill-bg: #132036;
  --flow-pill-fg: #cbd5e1;
  --flow-pill-ring: rgb(32, 201, 151);
  --flow-field-radius: 14px;
}

.flow-page {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  color: var(--flow-text);
  background: transparent;
  border-radius: inherit;
  overflow: hidden;
  transition: grid-template-columns 300ms cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
}

.flow-page.flow-collapsed {
  grid-template-columns: 60px minmax(0, 1fr);
}

.flow-page button,
.flow-page input,
.flow-page select,
.flow-page textarea,
.flow-drawer button,
.flow-drawer input,
.flow-drawer select,
.flow-drawer textarea,
.flow-modal-form input,
.flow-modal-form select,
.flow-modal-form textarea {
  font: inherit;
}

/* ==================== Left Palette (220px -> 60px icon rail) ==================== */
.flow-palette {
  min-width: 0;
  height: 100%;
  padding: 18px 12px 18px 18px;
  border-right: 1px solid var(--flow-border);
  background: transparent;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  transition: padding 300ms cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  z-index: 6;
}

.flow-collapsed .flow-palette {
  padding: 18px 8px;
}

.flow-palette-title {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 28px;
  padding: 2px 4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--flow-text);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease;
}

.flow-palette-title svg {
  color: var(--flow-muted);
  flex: none;
  transition: color 150ms ease;
}

.flow-palette-title:hover svg,
.flow-palette-title:hover {
  color: var(--flow-white);
}

.flow-collapsed .flow-palette-title {
  justify-content: center;
  padding: 2px 0;
}

.flow-collapsed .flow-palette-title > span {
  display: none;
}

.flow-palette-groups {
  display: flex;
  flex-direction: column;
  margin-top: 14px;
  gap: 14px;
}

.flow-collapsed .flow-palette-groups {
  gap: 8px;
  align-items: center;
}

.flow-palette-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.flow-collapsed .flow-palette-group {
  width: 100%;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--flow-line);
}

.flow-collapsed .flow-palette-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.flow-palette-group h2 {
  margin: 0 0 4px;
  padding-left: 4px;
  color: var(--flow-muted);
  font-size: 12px;
  line-height: 18px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-collapsed .flow-palette-group h2 {
  display: none;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--flow-text);
  font-size: 14px;
  line-height: 20px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, opacity 150ms ease;
}

.flow-collapsed .flow-step {
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  justify-content: center;
}

.flow-collapsed .flow-step > span {
  display: none;
}

.flow-step svg {
  flex: none;
  color: var(--step-color);
}

.flow-step:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--flow-white);
}

.flow-step:active:not(:disabled) {
  cursor: grabbing;
}

.flow-step:disabled {
  opacity: 0.5;
  cursor: default;
}

.flow-step.flow-step-active {
  background: rgba(3, 132, 246, 0.18);
  color: var(--flow-white);
}

/* ==================== Note 16-Color Swatch Popover ==================== */
.flow-note-popover {
  position: fixed;
  z-index: 50;
  width: 124px;
  padding: 8px;
  border-radius: 10px;
  background: var(--flow-tooltip);
  border: 1px solid var(--flow-border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  display: grid;
  grid-template-columns: repeat(2, 50px);
  gap: 8px;
  animation: flow-pop-in 140ms cubic-bezier(0.22, 1, 0.36, 1);
}

.flow-note-swatch {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.flow-note-swatch:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}

.flow-note-banner {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 12;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--flow-tooltip);
  border: 1px solid var(--flow-border);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  color: var(--flow-text);
  animation: flow-pop-in 160ms ease;
}

.flow-note-banner-dot {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex: none;
}

.flow-note-banner button {
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  color: var(--flow-text);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  cursor: pointer;
}

.flow-note-banner button:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ==================== Workspace & Single-Row Top Toolbar ==================== */
.flow-workspace {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.flow-toolbar {
  position: absolute;
  z-index: 8;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.flow-toolbar > * {
  pointer-events: auto;
}

.flow-button {
  min-height: 30px;
  height: 30px;
  padding: 0 10px;
  display: inline-flex;
  flex: none;
  justify-content: center;
  align-items: center;
  gap: 6px;
  color: var(--flow-text);
  background: var(--flow-surface);
  border: 1px solid var(--flow-border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, opacity 150ms ease, transform 100ms ease;
}

.flow-button svg {
  flex: none;
}

.flow-button:hover:not(:disabled) {
  background: var(--flow-surface-active);
  border-color: rgba(255, 255, 255, 0.3);
}

.flow-button:active:not(:disabled) {
  transform: scale(0.98);
}

.flow-button:disabled {
  opacity: 0.5;
  cursor: default;
  pointer-events: none;
}

.flow-button.flow-primary {
  background: var(--flow-primary);
  border-color: transparent;
  color: var(--flow-white);
}

.flow-button.flow-primary:hover:not(:disabled) {
  background: var(--flow-primary-hover);
}

.flow-button.flow-secondary {
  background: var(--flow-default);
  border-color: transparent;
  color: var(--flow-white);
}

.flow-button.flow-secondary:hover:not(:disabled) {
  background: #52525b;
}

.flow-button.flow-new {
  width: 30px;
  height: 30px;
  padding: 0;
  box-shadow: 0 0 8px rgba(3, 132, 246, 0.35);
}

.flow-button.flow-quiet {
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  border-color: transparent;
  color: var(--flow-muted);
}

.flow-button.flow-quiet:hover:not(:disabled) {
  background: var(--flow-surface-active);
  color: var(--flow-white);
}

.flow-button.flow-danger {
  background: var(--flow-danger-soft);
  border-color: rgba(243, 18, 96, 0.35);
  color: #ff6696;
}

.flow-button.flow-danger:hover:not(:disabled) {
  background: rgba(243, 18, 96, 0.28);
  color: var(--flow-white);
}

.flow-button.flow-danger-solid {
  background: var(--flow-danger);
  border-color: transparent;
  color: var(--flow-white);
}

.flow-button.flow-danger-solid:hover:not(:disabled) {
  background: #ff2c74;
}

.flow-divider {
  width: 1px;
  height: 22px;
  flex: none;
  background: var(--flow-border);
}

.flow-select,
.flow-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.flow-select > svg {
  position: absolute;
  right: 9px;
  pointer-events: none;
  color: var(--flow-muted);
}

.flow-search > svg {
  position: absolute;
  left: 10px;
  pointer-events: none;
  color: var(--flow-muted);
}

.flow-select select,
.flow-search input {
  color: var(--flow-text);
  border: 1px solid var(--flow-border);
  border-radius: 8px;
  background-color: var(--flow-surface);
  background-image: none;
  font-size: 12px;
  height: 30px;
  width: 100%;
  min-width: 0;
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.flow-select select::picker-icon,
.flow-select-input::picker-icon {
  display: none !important;
}

.flow-select select::-ms-expand {
  display: none;
}

.flow-select select:hover:not(:disabled),
.flow-search input:hover {
  border-color: rgba(255, 255, 255, 0.34);
}

.flow-select {
  width: 195px;
  flex: 0 0 195px;
}

.flow-select select {
  padding: 0 28px 0 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-select select:disabled {
  color: var(--flow-muted);
  opacity: 0.72;
}

.flow-select option {
  color: var(--flow-text);
  background: var(--flow-surface);
}

.flow-search {
  width: 195px;
  flex: 0 0 195px;
}

.flow-search input {
  padding: 0 26px 0 30px;
  line-height: normal;
}

.flow-search input::placeholder {
  color: var(--flow-muted);
}

.flow-search-clear {
  position: absolute;
  right: 5px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--flow-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.flow-search-clear:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--flow-white);
}

/* ==================== Canvas & ReactFlow SVG Dot Grid ==================== */
.flow-canvas {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  outline: none;
  touch-action: none;
  user-select: none;
  cursor: grab;
  background: transparent;
}

.flow-canvas.flow-panning {
  cursor: grabbing;
}

.flow-canvas.flow-placing-note {
  cursor: crosshair;
}

.flow-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.flow-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  transform-origin: 0 0;
  z-index: 1;
}

.flow-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 3;
  text-align: center;
  padding: 24px;
}

.flow-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--flow-line);
  display: grid;
  place-items: center;
  color: var(--flow-muted);
}

.flow-empty h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--flow-text);
}

.flow-empty p {
  font-size: 13px;
  color: var(--flow-muted);
  max-width: 320px;
}

/* ==================== Edges, Hover × Delete Button & Typed Edge Pills ==================== */
.flow-links {
  position: absolute;
  top: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}

.flow-edge-line {
  fill: none;
  stroke: var(--flow-edge);
  stroke-width: 2;
  transition: stroke 140ms ease;
  pointer-events: none;
}

.flow-edge.flow-edge-hover .flow-edge-line,
.flow-edge:hover .flow-edge-line {
  stroke: #d4d4dc;
}

.flow-edge.flow-edge-selected .flow-edge-line {
  stroke: var(--flow-primary);
}

.flow-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 20;
  pointer-events: stroke;
  cursor: pointer;
}

.flow-connection-preview {
  fill: none;
  stroke: var(--flow-edge);
  stroke-width: 2;
  pointer-events: none;
}

.flow-connection-preview.flow-connection-snapped {
  stroke: var(--flow-primary);
  stroke-width: 2.2;
}

/* Exact 14x14px circular blue -> red hover × delete button inside .flow-world (scales with zoom!) */
.flow-edge-del {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 10;
  width: 14px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 9999px;
  background: var(--flow-blue-500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: all;
  opacity: 0;
  visibility: hidden;
  transition: background-color 150ms ease, opacity 120ms ease, visibility 120ms ease;
}

.flow-edge-del.visible,
.flow-edge-del:hover {
  opacity: 1;
  visibility: visible;
}

.flow-edge-del:hover,
.flow-edge-del.visible:hover,
.flow-edge-del.flow-edge-del-hot {
  background-color: var(--flow-red-500) !important;
}

.flow-edge-pill {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 5;
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--flow-pill-bg);
  color: var(--flow-pill-fg);
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: var(--flow-pill-ring) 0 0 0 2px inset;
  cursor: pointer;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}

.flow-edge-pill:hover {
  background: #1b2c49;
}

.flow-edge-pill.flow-edge-pill-selected {
  box-shadow: var(--flow-primary) 0 0 0 2px inset;
}

/* ==================== Start Node & Step Cards ==================== */
.flow-node {
  position: absolute;
  left: var(--node-x);
  top: var(--node-y);
  z-index: 3;
  transition: opacity 160ms ease;
}

.flow-node.flow-node-selected {
  z-index: 6;
}

.flow-node.flow-node-muted {
  opacity: 0.24;
}

.flow-node-card {
  width: 200px;
  padding: 8px;
  border-radius: 8px;
  background: var(--flow-surface);
  border: 1px solid var(--flow-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  cursor: grab;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.flow-node-card:hover {
  border-color: rgba(0, 111, 238, 0.28);
}

.flow-node-selected .flow-node-card {
  border-color: var(--flow-primary);
}

/* Start node — compact horizontal pill */
.flow-node-start .flow-node-card {
  width: auto;
  min-width: 108px;
  padding: 8px 12px 8px 8px;
  border-radius: 12px;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.flow-start-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--flow-success);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
}

.flow-start-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--flow-text);
  padding: 0 4px;
}

/* Step card header */
.flow-node-heading {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.flow-node-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--step-tint);
  color: var(--step-color);
  display: grid;
  place-items: center;
  flex: none;
}

.flow-node-caption {
  min-width: 0;
  flex: 1 1 auto;
  padding: 2px 4px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.flow-type-chip {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--step-color);
  color: var(--step-chip-fg, #fff);
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.flow-node-title {
  display: block;
  width: 100%;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--flow-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Step card body previews */
.flow-node-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flow-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.flow-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 16px;
  min-height: 16px;
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(63, 63, 70, 0.4);
  color: var(--flow-text);
  font-size: 11px;
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-meta-chip svg {
  flex: none;
}

.flow-finish-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--flow-muted);
}

.flow-finish-row strong {
  color: var(--flow-text);
  font-weight: 500;
}

/* Handles (12x12px ReactFlow circles) */
.flow-handle {
  position: absolute;
  left: 50%;
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 50%;
  background: var(--flow-surface);
  border: 1px solid var(--flow-border);
  cursor: crosshair;
  z-index: 4;
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.flow-handle-in {
  top: 0;
  transform: translate(-50%, -50%);
}

.flow-handle-out {
  bottom: 0;
  transform: translate(-50%, 50%);
}

.flow-handle:hover,
.flow-handle-active {
  border-color: var(--flow-primary);
  background: var(--flow-primary);
  transform: translate(-50%, -50%) scale(1.22);
}

.flow-handle-out:hover,
.flow-handle-out.flow-handle-active {
  transform: translate(-50%, 50%) scale(1.22);
}

.flow-handle-available {
  border-color: var(--flow-primary);
  box-shadow: 0 0 0 3px rgba(3, 132, 246, 0.28);
}

.flow-handle-snapped {
  background: var(--flow-primary);
  border-color: #fff;
  box-shadow: 0 0 0 5px rgba(3, 132, 246, 0.35);
}

/* ==================== Floating 3-Icon Node Toolbar (#18181b) ==================== */
.flow-node-toolbar {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: var(--flow-tooltip);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  z-index: 12;
  animation: flow-toolbar-in 140ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes flow-toolbar-in {
  from { opacity: 0; transform: translate(-50%, 5px) scale(0.95); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

@keyframes flow-pop-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.flow-nt-btn {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--flow-text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.flow-nt-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.flow-nt-btn.flow-nt-danger {
  background: var(--flow-danger-soft);
  color: #fff;
}

.flow-nt-btn.flow-nt-danger:hover {
  background: var(--flow-danger);
}

/* ==================== Sticky Note Node ==================== */
.flow-note {
  position: absolute;
  left: var(--node-x);
  top: var(--node-y);
  width: var(--note-w, 200px);
  height: var(--note-h, 100px);
  min-width: 80px;
  min-height: 80px;
  padding: 10px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  z-index: 2;
  cursor: grab;
  transition: border-color 140ms ease, box-shadow 140ms ease;
  display: flex;
  flex-direction: column;
}

.flow-note.flow-node-selected {
  border-color: var(--flow-primary);
  z-index: 6;
}

.flow-note-content {
  width: 100%;
  height: 100%;
  font-size: 10px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: auto;
  pointer-events: none;
}

.flow-note-placeholder {
  opacity: 0.48;
  font-style: italic;
}

.flow-note-editor {
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: inherit;
  font-size: 10px;
  line-height: 1.4;
  padding: 0;
}

.flow-note-resize {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  cursor: nwse-resize;
  opacity: 0.55;
  transition: opacity 120ms ease;
}

.flow-note-resize:hover,
.flow-note.flow-node-selected .flow-note-resize {
  opacity: 0.95;
}

/* ==================== Right-Side Slide-Over Drawer (Exact #0f1b2b) ==================== */
.flow-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: flex-end;
  animation: flow-fade-in 250ms cubic-bezier(0.32, 0.72, 0, 1);
}

.flow-drawer-backdrop.closing {
  animation: flow-fade-out 180ms ease forwards;
}

.flow-drawer {
  width: min(42rem, 85vw);
  max-width: 100vw;
  height: 100dvh;
  background: var(--flow-overlay);
  color: var(--flow-text);
  border-radius: 14px 0 0 14px;
  box-shadow: var(--flow-overlay-shadow), -16px 0 48px rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: flow-slide-in 250ms cubic-bezier(0.32, 0.72, 0, 1);
}

.flow-drawer-backdrop.closing .flow-drawer {
  animation: flow-slide-out 180ms ease forwards;
}

@keyframes flow-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes flow-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes flow-slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes flow-slide-out { from { transform: translateX(0); } to { transform: translateX(100%); } }

.flow-drawer-header {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 16px;
}

.flow-drawer-heading h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--flow-white);
  line-height: 1.3;
}

.flow-drawer-uuid {
  margin-top: 4px;
  font-size: 13px;
  color: var(--flow-muted);
}

.flow-drawer-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--flow-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: background-color 140ms ease, color 140ms ease;
}

.flow-drawer-close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--flow-white);
}

/* Numbered Horizontal Progress Stepper */
.flow-stepper {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 24px 20px;
}

.flow-stepper-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--flow-muted);
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  transition: color 200ms ease;
}

.flow-stepper-item:disabled {
  opacity: 0.45;
  cursor: default;
}

.flow-stepper-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--flow-default);
  background: transparent;
  color: var(--flow-muted);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 600;
  transition: border-color 300ms ease, background-color 300ms ease, color 300ms ease;
}

.flow-stepper-label {
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
}

.flow-stepper-item.active,
.flow-stepper-item.done {
  color: var(--flow-white);
}

.flow-stepper-item.active .flow-stepper-circle {
  border-color: var(--flow-primary);
  background: var(--flow-primary);
  color: var(--flow-white);
}

.flow-stepper-item.done .flow-stepper-circle {
  border-color: var(--flow-primary);
  color: var(--flow-primary);
  background: rgba(3, 132, 246, 0.12);
}

.flow-stepper-line {
  flex: 1 1 36px;
  max-width: 110px;
  height: 2px;
  margin: 0 14px;
  background: var(--flow-default);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.flow-stepper-line::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--flow-primary);
  transition: width 300ms ease;
}

.flow-stepper-line.filled::after {
  width: 100%;
}

.flow-drawer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.flow-drawer-footer {
  flex: none;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--flow-line);
  background: var(--flow-overlay);
  display: flex;
  gap: 10px;
}

.flow-drawer-footer .flow-button {
  min-height: 40px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  flex: 1 1 auto;
}

/* ==================== Drawer Form Controls (Exact HeroUI Dark Tokens) ==================== */
.flow-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flow-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--flow-text);
}

.flow-field-hint {
  font-size: 12px;
  color: var(--flow-muted);
  line-height: 1.45;
}

.flow-input,
.flow-textarea,
.flow-select-input {
  width: 100%;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: var(--flow-field-radius);
  border: 1px solid var(--flow-border);
  background-color: var(--flow-surface);
  color: var(--flow-white);
  font-size: 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.flow-input::placeholder,
.flow-textarea::placeholder {
  color: var(--flow-muted);
}

.flow-input:focus,
.flow-textarea:focus,
.flow-select-input:focus {
  outline: none;
  border-color: var(--flow-primary);
  box-shadow: 0 0 0 2px rgba(3, 132, 246, 0.24);
}

.flow-textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.45;
}

.flow-select-input {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='1.8'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-size: 16px;
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.flow-select-input option {
  background: var(--flow-surface);
  color: var(--flow-white);
}

.flow-delay-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.flow-delay-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.flow-delay-grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.flow-delay-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flow-delay-cell span {
  font-size: 11px;
  color: var(--flow-muted);
}

.flow-delay-cell input {
  text-align: center;
  padding: 8px 6px;
}

/* AI Reply 00:00–10:00 slider */
.flow-slider-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--flow-field-radius);
  background: var(--flow-surface);
  border: 1px solid var(--flow-border);
}

.flow-slider-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.flow-slider-head strong {
  font-variant-numeric: tabular-nums;
  color: var(--flow-primary);
}

.flow-slider-box input[type="range"] {
  width: 100%;
  accent-color: var(--flow-primary);
  cursor: pointer;
}

.flow-slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--flow-muted);
}

/* Checkbox & Toggle Switch */
.flow-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--flow-text);
  cursor: pointer;
}

.flow-check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--flow-primary);
  cursor: pointer;
}

.flow-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--flow-field-radius);
  background: var(--flow-surface);
  border: 1px solid var(--flow-border);
  cursor: pointer;
  font-size: 13px;
}

.flow-switch {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--flow-default);
  transition: background-color 180ms ease;
  flex: none;
}

.flow-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.flow-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 180ms ease;
}

.flow-switch:has(input:checked) {
  background: var(--flow-primary);
}

.flow-switch:has(input:checked)::after {
  transform: translateX(18px);
}

/* Segmented Tabs (Global push messages | Step push messages) */
.flow-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
  border-radius: 12px;
  background: var(--flow-surface);
  border: 1px solid var(--flow-border);
  gap: 4px;
}

.flow-segmented button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--flow-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}

.flow-segmented button.active {
  background: var(--flow-surface-active);
  color: var(--flow-white);
}

/* Draggable Message / Push / Rule Cards */
.flow-subcard {
  border-radius: 14px;
  background: var(--flow-surface);
  border: 1px solid var(--flow-border);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 150ms ease, opacity 150ms ease;
}

.flow-subcard.dragging {
  opacity: 0.45;
  border-color: var(--flow-primary);
}

.flow-subcard-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flow-drag-handle {
  color: var(--flow-muted);
  cursor: grab;
  display: grid;
  place-items: center;
  padding: 4px;
  border-radius: 6px;
}

.flow-drag-handle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--flow-white);
}

.flow-inter-delay {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  margin: -4px 0 -4px 16px;
  border-left: 2px dashed var(--flow-border);
}

.flow-inter-delay > span {
  font-size: 11px;
  color: var(--flow-muted);
}

/* Reply keyboard buttons inside Send message */
.flow-reply-box {
  padding: 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--flow-line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flow-reply-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.flow-reply-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(3, 132, 246, 0.16);
  border: 1px solid rgba(3, 132, 246, 0.38);
  font-size: 12px;
}

.flow-reply-pill input {
  background: transparent;
  border: 0;
  color: #fff;
  width: 110px;
  font-size: 12px;
  outline: none;
}

.flow-reply-pill button {
  border: 0;
  background: transparent;
  color: var(--flow-muted);
  cursor: pointer;
  padding: 0 2px;
}

.flow-reply-pill button:hover {
  color: #ff6696;
}

/* Available Variables chips (Webhook) */
.flow-vars-box {
  padding: 14px;
  border-radius: 14px;
  background: var(--flow-surface);
  border: 1px solid var(--flow-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flow-vars-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.flow-var-chip {
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--flow-border);
  background: rgba(255, 255, 255, 0.04);
  color: #338ef7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.flow-var-chip:hover {
  background: rgba(3, 132, 246, 0.2);
  border-color: var(--flow-primary);
  color: var(--flow-white);
}

/* Info / Guard Banners */
.flow-banner {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(3, 132, 246, 0.12);
  border: 1px solid rgba(3, 132, 246, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--flow-text);
}

.flow-banner.warn {
  background: rgba(245, 165, 36, 0.12);
  border-color: rgba(245, 165, 36, 0.32);
}

.flow-else-zone {
  padding: 14px;
  border-radius: 14px;
  border: 1.5px dashed var(--flow-border);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flow-inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flow-inline-row > * {
  min-width: 0;
}

/* ==================== Center Modals & Edit Flows Wide Table ==================== */
.dialog.flow-dialog-theme {
  background: var(--flow-overlay);
  box-shadow: var(--flow-overlay-shadow), 0 24px 80px rgba(0, 0, 0, 0.72);
  border: 1px solid var(--flow-border);
  border-radius: 20px;
  margin: auto;
}

.dialog.flow-wide-dialog {
  width: min(1240px, 95vw) !important;
  max-width: 95vw !important;
  margin: auto !important;
}

.flow-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--flow-border);
  border-radius: 12px;
  background: var(--flow-surface);
}

.flow-flows-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.flow-flows-table th,
.flow-flows-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--flow-line);
  text-align: center;
  white-space: nowrap;
}

.flow-flows-table th {
  color: var(--flow-muted);
  font-weight: 500;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.02);
}

.flow-flows-table td:nth-child(2),
.flow-flows-table th:nth-child(2) {
  text-align: left;
  min-width: 165px;
}

.flow-flows-table tr:last-child td {
  border-bottom: 0;
}

.flow-flows-table tr.dragging {
  opacity: 0.45;
}

.flow-modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Fix: `.flow-page button { font: inherit }` overrode button font-size — force exact 12px like original */
.flow-page .flow-button,
.flow-page .flow-button span {
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.flow-page .flow-search input {
  font-size: 12px;
}
