/* ============================================================
   NexTags CRM — Liquid Glass design system
   Dark-only · roxo #6C5CE7→#A855F7 · mesh gradient · glass cards
   ============================================================ */

:root {
  /* Backgrounds */
  --bg-root: #0A0A0F;
  --bg-sidebar: #0D0D14;
  --bg-surface: #1A1A2E;
  --bg-card: rgba(18, 18, 26, 0.8);

  /* Accent — ROXO, nunca azul */
  --accent-1: #6C5CE7;
  --accent-2: #A855F7;
  --accent-cyan: #00D9FF;

  /* Estados */
  --danger: #FF6B6B;
  --danger-deep: #FF4757;
  --success: #00E676;
  --success-light: #69F0AE;
  --warning: #FFD93D;
  --warning-deep: #FFA502;
  --whatsapp: #25D366;

  /* Texto (WCAG AA) */
  --text-primary: #F5F5F7;
  --text-secondary: #C4C4D1;
  --text-tertiary: #9090A3;
  --text-muted: #6B6B80;
  --text-disabled: #4A4A5C;

  /* Bordas */
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);

  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-w: 248px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg-root);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: rgba(108, 92, 231, 0.35); }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.16); background-clip: content-box; }

/* ============================================================
   Mesh gradient background + stars
   ============================================================ */
.mesh { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.blob { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.55; }
.blob.b1 { width: 620px; height: 620px; background: radial-gradient(circle, #6C5CE7, transparent 70%); top: -180px; left: -120px; animation: float1 28s ease-in-out infinite; }
.blob.b2 { width: 540px; height: 540px; background: radial-gradient(circle, #A855F7, transparent 70%); bottom: -160px; right: -100px; animation: float2 32s ease-in-out infinite; }
.blob.b3 { width: 460px; height: 460px; background: radial-gradient(circle, #00D9FF, transparent 70%); top: 40%; left: 55%; opacity: 0.28; animation: float3 36s ease-in-out infinite; }
@keyframes float1 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(80px,60px) scale(1.1)} }
@keyframes float2 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(-70px,-50px) scale(1.08)} }
@keyframes float3 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(-60px,40px) scale(1.12)} }
.stars { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.4), transparent),
    radial-gradient(1px 1px at 60% 70%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 80% 20%, rgba(255,255,255,0.35), transparent),
    radial-gradient(1px 1px at 35% 85%, rgba(255,255,255,0.25), transparent),
    radial-gradient(1px 1px at 90% 60%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 10% 65%, rgba(255,255,255,0.22), transparent);
  background-size: 700px 700px, 600px 600px, 800px 800px, 500px 500px, 650px 650px, 550px 550px;
}
/* noise grain */
body::before { content:''; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ============================================================
   App shell
   ============================================================ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: rgba(13, 13, 20, 0.6);
  backdrop-filter: blur(40px) saturate(180%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 22px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, #6C5CE7, #A855F7);
  display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #fff;
  box-shadow: 0 0 20px rgba(108,92,231,0.45), inset 0 1px 0 rgba(255,255,255,0.25); }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-name span { background: linear-gradient(90deg, #A855F7, #00D9FF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { font-size: 10px; color: var(--text-muted); letter-spacing: 0.06em; text-transform: uppercase; }

.nav-label { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-disabled); padding: 14px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border-radius: 11px; color: var(--text-tertiary); font-weight: 500; font-size: 13.5px; position: relative; transition: all 0.15s; margin-bottom: 2px; }
.nav-item svg { width: 19px; height: 19px; stroke-width: 1.6; flex-shrink: 0; }
.nav-item:hover { color: var(--text-primary); background: rgba(255,255,255,0.03); }
.nav-item.active { color: var(--text-primary); background: linear-gradient(90deg, rgba(108,92,231,0.18), rgba(168,85,247,0.06)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.06); }
.nav-item.active::before { content:''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: linear-gradient(180deg, #6C5CE7, #A855F7); box-shadow: 0 0 10px rgba(108,92,231,0.6); }
.nav-item .badge { margin-left: auto; font-family: var(--font-mono); font-size: 10px; padding: 2px 7px; border-radius: 8px; background: linear-gradient(135deg, #6C5CE7, #A855F7); color: #fff; font-weight: 700; }

.sidebar-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--border); }
.acct-chip { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 11px; background: rgba(255,255,255,0.03); }
.acct-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); flex-shrink: 0; }
.acct-info { min-width: 0; }
.acct-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-meta { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

/* main */
main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 22px 32px 16px; position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.page-eyebrow { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-2); font-weight: 600; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.view { padding: 8px 32px 48px; }

/* ============================================================
   Glass card
   ============================================================ */
.glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(40px) saturate(180%);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.08);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.glass:hover { border-color: var(--border-hover); }
.card { padding: 20px; }
.card-pad-lg { padding: 24px; }

.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-head h3 { font-size: 14px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--text-muted); }
.card-head .right { margin-left: auto; }
.section-title { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); font-weight: 600; margin: 28px 0 12px; display:flex; align-items:center; gap:8px; }
.section-title .count { font-family: var(--font-mono); color: var(--accent-2); }

/* ============================================================
   KPI cards
   ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi { position: relative; overflow: hidden; padding: 18px 20px; }
.kpi .ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; margin-bottom: 12px; background: rgba(108,92,231,0.12); }
.kpi .ico svg { width: 18px; height: 18px; color: var(--accent-2); }
.kpi .label { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); font-weight: 600; }
.kpi .value { font-family: var(--font-mono); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-feature-settings: "tnum"; }
.kpi .delta { font-size: 11px; margin-top: 6px; color: var(--text-muted); }
/* featured iridescent */
.kpi.featured { background: rgba(108, 92, 231, 0.07); }
.kpi.featured::after { content:''; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent, rgba(108,92,231,0.4), rgba(0,217,255,0.3), transparent); filter: blur(28px); animation: spin 9s linear infinite; z-index: 0; }
.kpi.featured > * { position: relative; z-index: 1; }
.kpi.featured .value { background: linear-gradient(90deg, #fff, #00D9FF); -webkit-background-clip: text; background-clip: text; color: transparent; }
.kpi.featured .ico { background: rgba(0,217,255,0.14); }
.kpi.featured .ico svg { color: var(--accent-cyan); }
@keyframes spin { to { transform: rotate(360deg); } }
.tone-success .value { color: var(--success); }
.tone-success .ico { background: rgba(0,230,118,0.12); } .tone-success .ico svg { color: var(--success); }
.tone-danger .value { color: var(--danger); }
.tone-danger .ico { background: rgba(255,107,107,0.12); } .tone-danger .ico svg { color: var(--danger); }
.tone-warning .ico { background: rgba(255,217,61,0.12); } .tone-warning .ico svg { color: var(--warning); }

/* ============================================================
   Buttons
   ============================================================ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 11px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text-primary); font-weight: 600; font-size: 13px; line-height: 1; transition: all 0.15s; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--border-hover); background: rgba(255,255,255,0.07); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-primary { border: none; background: linear-gradient(135deg, #6C5CE7, #A855F7); box-shadow: 0 4px 18px rgba(108,92,231,0.4), inset 0 1px 0 rgba(255,255,255,0.2); }
.btn-primary:hover { box-shadow: 0 6px 24px rgba(108,92,231,0.55), inset 0 1px 0 rgba(255,255,255,0.2); }
.btn-success { border: none; background: linear-gradient(135deg, #00B248, #00E676); box-shadow: 0 4px 18px rgba(0,230,118,0.32); color: #04140a; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 9px; }
.btn-icon { padding: 9px; border-radius: 10px; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th { text-align: left; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: rgba(13,13,20,0.7); backdrop-filter: blur(8px); }
table.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr { transition: background 0.12s; }
table.tbl tbody tr:hover { background: rgba(255,255,255,0.02); }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
.num { font-family: var(--font-mono); text-align: right; }

/* ============================================================
   Badges / pills
   ============================================================ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.badge.sent, .badge.running { background: rgba(0,230,118,0.12); color: var(--success-light); } .badge.sent .dot, .badge.running .dot { background: var(--success); box-shadow: 0 0 6px var(--success); }
.badge.queued, .badge.draft { background: rgba(255,217,61,0.12); color: var(--warning); } .badge.queued .dot, .badge.draft .dot { background: var(--warning); }
.badge.failed { background: rgba(255,107,107,0.12); color: var(--danger); } .badge.failed .dot { background: var(--danger); }
.badge.neutral { background: rgba(255,255,255,0.06); color: var(--text-tertiary); } .badge.neutral .dot { background: var(--text-tertiary); }
.badge.info { background: rgba(0,217,255,0.12); color: var(--accent-cyan); } .badge.info .dot { background: var(--accent-cyan); }
.badge.purple { background: rgba(168,85,247,0.14); color: #d6b6ff; }

.pill { display:inline-flex; align-items:center; gap:6px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,0.04); border: 1px solid var(--border); font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); }

/* ============================================================
   Forms
   ============================================================ */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); font-weight: 600; margin-bottom: 7px; }
.input, .select, textarea.input { width: 100%; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); color: var(--text-primary); font-size: 13.5px; font-family: inherit; transition: border-color 0.15s, box-shadow 0.15s; }
textarea.input { resize: vertical; min-height: 100px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; }
.input:focus, .select:focus, textarea.input:focus { outline: none; border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(108,92,231,0.18); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%239090A3' stroke-width='2'%3E%3Cpath d='M3 5l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
.help { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.input::placeholder, textarea.input::placeholder { color: var(--text-disabled); }

/* slide-over */
.overlay { position: fixed; inset: 0; background: rgba(5,5,10,0.55); backdrop-filter: blur(4px); z-index: 50; opacity: 0; animation: fadeIn 0.2s forwards; }
.slideover { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 94vw); z-index: 51; background: rgba(16,16,24,0.92); backdrop-filter: blur(40px) saturate(180%); border-left: 1px solid var(--border); box-shadow: -20px 0 60px rgba(0,0,0,0.5); display: flex; flex-direction: column; transform: translateX(20px); opacity: 0; animation: slideIn 0.24s cubic-bezier(0.4,0,0.2,1) forwards; }
.slideover-head { display: flex; align-items: center; gap: 12px; padding: 22px 24px 16px; border-bottom: 1px solid var(--border); }
.slideover-head h2 { font-size: 17px; font-weight: 700; }
.slideover-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.slideover-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; }
.x-btn { margin-left: auto; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,0.04); border: 1px solid var(--border); color: var(--text-tertiary); }
.x-btn:hover { color: var(--text-primary); }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes slideIn { to { transform: translateX(0); opacity: 1; } }

/* ============================================================
   Empty states
   ============================================================ */
.empty { text-align: center; padding: 56px 24px; }
.empty .ico { width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 18px; display: grid; place-items: center; background: rgba(108,92,231,0.08); position: relative; }
.empty .ico::after { content:''; position: absolute; inset: -20px; border-radius: 40px; background: radial-gradient(circle, rgba(108,92,231,0.25), transparent 70%); filter: blur(20px); z-index: -1; }
.empty .ico svg { width: 32px; height: 32px; color: var(--accent-2); }
.empty h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.empty p { color: var(--text-muted); max-width: 420px; margin: 0 auto 18px; font-size: 13px; }

/* ============================================================
   Flow builder
   ============================================================ */
.flow-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
.palette { padding: 16px; }
.palette h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-tertiary); margin-bottom: 12px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,0.02); margin-bottom: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); cursor: grab; transition: all 0.15s; }
.palette-item:hover { border-color: var(--accent-1); background: rgba(108,92,231,0.08); color: var(--text-primary); transform: translateX(2px); }
.palette-item .pi-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.palette-item .pi-ico svg { width: 15px; height: 15px; }

.canvas { position: relative; min-height: 560px; padding: 36px; overflow: auto;
  background-image: radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px); background-size: 22px 22px; }
.flow-col { display: flex; flex-direction: column; align-items: center; gap: 0; }
.node { width: 300px; padding: 14px 16px; position: relative; }
.node.trigger { background: linear-gradient(135deg, rgba(108,92,231,0.18), rgba(168,85,247,0.06)); border-color: rgba(168,85,247,0.3); }
.node.terminal { background: linear-gradient(135deg, rgba(0,230,118,0.12), transparent); border-color: rgba(0,230,118,0.25); }
.node-head { display: flex; align-items: center; gap: 9px; }
.node-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.node-ico svg { width: 16px; height: 16px; }
.node-eyebrow { font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-tertiary); font-weight: 700; }
.node-title { font-size: 13.5px; font-weight: 600; }
.node-body { font-size: 12px; color: var(--text-tertiary); margin-top: 8px; line-height: 1.5; }
.connector { width: 2px; height: 30px; background: linear-gradient(180deg, rgba(168,85,247,0.5), rgba(108,92,231,0.2)); position: relative; }
.connector::after { content:''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 7px; height: 7px; border-right: 2px solid rgba(108,92,231,0.5); border-bottom: 2px solid rgba(108,92,231,0.5); transform: translateX(-50%) rotate(45deg); }
.connector .clabel { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }
.add-node { width: 26px; height: 26px; border-radius: 50%; border: 1px dashed var(--border-hover); background: rgba(255,255,255,0.02); color: var(--text-tertiary); display: grid; place-items: center; transition: all 0.15s; }
.add-node:hover { border-color: var(--accent-1); color: var(--accent-2); background: rgba(108,92,231,0.1); }

/* ============================================================
   Inbox / Conversas
   ============================================================ */
.inbox { display: grid; grid-template-columns: 320px 1fr 300px; gap: 16px; height: calc(100vh - 150px); }
.conv-list { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.conv-search { padding: 14px; border-bottom: 1px solid var(--border); }
.conv-scroll { overflow-y: auto; flex: 1; }
.conv-row { display: flex; gap: 11px; padding: 13px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.12s; }
.conv-row:hover { background: rgba(255,255,255,0.03); }
.conv-row.active { background: linear-gradient(90deg, rgba(108,92,231,0.14), transparent); }
.avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; }
.conv-meta { min-width: 0; flex: 1; }
.conv-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; }
.conv-name .time { margin-left: auto; font-size: 10px; color: var(--text-muted); font-weight: 400; font-family: var(--font-mono); }
.conv-preview { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.thread { display: flex; flex-direction: column; overflow: hidden; }
.thread-head { display: flex; align-items: center; gap: 11px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.thread-msgs { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 70%; padding: 9px 13px; border-radius: 14px; font-size: 13px; line-height: 1.5; }
.bubble.in { align-self: flex-start; background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; background: linear-gradient(135deg, rgba(37,211,102,0.22), rgba(37,211,102,0.12)); border: 1px solid rgba(37,211,102,0.25); border-bottom-right-radius: 4px; }
.bubble .bt { font-size: 9px; color: var(--text-muted); margin-top: 4px; font-family: var(--font-mono); text-align: right; }
.thread-input { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.contact-panel { padding: 20px; }
.contact-panel .avatar-lg { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px; display: grid; place-items: center; font-weight: 700; font-size: 22px; color: #fff; }
.info-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.info-row .k { color: var(--text-muted); }
.info-row .v { color: var(--text-secondary); font-family: var(--font-mono); }
.toggle { position: relative; width: 40px; height: 22px; border-radius: 999px; background: rgba(255,255,255,0.1); transition: background 0.2s; flex-shrink: 0; }
.toggle.on { background: linear-gradient(135deg, #6C5CE7, #A855F7); }
.toggle::after { content:''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.toggle.on::after { transform: translateX(18px); }

/* loading */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.15); border-top-color: var(--accent-2); border-radius: 50%; animation: spin 0.7s linear infinite; }
.center-load { display: grid; place-items: center; padding: 60px; }
.skeleton { background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.07), rgba(255,255,255,0.03)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.toast-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 13px 18px; border-radius: 12px; background: rgba(20,20,30,0.95); backdrop-filter: blur(20px); border: 1px solid var(--border); box-shadow: 0 8px 30px rgba(0,0,0,0.5); font-size: 13px; min-width: 240px; animation: slideIn 0.24s; border-left: 3px solid var(--accent-1); }
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }

.row-actions { display: flex; gap: 8px; align-items: center; }
.muted { color: var(--text-muted); }
.fade-in { animation: fadeIn 0.3s ease; }

/* ============================================================
   WABAs conectadas
   ============================================================ */
.waba-card { margin-bottom: 16px; }
.waba-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.waba-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.waba-badges { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.waba-limit-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.limit-box { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.limit-box .lk { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); font-weight: 600; }
.limit-box .lv { margin-top: 7px; }
.limit-box .lhint { font-size: 11px; color: var(--warning); margin-top: 6px; }
.health-banner { margin-top: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); }
.health-banner ul { margin: 0; padding-left: 18px; font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; }
.health-banner.hb-green { background: rgba(0,230,118,0.07); border-color: rgba(0,230,118,0.2); }
.health-banner.hb-yellow { background: rgba(255,217,61,0.07); border-color: rgba(255,217,61,0.22); }
.health-banner.hb-red { background: rgba(255,107,107,0.08); border-color: rgba(255,107,107,0.25); }
.meta-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.meta-item { background: rgba(255,255,255,0.02); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px; min-width: 0; }
.meta-item .mk { font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); font-weight: 600; }
.meta-item .mv { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; word-break: break-word; }
.limit-note { margin-top: 16px; }
.limit-note summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-secondary); list-style: none; display: flex; align-items: center; gap: 8px; }
.limit-note summary::before { content: '?'; width: 20px; height: 20px; border-radius: 6px; background: rgba(0,217,255,0.14); color: var(--accent-cyan); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.limit-note summary::-webkit-details-marker { display: none; }
.limit-note[open] summary { color: var(--text-primary); }
.limit-note p { margin: 0; }
@media (max-width: 720px) { .meta-grid { grid-template-columns: 1fr; } .waba-limit-row { grid-template-columns: 1fr; } .waba-badges { margin-left: 0; } }

/* ============================================================
   Construtor de fluxo (builder)
   ============================================================ */
.builder-layout { display: grid; grid-template-columns: 196px 1fr 340px; gap: 16px; align-items: start; }
.builder-center { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.palette { position: sticky; top: 84px; }
.palette-hint { font-size: 11px; color: var(--text-muted); margin-top: 12px; line-height: 1.5; }
.builder-head { padding: 16px 18px; }
.fb-name { font-size: 16px; font-weight: 700; border: none; background: transparent; padding: 4px 0; }
.fb-name:focus { box-shadow: none; border-bottom: 1px solid var(--accent-1); border-radius: 0; }
.fb-head-row { display: grid; grid-template-columns: 1fr 160px; gap: 12px; margin-top: 12px; }
.fb-field label { display: block; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary); font-weight: 600; margin-bottom: 6px; }
.node { cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.node.selected { border-color: rgba(168,85,247,0.5); box-shadow: 0 0 0 1px rgba(168,85,247,0.35), 0 8px 32px rgba(0,0,0,0.4); }
.node-acts { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.node:hover .node-acts { opacity: 1; }
.node-act { width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text-tertiary); font-size: 13px; line-height: 1; display: grid; place-items: center; }
.node-act:hover { color: var(--text-primary); border-color: var(--border-hover); }
.add-node.add-end { border-style: solid; }
.inspector { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; padding: 0; }
.insp-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.insp-title { font-weight: 700; font-size: 14px; }
.insp-body { padding: 16px 18px; }
.insp-note { font-size: 12.5px; color: var(--text-secondary); background: rgba(0,217,255,0.06); border: 1px solid rgba(0,217,255,0.15); border-radius: 10px; padding: 9px 11px; margin-bottom: 16px; }
.ins-label { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-tertiary); font-weight: 600; margin: 4px 0 8px; }
.btn-edit { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.btn-edit .input { flex: 1; }
.insert-menu { position: fixed; z-index: 60; width: 220px; background: rgba(20,20,30,0.97); backdrop-filter: blur(20px); border: 1px solid var(--border-hover); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,0.55); padding: 6px; animation: fadeIn 0.12s; }
.ins-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.ins-item:hover { background: rgba(108,92,231,0.12); color: var(--text-primary); }
.ins-item .pi-ico { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0; }
.ins-item .pi-ico svg { width: 14px; height: 14px; }
@media (max-width: 1100px) { .builder-layout { grid-template-columns: 1fr; } .palette, .inspector { position: static; max-height: none; } .palette { display: flex; flex-wrap: wrap; gap: 8px; } .palette h4, .palette-hint { width: 100%; } }

@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .inbox { grid-template-columns: 280px 1fr; } .contact-panel { display: none; }
  .flow-layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; } .sidebar { display: none; }
  .kpi-grid { grid-template-columns: 1fr; } .view, .topbar { padding-left: 16px; padding-right: 16px; }
}
