/* Fluxo 2.0 — Construtor em colunas */
.page.fluxo-v2-page {
  display: none;
  flex-direction: column;
  min-height: 0;
  overflow: visible;
  padding: 0 !important;
  margin: -24px -24px 0;
  width: calc(100% + 48px);
}

body.admin-page-fluxo-v2 .main {
  padding-bottom: 0;
  overflow: auto;
}

.fv2-shell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg);
}

.fv2-topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 40;
}

.fv2-topbar-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
}

.fv2-topbar-back:hover {
  background: var(--border);
}

.fv2-topbar-title-wrap {
  flex: 1;
  min-width: 160px;
}

.fv2-topbar-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.fv2-topbar-sub {
  margin: 2px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.fv2-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(16, 185, 129, 0.15);
  color: var(--passo);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.fv2-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.fv2-menu-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fv2-menu-field-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.fv2-topbar select,
.fv2-menu-field select {
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  min-width: 200px;
  max-width: 280px;
}

.fv2-columns-scroll {
  flex: 0 0 auto;
  overflow: visible;
}

.fv2-columns {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  min-width: min-content;
  width: max-content;
}

.fv2-col {
  display: flex;
  flex-direction: column;
  flex: 0 0 300px;
  width: 300px;
  border-right: 1px solid var(--border);
  background: var(--card);
}

.fv2-col--detalhe,
.fv2-col--destino {
  flex: 0 0 340px;
  width: 340px;
}

.fv2-col--trilha {
  flex: 0 0 720px;
  width: 720px;
  min-width: 720px;
}

.fv2-col-foot {
  flex-shrink: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fv2-col-toolbar--actions {
  flex-wrap: wrap;
  gap: 6px;
}

.fv2-trilha-body {
  padding: 10px !important;
}

.fv2-trail-root {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: min-content;
}

.fv2-trail-etapa-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  overflow: hidden;
}

.fv2-trail-etapa-title {
  padding: 8px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--etapa);
  background: rgba(99, 102, 241, 0.08);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.fv2-trail-etapa-tipo {
  font-weight: 500;
  color: var(--muted);
}

.fv2-trail-seq {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: 6px;
  padding: 10px;
  overflow-x: auto;
  min-height: 48px;
}

.fv2-trail-node {
  flex-shrink: 0;
  max-width: 200px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--passo);
  background: var(--card);
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1.35;
}

.fv2-trail-node:hover {
  border-color: rgba(99, 102, 241, 0.45);
}

.fv2-trail-node.is-active {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
}

.fv2-trail-node-type {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--passo);
  margin-bottom: 3px;
}

.fv2-trail-node-label {
  display: block;
  color: var(--text);
  word-break: break-word;
}

.fv2-trail-var {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--passo);
}

.fv2-trail-arrow {
  flex-shrink: 0;
  align-self: center;
  color: var(--muted);
  font-size: 1rem;
  padding: 0 2px;
}

.fv2-trail-forks {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  overflow-x: auto;
}

.fv2-trail-fork {
  flex: 0 0 auto;
  min-width: 160px;
  max-width: 280px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

.fv2-trail-fork--ok { border-left: 3px solid #22c55e; }
.fv2-trail-fork--fail { border-left: 3px solid #ef4444; }
.fv2-trail-fork--cond { border-left: 3px solid #f59e0b; }
.fv2-trail-fork--bloco { border-left: 3px solid #8b5cf6; }
.fv2-trail-fork--end { border-left: 3px solid #6b7280; }

.fv2-trail-fork-hd {
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.fv2-trail-fork-hd em {
  display: block;
  font-style: normal;
  font-weight: 400;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 2px;
}

.fv2-trail-fork-body {
  padding: 6px;
}

.fv2-trail-fork-body .fv2-trail-seq {
  padding: 4px;
}

.fv2-trail-terminal {
  flex-shrink: 0;
  align-self: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--card);
}

.fv2-trail-terminal--encerramento { border-color: #22c55e; color: #22c55e; }
.fv2-trail-terminal--fila { border-color: #f59e0b; color: #f59e0b; }
.fv2-trail-terminal--bloco { border-color: #8b5cf6; color: #8b5cf6; }
.fv2-trail-terminal--menu { border-color: #3b82f6; color: #3b82f6; }
.fv2-trail-terminal--muted { color: var(--muted); }

.fv2-trail-subbloco {
  flex-shrink: 0;
  border: 1px dashed #8b5cf6;
  border-radius: 8px;
  padding: 4px;
  background: rgba(139, 92, 246, 0.06);
}

.fv2-trail-subbloco-hd {
  font-size: 0.72rem;
  font-weight: 700;
  color: #8b5cf6;
  padding: 4px 6px;
  cursor: pointer;
}

.fv2-trail-vars {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.fv2-trail-vars-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.fv2-trail-vars-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.fv2-trail-var-chip {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--passo);
}

.fv2-col:last-child {
  border-right: none;
}

.fv2-item-icon--menu { color: #f59e0b; border-color: rgba(245, 158, 11, 0.35); background: rgba(245, 158, 11, 0.12); }
.fv2-item-icon--opcao { color: var(--accent); border-color: rgba(99, 102, 241, 0.35); background: rgba(99, 102, 241, 0.1); }

.fv2-flow-hint {
  margin: 8px 10px 4px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.fv2-flow-next {
  margin: 6px 10px 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.78rem;
  cursor: pointer;
}

.fv2-flow-next:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.fv2-col-head {
  flex-shrink: 0;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.12);
}

.fv2-col-head h2 {
  margin: 0 0 4px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.fv2-col-head p {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.35;
}

.fv2-col-toolbar {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.fv2-etapa-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 10px 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.fv2-tab {
  flex: 1;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.fv2-tab.is-active {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
  margin-bottom: -1px;
}

.fv2-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  vertical-align: middle;
}

.fv2-tag--warn {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.fv2-item.is-muted {
  opacity: 0.55;
}

.fv2-preview-actions {
  margin-bottom: 8px;
}

.fv2-col-toolbar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.fv2-col-toolbar input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.82rem;
}

.fv2-col-body {
  flex: 0 0 auto;
  overflow: visible;
  padding: 8px;
}

.fv2-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 10px;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.fv2-item:hover {
  background: rgba(99, 102, 241, 0.08);
}

.fv2-item.is-active {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(99, 102, 241, 0.45);
}

.fv2-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  background: var(--bg);
  border: 1px solid var(--border);
}

.fv2-item-icon--bloco { color: var(--bloco); border-color: var(--bloco-dim); background: var(--bloco-dim); }
.fv2-item-icon--etapa { color: var(--etapa); border-color: var(--etapa-dim); background: var(--etapa-dim); }
.fv2-item-icon--passo { color: var(--passo); border-color: var(--passo-dim); background: var(--passo-dim); }

.fv2-item-main {
  flex: 1;
  min-width: 0;
}

.fv2-item-title {
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: break-word;
  word-break: normal;
}

.fv2-item-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.35;
}

.fv2-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--passo);
  flex-shrink: 0;
  margin-top: 6px;
}

.fv2-timeline {
  position: relative;
  padding-left: 8px;
}

.fv2-timeline-item {
  position: relative;
  padding-left: 28px;
  margin-bottom: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px 8px;
}

.fv2-timeline-item .fv2-passo-card {
  flex: 1;
  min-width: 0;
}

.fv2-passo-del {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  margin-top: 10px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}

.fv2-passo-del:hover {
  background: rgba(239, 68, 68, 0.2);
}

.fv2-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  vertical-align: middle;
}

.fv2-param-table-hd,
.fv2-param-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.78rem;
}

.fv2-param-table-hd {
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.fv2-param-row input {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.8rem;
  min-width: 0;
}

.fv2-fieldset--fail {
  border-color: rgba(239, 68, 68, 0.35);
}

.fv2-fieldset--fail legend {
  color: #ef4444;
}

.fv2-timeline-item::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: -4px;
  width: 2px;
  background: var(--border);
}

.fv2-timeline-item:last-child::before {
  bottom: 50%;
}

.fv2-timeline-num {
  position: absolute;
  left: 0;
  top: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--muted);
  z-index: 1;
}

.fv2-timeline-item.is-active .fv2-timeline-num {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(99, 102, 241, 0.15);
}

.fv2-passo-card {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--passo);
  background: var(--bg);
  cursor: pointer;
}

.fv2-passo-card.is-active {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.08);
}

.fv2-passo-type {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--passo);
  letter-spacing: 0.03em;
}

.fv2-passo-resumo {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-word;
}

.fv2-passo-vars {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.fv2-passo-var-chip {
  display: inline-block;
  font-size: 0.65rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.22);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fv2-passo-var-chip--compact {
  font-size: 0.6rem;
  padding: 1px 5px;
}

.fv2-etapa-vars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.fv2-etapa-passo-vars {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
}

.fv2-etapa-passo-vars-head {
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--passo);
  flex-shrink: 0;
  opacity: 0.9;
  margin-right: 1px;
}

.fv2-detail-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.fv2-detail-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.fv2-detail-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.fv2-detail-header p {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

.fv2-form {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fv2-form label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--muted);
}

.fv2-form input,
.fv2-form textarea,
.fv2-form select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
}

.fv2-form textarea {
  min-height: 88px;
  resize: vertical;
}

.fv2-dest-row {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.8rem;
  line-height: 1.4;
}

.fv2-dest-row strong {
  color: var(--accent);
}

.fv2-dest-row--ok { border-left: 3px solid #22c55e; }
.fv2-dest-row--fail { border-left: 3px solid #ef4444; }
.fv2-dest-row--cond { border-left: 3px solid #f59e0b; }
.fv2-dest-row--bloco { border-left: 3px solid #8b5cf6; }
.fv2-dest-row--end { border-left: 3px solid #6b7280; }
.fv2-dest-row--flow { border-left: 3px solid var(--accent); }

.fv2-bloco-pick {
  padding: 4px 4px 8px;
}

.fv2-bloco-pick-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.fv2-bloco-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.82rem;
}

.fv2-item-edit {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
}

.fv2-item-edit:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.fv2-item-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  flex: 0 0 100%;
  padding-left: 42px;
  margin-top: 2px;
}

.fv2-item-actions .btn.btn-sm {
  min-width: 26px;
  padding: 2px 6px;
}

.fv2-item-del {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
}

.fv2-item-del:hover {
  background: rgba(239, 68, 68, 0.2);
}

.fv2-passo-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex: 0 0 100%;
  margin-top: 0;
  padding-left: 0;
}

.fv2-passo-actions .btn.btn-sm {
  min-width: 26px;
  padding: 2px 6px;
}

.fv2-passo-edit {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
}

.fv2-passo-edit:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.fv2-col-foot .btn-danger {
  border-color: rgba(239, 68, 68, 0.5);
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.fv2-col-foot .btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

.fv2-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: var(--card);
  font-size: 0.75rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.fv2-footer-path {
  color: var(--text);
}

.fv2-footer-path span {
  color: var(--muted);
}

.fv2-col-add {
  width: 100%;
  margin-top: 4px;
}

.fv2-scroll-hint {
  flex-shrink: 0;
  padding: 4px 16px 6px;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.08);
}
.fv2-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.fv2-modal-backdrop[hidden] {
  display: none !important;
}

.fv2-modal {
  width: min(520px, 100%);
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.fv2-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.fv2-modal-head h3 {
  margin: 0;
  font-size: 1rem;
}

.fv2-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
}

.fv2-modal-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.fv2-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.fv2-form-group {
  margin-bottom: 12px;
}

.fv2-form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--muted);
}

.fv2-fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
}

.fv2-fieldset legend {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0 6px;
}

.fv2-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 4px 0 0;
  line-height: 1.4;
}

.fv2-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  cursor: pointer;
}

.fv2-toggle-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 12px;
}

/* Switches dentro do editor de fluxo — evita conflito com .fv2-form input { width:100% } */
.fv2-form label.ebot-switch,
.fv2-fieldset label.ebot-switch,
.fv2-correcao-switch {
  display: flex !important;
  align-items: center;
  gap: 12px;
  width: 100%;
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--text);
  margin-bottom: 0;
  cursor: pointer;
}

.fv2-form .ebot-switch-input,
.fv2-fieldset .ebot-switch-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  background: transparent !important;
  opacity: 0 !important;
  pointer-events: none;
}

.fv2-correcao-switch[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.fv2-opcao-row,
.fv2-verif-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  align-items: center;
}

.fv2-opcao-row input,
.fv2-verif-row input,
.fv2-verif-row select {
  flex: 1;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.82rem;
}

.fv2-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
}

.fv2-form-actions .fv2-hint--actions {
  flex: 1 1 100%;
  margin: 4px 0 0;
}

.fv2-dest-tipo,
.fv2-bloco-select {
  width: 100%;
}

.fv2-test-out {
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.72rem;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Editor mensagem WhatsApp (Detalhes do passo) */
.fv2-wa-fieldset {
  margin-bottom: 12px;
}

.fv2-wa-chips {
  margin-bottom: 10px;
}

.fv2-wa-chips .template-builder-chip {
  font-size: 0.72rem;
  padding: 3px 8px;
}

.fv2-wa-sub {
  margin-top: 6px;
}

.fv2-wa-sub.hidden,
.fv2-wa-panel.hidden {
  display: none !important;
}

.fv2-wa-panel {
  margin: 10px 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.04);
}

.fv2-req {
  color: #dc2626;
  font-size: 0.8rem;
}

.fv2-char-count {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}

.fv2-wa-btn-row,
.fv2-wa-list-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.fv2-wa-btn-row--config {
  flex-direction: column;
  align-items: stretch;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.fv2-wa-btn-row-main,
.fv2-wa-btn-row-extra {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.fv2-wa-btn-row-extra input,
.fv2-wa-btn-row-extra select {
  flex: 1;
  min-width: 100px;
  font-size: 12px;
}

.fv2-wa-btn-field-lbl {
  flex: 0 0 auto;
  font-size: 0.68rem;
  color: var(--muted);
  min-width: 52px;
  margin: 0;
}

.fv2-wa-btn-row input,
.fv2-wa-list-row input {
  flex: 1;
  min-width: 80px;
}

.fv2-wa-row-vis {
  flex: 0 0 auto;
  max-width: 118px;
  font-size: 0.72rem;
  padding: 4px 6px;
}

.fv2-wa-list-section {
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.fv2-wa-list-section-hd {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.fv2-wa-list-section-hd input {
  flex: 1;
}

.fv2-wa-preview-wrap {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.fv2-wa-preview-label {
  font-size: 0.78rem;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

.fv2-wa-preview-bubble {
  max-width: 100%;
  background: #d9fdd3 !important;
  color: #111827;
  padding: 10px 14px;
  border-radius: 12px 12px 4px 12px;
  font-size: 0.85rem;
  line-height: 1.45;
}

.fv2-detalhes-wrap .fv2-form {
  max-height: none;
}

/* Editor de função inline (Detalhes do passo) */
.fv2-funcao-select-row .fv2-funcao-select-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.fv2-funcao-select-wrap select {
  flex: 1;
  min-width: 160px;
}

.fv2-col--funcao-expanded {
  min-width: 520px !important;
  flex: 1.4 1 520px !important;
}

.fv2-funcao-editor-host {
  margin-top: 8px;
}

.fv2-funcao-inline-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fv2-funcao-inline-layout .modal-funcao-form,
.fv2-funcao-inline-layout .modal-funcao-preview {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  max-height: none !important;
  overflow: visible !important;
  border-left: none !important;
  padding-left: 0 !important;
  height: auto !important;
}

.fv2-funcao-inline-layout .modal-funcao-form {
  font-size: 0.88rem;
}

.fv2-funcao-inline-layout .modal-funcao-form .form-group {
  margin-bottom: 10px;
}

.fv2-funcao-inline-layout .modal-funcao-form input,
.fv2-funcao-inline-layout .modal-funcao-form select,
.fv2-funcao-inline-layout .modal-funcao-form textarea {
  max-width: 100%;
}

.fv2-funcao-inline-layout .modal-funcao-preview {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.fv2-funcao-inline-layout .template-builder-bubble-phone {
  max-width: 100%;
}

.fv2-fieldset--funcao-editor {
  margin-top: 12px;
}

.fv2-funcao-vars-guia {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px dashed rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.06);
  font-size: 0.78rem;
  line-height: 1.45;
}

.fv2-funcao-vars-guia strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
}

.fv2-vars-list {
  margin: 8px 0 8px 18px;
  padding: 0;
}

.fv2-vars-list li {
  margin-bottom: 4px;
}

.fv2-funcao-passo-after-order {
  margin-top: 4px;
  padding-top: 4px;
}

.fv2-funcao-passo-after-order:not([hidden]) {
  display: block;
}

/* Modal de funções (Fluxo 2.0) */
.fv2-funcoes-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100050;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.fv2-funcoes-modal-backdrop[hidden] {
  display: none !important;
}

.fv2-funcoes-modal {
  width: min(1180px, 96vw);
  max-height: 92vh;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
}

.fv2-funcoes-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.fv2-funcoes-modal-head h3 {
  margin: 0;
  font-size: 1rem;
}

.fv2-funcoes-modal-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 18px 0;
  border-bottom: 1px solid var(--border);
}

.fv2-funcoes-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
}

.fv2-funcoes-tab.is-active {
  color: var(--funcao, var(--accent));
  background: rgba(139, 92, 246, 0.12);
}

.fv2-funcoes-modal-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px 18px;
}

.fv2-funcoes-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.fv2-funcoes-list-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.fv2-funcoes-list-toolbar input[type="search"] {
  flex: 1;
  min-width: 200px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.fv2-funcoes-table-wrap {
  overflow: auto;
  max-height: 52vh;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.fv2-funcoes-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.fv2-funcoes-table th,
.fv2-funcoes-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.fv2-funcoes-table th {
  position: sticky;
  top: 0;
  background: var(--card);
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--muted);
}

.fv2-funcoes-actions {
  white-space: nowrap;
}

.fv2-funcoes-editor-host {
  min-height: 280px;
}

.fv2-funcoes-editor-host .fv2-funcao-inline-layout {
  max-height: 58vh;
  overflow: auto;
}

.fv2-topbar-actions .btn-funcao {
  border-color: rgba(139, 92, 246, 0.45);
  color: var(--funcao, #8b5cf6);
}

/* Seções — detalhes do passo / editor de função */
.fv2-sec {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}

.fv2-sec-title {
  margin: 0 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.fv2-funcao-passo-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.fv2-funcao-form-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fv2-form-group--highlight {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.06);
}

.fv2-input-highlight {
  font-weight: 600;
  border-color: rgba(34, 197, 94, 0.55) !important;
  background: var(--bg);
}

.fv2-funcao-vars-guia--compact {
  margin: 0 0 10px;
  font-size: 0.82rem;
}

.fv2-funcao-vars-guia--compact summary {
  cursor: pointer;
  color: var(--muted);
}

.fv2-preview-actions {
  margin: 8px 0 10px;
}

.fv2-preview-actions--top {
  margin-bottom: 12px;
}

.fv2-item.is-ref-disp {
  border-left: 3px solid rgba(139, 92, 246, 0.65);
  background: rgba(139, 92, 246, 0.04);
}

.fv2-tag--ref {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  vertical-align: middle;
}

.fv2-tag--dev {
  background: rgba(234, 179, 8, 0.2);
  color: #eab308;
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
  vertical-align: middle;
}

/* Toggle dev/prod — linha abaixo do título */
.fv2-item-dev {
  flex: 0 0 100%;
  padding-left: 42px;
  margin-top: -2px;
}

.fv2-item-dev .ebot-toggle-duplo,
.fv2-item-dev .fv2-dev-modo-toggle {
  display: inline-flex;
  max-width: 100%;
}

.fv2-dev-modo-toggle button {
  font-size: 0.68rem;
  padding: 4px 7px;
  white-space: nowrap;
}

.fv2-timeline-item .fv2-item-dev {
  padding-left: 0;
  margin-top: 4px;
  flex: 1 1 auto;
  min-width: 0;
}

.fv2-timeline-item .fv2-passo-card {
  flex: 1 1 100%;
  min-width: 0;
  margin-bottom: 0;
}

.fv2-timeline-item .fv2-passo-actions {
  flex: 0 0 auto;
  width: auto;
  margin-top: 4px;
  padding-left: 6px;
}

.fv2-wa-list-row .fv2-wa-row-dev-toggle {
  flex-shrink: 0;
}

.fv2-wa-list-row .fv2-wa-row-dev-toggle button {
  font-size: 0.68rem;
  padding: 4px 6px;
}

.fv2-wa-list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
