/* ============================================================ */
/* CPV BOT ENGINE — MINIMALIST OFF-WHITE DESIGN SYSTEM          */
/* Clean, Modern SaaS Dashboard (Linear / Notion / Stripe style)*/
/* ============================================================ */

:root {
  /* Canvas & Containers (Off-White & Crisp White) */
  --bg-canvas: #f8fafc;        /* Off-white / Porcelain */
  --bg-body: #f8fafc;
  --bg-card: #ffffff;          /* Crisp White */
  --bg-card-hover: #f1f5f9;    /* Slate-100 */
  --bg-subtle: #f8fafc;        /* Slate-50 */
  --bg-panel: #ffffff;
  
  /* Borders */
  --border: #e2e8f0;           /* Slate-200 Hairline */
  --border-subtle: #f1f5f9;    /* Slate-100 */
  --border-focus: #0f172a;     /* Slate-900 */
  --border-hover: #cbd5e1;     /* Slate-300 */
  
  /* Typography Contrast */
  --text: #0f172a;             /* Slate-900 Dark Charcoal */
  --text-secondary: #334155;   /* Slate-700 */
  --text-muted: #64748b;       /* Slate-500 */
  --text-dim: #94a3b8;         /* Slate-400 */
  
  /* Brand & Accents (Monochrome Minimalist) */
  --primary: #0f172a;          /* Slate-900 Monochrome */
  --primary-hover: #1e293b;
  --dark-btn: #0f172a;
  --dark-btn-hover: #1e293b;
  --success: #10b981;
  --warning: #64748b;
  --error: #ef4444;
  --purple: #64748b;
  
  /* Geometry & Shadows */
  --radius: 10px;
  --radius-lg: 12px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
  --shadow-modal: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  
  /* Font Stack */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'Consolas', 'Courier New', monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-body);
}

body {
  background-color: var(--bg-canvas);
  color: var(--text);
  min-height: 100vh;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Minimalist Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-canvas);
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================ */
/* HEADER PRINCIPAL                                             */
/* ============================================================ */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  background: #0f172a;
  color: #ffffff;
  font-weight: 800;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  letter-spacing: 0.5px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
  border: 1px solid #1e293b;
}

.brand-logo::after {
  display: none !important;
}

.brand-info h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-info span {
  font-size: 12px;
  color: var(--text-muted);
}

.jarvis-pill {
  font-size: 11px;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.3px;
}

.jarvis-pill i {
  color: #64748b;
  font-size: 10px;
}

/* Header Navigation Tabs */
.app-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-tab {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.nav-tab:hover {
  background: #f1f5f9;
  color: var(--text);
}

.nav-tab.active {
  background: #0f172a;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15);
}

/* Header Status & Actions */
.header-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.badge-status.connected {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}
.badge-status.connected .status-dot {
  background: #10b981;
}

.badge-status.qrcode {
  background: #fffbeb;
  color: #d97706;
  border-color: #fde68a;
}
.badge-status.qrcode .status-dot {
  background: #f59e0b;
  animation: pulse 1.5s infinite;
}

.badge-status.disconnected {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}
.badge-status.disconnected .status-dot {
  background: #ef4444;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.btn-action {
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn-action:hover {
  background: #1e293b;
  border-color: #1e293b;
}

.btn-action.danger {
  background: #ffffff;
  color: #dc2626;
  border: 1px solid #fca5a5;
}

.btn-action.danger:hover {
  background: #fef2f2;
  border-color: #f87171;
}

/* ============================================================ */
/* LAYOUT BASE                                                  */
/* ============================================================ */
.main-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.view-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.view-panel:not(.active) {
  display: none !important;
}

/* ============================================================ */
/* ABA 1: CRM KANBAN & KPI SUMMARY BAR                          */
/* ============================================================ */
.crm-kanban-container {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* KPI Summary Bar */
.crm-summary-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.crm-summary-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-card);
  position: relative;
}

.crm-summary-item::before,
.crm-summary-item::after {
  display: none !important;
}

.crm-summary-item:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

.crm-summary-item .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.crm-summary-item .num {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
  letter-spacing: -0.02em;
}

.crm-summary-item .icon {
  font-size: 18px;
  color: #64748b;
  opacity: 0.8;
}

.crm-summary-item.pago .icon { color: #059669; }

.crm-summary-item.pago {
  border-left: 3px solid #059669;
}

/* Quadro Kanban */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
}

.kanban-column {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  min-width: 260px;
  overflow: hidden;
}

.kanban-column-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  background: transparent;
}

.kanban-column-header .column-count {
  background: #ffffff;
  color: var(--text-secondary);
  border: 1px solid #cbd5e1;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.kanban-column-header.pago-header {
  border-top: 3px solid #059669;
}

.kanban-column-header.agendado-header {
  border-top: 3px solid #7c3aed;
}

.kanban-column-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex: 1;
}

.card-empty-placeholder {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  padding: 30px 10px;
}

/* Cards do Kanban */
.kanban-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-card);
}

.kanban-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

.kanban-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.kanban-card-phone {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.kanban-card-machine {
  font-size: 11.5px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.kanban-card-preview {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.kanban-card-btn {
  background: #f8fafc;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.kanban-card-btn:hover {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

/* ============================================================ */
/* ABA 2: VISÃO CHAT AO VIVO & LEADS CONSOLE                    */
/* ============================================================ */
.main-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  padding: 20px 24px;
  flex: 1;
}

@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
}

.left-panel, .right-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Cards Universais */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag {
  font-size: 11px;
  font-weight: 500;
  background: #f1f5f9;
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
  color: var(--text-muted);
}

/* QR Code Card */
.qr-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  background: #ffffff;
}

.qr-img {
  width: 200px;
  height: 200px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}

.qr-placeholder {
  text-align: center;
  color: var(--text-muted);
}

.qr-placeholder i {
  font-size: 32px;
  margin-bottom: 12px;
  color: #64748b;
}

.qr-connected-box {
  text-align: center;
  color: var(--success);
}

.qr-connected-box i {
  font-size: 44px;
  margin-bottom: 10px;
  color: var(--success);
}

.qr-connected-box h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.qr-connected-box p {
  font-size: 12px;
  color: var(--text-muted);
}

.qr-instructions {
  background: #f8fafc;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
}

.qr-instructions ol {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Metric Cards (Left Column) */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.metric-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.metric-icon.blue { background: #f1f5f9; color: #334155; }
.metric-icon.green { background: #ecfdf5; color: #059669; }
.metric-icon.purple { background: #f1f5f9; color: #334155; }

.metric-data {
  display: flex;
  flex-direction: column;
}

.metric-number {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.metric-label {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
}

/* Test Card */
.test-card .card-body {
  padding: 16px 18px;
  background: #ffffff;
}

.input-group {
  margin-bottom: 12px;
}

.input-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  padding: 9px 12px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: all 0.15s ease;
}

.input-group input:focus {
  border-color: #0f172a;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06);
}

.btn-primary {
  width: 100%;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
  padding: 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.btn-primary:hover {
  background: #1e293b;
  border-color: #1e293b;
}

/* Leads & Chat Section */
.leads-card {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 110px);
}

.btn-refresh {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}

.btn-refresh:hover {
  color: var(--text);
}

/* Filtros CRM no Chat */
.crm-filters {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.crm-filter-btn {
  background: #ffffff;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.crm-filter-btn:hover {
  color: var(--text);
  border-color: #cbd5e1;
}

.crm-filter-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
  font-weight: 600;
}

.leads-container {
  display: grid;
  grid-template-columns: 290px 1fr;
  flex: 1;
  overflow: hidden;
}

.leads-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.lead-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.15s ease;
}

.lead-item:hover {
  background: #f8fafc;
}

.lead-item.active {
  background: #f1f5f9;
  border-left: 3px solid #0f172a;
}

.lead-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lead-phone {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.lead-mode {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: var(--text-secondary);
}

.lead-node {
  font-size: 11px;
  color: var(--text-muted);
}

.crm-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 600;
  text-transform: uppercase;
}
.crm-badge.pago { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.crm-badge.checkout { background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; }
.crm-badge.oferta { background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; }
.crm-badge.qualificando { background: #f1f5f9; color: #334155; border: 1px solid #e2e8f0; }
.crm-badge.novo { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.crm-badge.desinteressado { background: #f8fafc; color: #94a3b8; border: 1px solid #e2e8f0; }

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-dim);
}

.empty-state i {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Chat Viewer */
.chat-viewer {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  background: #f8fafc;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
}

.chat-empty i { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }

.chat-active {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-header {
  padding: 12px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-contact-info h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.node-pill {
  font-size: 11px;
  font-weight: 500;
  background: #f1f5f9;
  color: #334155;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.chat-mode-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.chat-mode-selector select {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
}

.btn-small {
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-small:hover {
  background: #e2e8f0;
}

.btn-small.success {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
  font-weight: 600;
}

.btn-small.success:hover {
  background: #d1fae5;
}

/* Balões de Mensagem (Minimalista & Ultra Legível) */
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #f8fafc;
}

.message-bubble {
  max-width: 75%;
  padding: 11px 15px;
  font-size: 13.5px;
  line-height: 1.5;
  word-break: break-word;
}

.message-bubble.lead {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border-radius: 12px 12px 12px 3px;
}

.message-bubble.ai, .message-bubble.bot {
  align-self: flex-end;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12);
  border-radius: 12px 12px 3px 12px;
}

.message-bubble.lead .message-meta {
  color: var(--text-dim);
  font-size: 10.5px;
  margin-top: 4px;
  text-align: right;
}

.message-bubble.ai .message-meta, .message-bubble.bot .message-meta {
  color: #94a3b8;
  font-size: 10.5px;
  margin-top: 4px;
  text-align: right;
}

/* Chat Input Bar */
.chat-input-bar {
  padding: 12px 16px;
  background: #ffffff;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
}

.chat-input-bar input {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--text);
  outline: none;
  font-size: 13.5px;
  transition: all 0.15s ease;
}

.chat-input-bar input:focus {
  border-color: #0f172a;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06);
}

.btn-send {
  background: #0f172a;
  color: #ffffff;
  border: none;
  padding: 0 18px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-send:hover {
  background: #1e293b;
}

/* Tag Pago Button */
.btn-tag-pago {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #059669;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.btn-tag-pago:hover {
  background: #d1fae5;
}

.btn-tag-pago.is-paid {
  background: #059669;
  color: #ffffff;
  border-color: #059669;
}

/* ============================================================ */
/* ABA 3: CAMPANHA DE FOLLOW-UP DIA 09                          */
/* ============================================================ */
.campaign-container {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.campaign-header-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-card);
}

.campaign-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #e2e8f0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.campaign-title-area h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.campaign-title-area p {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 650px;
}

.campaign-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-primary-campaign {
  background: #059669;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn-primary-campaign:hover {
  background: #047857;
}

.btn-danger-campaign {
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-refresh-campaign {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-refresh-campaign:hover {
  background: #f1f5f9;
}

/* Stats Grid da Campanha */
.campaign-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.c-stat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card);
}

.c-stat-card.highlight-green {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.c-stat-card.highlight-orange {
  border-color: var(--border);
  background: #ffffff;
}

.c-stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.c-stat-icon.blue { background: #f1f5f9; color: #334155; }
.c-stat-icon.green { background: #ecfdf5; color: #059669; }
.c-stat-icon.orange { background: #f1f5f9; color: #334155; }
.c-stat-icon.purple { background: #f1f5f9; color: #334155; }

.c-stat-data {
  display: flex;
  flex-direction: column;
}

.c-stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.c-stat-number {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.c-stat-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.text-success { color: #059669 !important; font-weight: 600; }

/* Barra de Progresso */
.campaign-progress-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-card);
}

.progress-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.progress-status-badge {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.progress-counter {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: #059669;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.current-lead-row {
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.current-lead-row strong {
  color: var(--text);
}

/* Grid de Configurações da Campanha */
.campaign-main-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  min-height: 0;
  flex: 1;
}

.campaign-left-col,
.campaign-right-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.campaign-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.campaign-card .card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.campaign-card .card-header h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}

.campaign-card .card-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.campaign-card .card-body.no-padding {
  padding: 0;
}

/* Opções de Alvo */
.campaign-target-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.target-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.target-option:hover {
  background: #f1f5f9;
}

.target-option.active {
  border-color: #0f172a;
  background: #f8fafc;
}

.target-option input[type="radio"] {
  margin-top: 3px;
  cursor: pointer;
}

.opt-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.opt-text strong {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
}

.opt-text span {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.opt-count {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  background: #e2e8f0;
  padding: 3px 8px;
  border-radius: 6px;
}

.pacing-badge-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  color: #065f46;
}

.pacing-badge-box i {
  font-size: 18px;
  color: #059669;
  margin-top: 2px;
}

.pacing-badge-box strong {
  font-size: 12px;
  color: #047857;
  display: block;
  margin-bottom: 2px;
}

.pacing-badge-box p {
  font-size: 11.5px;
  color: #065f46;
  line-height: 1.4;
  margin: 0;
}

/* Alunos Pagos Auditados */
.paid-audit-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.paid-audit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.paid-audit-item:last-child {
  border-bottom: none;
}

.paid-audit-name {
  font-weight: 600;
  color: var(--text);
}

.paid-audit-phone {
  font-size: 11px;
  color: var(--text-muted);
}

.paid-audit-tag {
  background: #ecfdf5;
  color: #059669;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-count {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
}
.badge-count.green {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

/* Prévia da Mensagem */
.preview-tabs {
  display: flex;
  gap: 6px;
}

.preview-tab {
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.preview-tab:hover {
  color: var(--text);
}

.preview-tab.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

.message-preview-bubble {
  background: #f8fafc;
  color: var(--text);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
}

/* Console de Logs */
.campaign-log-console {
  background: #0f172a;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  height: 220px;
  overflow-y: auto;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.log-line {
  word-break: break-all;
}

.log-line.info { color: #cbd5e1; }
.log-line.success { color: #4ade80; }
.log-line.warn { color: #facc15; }
.log-line.error { color: #f87171; }

.btn-clear-logs {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
}

.btn-clear-logs:hover {
  color: var(--error);
}

/* ============================================================ */
/* ABA 4: VISÃO AGENDA & RECONTATOS                             */
/* ============================================================ */
.campaign-dashboard-grid {
  display: grid;
  gap: 16px;
}

/* ============================================================ */
/* RESPONSIVIDADE MOBILE & BOTTOM BAR                           */
/* ============================================================ */
.desktop-only {
  display: flex !important;
}
.mobile-only {
  display: none !important;
}

.btn-back-chat {
  background: #f1f5f9;
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 8px;
}

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #ffffff;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
  z-index: 999;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.mobile-nav-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  flex: 1;
  height: 100%;
  transition: all 0.15s ease;
}

.mobile-nav-item i {
  font-size: 17px;
}

.mobile-nav-item.active {
  color: #0f172a;
  font-weight: 600;
}

@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: flex !important;
  }

  body {
    height: 100dvh;
    overflow: hidden;
  }

  .app-container {
    height: 100dvh;
    padding-bottom: 60px;
    display: flex;
    flex-direction: column;
  }

  .app-header {
    padding: 10px 14px;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .brand-info h2 {
    font-size: 14px;
  }

  .brand-info span {
    display: none;
  }

  .header-status .badge-status {
    padding: 4px 8px;
    font-size: 11px;
  }

  .btn-action {
    padding: 6px 10px;
    font-size: 11px;
  }

  .crm-kanban-container {
    padding: 12px;
    gap: 12px;
  }

  .crm-summary-bar {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .crm-summary-item {
    min-width: 110px;
    padding: 10px 12px;
    flex-shrink: 0;
  }

  .crm-summary-item .num {
    font-size: 18px;
  }

  .crm-summary-item .label {
    font-size: 9.5px;
  }

  .kanban-board {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 10px;
    padding-bottom: 8px;
  }

  .kanban-column {
    min-width: 84vw;
    max-width: 86vw;
    scroll-snap-align: center;
    flex-shrink: 0;
  }

  .main-layout {
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
    height: 100%;
  }

  .left-panel {
    display: none;
  }

  .left-panel.show-mobile {
    display: flex !important;
    padding: 14px;
    overflow-y: auto;
  }

  .right-panel {
    height: 100%;
    width: 100%;
  }

  .leads-card {
    border-radius: 0;
    border: none;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .leads-card .card-header {
    padding: 10px 14px;
  }

  .leads-container {
    flex: 1;
    position: relative;
    overflow: hidden;
  }

  .leads-list {
    width: 100%;
    height: 100%;
    border-right: none;
    overflow-y: auto;
  }

  .chat-viewer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    display: none;
  }

  .leads-container.mobile-chat-open .chat-viewer {
    display: flex !important;
  }

  .leads-container.mobile-chat-open .leads-list {
    display: none !important;
  }

  .chat-header {
    padding: 10px 12px;
  }

  .chat-messages {
    padding: 12px 10px;
  }

  .message-bubble {
    max-width: 90%;
    font-size: 13px;
  }

  .chat-input-bar {
    padding: 8px 10px;
  }
}


/* ============================================================ */
/* MODAL UNIVERSAL DE CONEXÃO WHATSAPP (QR CODE & PAIRING CODE)  */
/* ============================================================ */
.connection-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.connection-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: -1;
}

.connection-modal-content {
  background: #ffffff;
  border-radius: 16px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  animation: modalScaleIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.connection-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.modal-close-btn:hover {
  color: #0f172a;
  background: #f1f5f9;
}

.modal-tabs {
  display: flex;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.modal-tab {
  flex: 1;
  padding: 12px 14px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.modal-tab.active {
  color: #005293;
  border-bottom-color: #005293;
  background: #ffffff;
}

.modal-tab-body {
  padding: 20px;
  min-height: 270px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #ffffff;
}

.connection-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #f1f5f9;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Badge pulsar quando aguardando leitura */
.badge-status.qrcode, .badge-status.disconnected {
  cursor: pointer;
  transition: transform 0.15s ease;
}

.badge-status.qrcode:hover, .badge-status.disconnected:hover {
  transform: scale(1.05);
}

.badge-status.qrcode .status-dot {
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
  100% { transform: scale(1); opacity: 1; }
}

/* Banner de alerta no topo do CRM */
.global-conn-alert {
  background: #fffbeb;
  border-bottom: 1px solid #fef3c7;
  padding: 10px 20px;
  font-size: 12.5px;
  color: #92400e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
