
  :root {
    --navy-900: #0F2A4A;
    --navy-800: #16365B;
    --blue-600: #1D5FA3;
    --blue-500: #2E74BE;
    --blue-100: #E5EFF9;
    --bg-canvas: #F4F6F9;
    --bg-dotted: #EBEEF3;
    --surface: #FFFFFF;
    --text-primary: #17242F;
    --text-secondary: #5B6B7D;
    --text-muted: #93A1B0;
    --border: #E1E7EE;
    --border-strong: #CBD5E1;
    --success: #1D8A5F;
    --success-bg: #E7F5EE;
    --warning: #C2410C;
    --warning-bg: #FDECE3;
    --purple: #6D4FC7;
    --purple-bg: #EFEAFB;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(15, 42, 74, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 42, 74, 0.08);
    --shadow-lg: 0 12px 40px rgba(15, 42, 74, 0.14);
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }

  html, body {
    height: 100%;
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--bg-canvas);
  }

  /* ============ APP SHELL (compartilhado pelas 4 telas) ============ */
  .layout {
    display: grid;
    grid-template-columns: 232px 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .layout.sidebar-collapsed {
    grid-template-columns: 64px 1fr;
  }
  .layout > .sidebar { min-height: 100vh; }
  .view { min-width: 0; }

  /* Fluxo é a única tela com altura travada (canvas precisa de scroll interno próprio) */
  #view-fluxo { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
  #view-fluxo .main { height: 100%; flex: 1; min-width: 0; }

  /* ============ SIDEBAR ============ */
  .sidebar {
    background: var(--navy-900);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
  }

  .sidebar::after {
    content: '';
    position: absolute;
    bottom: -140px;
    left: -80px;
    width: 340px;
    height: 340px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(46, 116, 190, 0.35), transparent 70%);
    pointer-events: none;
  }

  .sidebar-brand {
    padding: 22px 20px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15px;
    color: white;
    flex-shrink: 0;
  }

  .brand-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 15.5px;
    color: white;
    letter-spacing: 0.2px;
    line-height: 1.15;
  }

  .brand-sub {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-top: 1px;
  }

  .sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 1;
  }

  .nav-label {
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 14px 12px 6px;
  }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.65);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
  }

  .nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: white;
  }

  .nav-item.active {
    background: var(--blue-600);
    color: white;
  }

  .nav-item svg { flex-shrink: 0; width: 17px; height: 17px; opacity: 0.9; }

  .sidebar-footer {
    padding: 14px 20px 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1;
  }

  .avatar-mini {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--blue-500);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
  }

  .footer-text { line-height: 1.25; overflow: hidden; }
  .footer-name { font-size: 12.5px; font-weight: 600; color: white; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
  .footer-role { font-size: 11px; color: rgba(255,255,255,0.45); }

  /* ============ MAIN AREA ============ */
  .main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
  }

  /* ============ TOPBAR ============ */
  .topbar {
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    flex-shrink: 0;
    z-index: 5;
  }

  .topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .flow-title-group {
    display: flex;
    flex-direction: column;
    gap: 1px;
  }

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

  .edit-pencil {
    opacity: 0.35;
    cursor: pointer;
    width: 13px;
    height: 13px;
  }

  .flow-meta {
    font-size: 11.5px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .save-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
  }

  .topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .btn {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.15s;
  }

  .btn:hover { background: #F8FAFC; border-color: var(--text-muted); }

  .btn-primary {
    background: var(--navy-900);
    border-color: var(--navy-900);
    color: white;
  }

  .btn-primary:hover { background: var(--navy-800); }

  .btn svg { width: 15px; height: 15px; }

  /* ============ CANVAS ============ */
  .canvas-wrap {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--bg-canvas);
    background-image: radial-gradient(var(--bg-dotted) 1.4px, transparent 1.4px);
    background-size: 22px 22px;
  }

  .canvas {
    position: absolute;
    inset: 0;
    transform: translate(0px, 0px);
  }

  /* connector lines (SVG) */
  .connectors {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
  }

  /* ============ NODE ============ */
  .node {
    position: absolute;
    width: 246px;
    background: var(--surface);
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow-sm);
    z-index: 2;
    cursor: grab;
    transition: box-shadow 0.15s, border-color 0.15s;
  }

  .node:hover { box-shadow: var(--shadow-md); }

  .node.selected {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px var(--blue-100), var(--shadow-md);
  }

  .node-head {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--border);
  }

  .node-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .node-icon svg { width: 15px; height: 15px; }

  .node-title-group { min-width: 0; flex: 1; }
  .node-title { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .node-type { font-size: 10.5px; color: var(--text-muted); }

  .node-body { padding: 11px 12px; display: flex; flex-direction: column; gap: 7px; }

  .node-row {
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 9px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
  }

  .node-row strong { color: var(--text-primary); font-weight: 600; }

  .node-row.mono { font-family: var(--font-mono); font-size: 11px; }

  .node-foot {
    padding: 8px 12px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .port {
    position: absolute;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--blue-500);
    z-index: 3;
  }
  .port.out { right: -6px; top: 50%; transform: translateY(-50%); }
  .port.in { left: -6px; top: 50%; transform: translateY(-50%); }
  .port.multi { position: static; transform: none; margin-left: auto; }

  .branch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 7px 9px;
    font-size: 12px;
    position: relative;
  }

  .branch-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
  .branch-label { display: flex; align-items: center; gap: 7px; color: var(--text-primary); font-weight: 500; }

  .branch-port {
    position: absolute;
    right: -18px;
    top: 50%;
    transform: translateY(-50%);
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--blue-500);
  }

  /* icon color variants per node kind */
  .ic-trigger { background: var(--purple-bg); color: var(--purple); }
  .ic-send { background: var(--blue-100); color: var(--blue-600); }
  .ic-wait { background: #FFF4E5; color: #B7791F; }
  .ic-cond { background: #FFF4E5; color: #B7791F; }
  .ic-ai { background: var(--purple-bg); color: var(--purple); }
  .ic-classify { background: var(--success-bg); color: var(--success); }

  /* Start node badge */
  .start-badge {
    position: absolute;
    left: -46px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--navy-900);
    color: white;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 5px 9px;
    border-radius: 999px;
    text-transform: uppercase;
    white-space: nowrap;
  }

  /* ============ RIGHT CONFIG PANEL ============ */
  .config-panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 340px;
    background: var(--surface);
    border-left: 1px solid var(--border);
    box-shadow: -8px 0 24px rgba(15,42,74,0.08);
    z-index: 20;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    pointer-events: none;
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s;
  }
  .config-panel.open {
    transform: translateX(0);
    pointer-events: auto;
    opacity: 1;
  }

  .config-head {
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .config-head-left { display: flex; gap: 10px; align-items: flex-start; }

  .config-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .config-icon svg { width: 17px; height: 17px; }

  .config-title { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--text-primary); }
  .config-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

  .config-close {
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 6px; cursor: pointer; color: var(--text-muted);
    border: none; background: none; flex-shrink: 0;
  }
  .config-close:hover { background: #F1F5F9; color: var(--text-primary); }
  .config-close svg { width: 16px; height: 16px; }

  .config-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .field-group { display: flex; flex-direction: column; gap: 6px; }

  .field-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .field-hint { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; margin-top: -2px; }

  .field-input, .field-select, .field-textarea {
    font-family: var(--font-body);
    font-size: 13px;
    padding: 9px 11px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
  }

  .field-input:focus, .field-select:focus, .field-textarea:focus { border-color: var(--blue-500); }
  .field-textarea { resize: vertical; min-height: 64px; line-height: 1.5; }

  .field-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%235B6B7D' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 30px;
    cursor: pointer;
  }

  .pill-select {
    display: flex;
    gap: 6px;
    background: #F1F5F9;
    padding: 3px;
    border-radius: 9px;
  }

  .pill-option {
    flex: 1;
    text-align: center;
    padding: 7px 8px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
  }

  .pill-option.active { background: var(--surface); color: var(--navy-900); box-shadow: var(--shadow-sm); }

  .divider-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-top: 6px;
    border-top: 1px solid var(--border);
  }

  .helper-box {
    background: var(--blue-100);
    border: 1px solid #CBE0F5;
    border-radius: 8px;
    padding: 11px 12px;
    font-size: 12px;
    color: var(--navy-800);
    line-height: 1.5;
    display: flex;
    gap: 8px;
  }
  .helper-box svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; color: var(--blue-600); }

  .config-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
  }

  .config-footer .btn { flex: 1; justify-content: center; }

  /* variable chip inside textarea helper */
  .var-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
  .var-chip {
    font-family: var(--font-mono);
    font-size: 10.5px;
    background: #F1F5F9;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 3px 7px;
    border-radius: 5px;
    cursor: pointer;
  }
  .var-chip:hover { background: var(--blue-100); color: var(--blue-600); border-color: #CBE0F5; }

  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }

  /* ============ CSS específico: MOTORISTAS ============ */
.page-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--text-primary); }
.page-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
#view-motoristas .content { flex: 1; padding: 22px 28px; overflow-y: auto; }

.filter-row { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.search-input { flex: 1; max-width: 320px; font-size: 13px; padding: 9px 12px 9px 34px; border-radius: 9px; border: 1.5px solid var(--border); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2393A1B0' stroke-width='1.8'%3E%3Ccircle cx='7' cy='7' r='5.5'/%3E%3Cpath d='M15 15l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 11px center; outline: none; }
.filter-chip { font-size: 12.5px; font-weight: 600; padding: 7px 13px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.filter-chip.active { background: var(--navy-900); border-color: var(--navy-900); color: white; }
.filter-chip .count { font-family: var(--font-mono); font-size: 11px; opacity: 0.7; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); overflow: hidden; transition: box-shadow 0.15s; cursor: pointer; }
.card:hover { box-shadow: var(--shadow-md); }
.card-top { padding: 16px 16px 14px; display: flex; gap: 12px; align-items: flex-start; }
.card-avatar { width: 42px; height: 42px; border-radius: 10px; background: var(--blue-100); color: var(--blue-600); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 15px; flex-shrink: 0; }
.card-name-group { flex: 1; min-width: 0; }
.card-name { font-size: 14.5px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-phone { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.status-badge { font-size: 10.5px; font-weight: 700; padding: 4px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap; }
.status-completo { background: var(--success-bg); color: var(--success); }
.status-coletando { background: var(--blue-100); color: var(--blue-600); }
.status-conflito { background: var(--warning-bg); color: var(--warning); }
.card-progress { padding: 0 16px 14px; }
.progress-track { height: 5px; border-radius: 4px; background: #EEF1F5; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--blue-500); }
.progress-label { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.card-fields { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.field-line { display: flex; justify-content: space-between; font-size: 12.5px; }
.field-line-label { color: var(--text-muted); }
.field-line-value { color: var(--text-primary); font-weight: 500; }
.field-line-value.pending { color: var(--text-muted); font-style: italic; font-weight: 400; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: #FAFBFC; }
.card-time { font-size: 11px; color: var(--text-muted); }
.conflict-tag { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--warning); }
.conflict-tag svg { width: 13px; height: 13px; }
.drawer-overlay {
    position: fixed; inset: 0; background: rgba(15, 42, 74, 0.32);
    z-index: 50; opacity: 0; pointer-events: none; transition: opacity 0.18s;
  }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: min(460px, 100vw);
    background: var(--surface);
    box-shadow: -10px 0 34px rgba(15, 42, 74, 0.16);
    z-index: 51;
    transform: translateX(100%);
    transition: transform 0.22s cubic-bezier(.32,.72,0,1);
    display: flex; flex-direction: column;
  }
.drawer.open { transform: translateX(0); }
.drawer-head {
    padding: 18px 20px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-shrink: 0;
  }
.drawer-head-left { display: flex; gap: 12px; align-items: center; min-width: 0; }
.drawer-avatar { width: 40px; height: 40px; border-radius: 10px; background: var(--blue-100); color: var(--blue-600); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 14px; flex-shrink: 0; }
.drawer-title { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-phone { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.drawer-close { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; border: none; background: none; flex-shrink: 0; }
.drawer-close:hover { background: #F1F5F9; color: var(--text-primary); }
.drawer-close svg { width: 16px; height: 16px; }
.pause-bar {
    margin: 14px 20px 0; padding: 11px 14px; border-radius: 10px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--success-bg); border: 1px solid #CFE6DA;
  }
.pause-bar.paused { background: var(--warning-bg); border-color: #F4C4A8; }
.pause-bar-info { display: flex; align-items: center; gap: 9px; min-width: 0; }
.pause-bar-info svg { width: 16px; height: 16px; color: var(--success); flex-shrink: 0; }
.pause-bar.paused .pause-bar-info svg { color: var(--warning); }
.pause-bar-text { min-width: 0; }
.pause-bar-title { font-size: 12.5px; font-weight: 700; color: var(--success); }
.pause-bar.paused .pause-bar-title { color: var(--warning); }
.pause-bar-sub { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.pause-toggle-btn {
    font-size: 12px; font-weight: 700; padding: 7px 12px; border-radius: 7px;
    border: 1.5px solid var(--success); color: var(--success); background: var(--surface); cursor: pointer; flex-shrink: 0;
  }
.pause-bar.paused .pause-toggle-btn { border-color: var(--warning); color: var(--warning); }
.drawer-tabs { display: flex; gap: 4px; padding: 14px 20px 0; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.drawer-tab { font-size: 12.5px; font-weight: 600; color: var(--text-muted); padding: 8px 4px 10px; border-bottom: 2px solid transparent; cursor: pointer; margin-right: 16px; }
.drawer-tab.active { color: var(--navy-900); border-bottom-color: var(--blue-500); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 24px; }
.drawer-section { margin-bottom: 22px; }
.drawer-section:last-child { margin-bottom: 0; }
.drawer-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 10px; }
.fields-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-box { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: #FAFBFC; }
.field-box.filled { background: var(--success-bg); border-color: #CFE6DA; }
.field-box-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.field-box.filled .field-box-label { color: var(--success); }
.field-box-value { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.field-box-value.empty { font-weight: 400; font-style: italic; color: var(--text-muted); }
.conflict-box { background: var(--warning-bg); border: 1px solid #F4C4A8; border-radius: 9px; padding: 12px 13px; }
.conflict-box-head { font-size: 12.5px; font-weight: 700; color: var(--warning); margin-bottom: 6px; }
.conflict-values { display: flex; gap: 8px; font-family: var(--font-mono); font-size: 11.5px; color: var(--navy-800); }
.conflict-resolve { display: flex; gap: 8px; margin-top: 10px; }
.conflict-resolve button { flex: 1; font-size: 11.5px; font-weight: 700; padding: 7px; border-radius: 6px; cursor: pointer; }
.conflict-btn-keep { background: var(--surface); border: 1.5px solid var(--border-strong); color: var(--text-primary); }
.conflict-btn-new { background: var(--navy-900); border: 1.5px solid var(--navy-900); color: white; }
#tab-conversa { flex-direction: column; height: 100%; min-height: 0; }
.chat-timeline { display: flex; flex-direction: column; gap: 10px; flex: 1; overflow-y: auto; min-height: 0; }
.chat-manual-send-wrap { flex-shrink: 0; }
.chat-bubble-row { display: flex; }
.chat-bubble-row.out { justify-content: flex-end; }
.chat-bubble {
    max-width: 78%; padding: 9px 12px; border-radius: 12px; font-size: 13px; line-height: 1.45;
    background: #F1F5F9; color: var(--text-primary); position: relative;
  }
.chat-bubble-row.out .chat-bubble { background: var(--blue-500); color: white; }
.chat-bubble-row.system .chat-bubble { background: var(--purple-bg); color: var(--purple); font-size: 11.5px; font-weight: 600; text-align: center; margin: 0 auto; }
.chat-time { font-size: 10px; color: var(--text-muted); margin-top: 4px; display: block; }
.chat-bubble-row.out .chat-time { color: rgba(255,255,255,0.75); }
.chat-extract-tag {
    display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 10px;
    background: rgba(255,255,255,0.5); color: var(--success); padding: 2px 6px; border-radius: 5px; margin-top: 6px;
  }
.chat-bubble-row.out .chat-extract-tag { display: none; }
.chat-media-badge { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.chat-media-badge svg { width: 14px; height: 14px; }
.drawer-footer { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-shrink: 0; }
.drawer-footer .btn { flex: 1; justify-content: center; }
.btn-danger-outline { color: var(--warning); border-color: #F4C4A8; }
.btn-danger-outline:hover { background: var(--warning-bg); }

  /* ============ CSS específico: CONEXOES ============ */
#view-conexoes .content { flex: 1; padding: 22px 28px; width: 100% !important; max-width: 100% !important; box-sizing: border-box; }
.conn-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 20px; }
.conn-head { padding: 20px 22px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--border); }
.wa-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--success-bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.wa-icon svg { width: 24px; height: 24px; color: var(--success); }
.conn-info { flex: 1; }
.conn-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.conn-number { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.status-pill { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--success-bg); color: var(--success); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }
.status-dot.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(29,138,95,0.5); } 70% { box-shadow: 0 0 0 6px rgba(29,138,95,0); } 100% { box-shadow: 0 0 0 0 rgba(29,138,95,0); } }
.conn-stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.stat-cell { padding: 16px 22px; border-right: 1px solid var(--border); }
.stat-cell:last-child { border-right: none; }
.stat-value { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.conn-actions { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; background: #FAFBFC; }
.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin: 28px 0 12px; }
.setting-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.setting-info { display: flex; align-items: center; gap: 12px; }
.setting-icon { width: 34px; height: 34px; border-radius: 8px; background: var(--blue-100); color: var(--blue-600); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.setting-icon svg { width: 17px; height: 17px; }
.setting-title { font-size: 13.5px; font-weight: 600; }
.setting-desc { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.toggle { width: 40px; height: 23px; border-radius: 999px; background: var(--success); position: relative; cursor: pointer; flex-shrink: 0; }
.toggle::after { content: ''; position: absolute; width: 17px; height: 17px; border-radius: 50%; background: white; top: 3px; right: 3px; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }

  /* ============ CSS específico: CONFIGURACOES ============ */
#view-configuracoes .content { flex: 1; padding: 26px 32px; overflow-y: auto; max-width: 880px; }
.body-wrap { flex: 1; display: flex; overflow: hidden; }
.settings-nav { width: 200px; border-right: 1px solid var(--border); padding: 20px 12px; flex-shrink: 0; }
.settings-nav-item { display: block; padding: 8px 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text-secondary); cursor: pointer; margin-bottom: 2px; }
.settings-nav-item.active { background: var(--blue-100); color: var(--blue-600); font-weight: 600; }
.settings-nav-item:hover:not(.active) { background: #F1F5F9; }
.settings-nav-item.dev { display: flex; align-items: center; gap: 6px; }
.dev-tag { font-size: 8.5px; font-weight: 700; background: var(--warning-bg); color: var(--warning); padding: 1px 5px; border-radius: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.section-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.section-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 22px; line-height: 1.5; }
.warn-banner { background: var(--warning-bg); border: 1px solid #F4C4A8; border-radius: var(--radius-md); padding: 13px 16px; display: flex; gap: 10px; margin-bottom: 22px; }
.warn-banner svg { width: 17px; height: 17px; color: var(--warning); flex-shrink: 0; margin-top: 1px; }
.warn-banner-text { font-size: 12.5px; color: var(--navy-800); line-height: 1.5; }
.warn-banner-text strong { color: var(--warning); }
.schema-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.schema-head-row, .schema-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 0.9fr 40px; align-items: center; }
.schema-head-row { padding: 10px 16px; background: #FAFBFC; border-bottom: 1px solid var(--border); }
.schema-head-cell { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-muted); }
.schema-row { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.schema-row:last-child { border-bottom: none; }
.schema-field-name { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; color: var(--text-primary); }
.schema-field-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.schema-badge { font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; display: inline-block; width: fit-content; }
.badge-pergunta { background: var(--blue-100); color: var(--blue-600); }
.badge-foto { background: var(--purple-bg); color: var(--purple); }
.badge-admin { background: #F1F5F9; color: var(--text-secondary); }
.badge-lookup { background: var(--warning-bg); color: var(--warning); }
.schema-required { font-size: 12px; color: var(--text-secondary); }
.schema-row-actions { display: flex; justify-content: flex-end; }
.icon-btn { width: 26px; height: 26px; border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; border: none; background: none; }
.icon-btn:hover { background: #F1F5F9; color: var(--text-primary); }
.icon-btn svg { width: 15px; height: 15px; }
.add-field-btn { margin-top: 12px; width: 100%; padding: 11px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md); background: none; color: var(--text-secondary); font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.add-field-btn:hover { background: var(--surface); border-color: var(--blue-500); color: var(--blue-600); }
.add-field-btn svg { width: 15px; height: 15px; }
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.admin-field-name { font-size: 13.5px; font-weight: 600; }
.admin-field-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.field-input-sm { font-size: 13px; padding: 8px 11px; border-radius: 7px; border: 1.5px solid var(--border); width: 220px; font-family: var(--font-mono); }



/* ══════════════════════════════════════════════════════════════════
   REGRAS MASTER: TOPBAR, ZOOM, SIDEBAR, NÓS, CONEXÕES & MODAIS
══════════════════════════════════════════════════════════════════ */

/* ============ REGRAS GLOBAIS DE LAYOUT E VIEWS ============ */
.view {
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.view .main {
  height: 100%;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.view .content {
  flex: 1;
  padding: 22px 28px;
  overflow-y: auto;
}

/* ============ SIDEBAR COLLAPSE & ICONS ============ */
.sidebar-collapse-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.sidebar-collapse-btn:hover {
  background: rgba(255,255,255,0.15);
  color: #FFFFFF;
}
.sidebar-collapse-btn svg {
  width: 14px;
  height: 14px;
  transition: transform 0.22s;
}
.layout.sidebar-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}
.layout.sidebar-collapsed .brand-info,
.layout.sidebar-collapsed .nav-label,
.layout.sidebar-collapsed .nav-item span,
.layout.sidebar-collapsed .footer-text {
  display: none !important;
}
.layout.sidebar-collapsed .sidebar-brand {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 14px 6px;
  gap: 10px;
}
.layout.sidebar-collapsed .brand-mark {
  width: 32px;
  height: 32px;
  font-size: 13px;
  margin: 0 auto;
}
.layout.sidebar-collapsed .sidebar-collapse-btn {
  margin: 0 auto;
}
.layout.sidebar-collapsed .sidebar-nav {
  padding: 12px 6px;
}
.layout.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
  width: 44px;
  margin: 4px auto;
  border-radius: 8px;
}
.layout.sidebar-collapsed .nav-item svg {
  margin: 0;
  width: 18px;
  height: 18px;
}
.layout.sidebar-collapsed .sidebar-footer {
  justify-content: center;
  padding: 14px 6px;
}
.layout.sidebar-collapsed .avatar-mini {
  margin: 0 auto;
}

/* ============ ZOOM CONTROLS (TOPBAR) ============ */
.zoom-controls {
  display: flex;
  align-items: center;
  background: #F1F5F9;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  gap: 2px;
}
.btn-icon {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover {
  background: #E2E8F0;
  color: var(--text-primary);
}
.btn-icon svg {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0;
  display: block;
}
.zoom-pct {
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  padding: 0 6px;
  min-width: 38px;
  text-align: center;
  user-select: none;
}

/* ============ CANVAS & NÓS ============ */
.canvas {
  position: absolute;
  width: 6000px;
  height: 6000px;
  left: 0;
  top: 0;
  transform: translate(0px, 0px);
  transform-origin: 0 0;
}
.connectors {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
}

.connector-path {
  fill: none;
  stroke: #93A1B0;
  stroke-width: 2;
  transition: stroke 0.15s;
}
.connector-hitbox {
  fill: none;
  stroke: transparent;
  stroke-width: 18;
  cursor: pointer;
}
.connector-group:hover .connector-path,
.connector-group.selected .connector-path {
  stroke: #2E74BE;
  stroke-width: 2.5;
}
.connector-ghost {
  fill: none;
  stroke: #2E74BE;
  stroke-width: 2.2;
  pointer-events: none;
}

.conn-actions-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.conn-actions-pill {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 4px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 20px;
  padding: 2px;
  box-shadow: 0 2px 8px rgba(15,42,74,0.12);
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.15s;
}
.conn-action-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: #F1F5F9;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.conn-action-btn:hover {
  background: #2563EB;
  color: #FFFFFF;
}
.conn-action-btn.delete:hover {
  background: #DC2626;
  color: #FFFFFF;
}
.conn-action-btn svg {
  width: 12px;
  height: 12px;
}

.port {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid #2E74BE;
  cursor: crosshair;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #2E74BE;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.port:hover, .port.glow {
  transform: scale(1.3);
  box-shadow: 0 0 0 4px rgba(46,116,190,0.25);
  background: #2E74BE;
  color: #FFFFFF;
}
.port.in {
  left: -8px;
  top: 24px;
}
.port.out {
  right: -8px;
  top: 24px;
}
.branch-port-wrapper {
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
}
.branch-port-plus, .branch-port-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid #1D8A5F;
  cursor: crosshair;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  transition: transform 0.15s, box-shadow 0.15s;
}
.branch-port-plus:hover, .branch-port-dot:hover {
  transform: scale(1.3);
  box-shadow: 0 0 0 4px rgba(29,138,95,0.25);
}

.node-quick-delete {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #94A3B8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  z-index: 6;
}
.node:hover .node-quick-delete {
  opacity: 1;
}
.node-quick-delete:hover {
  background: #DC2626;
  border-color: #DC2626;
  color: #FFFFFF;
}
.node-quick-delete svg {
  width: 11px;
  height: 11px;
}

/* ============ CORES E ESTRUTURA DOS NÓS ============ */
.node {
  position: absolute;
  width: 246px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 2;
  cursor: grab;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.node:hover {
  box-shadow: var(--shadow-md);
}
.node.selected {
  border-color: #2563EB !important;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.2) !important;
}

.node-head {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.node-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.node-icon svg {
  width: 15px;
  height: 15px;
}
.node-title-group {
  flex: 1;
  min-width: 0;
}
.node-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.node-type {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-muted);
}
.node-body {
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-secondary);
}
.node-badge {
  position: absolute;
  top: -10px;
  left: 12px;
  background: var(--navy-900);
  color: white;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 4;
}

/* Cores individuais por tipo de nó */
.node-type-trigger { border-color: #86EFAC; }
.node-type-trigger .node-head { background: #F0FDF4; }
.node-type-trigger .node-icon { background: #DCFCE7; color: #16A34A; }
.node-type-trigger .node-title { color: #15803D; }

.node-type-send { border-color: #BFDBFE; }
.node-type-send .node-head { background: #EFF6FF; }
.node-type-send .node-icon { background: #DBEAFE; color: #2563EB; }
.node-type-send .node-title { color: #1D4ED8; }

.node-type-wait { border-color: #FED7AA; }
.node-type-wait .node-head { background: #FFF7ED; }
.node-type-wait .node-icon { background: #FFEDD5; color: #EA580C; }
.node-type-wait .node-title { color: #C2410C; }

.node-type-cond { border-color: #E9D5FF; }
.node-type-cond .node-head { background: #FAF5FF; }
.node-type-cond .node-icon { background: #F3E8FF; color: #9333EA; }
.node-type-cond .node-title { color: #7E22CE; }

.node-type-ai { border-color: #DDD6FE; }
.node-type-ai .node-head { background: #F5F3FF; }
.node-type-ai .node-icon { background: #EDE9FE; color: #7C3AED; }
.node-type-ai .node-title { color: #6D28D9; }

.node-type-classify { border-color: #BAE6FD; }
.node-type-classify .node-head { background: #F0F9FF; }
.node-type-classify .node-icon { background: #E0F2FE; color: #0284C7; }
.node-type-classify .node-title { color: #0369A1; }

/* Trigger groups e campos */
.trigger-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.trigger-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748B;
}
.keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}
.keyword-chip {
  font-size: 11px;
  font-weight: 600;
  background: #DCFCE7;
  color: #166534;
  border: 1px solid #BBF7D0;
  border-radius: 6px;
  padding: 2px 7px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.keyword-chip-remove {
  cursor: pointer;
  color: #15803D;
  font-size: 10px;
  font-weight: 700;
}
.keyword-chip-remove:hover {
  color: #DC2626;
}
.keyword-add-row {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.trigger-input {
  flex: 1;
  font-size: 11.5px;
  padding: 4px 8px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  background: #FFFFFF;
  outline: none;
}
.keyword-add-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid #86EFAC;
  background: #DCFCE7;
  color: #15803D;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.trigger-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 4px;
}
.trigger-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475569;
}
.trigger-toggle-label svg {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  flex-shrink: 0;
  color: #64748B;
}
.trigger-time-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.trigger-time-box {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 7px;
  padding: 3px 6px;
}
.trigger-time-input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: #1E293B;
  outline: none;
}

/* ============ PREVIEWS DE MÍDIA NO CANVAS ============ */
.node-img-preview {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #E2E8F0;
  margin-bottom: 6px;
}
.node-audio-player {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F1F5F9;
  border-radius: 8px;
  padding: 6px 10px;
  margin-bottom: 6px;
}
.node-audio-play-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #2563EB;
  color: #FFFFFF;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.node-audio-play-btn svg { width: 12px; height: 12px; }
.node-audio-waveform {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 20px;
}
.node-audio-bar {
  flex: 1;
  background: #94A3B8;
  border-radius: 2px;
}
.node-audio-time {
  font-size: 11px;
  font-family: var(--font-mono);
  color: #64748B;
}
.node-options-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.node-option-btn {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #1D5FA3;
  text-align: center;
}

/* ============ CUSTOM DROPDOWNS ============ */
.custom-dropdown {
  position: relative;
  width: 100%;
}
.custom-dropdown-trigger {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #FFFFFF;
  font-size: 13px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.custom-dropdown-arrow {
  width: 14px;
  height: 14px;
  color: #64748B;
  transition: transform 0.2s;
}
.custom-dropdown.open .custom-dropdown-arrow {
  transform: rotate(180deg);
}
.custom-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15,42,74,0.12);
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}
.custom-dropdown.open .custom-dropdown-menu {
  display: block;
}
.custom-dropdown-option {
  padding: 7px 10px;
  font-size: 12.5px;
  color: #334155;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}
.custom-dropdown-option:hover {
  background: #F1F5F9;
  color: #0F172A;
}
.custom-dropdown-option.selected {
  background: #EFF6FF;
  color: #2563EB;
  font-weight: 600;
}
.custom-dropdown-option svg {
  width: 14px;
  height: 14px;
  color: #2563EB;
}

/* ============ PALETA LATERAL SUSPENSA (Top Right & Hover Expandable) ============ */
.node-palette {
  position: absolute;
  top: 72px;
  right: 20px;
  bottom: auto !important;
  left: auto !important;
  transform: none !important;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 20px rgba(15,42,74,0.09);
  display: flex;
  flex-direction: column;
  padding: 6px;
  z-index: 15;
  width: 195px;
  transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
  user-select: none;
}
.node-palette.collapsed {
  width: 44px;
  padding: 6px 4px;
}
.node-palette.collapsed .palette-title,
.node-palette.collapsed .palette-label {
  display: none !important;
}
.node-palette.collapsed .palette-header {
  justify-content: center;
  padding: 4px 0;
}
.node-palette.collapsed .palette-toggle-btn {
  transform: rotate(180deg);
}
.node-palette.collapsed .palette-item {
  justify-content: center;
  padding: 6px 0;
  width: 34px;
  margin: 0 auto;
}

/* EXPANSÃO SUAVE AO PASSAR O MOUSE QUANDO MINIMIZADO */
.node-palette.collapsed:hover {
  width: 195px;
  padding: 6px;
  box-shadow: 0 10px 28px rgba(15,42,74,0.18);
}
.node-palette.collapsed:hover .palette-title,
.node-palette.collapsed:hover .palette-label {
  display: inline !important;
}
.node-palette.collapsed:hover .palette-header {
  justify-content: space-between;
  padding: 4px 6px 6px;
}
.node-palette.collapsed:hover .palette-toggle-btn {
  transform: rotate(0deg);
}
.node-palette.collapsed:hover .palette-item {
  justify-content: flex-start;
  padding: 6px 8px;
  width: 100%;
  margin: 0;
}

.node-palette .palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 6px 6px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.node-palette .palette-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}
.node-palette .palette-toggle-btn {
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.node-palette .palette-toggle-btn svg {
  width: 14px;
  height: 14px;
}
.node-palette .palette-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.node-palette .palette-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: grab;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}
.node-palette .palette-item:hover {
  background: var(--blue-100);
  border-color: #BFDBFE;
}
.node-palette .palette-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.node-palette .palette-icon svg {
  width: 14px;
  height: 14px;
}
.node-palette .palette-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

/* ============ CONEXÕES STACKED & MULTI-INSTÂNCIAS ============ */
.conn-instances-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 980px;
}
.instance-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 42, 74, 0.04);
  overflow: hidden;
  transition: all 0.2s;
}
.instance-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 4px 12px rgba(15, 42, 74, 0.06);
}
.instance-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #F1F5F9;
  background: #FFFFFF;
  gap: 14px;
}
.instance-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.instance-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #E6F8EE;
  color: #16A34A;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  border: 2px solid #FFFFFF;
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}
.instance-avatar-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  background: #16A34A;
}
.instance-avatar-badge.disconnected { background: #94A3B8; }
.instance-avatar-badge.reconnecting { background: #EAB308; }
.instance-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.instance-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.instance-name {
  font-size: 15px;
  font-weight: 700;
  color: #0F172A;
}
.instance-default-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: #EFF6FF;
  color: #2563EB;
  border: 1px solid #BFDBFE;
  padding: 1px 6px;
  border-radius: 12px;
}
.instance-phone {
  font-size: 12.5px;
  color: #64748B;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 8px;
}
.instance-meta-tag {
  font-size: 11px;
  color: #64748B;
  background: #F1F5F9;
  padding: 1px 6px;
  border-radius: 4px;
}
.instance-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.instance-health-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 11.5px;
}
.instance-health-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #475569;
}

.instance-section-block {
  padding: 20px 24px;
  border-bottom: 1px solid #F1F5F9;
}
.instance-section-block:last-child {
  border-bottom: none;
}
.instance-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.instance-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.instance-section-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #EFF6FF;
  color: #2563EB;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.instance-section-icon svg {
  width: 15px;
  height: 15px;
}
.instance-section-title {
  font-size: 13.5px;
  font-weight: 700;
  color: #0F172A;
}
.instance-section-desc {
  font-size: 12px;
  color: #64748B;
  margin-top: 2px;
}

.instance-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.instance-stat-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px 14px;
}
.instance-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: #0F172A;
  font-family: var(--font-display);
}
.instance-stat-label {
  font-size: 11.5px;
  color: #64748B;
  margin-top: 2px;
}
.instance-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.instance-actions-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.instance-settings-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  gap: 14px;
}
.setting-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.setting-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2563EB;
  flex-shrink: 0;
}
.setting-icon svg { width: 16px; height: 16px; }
.setting-title {
  font-size: 13px;
  font-weight: 600;
  color: #0F172A;
}
.setting-desc {
  font-size: 11.5px;
  color: #64748B;
  margin-top: 1px;
}

.webhook-info-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.webhook-url-row {
  display: flex;
  gap: 8px;
}
.webhook-url-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #CBD5E1;
  background: #FFFFFF;
  color: #0F172A;
}

.terminal-log-box {
  background: #0B132B;
  border-radius: 8px;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #E2E8F0;
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.terminal-log-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}
.terminal-log-time { color: #64748B; flex-shrink: 0; }
.terminal-log-tag-success { color: #10B981; font-weight: 700; flex-shrink: 0; }
.terminal-log-tag-info { color: #38BDF8; font-weight: 700; flex-shrink: 0; }
.terminal-log-tag-warn { color: #F59E0B; font-weight: 700; flex-shrink: 0; }

/* ============ WIZARD QR CODE & PAIRING CODE ============ */
.wizard-nav {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid #E2E8F0;
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.wizard-nav-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: #64748B;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.wizard-nav-btn.active {
  background: #EFF6FF;
  border-color: #2563EB;
  color: #2563EB;
}
.qr-wizard-container {
  display: flex;
  gap: 20px;
  align-items: center;
}
.qr-code-wrapper {
  width: 170px;
  height: 170px;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 10px;
  background: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}
.qr-code-svg {
  width: 140px;
  height: 140px;
}
.qr-code-timer-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: #16A34A;
  border-radius: 0 0 12px 12px;
  transition: width 1s linear;
  width: 100%;
}
.qr-instructions-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qr-step-item {
  display: flex;
  gap: 8px;
  font-size: 12px;
  line-height: 1.35;
  color: #475569;
}
.qr-step-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #EFF6FF;
  color: #2563EB;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pairing-code-display {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 14px;
  text-align: center;
}
.pairing-code-digits {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #0F172A;
  background: #FFFFFF;
  border: 1.5px dashed #CBD5E1;
  border-radius: 8px;
  padding: 8px 14px;
  display: inline-block;
  margin: 6px 0;
}

/* ============ MODAL GENÉRICO ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,42,74,0.45);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s;
  backdrop-filter: blur(2px);
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(15,42,74,0.2);
  width: min(520px, 95vw);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  transform: scale(0.96);
  transition: transform 0.18s;
  border: 1px solid var(--border);
}
.modal-overlay.open .modal {
  transform: scale(1);
}
.modal-head {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 700;
  color: var(--navy-900);
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}


/* ============ CONEXÕES FULL-WIDTH 2-COLUMN LAYOUT ============ */
.conn-instances-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 100%;
}
.instance-card-full {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 42, 74, 0.04);
  overflow: hidden;
  width: 100%;
}
.instance-body-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
  padding: 18px 20px 22px;
  background: #FFFFFF;
}
@media (max-width: 1100px) {
  .instance-body-grid {
    grid-template-columns: 1fr;
  }
}
.instance-col-main, .instance-col-side {
  display: flex;
  flex-direction: column;
}
.instance-section-box {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(15,42,74,0.03);
}
.instance-section-box .instance-section-header {
  margin-bottom: 12px;
}
.instance-settings-list.compact {
  gap: 8px;
}
.instance-settings-list.compact .setting-row {
  padding: 10px 12px;
}


/* ============ REGRAS GLOBAIS DE ÍCONES E SVG ============ */
svg {
  flex-shrink: 0;
}
.upload-dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 8px;
  padding: 14px 12px;
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.upload-dropzone:hover {
  background: #EFF6FF;
  border-color: #2563EB;
}
.upload-dropzone svg {
  width: 22px !important;
  height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
  color: #2563EB;
  margin-bottom: 2px;
}
.upload-dropzone-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy-900);
}
.upload-dropzone-sub {
  font-size: 10.5px;
  color: var(--text-muted);
}
.helper-box {
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
  color: #1E3A8A;
  line-height: 1.4;
  margin-top: 8px;
}
.helper-box svg {
  width: 16px !important;
  height: 16px !important;
  max-width: 16px !important;
  max-height: 16px !important;
  color: #2563EB;
  margin-top: 1px;
  flex-shrink: 0;
}
.config-options-builder {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.config-option-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.config-option-delete {
  width: 28px;
  height: 28px;
  border: 1px solid #CBD5E1;
  background: #F8FAFC;
  color: #64748B;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.15s;
}
.config-option-delete:hover {
  background: #FEE2E2;
  border-color: #FCA5A5;
  color: #DC2626;
}
.var-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.var-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
  border-radius: 5px;
  padding: 2px 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.var-chip:hover {
  background: #DBEAFE;
  border-color: #93C5FD;
}
