/* =============================================================
   VENDDYX - Design System Premium
   Paleta: Roxo (#6C5CE7) + Amarelo CTA (#FFD100) + Dark BG
   Inspirado em Linear, Pipedrive, Notion
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600&display=swap');

/* =================================================================
   DESIGN TOKENS — soft enterprise (light default)
   Inspirado em Slack, Linear, Notion, Attio, Stripe Dashboard.
   Light only.
   ================================================================= */
:root {
  /* === MARCA VENDDYX === */
  --brand-purple: #6D5EF9;
  --brand-purple-deep: #5B4DF4;
  --brand-purple-darker: #4F46E5;
  --brand-bg-1: #1E1B3A;
  --brand-bg-2: #2A2356;
  --brand-cta: #FFD100;
  --brand-cta-hover: #FFC300;

  /* Cores principais */
  --primary: #6D5EF9;
  --primary-dark: #5B4DF4;
  --primary-darker: #4F46E5;
  --primary-light: #EEF2FF;
  --primary-lighter: #F5F7FF;

  --accent: #FFD100;
  --accent-dark: #FFB800;
  --accent-light: #FFFBEB;

  --secondary: #22C55E;
  --secondary-dark: #16A34A;
  --secondary-light: #ECFDF5;

  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --success: #22C55E;
  --info: #3B82F6;
  --success-light: #ECFDF5;

  /* Neutros (light) — superficies levemente WARM (off-white sofisticado).
     Inspirado em Linear/Notion light: nao ha branco-estourado-hospital. */
  --bg:        #F8F9FB;   /* fundo geral: levemente azulado-quente */
  --bg-soft:   #F1F3F6;   /* hover/secundario */
  --bg-dark:   #0F172A;
  --card:      #FFFFFF;
  --surface:   #FFFFFF;
  --surface-2: #FAFBFC;   /* inputs/cards secundarios */

  --text:           #1A1D24;   /* nao 100% preto — menos cansativo */
  --text-secondary: #374151;
  --text-muted:     #697080;
  --text-light:     #9CA3AF;

  --border:        #E7EAEE;    /* mais sutil que #E5E7EB */
  --border-strong: #D1D5DB;
  --border-soft:   #F0F2F5;

  /* Chat: bubbles (light) */
  --bubble-them:    #FFFFFF;
  --bubble-them-tx: #111827;
  --bubble-me:      #E9F2FF;
  --bubble-me-tx:   #0B2640;

  /* Sombras enterprise (estilo Linear/Notion) — sutis, sem glow.
     Camadas combinadas pra sensacao de profundidade fina. */
  --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-sm: 0 1px 3px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 1px 3px rgba(17, 24, 39, 0.06), 0 4px 8px -2px rgba(17, 24, 39, 0.04);
  --shadow-lg: 0 4px 12px rgba(17, 24, 39, 0.08), 0 1px 3px rgba(17, 24, 39, 0.04);
  --shadow-xl: 0 12px 28px rgba(17, 24, 39, 0.10), 0 2px 4px rgba(17, 24, 39, 0.04);
  --shadow-2xl: 0 24px 48px rgba(17, 24, 39, 0.14);
  --shadow-glow: 0 0 0 3px rgba(109, 94, 249, 0.14);

  /* Border radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --t-fast: 0.12s cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* === SPACING SCALE (4pt grid) — Fase 1
     Tokens opt-in pra componentes novos (.vx-*). Codigo legado segue
     usando valores literais sem quebra. */
  --space-0:  0;
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* === TYPOGRAPHY SCALE — Fase 1
     Escala consistente p/ Linear/Notion/Attio vibe. Base 14px. */
  --text-xs:   11px;
  --text-sm:   12.5px;
  --text-base: 14px;
  --text-md:   15px;
  --text-lg:   17px;
  --text-xl:   20px;
  --text-2xl:  26px;
  --text-3xl:  34px;

  /* Line-heights pareados (tight pra titulos, normal pra corpo) */
  --leading-tight:  1.2;
  --leading-snug:   1.35;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* Font weights — Inter completo */
  --fw-regular:  400;
  --fw-medium:   500;
  --fw-semibold: 600;
  --fw-bold:     700;

  /* Letter-spacing tokens — Inter visualmente correto */
  --tracking-tight:  -0.02em;
  --tracking-normal: -0.01em;
  --tracking-wide:    0;
  --tracking-uppercase: 0.06em;

  /* Easing curves expostos pra reuso fora de transitions inline */
  --ease-fluid:  cubic-bezier(0.4, 0, 0.2, 1);
  --ease-snappy: cubic-bezier(0.2, 0, 0, 1);
}

/* Dark mode foi removido do sistema. VENDDYX usa exclusivamente
   light theme premium (off-white sofisticado estilo Linear/Notion). */

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Light only — sistema sem dark mode. Browser usa scrollbar nativa,
     form controls, autofill colors etc no esquema claro consistentemente. */
  color-scheme: light;
}

/* ===== ACESSIBILIDADE: reduce motion =====
   Respeita usuarios com sensibilidade a movimento (vestibular,
   epilepsia fotossensivel, preferencia pessoal). Anula
   animacoes e transicoes longas, mantendo apenas feedback minimo. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* cv02/cv03/cv11 = stylistic alternates do Inter (numerais, ascenders, etc).
     ss01 = "single-storey a". calt = ligaduras contextuais. */
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01', 'calt';
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  font-size: 14px;
  letter-spacing: -0.01em;
}

/* Numeros tabulares (alinhados em colunas) onde fizer sentido —
   timestamps, valores, contadores. Aplicado seletivamente nos
   componentes que precisam, nao globalmente. */

a { color: inherit; text-decoration: none; transition: color var(--t-fast); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

code, pre { font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace; }
code {
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: 12.5px;
  border: 1px solid var(--border);
}

::selection { background: var(--primary-light); color: var(--primary-dark); }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* === AUTH PAGES === */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, #7C3AED 100%);
  background-size: 200% 200%;
  animation: gradient 8s ease infinite;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

@keyframes gradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.auth-container::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.15), transparent 50%),
              radial-gradient(circle at 80% 80%, rgba(255,255,255,0.10), transparent 50%);
  pointer-events: none;
}

.auth-card {
  background: white;
  padding: 44px 40px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  width: 100%;
  max-width: 460px;
  position: relative;
  z-index: 1;
}

.auth-card h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.6px; margin-bottom: 8px; }
.auth-card .subtitle { color: var(--text-muted); margin-bottom: 28px; font-size: 15px; }

.brand {
  font-weight: 800;
  font-size: 22px;
  color: var(--primary);
  margin-bottom: 24px;
  letter-spacing: -0.6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* === FORMS === */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text-secondary);
  letter-spacing: -0.1px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14.5px;
  background: white;
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  font-weight: 500;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-light); font-weight: 400; }

.form-group textarea { resize: vertical; min-height: 64px; line-height: 1.5; }

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover { border-color: var(--border-strong); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), box-shadow var(--t-fast),
              transform var(--t-fast);
  white-space: nowrap;
  letter-spacing: -0.1px;
  position: relative;
  overflow: hidden;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
  box-shadow: 0 1px 2px rgba(79,70,229,0.2), inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: 0 6px 16px rgba(79,70,229,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-soft); border-color: var(--border-strong); }

.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--bg-soft); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #DC2626; box-shadow: 0 4px 12px rgba(239,68,68,0.35); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: var(--secondary-dark); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: var(--radius-sm); }

.muted-link { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-muted); }
.muted-link a { color: var(--primary); font-weight: 600; }
.muted-link a:hover { color: var(--primary-dark); }

/* === ALERTS === */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 13.5px;
  font-weight: 500;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid transparent;
}
.alert-error   { background: var(--danger-light);   color: #991B1B; border-color: #FECACA; }
.alert-success { background: var(--success-light);  color: #065F46; border-color: #A7F3D0; }
.alert-warning { background: var(--warning-light);  color: #92400E; border-color: #FDE68A; }
.alert-info    { background: var(--primary-light);  color: var(--primary-darker); border-color: #C7D2FE; }

/* === APP LAYOUT === */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: white;
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar .brand { padding: 0 8px 24px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 2px;
  transition: background-color var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), box-shadow var(--t-fast),
              transform var(--t-fast);
  font-size: 14px;
  cursor: pointer;
  letter-spacing: -0.1px;
}
.nav-item:hover { background: var(--bg-soft); color: var(--text); }
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary-darker);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(79,70,229,0.1);
}

.main { flex: 1; padding: 28px 32px; overflow-x: auto; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.topbar h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--text);
}

/* === KANBAN === */
.kanban {
  display: flex;
  gap: 14px;
  padding-bottom: 20px;
  overflow-x: auto;
  min-height: 200px;
}

.kanban-col {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* Sticky header — fica fixo no topo quando scrolla dentro da coluna.
   Tem bg pra cobrir cards passando atras. z-index baixo pra nao tapar
   dropdowns/modals globais. */
.kanban-col-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -4px -4px 8px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
}

.kanban-col-header h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.count-badge {
  background: white;
  padding: 2px 9px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* Drop zone — feedback refinado durante drag.
   .over com dashed border inset + bg lilac soft. */
.drop-zone {
  min-height: 80px;
  border: 2px dashed transparent;
  border-radius: var(--radius);
  transition: background 120ms var(--ease-fluid),
              border-color 120ms var(--ease-fluid);
  padding: 4px 4px;
  flex: 1;
  position: relative;
}
.drop-zone.over {
  background: var(--primary-light);
  border-color: rgba(109, 94, 249, 0.32);
}
/* Quando esta vazia (sem cards) e ativa, mostra placeholder "Soltar aqui" */
.drop-zone.over:empty::before {
  content: 'Soltar aqui';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-uppercase);
  text-transform: uppercase;
  color: var(--primary);
  opacity: 0.7;
  pointer-events: none;
}

.lead-card {
  background: white;
  padding: 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  /* Anima so propriedades GPU-cheap (transform/opacity/box-shadow/border) */
  /* transition simplificada — em pipelines com 100+ cards, hover repinta
     muito. Sem transform translateY (que forca compositing) e sem transition
     em transform/shadow. So border-color (cheap repaint). */
  transition: border-color 120ms ease;
}
.lead-card:hover {
  border-color: var(--primary);
}
.lead-card:active { cursor: grabbing; }
.lead-card.dragging {
  opacity: 0.45;
  transform: rotate(1.5deg) scale(0.98);
  cursor: grabbing;
}
/* Card recem-droppado em outra coluna — flash sutil de confirmacao */
.lead-card.just-dropped {
  animation: card-just-dropped 540ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes card-just-dropped {
  0%   { transform: translateY(-4px) scale(0.98); box-shadow: 0 0 0 3px rgba(109, 94, 249, 0.18), var(--shadow-md); }
  100% { transform: translateY(0) scale(1); box-shadow: var(--shadow-sm); }
}
@media (prefers-reduced-motion: reduce) {
  .lead-card.just-dropped,
  .lead-card.dragging { animation: none; transform: none; }
}

.lead-card h4 { font-size: 14px; margin-bottom: 6px; word-break: break-word; font-weight: 600; letter-spacing: -0.2px; }
.lead-card .phone { font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.lead-card .meta { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; font-weight: 500; }

/* === ONBOARDING === */
.onboarding { max-width: 820px; margin: 0 auto; padding: 60px 24px; }
.onboarding h1 { text-align: center; margin-bottom: 8px; font-size: 34px; font-weight: 800; letter-spacing: -1px; }
.onboarding > .subtitle { text-align: center; color: var(--text-muted); margin-bottom: 40px; font-size: 16px; }

.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.type-card {
  background: white;
  padding: 32px 24px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: background-color var(--t-base), color var(--t-base),
              border-color var(--t-base), box-shadow var(--t-base),
              transform var(--t-base);
  text-align: center;
}
.type-card:hover { border-color: var(--primary); transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.type-card.selected { border-color: var(--primary); background: var(--primary-light); }
.type-card .icon { font-size: 44px; margin-bottom: 14px; }
.type-card h3 { font-size: 17px; margin-bottom: 6px; font-weight: 700; }
.type-card p { color: var(--text-muted); font-size: 13px; }

/* === MODAL === */
.modal-backdrop {
  position: fixed; inset: 0;
  /* Sem backdrop-filter blur — caro em laptops/celulares medios (GPU
     compositing constante mesmo escondido). Overlay opaco mais escuro
     compensa visualmente sem custo. */
  background: rgba(15, 23, 42, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  /* PHASE-RESP: z-index 200 cobre topbar (100), hamburger (110), sidebar
     drawer (70/120) e o overlay da sidebar. Antes era 100 e o hamburger
     mobile (z-index 110) ficava POR CIMA do modal. */
  z-index: 200;
  padding: 20px;
  animation: fadeIn var(--t-base);
}
/* Defesa em profundidade: quando qualquer modal-backdrop esta aberto,
   escondemos o hamburger (.vx-mobile-menu-btn) mesmo que algum z-index
   futuro inverta. JS adiciona body.modal-open quando o modal abre. */
body.modal-open .vx-mobile-menu-btn { display: none !important; }

/* PHASE-RESP: botao X de fechar no canto sup direito do modal global
   (.modal-backdrop > .modal). Posicao absoluta dentro do .modal (que e'
   position: relative implicito pelo flex; reforcamos abaixo via .modal). */
.modal-close-btn {
  position: absolute;
  top: 12px; right: 12px;
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted, #697080);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, border-color 0.14s;
  z-index: 2;
}
.modal-close-btn:hover {
  background: var(--bg-soft, #F1F3F6);
  color: var(--text, #111827);
  border-color: var(--border, #E5E7EB);
}
.modal-close-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(109, 94, 249, 0.18);
}
.modal { position: relative; }
.modal-backdrop.open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-2xl);
  animation: slideUp var(--t-slow);
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal h3 { margin-bottom: 20px; font-size: 19px; font-weight: 700; letter-spacing: -0.4px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }

/* === CARDS === */
.card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 18px;
  transition: box-shadow var(--t-base);
}
.card:hover { box-shadow: var(--shadow-md); }
.card h3 { margin-bottom: 16px; font-size: 17px; font-weight: 700; letter-spacing: -0.3px; }

.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type="color"] {
  width: 56px; height: 42px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius); cursor: pointer; padding: 3px;
  background: white;
}
.color-row input[type="text"] { flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 13px; }

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.badge-ceo      { background: #FEF3C7; color: #92400E; }
.badge-gerente  { background: #DBEAFE; color: #1E40AF; }
.badge-vendedor { background: #D1FAE5; color: #065F46; }
.badge-inativo  { background: #FEE2E2; color: #991B1B; }

/* === TABLES === */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
th { color: var(--text-muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.5px; background: var(--bg-soft); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover { background: var(--bg-soft); }

/* =====================================================
   PHASE-UX: UTILITIES de feedback de ação (opt-in).
   Classes que telas/handlers podem aplicar para padronizar visual:
   - .is-loading / .btn-loading: botão em estado de processamento
     (spinner inline antes do texto + opacidade + cursor wait + bloqueio
     pointer-events). Ó opt-in: nada é aplicado por default — os
     componentes existentes que já têm loader próprio não são
     afetados.
   - .vx-focus-ring: foco visível padronizado (acessibilidade).
   - .vx-clickable: hover discreto + active state + cursor pointer
     para cards/itens clicáveis sem visual de botão.
   - Spinner pequeno (`@keyframes vx-spin`).
   Tudo respeita @media (prefers-reduced-motion: reduce).
   ===================================================== */
@keyframes vx-spin { to { transform: rotate(360deg); } }

/* Botão em estado busy/loading — opt-in via classList.add('is-loading') */
.is-loading,
.btn-loading {
  position: relative;
  pointer-events: none;
  cursor: wait;
  opacity: 0.78;
}
/* Spinner inline ANTES do texto. Usa ::before para não reescrever
   o conteúdo HTML existente do botão. */
.is-loading::before,
.btn-loading::before {
  content: '';
  display: inline-block;
  width: 12px; height: 12px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: vx-spin 0.7s linear infinite;
  opacity: 0.85;
}
/* Aria-busy também ativa o estado (assistive tech-friendly) */
[aria-busy="true"]:not(.is-loading):not(.btn-loading) {
  pointer-events: none;
  cursor: wait;
  opacity: 0.85;
}

/* Foco visível padronizado (a11y) — opt-in via .vx-focus-ring ou
   aplicado por botões/inputs que já tinham um ring custom. */
.vx-focus-ring:focus-visible,
button:focus-visible,
a.nav-item:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.22);
  border-radius: inherit;
}

/* Card/item clicável — hover discreto + active state. Opt-in via
   .vx-clickable. */
.vx-clickable {
  cursor: pointer;
  transition: background-color 120ms ease-out, transform 120ms ease-out;
}
.vx-clickable:hover { background-color: var(--bg-soft, #F1F3F6); }
.vx-clickable:active { transform: scale(0.985); }

/* Skeleton bloco simples para placeholders (opt-in via .vx-skeleton-bar)
   — uma barra cinza com shimmer suave. */
@keyframes vx-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.vx-skeleton-bar {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #EEF1F5 0%, #F8FAFC 50%, #EEF1F5 100%);
  background-size: 200% 100%;
  animation: vx-shimmer 1.4s ease-in-out infinite;
}

/* Reduced motion: desliga animacoes destes utilities */
@media (prefers-reduced-motion: reduce) {
  .is-loading::before,
  .btn-loading::before { animation: none !important; }
  .vx-skeleton-bar { animation: none !important; }
  .vx-clickable { transition: none !important; }
  .vx-clickable:active { transform: none !important; }
}

/* =====================================================
   PHASE-NAV (v2): apenas animacao de ENTRADA da pagina.
   Versao anterior usava preventDefault + setTimeout + pointer-events:
   none, o que travava cliques (era preciso clicar 2-3x). Agora a
   navegacao e' 100% NATIVA do navegador — sem interceptacao agressiva.
   Mantemos so' fade-in leve de entrada + feedback visual no item
   clicado (.nav-clicking). Animacao aplica APENAS no <main>.
   ===================================================== */
@keyframes vx-page-enter {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}
body.vx-page-ready > .app > .main {
  animation: vx-page-enter 140ms ease-out both;
}
/* Feedback INSTANTANEO no item de menu clicado — escala leve da
   opacidade enquanto o navegador inicia a navegacao. NAO bloqueia
   nada (sem preventDefault, sem pointer-events: none). */
.nav-item.nav-clicking {
  opacity: 0.75;
  transition: opacity 80ms ease-out;
}
/* Reduced motion: desliga animacoes — navegacao nativa continua. */
@media (prefers-reduced-motion: reduce) {
  body.vx-page-ready > .app > .main { animation: none !important; }
  .nav-item.nav-clicking { opacity: 1 !important; transition: none !important; }
}

/* === RESPONSIVE === */
/* PHASE-RESP: botao hamburger — oculto por DEFAULT (desktop), visivel em
   mobile via @media abaixo. IMPORTANTE: declarado ANTES do @media para
   que a regra mobile (display: inline-flex) ganhe por ordem de fonte
   sem precisar de !important. Bug anterior: a regra de ocultar estava
   DEPOIS do @media e sobrescrevia em todas as viewports. */
.vx-mobile-menu-btn { display: none; }

/* @keyframes precisa ficar fora do @media pra ser referenciavel sempre */
@keyframes vx-fade-in { from { opacity: 0; } to { opacity: 1; } }

/* PHASE-RESP: < 768px — sidebar vira DRAWER lateral (oculta por default).
   Antes era empilhada no topo via `position: static`, o que empurrava o
   conteudo principal pra baixo e ocupava metade da tela em telas pequenas.
   Agora: slide-in da esquerda controlado por body.sidebar-open + overlay
   semi-transparente que fecha ao clicar fora. */
@media (max-width: 768px) {
  /* Drawer mobile — seletor combinado neutraliza body.sidebar-collapsed
     que vem do localStorage do desktop. Sem isso, abrir o drawer com
     sidebar previamente colapsada (68px, sem labels) mostraria apenas
     icones. No mobile, drawer SEMPRE expandido. */
  .sidebar,
  body.sidebar-collapsed .sidebar {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    width: min(82vw, 292px) !important;
    min-width: 260px;
    height: 100vh;
    z-index: 70;
    padding: 64px 12px 16px !important; /* 64px topo = espaco pro hamburger */
    border-right: 1px solid var(--border);
    border-bottom: none;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,0.08);
  }
  body.sidebar-open .sidebar,
  body.sidebar-open.sidebar-collapsed .sidebar {
    transform: translateX(0);
  }
  /* Restaura layout EXPANDIDO mesmo se a classe collapsed estiver no body.
     Sobrescreve as regras desktop (sidebar.js injetado) que escondiam .lbl
     e centralizavam .nav-item em pill 44x44. */
  body.sidebar-collapsed .sidebar .sb-header,
  .sidebar .sb-header {
    justify-content: flex-end;
    padding: 4px 0 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-soft, #F3F4F6) !important;
  }
  body.sidebar-collapsed .sidebar nav,
  .sidebar nav {
    gap: 2px !important;
    padding: 0 !important;
    align-items: stretch !important;
  }
  body.sidebar-collapsed .sidebar .nav-item,
  .sidebar .nav-item {
    width: auto !important;
    height: auto !important;
    justify-content: flex-start !important;
    padding: 10px 12px !important;
    border-radius: 8px !important;
    margin: 0 !important;
    gap: 12px !important;
  }
  body.sidebar-collapsed .sidebar .nav-item .lbl,
  .sidebar .nav-item .lbl {
    display: inline-flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    width: auto !important;
  }
  /* O toggle .sb-toggle (chevron desktop pra recolher) nao faz sentido
     no drawer mobile — usuario fecha pelo hamburger/overlay/ESC. */
  body.sidebar-collapsed .sidebar .sb-toggle,
  .sidebar .sb-toggle {
    display: none !important;
  }
  /* Overlay (criado via JS apenas quando aberto) */
  body.sidebar-open::before {
    content: '';
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, 0.42);
    z-index: 60;
    animation: vx-fade-in 0.18s ease both;
  }
  /* IMPORTANTE: NAO forcamos flex-direction: column em .app no mobile.
     A sidebar agora e' position: fixed (sai do flow), entao .main pode
     continuar com flex-direction default (row), ocupando 100% da largura.
     Forcar column quebrava o layout de conversa.html (que tem regras
     proprias de .app via body.page-conversa). */
  .main { padding: 14px; }
  .kanban-col { width: 280px; }
  .auth-card { padding: 32px 24px; }
  /* Botao hamburger — display: inline-flex SOBRESCREVE o default acima */
  .vx-mobile-menu-btn {
    position: fixed;
    top: 14px; left: 12px;
    z-index: 110;  /* acima da .codin-globalbar (z-index 100) */
    width: 40px; height: 40px;
    border-radius: 10px;
    background: var(--bg-surface, #FFFFFF);
    border: 1px solid var(--border, #E5E7EB);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text, #111827);
    cursor: pointer;
  }
  .vx-mobile-menu-btn:hover { background: var(--bg-soft, #F1F3F6); }
  /* Hamburger continua visivel quando drawer aberto — vira o botao "fechar"
     (z-index 110 fica sobre o drawer que e' z-index 70). Drawer tem
     padding-top 64px pra nao colocar conteudo embaixo dele. */
  body.sidebar-open .vx-mobile-menu-btn {
    background: var(--bg-surface, #FFFFFF);
    color: var(--text, #111827);
  }
  /* Da espaco pro hamburger sem sobrepor a logo da topbar */
  .codin-globalbar { padding-left: 64px !important; }
  /* Evita scroll horizontal acidental em mobile */
  html, body { max-width: 100%; overflow-x: hidden; }
}

/* =====================================================
   PHASE-RESP: Pipeline mobile (<=700px) — modo LISTA por status.
   Em vez do Kanban horizontal (que esprema colunas no celular),
   mostramos UMA coluna por vez em formato lista vertical 100% largura.
   Navegacao via select + botoes Anterior/Proximo (HTML em pipeline.html).
   body.pipeline-mobile-mode e' aplicado pelo pipeline.js via matchMedia.
   ===================================================== */
.pipeline-mobile-nav { display: none; }
@media (max-width: 700px) {
  body.pipeline-mobile-mode .pipeline-mobile-nav {
    display: block;
    background: var(--bg-surface, #FFFFFF);
    border: 1px solid var(--border, #E5E7EB);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
  }
  body.pipeline-mobile-mode .pmn-row { display: flex; align-items: center; gap: 8px; }
  body.pipeline-mobile-mode .pmn-row-select { gap: 10px; margin-bottom: 6px; }
  body.pipeline-mobile-mode .pmn-row-select label {
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-muted, #697080);
    flex: 0 0 auto;
  }
  body.pipeline-mobile-mode #pipeline-mobile-status {
    flex: 1 1 auto;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border, #E5E7EB);
    border-radius: 8px;
    background: #FFFFFF;
    font-size: 14px;
    color: var(--text, #111827);
  }
  body.pipeline-mobile-mode .pmn-meta {
    font-size: 12px;
    color: var(--text-muted, #697080);
    margin: 4px 0 8px;
  }
  body.pipeline-mobile-mode .pmn-row-actions { gap: 8px; }
  body.pipeline-mobile-mode .pmn-btn {
    flex: 1 1 50%;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--border, #E5E7EB);
    background: var(--bg-soft, #F1F3F6);
    color: var(--text, #111827);
    font-size: 13px; font-weight: 600;
    cursor: pointer;
  }
  body.pipeline-mobile-mode .pmn-btn:hover:not(:disabled) {
    background: var(--bg-subtle, #F3F4F6);
  }
  body.pipeline-mobile-mode .pmn-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  /* Kanban no modo mobile vira COLUNA. Sem scroll horizontal. */
  body.pipeline-mobile-mode .kanban {
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
    gap: 0 !important;
  }
  /* Esconde todas as colunas. Apenas a .kanban-col-active e' exibida.
     pipeline.js marca a classe quando o usuario seleciona status. */
  body.pipeline-mobile-mode .kanban-col {
    display: none !important;
  }
  body.pipeline-mobile-mode .kanban-col.kanban-col-active {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
    padding: 12px !important;
    background: var(--bg-soft, #F1F3F6) !important;
    border-radius: 12px;
  }
  /* Header da coluna mais discreto no mobile — info ja' aparece no nav meta. */
  body.pipeline-mobile-mode .kanban-col.kanban-col-active .kanban-col-header {
    display: none;
  }
  /* Cards em lista vertical full-width */
  body.pipeline-mobile-mode .kanban-col.kanban-col-active .drop-zone {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  body.pipeline-mobile-mode .lead-card {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-surface, #FFFFFF);
    border: 1px solid var(--border, #E5E7EB);
    border-radius: 12px;
  }
  body.pipeline-mobile-mode .lead-card .preview,
  body.pipeline-mobile-mode .lead-card .last-msg {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12.5px;
    line-height: 1.35;
    color: var(--text-secondary, #4B5563);
  }
  body.pipeline-mobile-mode .lead-card .btn-followup {
    height: 34px;
    padding: 0 12px;
    font-size: 12px;
    width: 100%;
    margin-top: 8px;
    display: block !important;
    opacity: 1 !important;
  }
  /* Modo mobile cancela o scroll horizontal duplicado do main */
  body.pipeline-mobile-mode .main { overflow-x: hidden !important; }
}

/* =====================================================
   PHASE-RESP: Pipeline mobile — ajustes escopados em
   body.page-pipeline. O Kanban ja' tem overflow-x: auto
   nativo (.kanban em style.css linha ~443), mas no mobile
   o body herda overflow-x: auto via .main que pode gerar
   scroll horizontal duplicado/global. Aqui forcamos o
   scroll horizontal SO' no container .kanban (com snap),
   o body fica preso em overflow-x: hidden, paddings/colunas/
   cards ficam compactos.
   ===================================================== */
@media (max-width: 768px) {
  /* Body/main sem scroll horizontal — quem rola horizontal e' so' o kanban */
  body.page-pipeline,
  body.page-pipeline .main {
    overflow-x: hidden !important;
  }
  body.page-pipeline .main { padding: 12px 10px 20px; }

  /* Topbar (header da pagina, nao a global): compacta + empilha controles */
  body.page-pipeline .topbar {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    padding: 0;
  }
  body.page-pipeline .topbar h2 {
    font-size: 18px;
    width: 100%;
    margin: 0;
  }
  body.page-pipeline .topbar > div {
    width: 100%;
    gap: 8px !important;
  }
  body.page-pipeline #filtro-vendedor {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }
  body.page-pipeline #novo-lead {
    width: 100% !important;
    padding: 10px 16px !important;
    font-size: 13.5px;
  }

  /* Kanban: scroll horizontal interno suave, padding lateral pra primeira/
     ultima coluna nao colar na borda. scroll-snap-type ajuda a "encaixar"
     a coluna ao parar o swipe (UX padrao Trello/Notion mobile). */
  body.page-pipeline:not(.pipeline-mobile-mode) .kanban {
    gap: 10px;
    padding: 0 4px 12px;
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scroll-padding-left: 4px;
  }
  body.page-pipeline:not(.pipeline-mobile-mode) .kanban::-webkit-scrollbar { height: 6px; }
  body.page-pipeline:not(.pipeline-mobile-mode) .kanban::-webkit-scrollbar-thumb {
    background: var(--border-strong, #CBD5E1);
    border-radius: 99px;
  }
  body.page-pipeline:not(.pipeline-mobile-mode) .kanban-col {
    width: min(82vw, 290px) !important;
    min-width: 240px;
    max-height: calc(100vh - 220px);
    padding: 10px;
    scroll-snap-align: start;
  }
  body.page-pipeline .kanban-col-header { padding: 6px 8px; margin-bottom: 8px; }
  body.page-pipeline .kanban-col-header h3 { font-size: 11.5px; }

  /* Cards mais densos */
  body.page-pipeline .lead-card { padding: 12px 12px 10px; }
  body.page-pipeline .lead-card .nome-lead,
  body.page-pipeline .lead-card h4,
  body.page-pipeline .lead-card .lead-name { font-size: 13.5px; line-height: 1.25; }
  body.page-pipeline .lead-card .preview,
  body.page-pipeline .lead-card .last-msg {
    font-size: 12px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  body.page-pipeline .lead-card .badge,
  body.page-pipeline .lead-card .sla-tag,
  body.page-pipeline .lead-card .ia-intent,
  body.page-pipeline .lead-card .ia-handoff-badge { font-size: 9.5px; padding: 2px 6px; }
  body.page-pipeline .lead-card .card-bottom {
    margin-top: 8px;
    padding-top: 8px;
    gap: 6px;
  }
  body.page-pipeline .lead-card .btn-followup {
    padding: 5px 10px;
    font-size: 11px;
  }

  /* Modal Novo Lead: ja' tem .modal-backdrop global; reforcamos paddings */
  body.page-pipeline .modal { padding: 18px; max-height: 90vh; overflow-y: auto; }
}

@media (max-width: 430px) {
  body.page-pipeline .main { padding: 10px 8px 18px; }
  body.page-pipeline:not(.pipeline-mobile-mode) .kanban { gap: 8px; padding: 0 2px 10px; }
  body.page-pipeline:not(.pipeline-mobile-mode) .kanban-col {
    width: min(86vw, 280px) !important;
    min-width: 230px;
    padding: 9px;
  }
  body.page-pipeline .lead-card { padding: 10px 10px 8px; }
}

/* =====================================================
   PHASE-RESP: Dashboard mobile — ajustes finos escopados em
   body.dashboard-page. A tela ja' tem media queries proprias
   no dashboard.html cobrindo grids (kpi-hero-grid, dual-grid,
   funil-row, cta-grid). Esses blocos abaixo so' fazem polish
   de spacing/tipografia/padding em mobile para que (a) os
   cards nao fiquem espremidos, (b) os numeros grandes nao
   quebrem linha em 360px, (c) o overflow horizontal nao
   apareca por causa de paddings/margens herdadas do desktop.
   ===================================================== */
@media (max-width: 768px) {
  body.dashboard-page .main { padding: 12px 12px 24px; }
  body.dashboard-page .hero {
    gap: 10px;
    margin-bottom: 20px;
  }
  body.dashboard-page .hero-greeting h1 {
    font-size: clamp(18px, 5vw, 22px);
  }
  body.dashboard-page .hero-greeting h1 .h1-icon {
    width: 30px; height: 30px;
  }
  body.dashboard-page .hero-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }
  body.dashboard-page .hero-actions > * { flex: 1 1 auto; min-width: 0; }
  body.dashboard-page .glass-panel {
    padding: 16px;
    margin-bottom: 18px;
  }
  body.dashboard-page .kpi-hero-grid {
    gap: 12px;
    margin-bottom: 22px;
  }
  body.dashboard-page .kpi-card { padding: 16px; }
  body.dashboard-page .kpi-card .kpi-value {
    font-size: 26px;
    letter-spacing: -0.5px;
  }
  body.dashboard-page .kpi-card .kpi-label { font-size: 11.5px; }
  body.dashboard-page .kpi-card .kpi-icon { width: 36px; height: 36px; }
  body.dashboard-page .dual-grid {
    gap: 12px;
    margin-bottom: 22px;
  }
  body.dashboard-page .cta-grid {
    gap: 12px;
    margin-bottom: 22px;
  }
  body.dashboard-page .cta-card { padding: 14px 16px; }
  body.dashboard-page .feed-list { max-height: 360px; }
  /* Container das tabelas/listas — overflow interno se houver */
  body.dashboard-page .panel-table-wrapper,
  body.dashboard-page .panel-list-wrapper { overflow-x: auto; }
  body.dashboard-page .panel-header { flex-wrap: wrap; gap: 8px; }
}

/* =====================================================
   PHASE-RESP: Relatórios mobile — ajustes escopados em
   body.page-relatorios. A tela ja' tem media queries proprias
   no relatorios.html (kpis-grid 5→3→2 cols, chart-grid 2fr/1fr→1fr
   @900px, exec-summary 1fr @900px). Aqui adicionamos polish para
   topbar (3 botoes que estouravam em mobile), filters-bar (cada
   filter-group min-width 150px nao cabia em 360px), KPI value font,
   charts altura menor, alert-perdido com flex-wrap.
   ===================================================== */
@media (max-width: 768px) {
  body.page-relatorios .main { padding: 14px 12px 24px; overflow-x: hidden; }

  /* Topbar: empilha titulo + 3 botoes (Atualizar / Imprimir / PDF) */
  body.page-relatorios .topbar {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
    padding: 0;
  }
  body.page-relatorios .topbar h2 { width: 100%; font-size: 18px; margin: 0; }
  body.page-relatorios .topbar > div {
    display: flex !important;
    width: 100%;
    gap: 6px !important;
    flex-wrap: wrap;
  }
  body.page-relatorios .topbar > div .vx-btn {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
  }

  /* Filtros em 1 coluna no mobile */
  body.page-relatorios .filters-bar {
    padding: 14px;
    gap: 10px;
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 18px;
  }
  body.page-relatorios .filters-bar .filter-group { width: 100%; min-width: 0; }
  body.page-relatorios .filters-bar select,
  body.page-relatorios .filters-bar input[type=date] {
    width: 100%;
    padding: 10px 12px;
  }
  body.page-relatorios .filters-bar .actions {
    width: 100%;
    margin-left: 0;
    display: flex;
    gap: 8px;
  }
  body.page-relatorios .filters-bar .actions .vx-btn {
    flex: 1 1 50%;
    justify-content: center;
  }

  /* Exec summary / Insights cards mais enxutos */
  body.page-relatorios .exec-summary-card,
  body.page-relatorios .insights-card { padding: 14px 16px; }
  body.page-relatorios .exec-summary-text { font-size: 13.5px; }

  /* Alerta dinheiro perdido — flex-wrap */
  body.page-relatorios .alert-perdido {
    padding: 14px 16px;
    gap: 12px;
    flex-wrap: wrap;
  }
  body.page-relatorios .alert-perdido .ico { width: 36px; height: 36px; }
  body.page-relatorios .alert-perdido .text .big { font-size: 22px; }

  /* KPIs (5→3→2 cols ja' existem em 1100/700px). Polish de padding/font */
  body.page-relatorios .kpis-grid { gap: 10px; margin-bottom: 18px; }
  body.page-relatorios .kpi-card { padding: 14px; }
  body.page-relatorios .kpi-card .value { font-size: 20px; }
  body.page-relatorios .kpi-card .label { font-size: 10px; }
  body.page-relatorios .kpi-card .icon { width: 28px; height: 28px; top: 10px; right: 10px; }

  /* Charts: altura reduzida em mobile + padding menor */
  body.page-relatorios .chart-grid { gap: 12px; margin-bottom: 18px; }
  body.page-relatorios .chart-card { padding: 14px 14px 12px; }
  body.page-relatorios .chart-card h3 { font-size: 13.5px; margin-bottom: 10px; }
  body.page-relatorios .chart-box { height: 240px; }
  /* Grafico Vendedores tinha height inline 320px — sobrescrevemos */
  body.page-relatorios #grp-chart-vendedores .chart-box { height: 260px !important; }

  /* Wrappers de tabela (caso renderizados via JS) com scroll horizontal interno */
  body.page-relatorios .table-wrapper,
  body.page-relatorios .ranking-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -6px;
    padding: 0 6px;
  }
  body.page-relatorios table { min-width: 480px; }
}

/* =====================================================
   PHASE-RESP: Equipe mobile — polish escopado em body.page-equipe.
   A tela ja' tem media queries proprias em equipe.html:
   - .team-grid 1 col em <700px
   - .eq-kpi-grid 2 cols em <720px
   - .eq-search 100% em <720px
   Aqui completamos: equipe-header empilhada (h2 + botao Adicionar),
   modal de criar/editar usuario com altura controlada + scroll interno,
   modal-actions com flex-wrap, paddings reduzidos.
   ===================================================== */
@media (max-width: 768px) {
  body.page-equipe .main { padding: 14px 12px 24px; overflow-x: hidden; }

  /* Header da pagina — empilha h2 + botao Adicionar */
  body.page-equipe .equipe-header {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
  }
  body.page-equipe .equipe-header h2 {
    width: 100%;
    font-size: 18px;
    margin: 0;
  }
  body.page-equipe .equipe-header > .vx-btn {
    width: 100%;
    justify-content: center;
  }

  /* Modal Editar/Adicionar usuario com altura controlada + scroll interno.
     Reusa .modal-backdrop global (z-index 200 da rodada anterior).
     A modal de Equipe e' GRANDE (foto + nome + email + senha + cargo +
     dept + gerente + ativo + actions) — sem scroll interno, conteudo
     ficava embaixo do teclado mobile. */
  body.page-equipe .modal {
    padding: 18px;
    max-height: 90vh;
    overflow-y: auto;
    width: calc(100% - 24px);
  }
  body.page-equipe .modal h3 { font-size: 17px; margin-bottom: 14px; }
  body.page-equipe .modal-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  body.page-equipe .modal-actions .vx-btn {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
  }
  /* Botao "Desativar" tinha margin-right: auto pra ficar isolado a' esquerda;
     em mobile com wrap, isso quebrava — neutralizamos. */
  body.page-equipe .modal-actions #btn-delete { margin-right: 0; }

  /* Plano-summary com gap menor e padding reduzido */
  body.page-equipe .plano-summary {
    padding: 12px 14px;
    gap: 14px;
  }

  /* Toolbar de filtros: chips menores, busca acima por order:-1 (existente) */
  body.page-equipe .eq-toolbar { margin: 4px 0 14px; }
  body.page-equipe .eq-toolbar-row { gap: 8px; }
  body.page-equipe .eq-filter { font-size: 12px; padding: 5px 10px; }

  /* Vendor cards (auto-grid 1 col em <700px) com padding menor */
  body.page-equipe .team-grid { gap: 10px; }
  body.page-equipe .vendor-card { padding: 14px; gap: 10px; }
  body.page-equipe .vendor-actions { gap: 6px; padding-top: 10px; flex-wrap: wrap; }
  body.page-equipe .vendor-actions .vx-btn {
    flex: 1 1 calc(50% - 3px);
    min-width: 0;
    justify-content: center;
  }
}

/* =====================================================
   PHASE-RESP: Agente IA mobile — polish escopado em body.page-ia.
   A tela ja' tem media queries proprias (abas com scroll horizontal
   reescrito no ia-config.html, ai-pro-hero column em <=760px,
   modal de confirmacao em <=520px). Aqui adicionamos polish geral:
   main padding, hero compacto, sticky tabs em mobile, textareas de
   conhecimento usaveis, simulador Testar IA em formato chat full,
   body sem scroll horizontal.
   ===================================================== */
@media (max-width: 768px) {
  body.page-ia .main { padding: 12px 12px 24px; overflow-x: hidden; }

  /* Hero (.ai-pro-hero) ja vira coluna em <=760px (inline ia-config.html).
     Aqui ajustes finos de spacing. */
  /* PHASE-RESP: hero polish — regras espelham ia-config.html
     @media (max-width: 760px). Aqui apenas reforcamos margin/line-height
     sem competir com padding/avatar/CTA do bloco inline (que ja' cuida). */
  body.page-ia .ai-pro-hero { margin-bottom: 14px; }
  body.page-ia .ai-pro-info { min-width: 0 !important; }

  /* Abas sticky no topo do conteudo (continua sticky em mobile pra
     usuario sempre ter acesso). z-index baixo pra nao tapar modais. */
  body.page-ia .ia-tabs { margin: 14px 0 14px; top: 4px; }

  /* Cards/sections IA: padding interno menor + grids 1 col */
  body.page-ia .ia-section { padding: 14px 14px !important; }
  body.page-ia .ai-section-head h3,
  body.page-ia .ia-section h3 { font-size: 14px !important; }
  body.page-ia .ai-modo-grid { grid-template-columns: 1fr !important; }

  /* Textareas de Identidade/Regras/Conhecimento — altura confortavel
     no celular sem ser gigante */
  body.page-ia textarea {
    min-height: 96px;
    font-size: 13.5px;
    padding: 10px 12px;
    line-height: 1.45;
  }
  body.page-ia input[type="text"],
  body.page-ia input[type="email"],
  body.page-ia input[type="number"],
  body.page-ia select { font-size: 13.5px; }

  /* Modal de confirmacao (.ai-confirm-modal) ja' empilha actions
     em <=520px. Aqui garantimos max-height + scroll interno em <=768px
     pra modais maiores (refazer treinamento, limpar IA, gatilhos). */
  body.page-ia .ai-confirm-card,
  body.page-ia .vx-modal .box,
  body.page-ia .ai-modal {
    max-height: 92vh;
    overflow-y: auto;
  }

  /* Lista de gatilhos (Chamar humano): cada item vira card 1 col com
     padding/font reduzido */
  body.page-ia .handoff-row,
  body.page-ia .gatilho-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 12px;
  }
  body.page-ia .handoff-row .acoes,
  body.page-ia .gatilho-row .acoes {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Bot
oes em areas operacionais (Desativar todos / Reativar / Adicionar
     gatilho) full-width quando soltos */
  body.page-ia .ia-acoes-bar {
    flex-wrap: wrap;
    gap: 8px;
  }
  body.page-ia .ia-acoes-bar .ai-btn,
  body.page-ia .ia-acoes-bar button {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
  }

  /* Simulador "Testar IA" — chat com altura razoavel pro celular
     (sem teclado virtual cobrir input) */
  body.page-ia .ia-test-chat,
  body.page-ia .ia-wizard-chat,
  body.page-ia .ai-test-chat {
    max-height: 60vh;
    overflow-y: auto;
  }
  body.page-ia .ia-test-input,
  body.page-ia .ai-test-input,
  body.page-ia .ia-wizard-input {
    position: sticky;
    bottom: 0;
    background: var(--bg-surface, #FFFFFF);
    padding: 8px 0;
  }
}

/* =====================================================
   PHASE-RESP: WhatsApp mobile — polish escopado em body.page-whatsapp.
   A tela ja' tem media queries proprias (.wpp-tut-steps 1 col em
   <720px, .wpp-qr-block 1 col em <760px + padding, .vx-wpp-card/
   actions-row em <560px). Aqui completamos: hero compacto, cards
   com padding menor, urls/tokens com word-break, accordions de
   advanced acessiveis, botoes empilhaveis.
   ===================================================== */
@media (max-width: 768px) {
  body.page-whatsapp .main { padding: 12px 12px 24px; overflow-x: hidden; }
  body.page-whatsapp .wpp-page { padding: 14px 12px 60px; max-width: 100%; }

  /* Hero do status (.wpp-hero) compacto */
  body.page-whatsapp .wpp-hero {
    padding: 14px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
    gap: 10px;
    align-items: flex-start;
  }
  body.page-whatsapp .wpp-hero-ico { width: 36px; height: 36px; flex-shrink: 0; }
  body.page-whatsapp .wpp-hero-ico svg { width: 18px; height: 18px; }
  body.page-whatsapp .wpp-hero-txt h1 { font-size: 17px; line-height: 1.25; margin-bottom: 4px; }
  body.page-whatsapp .wpp-hero-txt p { font-size: 12.5px; line-height: 1.4; }
  /* Numero/email/url longos quebram sem estourar */
  body.page-whatsapp .wpp-hero-txt b,
  body.page-whatsapp .wpp-hero-txt code { word-break: break-all; overflow-wrap: anywhere; }

  /* Cards .vx-wpp-card e .wpp-step com padding interno menor */
  body.page-whatsapp .vx-wpp-card { padding: 22px 18px; margin: 18px 0 16px; }
  body.page-whatsapp .vx-wpp-card-head h1 { font-size: 17px; }
  body.page-whatsapp .wpp-step { padding: 14px; }
  body.page-whatsapp .wpp-step-head { gap: 8px; }
  body.page-whatsapp .wpp-step-num { width: 28px; height: 28px; font-size: 13px; }

  /* Inputs/forms: campos full-width + texto auxiliar legivel */
  body.page-whatsapp .wpp-form .form-group input,
  body.page-whatsapp .wpp-form .form-group select,
  body.page-whatsapp .vx-wpp-advanced input,
  body.page-whatsapp .vx-wpp-advanced select {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    font-size: 13.5px;
  }
  body.page-whatsapp .wpp-form .form-group label small { font-size: 11px; }

  /* Avancado: linha de acoes full-width em mobile + botoes flex 1 */
  body.page-whatsapp .vx-wpp-advanced { margin: 16px 0 56px; padding: 14px; }
  body.page-whatsapp .vx-wpp-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  body.page-whatsapp .vx-wpp-actions-row .vx-btn,
  body.page-whatsapp .vx-wpp-actions-row button { width: 100%; justify-content: center; }

  /* Alertas */
  body.page-whatsapp .wpp-alert { padding: 12px 14px; font-size: 12.5px; line-height: 1.45; }

  /* QR code respira: max-width 100%, centralizado */
  body.page-whatsapp .wpp-qr-block { gap: 14px; }
  body.page-whatsapp .wpp-qr-block img,
  body.page-whatsapp .wpp-qr-block canvas {
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    display: block;
  }

  /* URLs/webhook longos: quebra natural sem estourar (defense em
     profundidade — campos input ja' tem width 100%, mas se algum
     texto vier num <span> ou <code>, quebra tambem) */
  body.page-whatsapp .wpp-page code,
  body.page-whatsapp .wpp-page .wpp-url,
  body.page-whatsapp .wpp-page .webhook-url {
    word-break: break-all;
    overflow-wrap: anywhere;
    font-size: 12px;
  }
}

/* =====================================================
   PHASE-RESP: Configurações mobile — polish escopado em
   body.page-configuracoes. A tela ja' tem media queries proprias
   (.cfg-grid 1 col por default + 2 cols em >=880px, .cfg-field-row
   1 col em <=600px, .logo-preview-area column em <=600px). Aqui
   completamos: cfg-card padding menor, actions com flex-wrap, logo
   preview-box compacto em mobile estreito, dirty pill posicionada
   abaixo do titulo, mini-topbar nao estoura.
   ===================================================== */
@media (max-width: 768px) {
  body.page-configuracoes .main { padding: 14px 12px 24px; overflow-x: hidden; }
  body.page-configuracoes .cfg-page { padding: 14px 12px 50px; }
  body.page-configuracoes .cfg-grid { gap: 12px; }

  /* Cards mais densos */
  body.page-configuracoes .cfg-card { padding: 16px 16px; border-radius: 12px; }
  body.page-configuracoes .cfg-card-head { margin-bottom: 14px; }
  body.page-configuracoes .cfg-card-head h2 { font-size: 14px; }
  body.page-configuracoes .cfg-card-head p { font-size: 12px; line-height: 1.45; }

  /* Form fields com inputs full-width + min-width 0 (defesa contra
     containers flex que poderiam estourar) */
  body.page-configuracoes .cfg-field { margin-bottom: 12px; }
  body.page-configuracoes .cfg-input,
  body.page-configuracoes .cfg-select,
  body.page-configuracoes .cfg-textarea {
    width: 100%;
    min-width: 0;
    padding: 10px 12px;
    font-size: 13.5px;
  }

  /* Actions: empilha com wrap + dirty pill aparece em linha propria
     em mobile estreito (margin-right: auto desktop nao quebra wrap). */
  body.page-configuracoes .cfg-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    margin-top: 12px;
  }
  body.page-configuracoes .cfg-actions .cfg-btn,
  body.page-configuracoes .cfg-actions button {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: center;
  }
  /* Dirty pill: forca quebra de linha (line completa) em mobile */
  body.page-configuracoes .cfg-dirty-pill {
    margin: 0 auto 6px 0;
    flex-basis: 100%;
  }

  /* Logo preview compacto + responsivo */
  body.page-configuracoes .logo-preview-area {
    padding: 12px;
    gap: 12px;
  }
  body.page-configuracoes .logo-preview-box {
    width: 100px;
    height: 70px;
    margin: 0 auto;
  }
  body.page-configuracoes .logo-preview-info { text-align: center; }
  body.page-configuracoes .logo-preview-info strong { font-size: 12.5px; }
  body.page-configuracoes .logo-preview-info small { font-size: 11px; line-height: 1.4; }

  /* Mini-topbar de preview (se existir) — width 100%, sem estourar.
     Defensivo em caso de classe diferente: cobre .cfg-preview, .cfg-mini-topbar etc. */
  body.page-configuracoes .cfg-mini-topbar,
  body.page-configuracoes .cfg-preview-topbar,
  body.page-configuracoes .cfg-preview {
    max-width: 100%;
    overflow: hidden;
  }
  body.page-configuracoes .cfg-mini-topbar img,
  body.page-configuracoes .cfg-preview-topbar img,
  body.page-configuracoes .cfg-preview img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
  }

  /* Audit (cfg-audit) com line-height confortavel */
  body.page-configuracoes .cfg-audit { font-size: 11.5px; line-height: 1.55; word-break: break-word; }
}

@media (max-width: 430px) {
  body.page-configuracoes .main { padding: 10px 8px 20px; }
  body.page-configuracoes .cfg-page { padding: 12px 8px 50px; }
  body.page-configuracoes .cfg-card { padding: 14px; }
  body.page-configuracoes .cfg-card-head h2 { font-size: 13.5px; }
  /* Em 360px, botoes do action bar em 1 coluna (mais facil clicar) */
  body.page-configuracoes .cfg-actions .cfg-btn,
  body.page-configuracoes .cfg-actions button { flex: 1 1 100%; }
  /* Logo preview box ainda menor */
  body.page-configuracoes .logo-preview-box { width: 90px; height: 64px; }
}

@media (max-width: 430px) {
  body.page-whatsapp .main { padding: 10px 8px 20px; }
  body.page-whatsapp .wpp-page { padding: 12px 8px 50px; }
  body.page-whatsapp .wpp-hero { padding: 12px; }
  body.page-whatsapp .wpp-hero-txt h1 { font-size: 16px; }
  body.page-whatsapp .vx-wpp-card { padding: 18px 14px; }
  body.page-whatsapp .vx-wpp-card-head h1 { font-size: 16px; }
  /* Em 360px, acoes avancadas empilham em 1 coluna */
  body.page-whatsapp .vx-wpp-actions-row { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
  body.page-ia .main { padding: 10px 8px 20px; }
  body.page-ia .ai-pro-info h1 { font-size: 17px !important; }
  body.page-ia .ai-pro-summary { grid-template-columns: 1fr !important; }
  body.page-ia .ia-section { padding: 12px !important; }
  body.page-ia textarea { min-height: 84px; }
  /* Em 360px, CTAs do hero empilham em 1 coluna */
  body.page-ia .ai-pro-btn-primary,
  body.page-ia .ai-pro-btn-secondary {
    flex: 1 1 100%;
  }
}

@media (max-width: 430px) {
  body.page-equipe .main { padding: 10px 8px 20px; }
  body.page-equipe .equipe-header h2 { font-size: 17px; }
  body.page-equipe .vendor-card { padding: 12px; }
  body.page-equipe .vendor-avatar { width: 44px; height: 44px; }
  /* Em telas <=360px, acoes do card em 1 coluna pra nao espremer */
  body.page-equipe .vendor-actions .vx-btn {
    flex: 1 1 100%;
  }
  body.page-equipe .modal h3 { font-size: 16px; }
  body.page-equipe .modal { padding: 16px; }
}

@media (max-width: 430px) {
  body.page-relatorios .main { padding: 10px 8px 20px; }
  body.page-relatorios .topbar h2 { font-size: 17px; }
  /* KPIs em 1 coluna — em 360px-430px, 2 cols espreme o value */
  body.page-relatorios .kpis-grid { grid-template-columns: 1fr !important; }
  body.page-relatorios .kpi-card .value { font-size: 22px; }
  body.page-relatorios .chart-box { height: 220px; }
  body.page-relatorios #grp-chart-vendedores .chart-box { height: 240px !important; }
  body.page-relatorios .filters-bar { padding: 12px; }
  body.page-relatorios .alert-perdido { padding: 12px 14px; }
  body.page-relatorios .alert-perdido .text .big { font-size: 20px; }
}

@media (max-width: 430px) {
  body.dashboard-page .main { padding: 10px 10px 20px; }
  body.dashboard-page .hero { margin-bottom: 14px; }
  body.dashboard-page .glass-panel { padding: 14px; }
  body.dashboard-page .kpi-card .kpi-value { font-size: 22px; }
  body.dashboard-page .kpi-card { padding: 14px; }
  /* Funil: encolhe label pra caber em 360px (180px era pra desktop) */
  body.dashboard-page .funil-row {
    grid-template-columns: 96px 1fr 40px !important;
    gap: 8px;
  }
  body.dashboard-page .funil-label { font-size: 11.5px; }
  body.dashboard-page .funil-track { height: 22px; }
  body.dashboard-page .funil-qtd { font-size: 12px; }
  /* Ranking: avatares menores, gap menor */
  body.dashboard-page .rank-row {
    grid-template-columns: 26px 32px 1fr auto;
    gap: 10px;
  }
  body.dashboard-page .rank-avatar { width: 32px; height: 32px; font-size: 12px; }
  body.dashboard-page .rank-pos { width: 24px; height: 24px; font-size: 11px; }
  body.dashboard-page .rank-name { font-size: 13px; }
  body.dashboard-page .rank-value { font-size: 13px; }
  body.dashboard-page .cta-card { padding: 12px 14px; }
}

/* === SLA / Lead Card Premium ===
   Soft signaling via border-left color. Sem pulse-red agressivo —
   user wants premium feel without anxiety triggers. Atrasado fica
   evidente pelo border-left vermelho + sla-tag, suficiente. */
.lead-card {
    position: relative;
    padding: 14px 14px 12px;
    border-left-width: 3px;
}
.lead-card.sla-ok       { border-left-color: var(--secondary); }
.lead-card.sla-atencao  { border-left-color: var(--warning); }
.lead-card.sla-atrasado { border-left-color: var(--danger); }

/* === IA insights no card (Fase 4) === */
/* Score bar — thin gradient bar no TOP do card quando IA scoring >=60 */
.lead-card .lead-score-bar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    pointer-events: none;
}
.lead-card .lead-score-bar::before {
    content: '';
    display: block;
    height: 100%;
    width: var(--score-pct, 0%);
    background: var(--score-color, var(--primary));
    transition: width 0.4s var(--ease-fluid);
}
/* IA intent badge — discreto, canto superior direito */
.lead-card .ia-intent {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: var(--fw-semibold);
    letter-spacing: var(--tracking-uppercase);
    text-transform: uppercase;
    line-height: 1.3;
    flex-shrink: 0;
    margin-left: 6px;
}
.lead-card .ia-intent svg {
    width: 9px; height: 9px;
}
.lead-card .ia-intent.level-critical {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}
.lead-card .ia-intent.level-high {
    background: rgba(124, 77, 255, 0.10);
    color: var(--primary-darker);
}
.lead-card .ia-intent.level-warn {
    background: rgba(245, 158, 11, 0.10);
    color: #92400E;
}

/* Handoff IA badge: discreto, brand soft. So aparece se IA escalou. */
.lead-card .ia-handoff-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: var(--fw-semibold);
    letter-spacing: var(--tracking-uppercase);
    text-transform: uppercase;
    line-height: 1.3;
    flex-shrink: 0;
    margin-left: 6px;
    background: rgba(245, 158, 11, 0.12);
    color: #B45309;
}
.lead-card .ia-handoff-badge svg { width: 9px; height: 9px; }

/* Unread dot: cliente aguardando resposta do vendedor. Antes do nome. */
.lead-card .card-unread-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand-500, #7C5CFF);
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.12);
}

/* Cor escalonada do meta-tempo quando cliente esta aguardando.
   Cresce com tempo sem virar gritante. */
.lead-card .meta-tempo--warn {
    color: #92400E;
    font-weight: var(--fw-semibold);
}
.lead-card .meta-tempo--urgent {
    color: #991B1B;
    font-weight: var(--fw-bold);
}

.card-top {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    margin-bottom: 8px;
}
.card-top h4 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.2px; flex: 1; word-break: break-word; }

.sla-tag {
    font-size: 9.5px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.sla-tag.sla-ok       { background: var(--success-light); color: #065F46; }
.sla-tag.sla-atencao  { background: var(--warning-light); color: #92400E; }
.sla-tag.sla-atrasado { background: var(--danger-light);  color: #991B1B; }
.sla-tag.sla-fechado  { background: var(--success-light); color: #065F46; }

.sla-pill {
    font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px;
    text-transform: uppercase; letter-spacing: 0.4px;
}
.sla-pill.sla-atrasado { background: var(--danger-light);  color: #991B1B; }
.sla-pill.sla-atencao  { background: var(--warning-light); color: #92400E; }

.meta-row {
    font-size: 12.5px; color: var(--text-secondary); padding: 2px 0;
    display: flex; align-items: center; gap: 6px;
    font-weight: 500;
}
.meta-icon {
    font-size: 9.5px; font-weight: 700; color: var(--text-light);
    background: var(--bg-soft); padding: 1px 5px; border-radius: 3px;
    text-transform: uppercase; min-width: 24px; text-align: center;
}
.meta-valor {
    font-size: 14px; font-weight: 700; color: var(--text);
    margin-top: 6px; letter-spacing: -0.2px;
}
.meta-valor.sla-fechado { color: var(--secondary-dark); }
.meta-msg {
    font-size: 12px; color: var(--text-muted); padding: 8px 10px;
    background: var(--bg-soft); border-radius: 6px; margin-top: 8px;
    font-style: italic; line-height: 1.4;
}
.meta-vend {
    font-size: 11px; color: var(--text-secondary); font-weight: 600;
    background: var(--primary-light); padding: 2px 8px; border-radius: 99px;
}
.meta-tempo { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.origem-pill {
    font-size: 9.5px; font-weight: 700; padding: 2px 7px; border-radius: 4px;
    background: var(--bg-soft); color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.5px; margin-right: 6px;
}

.card-bottom {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    flex-wrap: wrap;
}

/* Kanban col header com SLA info */
.kanban-col-header { padding: 4px 6px 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px; gap: 8px; }

/* === SUGESTÃO INTELIGENTE NO CARD === */
.sugestao {
    margin-top: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: background-color var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), box-shadow var(--t-fast),
              transform var(--t-fast);
    border: 1px solid transparent;
    line-height: 1.3;
}
.sugestao:hover { transform: translateX(2px); }

.sugestao-azul {
    background: var(--primary-light);
    color: var(--primary-darker);
    border-color: rgba(79,70,229,0.2);
}
.sugestao-azul:hover { background: #DDD7FE; }

.sugestao-verde {
    background: var(--success-light);
    color: #065F46;
    border-color: rgba(16,185,129,0.25);
}
.sugestao-verde:hover { background: #D1FAE5; }

.sugestao-amarelo {
    background: var(--warning-light);
    color: #92400E;
    border-color: rgba(245,158,11,0.25);
}
.sugestao-amarelo:hover { background: #FEF3C7; }

.sugestao-icon {
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
    background: white;
    padding: 0 6px;
    border-radius: 4px;
}

.sugestao-texto { flex: 1; }

/* === BOTÃO FOLLOW-UP === */
.btn-followup {
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--text);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: background-color var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), box-shadow var(--t-fast),
              transform var(--t-fast);
    letter-spacing: -0.1px;
    opacity: 0;
    display: none;
}
.lead-card:hover .btn-followup { opacity: 1; display: block; }
.btn-followup:hover { background: var(--primary); transform: translateY(-1px); }
@media (hover: none) {
    .btn-followup { opacity: 1; display: block; }
}


/* ===== AJUSTES FINOS v17 - layout 100% sem buraco no fim ===== */
html, body { height: 100%; }
body { min-height: 100vh; margin: 0; }
.app {
    display: flex;
    flex: 1 1 auto;
    min-height: calc(100vh - 72px); /* header global = 72px */
}
/* Override do height: 100vh original. Com header sticky 56px, a sidebar
   100vh estourava o documento em 56px (gerando faixa em branco no fim).
   top: 56px gruda a sidebar abaixo do header sticky (em vez de atras). */
.sidebar {
    height: calc(100vh - 72px);
    top: 56px;
}
.main {
    flex: 1;
    padding: 24px;
    box-sizing: border-box;
    overflow-x: auto;
}
.main > *:last-child { margin-bottom: 0 !important; }
.kanban { padding-bottom: 0; margin-bottom: 0; }
.kanban-col { align-self: flex-start; max-height: calc(100vh - 180px); overflow-y: auto; }
.app, .main, .sidebar { box-sizing: border-box; }

/* =============================================================
   PRIMITIVOS .vx-* — Design System (Fase 1)
   Opt-in. Codigo legado nao usa. Fases 2-9 migram aos poucos.
   ============================================================= */

/* ===== .vx-btn — botao primitivo ===== */
.vx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-4);
  height: 36px;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-normal);
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  box-sizing: border-box;
  transition: transform var(--t-fast), background var(--t-fast),
              border-color var(--t-fast), color var(--t-fast),
              box-shadow var(--t-fast);
  will-change: transform;
}
.vx-btn:disabled,
.vx-btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.vx-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-glow);
}
.vx-btn:active { transform: translateY(0.5px) scale(0.99); transition-duration: 80ms; }
.vx-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Variants */
.vx-btn--primary {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}
.vx-btn--primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}
.vx-btn--secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.vx-btn--secondary:hover {
  background: var(--bg-soft);
  border-color: var(--border-strong);
}
.vx-btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}
.vx-btn--ghost:hover {
  background: var(--bg-soft);
  color: var(--text);
}
.vx-btn--brand-soft {
  background: var(--primary-light);
  color: var(--primary-darker);
  border-color: transparent;
}
.vx-btn--brand-soft:hover {
  background: #E0E6FF;
}
.vx-btn--danger {
  background: var(--danger);
  color: #FFFFFF;
  border-color: var(--danger);
}
.vx-btn--danger:hover { background: #DC2626; }
.vx-btn--danger-soft {
  background: var(--danger-light);
  color: #B42318;
  border-color: transparent;
}
.vx-btn--danger-soft:hover { background: #FEE2E2; }

/* Sizes */
.vx-btn--sm { height: 30px; padding: 0 var(--space-3); font-size: var(--text-sm); }
.vx-btn--sm svg { width: 14px; height: 14px; }
.vx-btn--lg { height: 44px; padding: 0 var(--space-5); font-size: var(--text-md); }
.vx-btn--lg svg { width: 18px; height: 18px; }
.vx-btn--icon { width: 36px; padding: 0; }
.vx-btn--icon.vx-btn--sm { width: 30px; }
.vx-btn--icon.vx-btn--lg { width: 44px; }

/* Loading state */
.vx-btn.is-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.vx-btn.is-loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 14px; height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid currentColor;
  border-color: rgba(255,255,255,0.3);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: vx-spin 0.7s linear infinite;
}
.vx-btn--secondary.is-loading::after,
.vx-btn--ghost.is-loading::after,
.vx-btn--brand-soft.is-loading::after,
.vx-btn--danger-soft.is-loading::after {
  border-color: rgba(17,24,39,0.2);
  border-top-color: var(--text);
}
@keyframes vx-spin { to { transform: rotate(360deg); } }

/* ===== .vx-input — input primitivo ===== */
.vx-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  width: 100%;
}
.vx-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  letter-spacing: var(--tracking-normal);
}
.vx-input,
.vx-select,
.vx-textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  letter-spacing: var(--tracking-normal);
  outline: none;
  box-sizing: border-box;
  transition: border-color var(--t-fast), box-shadow var(--t-fast),
              background var(--t-fast);
}
.vx-input::placeholder,
.vx-textarea::placeholder {
  color: var(--text-light);
}
.vx-input:hover,
.vx-select:hover,
.vx-textarea:hover {
  border-color: var(--border-strong);
}
.vx-input:focus,
.vx-select:focus,
.vx-textarea:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}
.vx-textarea {
  resize: vertical;
  min-height: 88px;
  font-family: inherit;
  line-height: var(--leading-normal);
}
.vx-input--sm { padding: 7px 10px; font-size: var(--text-sm); }
.vx-input--lg { padding: 13px 14px; font-size: var(--text-md); }

/* Estado de erro */
.vx-input.is-invalid,
.vx-select.is-invalid,
.vx-textarea.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}
.vx-help {
  font-size: var(--text-xs);
  color: var(--text-light);
  margin-top: 2px;
}
.vx-help.is-error { color: #B42318; }

/* Wrap c/ icone esquerda + suffix direita */
.vx-input-wrap {
  position: relative;
  width: 100%;
}
.vx-input-wrap > svg.vx-input-icon {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-light);
  pointer-events: none;
  transition: color var(--t-fast);
}
.vx-input-wrap > .vx-input { padding-left: 38px; }
.vx-input-wrap:focus-within > svg.vx-input-icon { color: var(--primary); }

/* ===== .vx-card — card primitivo ===== */
.vx-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: border-color var(--t-base), box-shadow var(--t-base),
              transform var(--t-base);
}
.vx-card--interactive {
  cursor: pointer;
}
.vx-card--interactive:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.vx-card--elevated {
  border-color: transparent;
  box-shadow: var(--shadow-md);
}
.vx-card--elevated:hover { box-shadow: var(--shadow-lg); }
.vx-card--flat { border-color: var(--border-soft); padding: var(--space-4); }
.vx-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.vx-card__title {
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
  letter-spacing: var(--tracking-normal);
}
.vx-card__sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.vx-card__divider {
  height: 1px;
  background: var(--border-soft);
  margin: var(--space-4) calc(var(--space-5) * -1);
}

/* ===== .vx-badge — pill/chip ===== */
.vx-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-uppercase);
  text-transform: uppercase;
  border-radius: var(--radius-full);
  background: var(--bg-soft);
  color: var(--text-muted);
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.4;
}
.vx-badge--neutral { background: var(--bg-soft);          color: var(--text-secondary); }
.vx-badge--brand   { background: var(--primary-light);    color: var(--primary-darker); }
.vx-badge--success { background: var(--success-light);    color: #047857; }
.vx-badge--warning { background: var(--warning-light);    color: #92400E; }
.vx-badge--danger  { background: var(--danger-light);     color: #B42318; }
.vx-badge--info    { background: rgba(59, 130, 246, 0.10); color: #1D4ED8; }
.vx-badge--dot::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.vx-badge--lg { padding: 3px 11px; font-size: 11.5px; }

/* Counter badge (sidebar, sino, etc) — numerico, mais compacto */
.vx-counter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  font-size: 10.5px;
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-transform: none;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #FFFFFF;
  line-height: 1;
}
.vx-counter--danger  { background: var(--danger); }
.vx-counter--neutral { background: var(--text-light); }

/* ===== .vx-skeleton — loading shimmer ===== */
.vx-skeleton {
  background: linear-gradient(
    90deg,
    rgba(17,24,39,0.05) 0%,
    rgba(17,24,39,0.09) 50%,
    rgba(17,24,39,0.05) 100%
  );
  background-size: 200% 100%;
  animation: vx-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius);
  display: block;
}
.vx-skeleton--line   { height: 12px; width: 100%; border-radius: var(--radius-sm); }
.vx-skeleton--text   { height: 14px; }
.vx-skeleton--title  { height: 20px; }
.vx-skeleton--avatar { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; }
.vx-skeleton--avatar-lg { width: 56px; height: 56px; border-radius: 50%; }
.vx-skeleton--card   { height: 80px; }
.vx-skeleton--w-30 { max-width: 30%; }
.vx-skeleton--w-50 { max-width: 50%; }
.vx-skeleton--w-70 { max-width: 70%; }
.vx-skeleton--w-90 { max-width: 90%; }
@keyframes vx-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .vx-skeleton { animation: none; background: rgba(17,24,39,0.06); }
}

/* ===== .vx-empty — empty state premium ===== */
.vx-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  max-width: 380px;
  margin: 0 auto;
}
.vx-empty__icon {
  width: 56px; height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-4);
}
.vx-empty__icon svg { width: 26px; height: 26px; }
.vx-empty__title {
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  color: var(--text);
  letter-spacing: var(--tracking-normal);
  margin-bottom: 6px;
}
.vx-empty__sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-snug);
  margin-bottom: var(--space-5);
}
.vx-empty__cta { display: inline-flex; }

/* ===== .vx-divider ===== */
.vx-divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: var(--space-4) 0;
}
.vx-divider--soft { background: var(--border-soft); }

/* ===== Utility classes minimas (opt-in) ===== */
.vx-stack-1 { display: flex; flex-direction: column; gap: var(--space-1); }
.vx-stack-2 { display: flex; flex-direction: column; gap: var(--space-2); }
.vx-stack-3 { display: flex; flex-direction: column; gap: var(--space-3); }
.vx-stack-4 { display: flex; flex-direction: column; gap: var(--space-4); }
.vx-row-1   { display: flex; align-items: center; gap: var(--space-1); }
.vx-row-2   { display: flex; align-items: center; gap: var(--space-2); }
.vx-row-3   { display: flex; align-items: center; gap: var(--space-3); }
.vx-row-4   { display: flex; align-items: center; gap: var(--space-4); }
.vx-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.vx-numeric { font-variant-numeric: tabular-nums; }
.vx-uppercase {
  text-transform: uppercase;
  letter-spacing: var(--tracking-uppercase);
}
