/* ==========================================================================
   YD-CONNECT DESIGN SYSTEM & CUSTOM GLASSMORPHISM RULES
   ========================================================================== */

:root {
  /* Paleta Neon & Dark Premium */
  --bg: #0f172a;
  --bg-rgb: 15, 23, 42;
  --panel: rgba(30, 41, 59, 0.65);
  --panel-hover: rgba(30, 41, 59, 0.85);
  --border: rgba(148, 163, 184, 0.15);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  --primary: #6366f1;
  --primary-rgb: 99, 102, 241;
  --primary-hover: #4f46e5;
  --secondary: #8b5cf6;
  --secondary-rgb: 139, 92, 246;
  --success: #10b981;
  --success-rgb: 16, 185, 129;
  --danger: #f43f5e;
  --danger-rgb: 244, 63, 94;
  --warning: #f59e0b;
  --warning-rgb: 245, 158, 11;
  
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --sidebar-w: 260px;
  --radius: 12px;
}

/* Reset básico */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .logo-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
}

/* Scrollbars customizadas */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* ==========================================================================
   APP E LAYOUT GERAL
   ========================================================================== */

.app-container {
  display: flex;
  width: 100%;
  height: 100vh;
  position: relative;
}

/* A tela Ãºnica do portal precisa ocupar toda a janela, inclusive no desktop. */
#app-wrapper {
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  height: 100vh;
}

/* SIDEBAR E NAVEGAÇÃO */
.sidebar {
  width: var(--sidebar-w);
  background: rgba(15, 23, 42, 0.85);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  backdrop-filter: blur(12px);
  z-index: 10;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}

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

.logo-icon {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.logo-title {
  font-size: 1.25rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sidebar-nav {
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  overflow-y: auto;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  padding: 12px 16px;
  width: 100%;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.nav-btn.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.05));
  border-left: 3px solid var(--primary);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 0 12px rgba(99, 102, 241, 0.05);
}

.nav-btn i {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.nav-btn:hover i {
  transform: translateX(2px);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.connection-status-card {
  background: rgba(30, 41, 59, 0.4);
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

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

.status-dot.green {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 1.8s infinite;
}

.status-dot.yellow {
  background-color: var(--warning);
  box-shadow: 0 0 8px var(--warning);
}

.status-dot.red {
  background-color: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

.connection-status-card small {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* CONTEÚDO PRINCIPAL */
.main-content {
  flex: 1;
  height: 100%;
  padding: 32px;
  overflow-y: auto;
  position: relative;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

/* ==========================================================================
   COMPONENTES CORE (GLASS, BUTTONS, CARDS)
   ========================================================================== */

.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-description {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* BOTÕES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  border: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(148, 163, 184, 0.2);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: #ff8596;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #ffd073;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
  background: var(--warning);
  color: white;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
}

/* CARDS */
.card {
  border-radius: var(--radius);
  margin-bottom: 24px;
}

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

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 24px;
}

/* ELEMENTOS DE FORMULÁRIO */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row.align-center {
  align-items: center;
}

.form-row .form-group {
  flex: 1;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

input[type="text"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.text-muted {
  color: var(--text-muted);
}

.text-danger {
  color: var(--danger);
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   ABA 1: DASHBOARD
   ========================================================================== */

.token-config-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
}

.token-config-box input {
  width: 140px;
  padding: 6px 10px;
  font-size: 0.8rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Glow Neons para Cards */
.glow-purple { box-shadow: inset 0 0 15px rgba(139, 92, 246, 0.05), 0 4px 20px rgba(0, 0, 0, 0.15); }
.glow-blue { box-shadow: inset 0 0 15px rgba(99, 102, 241, 0.05), 0 4px 20px rgba(0, 0, 0, 0.15); }
.glow-green { box-shadow: inset 0 0 15px rgba(16, 185, 129, 0.05), 0 4px 20px rgba(0, 0, 0, 0.15); }
.glow-yellow { box-shadow: inset 0 0 15px rgba(245, 158, 11, 0.05), 0 4px 20px rgba(0, 0, 0, 0.15); }

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--secondary); }
.stat-icon.blue { background: rgba(99, 102, 241, 0.15); color: var(--primary); }
.stat-icon.green { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-icon.yellow { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.flex-column-space {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.border-top {
  border-top: 1px solid var(--border);
}

.padding-top-only {
  padding-top: 20px;
}

/* QR Code */
.qr-container {
  width: 240px;
  height: 240px;
  margin: 0 auto 20px auto;
  border-radius: var(--radius);
  background: white;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
}

.qr-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-placeholder {
  color: var(--bg);
  display: flex;
  flex-direction: center;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  gap: 12px;
}

.qr-placeholder p {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.connection-body {
  display: flex;
  flex-direction: column;
}

.connection-details {
  margin-bottom: 20px;
}

.details-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  padding: 8px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.details-row span {
  color: var(--text-muted);
}

.card-actions {
  display: flex;
  gap: 10px;
}

/* ==========================================================================
   ABA 2: ATENDIMENTO HUMANO
   ========================================================================== */

.chat-layout {
  display: grid;
  grid-template-columns: 320px 1fr 300px;
  height: calc(100vh - 120px);
  overflow: hidden;
}

.chat-sidebar {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.chat-search {
  padding: 16px;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.chat-search i {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.chat-search input {
  padding-left: 36px;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.05);
  cursor: pointer;
  transition: background 0.2s ease;
}

.chat-item:hover {
  background: rgba(255, 255, 255, 0.02);
}

.chat-item.active {
  background: rgba(99, 102, 241, 0.08);
  border-left: 3px solid var(--primary);
}

.contact-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.chat-item-info {
  flex: 1;
  min-width: 0;
}

.chat-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.chat-item-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-item-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.chat-item-preview {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Janela do Chat */
.chat-window {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-right: 1px solid var(--border);
}

.chat-window-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.chat-window-placeholder h3 {
  margin-top: 16px;
  color: var(--text);
}

.chat-window-placeholder p {
  font-size: 0.9rem;
  max-width: 320px;
  margin-top: 8px;
}

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

.chat-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-contact-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-name {
  font-size: 1rem;
  font-weight: 600;
}

.contact-phone {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chat-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: rgba(15, 23, 42, 0.4);
}

/* Balões de Mensagem */
.msg-bubble {
  max-width: 65%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  position: relative;
  word-wrap: break-word;
  animation: fadeInUp 0.25s ease;
}

.msg-bubble.in {
  align-self: flex-start;
  background: rgba(30, 41, 59, 0.9);
  border-bottom-left-radius: 2px;
  border: 1px solid var(--border);
}

.msg-bubble.out {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-bottom-right-radius: 2px;
}

.msg-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.6);
}

.msg-bubble.in .msg-footer {
  color: var(--text-muted);
}

.chat-input-area {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
}

/* Detalhes do Lead */
.chat-details-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.panel-body {
  padding: 24px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* Badges e Tags */
.badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
}

.badge-primary { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.3); }

/* ==========================================================================
   ABA 3: PIPELINE CRM (KANBAN SYSTEM)
   ========================================================================== */

.kanban-board {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  align-items: flex-start;
  padding-bottom: 16px;
  height: calc(100vh - 200px);
}

.kanban-column {
  width: 280px;
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

.kanban-column.drag-over {
  background: rgba(99, 102, 241, 0.05);
  border-color: var(--primary);
}

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

.column-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.column-count {
  background: rgba(148, 163, 184, 0.15);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 150px;
}

/* Kanban Cards */
.kanban-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  cursor: grab;
  transition: all 0.2s ease;
  user-select: none;
}

.kanban-card:hover {
  background: var(--panel-hover);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  transform: translateY(-1px);
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.4;
  border-style: dashed;
}

.card-lead-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-lead-phone {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

.card-tag {
  background: rgba(148, 163, 184, 0.1);
  padding: 2px 6px;
  font-size: 0.7rem;
  border-radius: 4px;
  color: var(--text-muted);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(148, 163, 184, 0.05);
  padding-top: 8px;
}

.card-action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.card-action-btn:hover {
  color: var(--primary);
}

/* ==========================================================================
   WHATSAPP CRM PREMIUM
   ========================================================================== */

.crm-header {
  gap: 18px;
}

.crm-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crm-search {
  position: relative;
  width: min(360px, 36vw);
}

.crm-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.crm-search input {
  padding-left: 36px;
}

.crm-workspace {
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(440px, 1fr) 300px;
  height: calc(100vh - 132px);
  gap: 14px;
  min-height: 0;
}

.crm-funnel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  min-height: 0;
  padding-bottom: 4px;
}

.crm-column {
  min-width: 286px;
  max-width: 318px;
  flex: 1 0 286px;
  background: rgba(248, 250, 252, 0.94);
  color: #0f172a;
  border-radius: 8px;
  padding: 14px 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.22);
}

.crm-column-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.crm-column-head h3 {
  font-size: 1rem;
  color: #111827;
}

.crm-column-head span {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 0.78rem;
}

.crm-column-head strong {
  background: #e2e8f0;
  color: #334155;
  border-radius: 999px;
  min-width: 28px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
}

.crm-column-line {
  height: 4px;
  border-radius: 99px;
  background: var(--accent);
  margin: 12px 0 14px;
}

.crm-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
  padding-right: 3px;
}

.crm-lead-card {
  display: grid;
  grid-template-columns: 42px 1fr 14px;
  gap: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  color: #0f172a;
  cursor: pointer;
  box-shadow: 0 3px 9px rgba(15, 23, 42, 0.14);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.crm-lead-card:hover,
.crm-lead-card.active {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.crm-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366, #128c7e);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
}

.crm-card-main {
  min-width: 0;
}

.crm-card-top,
.crm-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.crm-card-top strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
}

.crm-card-top small,
.crm-card-meta span {
  color: #64748b;
  font-size: 0.75rem;
}

.crm-card-main p {
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 5px 0 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}

.crm-card-main i,
.crm-card-meta i {
  width: 13px;
  height: 13px;
  color: #22c55e;
}

.crm-card-tags,
.crm-side-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.crm-card-tags span,
.crm-side-tags span {
  background: #f1f5f9;
  color: #475569;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.68rem;
}

.crm-card-alert {
  color: #10b981;
  width: 14px;
  height: 14px;
  margin-top: 3px;
}

.crm-empty {
  padding: 18px;
  text-align: center;
  color: #64748b;
}

.crm-chat-panel,
.crm-info-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 0;
  overflow: hidden;
}

.crm-chat-panel {
  display: flex;
  flex-direction: column;
}

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

.crm-chat-actions {
  display: flex;
  gap: 8px;
}

.crm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background:
    linear-gradient(rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.9)),
    radial-gradient(circle at top left, rgba(16, 185, 129, 0.12), transparent 32%);
}

.crm-composer {
  display: grid;
  grid-template-columns: 1fr 54px;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--border);
}

.crm-composer textarea {
  resize: none;
  min-height: 46px;
}

.crm-info-panel {
  overflow-y: auto;
}

.crm-info-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  font-size: 0.84rem;
}

.crm-info-row span,
.crm-notes {
  color: var(--text-muted);
}

.crm-info-row strong {
  text-align: right;
}

.crm-notes {
  margin-top: 8px;
  line-height: 1.45;
  font-size: 0.86rem;
}

/* WhatsApp CRM operacional */
.wa-crm-page {
  height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.wa-crm-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.wa-crm-topbar h2 {
  font-size: 1.65rem;
}

.wa-crm-topbar p {
  color: var(--text-muted);
  margin-top: 4px;
}

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

.wa-ai-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

.wa-ai-pill.ok {
  color: #86efac;
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.1);
}

.wa-ai-pill.bad {
  color: #fca5a5;
  border-color: rgba(244, 63, 94, 0.35);
  background: rgba(244, 63, 94, 0.1);
}

.wa-crm-layout {
  display: grid;
  grid-template-columns: 360px minmax(420px, 1fr) 330px;
  gap: 14px;
  flex: 1;
  min-height: 0;
}

.wa-inbox,
.wa-chat,
.wa-side {
  background: rgba(30, 41, 59, 0.72);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-height: 0;
  overflow: hidden;
}

.wa-inbox {
  display: flex;
  flex-direction: column;
}

.wa-search {
  position: relative;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.wa-search i {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  color: var(--text-muted);
}

.wa-search input {
  padding-left: 36px;
}

.wa-stage-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.wa-stage-tabs button {
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.5);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 7px 10px;
  white-space: nowrap;
  cursor: pointer;
  font-weight: 700;
}

.wa-stage-tabs button.active {
  color: white;
  border-color: rgba(37, 99, 235, 0.6);
  background: rgba(37, 99, 235, 0.25);
}

.wa-stage-tabs span {
  margin-left: 5px;
  opacity: 0.75;
}

.wa-conversation-list {
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wa-chat-card {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 11px;
  background: rgba(15, 23, 42, 0.48);
  border: 1px solid var(--border);
  border-left: 4px solid var(--stage);
  border-radius: 8px;
  padding: 11px;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}

.wa-chat-card:hover,
.wa-chat-card.active {
  background: rgba(37, 99, 235, 0.13);
  border-color: rgba(96, 165, 250, 0.55);
  transform: translateY(-1px);
}

.wa-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #2563eb);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.wa-avatar.big {
  width: 52px;
  height: 52px;
}

.wa-card-body {
  min-width: 0;
}

.wa-card-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.wa-card-title strong,
.wa-card-body p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wa-card-title time,
.wa-card-body p,
.wa-card-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.wa-card-body p {
  margin: 5px 0 8px;
}

.wa-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.wa-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.wa-card-meta i {
  width: 13px;
  height: 13px;
}

.wa-mini-ai {
  color: #f0abfc !important;
  font-weight: 800;
}

.wa-chat {
  display: flex;
  flex-direction: column;
}

.wa-empty-state,
.wa-side-empty,
.wa-empty-list {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
}

.wa-empty-state i {
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
}

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

.wa-chat-person {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wa-chat-person span {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 3px;
}

.wa-chat-head-actions {
  display: flex;
  gap: 8px;
}

.wa-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(15, 23, 42, 0.42);
}

.wa-bubble {
  max-width: 72%;
  padding: 11px 13px;
  border-radius: 12px;
  line-height: 1.35;
  word-break: break-word;
}

.wa-bubble.in {
  align-self: flex-start;
  background: rgba(51, 65, 85, 0.82);
  border-bottom-left-radius: 3px;
}

.wa-bubble.out {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb, #10b981);
  border-bottom-right-radius: 3px;
}

.wa-bubble small {
  display: block;
  margin-top: 5px;
  opacity: 0.7;
  font-size: 0.7rem;
  text-align: right;
}

.wa-bubble a,
.wa-ai-box a {
  color: #93c5fd;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.wa-bubble.out a {
  color: #ffffff;
}

.wa-ai-box {
  border-top: 1px solid var(--border);
  background: rgba(139, 92, 246, 0.12);
  padding: 13px 16px;
}

.wa-ai-box span {
  display: block;
  color: var(--text-muted);
  font-size: 0.74rem;
  margin-top: 2px;
}

.wa-ai-box p {
  margin: 8px 0 10px;
  line-height: 1.42;
}

.wa-ai-actions {
  display: flex;
  gap: 8px;
}

.wa-composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--border);
}

.wa-composer-tools {
  display: flex;
  gap: 10px;
}

.wa-composer-tools select {
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(30, 41, 59, 0.9);
  color: var(--text-light);
  border: 1px solid var(--border);
  cursor: pointer;
  max-width: 200px;
}

.wa-composer-input-row {
  display: grid;
  grid-template-columns: 1fr 54px;
  gap: 10px;
}

.wa-composer-input-row textarea {
  min-height: 48px;
  resize: none;
}

.wa-mini-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: auto;
}

.wa-mini-badge.bot {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.wa-mini-badge.human {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.wa-mini-badge i {
  width: 11px;
  height: 11px;
}

.wa-composer,
.drawer,
.drawer-body {
  pointer-events: auto;
}

.wa-composer textarea,
.wa-composer button,
.wa-side button,
.wa-side select,
.drawer input,
.drawer textarea,
.drawer select,
.drawer button {
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

.wa-composer button:disabled,
.drawer button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.wa-side {
  overflow-y: auto;
}

.wa-side-head h3 {
  font-size: 1.05rem;
}

.wa-side-head span,
.wa-info-line strong {
  font-size: 0.78rem;
}

.wa-side-head .ok {
  color: #86efac;
}

.wa-side-head .warn {
  color: #fbbf24;
}

.wa-side-body {
  padding: 16px;
}

.wa-side-body label {
  display: block;
  color: var(--text-muted);
  margin: 14px 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
}

.wa-info-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.09);
  padding: 10px 0;
}

.wa-info-line span,
.wa-notes {
  color: var(--text-muted);
}

.wa-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wa-tags span {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  padding: 4px 8px;
  font-size: 0.72rem;
}

.wa-notes {
  line-height: 1.45;
}

.wa-danger-zone {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}

@media (max-width: 1280px) {
  .wa-crm-layout {
    grid-template-columns: 330px minmax(380px, 1fr);
  }
  .wa-side {
    display: none;
  }
}

/* CRM WhatsApp - ajustes de interação e leitura */
.wa-crm-topbar {
  padding: 18px 20px;
  margin: -8px 0 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: linear-gradient(110deg, rgba(15, 23, 42, 0.88), rgba(30, 41, 59, 0.62));
  box-shadow: 0 16px 34px rgba(2, 6, 23, 0.2);
}

.wa-crm-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #86efac;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.wa-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14), 0 0 14px rgba(34, 197, 94, 0.65);
}

.wa-crm-topbar h2 {
  letter-spacing: -0.03em;
}

.wa-crm-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wa-crm-metrics {
  display: flex;
  gap: 8px;
}

.wa-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.52);
}

.wa-metric strong {
  color: #f8fafc;
  font-size: 0.92rem;
}

.wa-metric small {
  color: var(--text-muted);
  font-size: 0.68rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wa-inbox,
.wa-chat,
.wa-side {
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.2);
}

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

.wa-inbox-head strong {
  display: block;
  color: #f8fafc;
  font-size: 0.98rem;
}

.wa-inbox-head span {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-top: 3px;
}

.wa-inbox-head > i {
  color: #93c5fd;
  width: 18px;
}

.wa-search {
  padding: 12px 14px;
}

.wa-search input {
  min-height: 42px;
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.72);
}

.wa-stage-tabs {
  padding: 10px 14px 12px;
  scrollbar-width: thin;
}

.wa-stage-tabs button {
  padding: 8px 11px;
  font-size: 0.76rem;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.wa-stage-tabs button:hover {
  transform: translateY(-1px);
  border-color: rgba(147, 197, 253, 0.5);
}

.wa-conversation-list {
  padding: 10px;
  gap: 8px;
}

.wa-chat-card {
  border-radius: 12px;
  padding: 12px;
  border-left-width: 3px;
}

.wa-chat-card:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.wa-chat-card.unread {
  background: linear-gradient(100deg, rgba(37, 99, 235, 0.16), rgba(16, 185, 129, 0.07));
  border-color: rgba(96, 165, 250, 0.32);
}

.wa-chat-card.unread .wa-card-title strong {
  color: #ffffff;
}

.wa-unread-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  color: #93c5fd;
  font-size: 0.68rem;
  font-weight: 700;
}

.wa-unread-label i {
  width: 12px;
  height: 12px;
}

.wa-chat-head {
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.34);
}

.wa-chat-person strong {
  font-size: 0.98rem;
}

.wa-chat-head-actions .btn {
  white-space: nowrap;
}

.wa-messages {
  padding: 22px 18px;
  background-color: rgba(15, 23, 42, 0.52);
  background-image: radial-gradient(circle at 15% 8%, rgba(37, 99, 235, 0.1), transparent 28%), radial-gradient(circle at 90% 92%, rgba(16, 185, 129, 0.08), transparent 26%);
}

.wa-bubble {
  max-width: min(78%, 620px);
  padding: 12px 14px;
  border-radius: 14px;
  box-shadow: 0 5px 15px rgba(2, 6, 23, 0.12);
}

.wa-bubble.in {
  background: rgba(51, 65, 85, 0.9);
}

.wa-bubble.out {
  background: linear-gradient(135deg, #2563eb, #0ea5a4);
}

.wa-composer {
  padding: 12px 14px 14px;
  background: rgba(15, 23, 42, 0.6);
}

.wa-composer-tools {
  justify-content: space-between;
  align-items: center;
}

.wa-composer-tools::after {
  content: 'Enter envia  ·  Shift + Enter quebra linha';
  color: var(--text-muted);
  font-size: 0.68rem;
}

.wa-composer-tools select {
  max-width: min(360px, 70%);
  min-height: 34px;
}

.wa-composer-input-row textarea {
  min-height: 54px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.76);
}

.wa-composer-input-row .btn {
  min-height: 54px;
  border-radius: 12px;
}

@media (max-width: 860px) {
  .wa-crm-page {
    height: auto;
    min-height: calc(100vh - 40px);
  }

  .wa-crm-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .wa-crm-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .wa-crm-layout {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .wa-inbox {
    flex: 0 0 auto;
    max-height: 45vh;
  }

  .wa-chat {
    min-height: 620px;
  }

  .wa-side {
    display: none;
  }
}

@media (max-width: 540px) {
  .wa-crm-topbar {
    padding: 15px;
  }

  .wa-crm-topbar p {
    font-size: 0.82rem;
  }

  .wa-crm-metrics {
    width: 100%;
  }

  .wa-metric {
    flex: 1;
  }

  .wa-chat-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .wa-chat-head-actions,
  .wa-chat-head-actions .btn {
    width: 100%;
  }

  .wa-chat-head-actions .btn {
    justify-content: center;
  }

  .wa-bubble {
    max-width: 90%;
  }

  .wa-composer-tools::after {
    display: none;
  }
}

/* ==========================================================================
   Tabela Genérica
   ========================================================================== */

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.table th, .table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.01);
}

/* ==========================================================================
   ABA 5: CAMPANHAS
   ========================================================================== */

.campaigns-grid {
  display: flex;
  gap: 24px;
}

.safety-analytics-card {
  margin-top: 24px;
}

.safety-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
}

.safety-level {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 5px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.safety-level.safe {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.42);
  background: rgba(34, 197, 94, 0.1);
}

.safety-level.attention {
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
}

.safety-level.critical {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.5);
  background: rgba(244, 63, 94, 0.1);
}

.safety-reason {
  padding: 12px 24px 18px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

@media (max-width: 760px) {
  .safety-metrics-grid {
    grid-template-columns: 1fr;
  }
}

.flex-fill {
  flex: 1;
}

/* ==========================================================================
   ABA: AUTOMAÇÕES
   ========================================================================== */

.automation-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.25fr) minmax(320px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.automation-item,
.automation-log {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.34);
  margin-bottom: 12px;
}

.automation-item p,
.automation-log small,
.automation-log span,
.automation-log p {
  color: var(--text-muted);
}

.automation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.automation-actions span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.16);
  color: #c4b5fd;
  font-size: 0.74rem;
  font-weight: 700;
}

.automation-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.automation-log {
  display: block;
}

.automation-log.failed {
  border-color: rgba(244, 63, 94, 0.45);
}

/* ==========================================================================
   ABA 7: LOGS E TERMINAL
   ========================================================================== */

.log-actions {
  display: flex;
  gap: 10px;
}

.form-control-inline {
  width: 220px;
}

.log-terminal-wrapper {
  margin-top: 10px;
  background: #090d16;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  height: calc(100vh - 220px);
}

.log-terminal {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: #10b981;
  overflow-y: auto;
  height: 100%;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ==========================================================================
   GAVETA LATERAL (CANVAS DRAWER)
   ========================================================================== */

.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  height: 100vh;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(16px);
  border-left: 1px solid var(--border);
  z-index: 999;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.drawer.active {
  transform: translateX(0);
}

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

.drawer-title {
  font-size: 1.2rem;
}

.drawer-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.drawer-close:hover {
  color: var(--text);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.drawer-chat-messages {
  height: 200px;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-chat-input-area {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.drawer-chat-input-area input {
  padding: 8px 12px;
}

/* ==========================================================================
   MODAL DE REGRAS
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 540px;
  border-radius: var(--radius);
  z-index: 1001;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.modal-overlay.active .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

/* ==========================================================================
   TOASTS DE SINALIZAÇÃO FLUTUANTE
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1010;
}

.toast {
  background: rgba(30, 41, 59, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  min-width: 250px;
  animation: slideInLeft 0.3s ease forwards;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }

/* ==========================================================================
   ANIMAÇÕES CSS
   ========================================================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInLeft {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

.animate-spin {
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Responsivo rápido */
@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .chat-layout {
    grid-template-columns: 260px 1fr;
  }
  #chat-lead-panel {
    display: none !important;
  }
}

/* Login Premium */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--bg);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.2) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.2) 0px, transparent 50%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  background: var(--panel);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  border-radius: var(--radius);
}

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-header h2 {
  font-size: 1.8rem;
  margin-top: 10px;
  letter-spacing: -0.02em;
}

.margin-top-sm {
  margin-top: 8px;
}

/* ========================================================================== 
   YURI DEVDIGITAL — BRAND REFRESH 2026
   ========================================================================== */

:root {
  --bg: #050d19;
  --bg-rgb: 5, 13, 25;
  --panel: rgba(11, 27, 49, 0.82);
  --panel-hover: rgba(17, 39, 68, 0.94);
  --border: rgba(245, 181, 35, 0.14);
  --border-focus: rgba(255, 193, 47, 0.62);
  --primary: #f5b523;
  --primary-rgb: 245, 181, 35;
  --primary-hover: #ffca4b;
  --secondary: #ff8a00;
  --secondary-rgb: 255, 138, 0;
  --text: #f7f9fc;
  --text-muted: #93a4bb;
  --sidebar-w: 276px;
  --radius: 14px;
}

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 8% 0%, rgba(23, 61, 104, 0.48), transparent 32%),
    radial-gradient(circle at 96% 94%, rgba(245, 181, 35, 0.09), transparent 30%),
    linear-gradient(135deg, #050d19 0%, #071426 52%, #050b15 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.16;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 48px 48px;
}

::selection { background: rgba(var(--primary-rgb), .3); color: #fff; }
::-webkit-scrollbar-thumb { background: rgba(var(--primary-rgb), .28); }
::-webkit-scrollbar-thumb:hover { background: rgba(var(--primary-rgb), .45); }

.sidebar {
  background: linear-gradient(180deg, rgba(7, 20, 38, .98), rgba(5, 14, 27, .96));
  border-right-color: rgba(var(--primary-rgb), .15);
  box-shadow: 16px 0 50px rgba(0, 0, 0, .16);
}

.sidebar-header { padding: 21px 20px; }
.logo-wrapper { gap: 13px; }
.brand-logo {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(var(--primary-rgb), .42), 0 8px 22px rgba(0, 0, 0, .4);
}
.logo-title { color: #fff; font-size: 1.2rem; letter-spacing: .01em; }
.logo-subtitle { color: var(--primary); margin-top: 3px; letter-spacing: .08em; text-transform: uppercase; font-size: .62rem; }
.logo-icon { background: linear-gradient(135deg, #ffd961, #f5a812 62%, #d87900); color: #071426; }

.sidebar-nav { padding: 18px 12px; gap: 5px; }
.nav-btn { border: 1px solid transparent; padding: 11px 14px; border-radius: 10px; }
.nav-btn:hover { background: rgba(var(--primary-rgb), .07); border-color: rgba(var(--primary-rgb), .08); color: #fff; }
.nav-btn.active {
  background: linear-gradient(90deg, rgba(var(--primary-rgb), .18), rgba(var(--primary-rgb), .035));
  border: 1px solid rgba(var(--primary-rgb), .15);
  border-left: 3px solid var(--primary);
  color: #fff4d2;
  box-shadow: inset 0 0 18px rgba(var(--primary-rgb), .035);
}
.nav-btn.active i { color: var(--primary); }
.sidebar-footer { background: rgba(2, 9, 18, .28); }
.connection-status-card { background: rgba(15, 34, 59, .62); }

.main-content { padding: 30px clamp(22px, 3vw, 42px); }
.page-header { margin-bottom: 26px; }
.page-title { font-size: clamp(1.55rem, 2.2vw, 2rem); letter-spacing: -.025em; }
.page-description { max-width: 720px; line-height: 1.55; }

.glass, .card, .modal, .drawer {
  border-color: rgba(var(--primary-rgb), .12);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .16), inset 0 1px 0 rgba(255,255,255,.025);
}
.card { overflow: hidden; }
.card-header { background: linear-gradient(90deg, rgba(var(--primary-rgb), .04), transparent); }

.btn-primary {
  background: linear-gradient(135deg, #ffcf50, #f5b523 52%, #e99508);
  color: #091426;
  border-color: #ffd86a;
  box-shadow: 0 7px 20px rgba(var(--primary-rgb), .18);
  font-weight: 700;
}
.btn-primary:hover { background: linear-gradient(135deg, #ffdc74, #ffc536 52%, #f2a715); color: #07101d; }
.btn-secondary:hover { border-color: rgba(var(--primary-rgb), .32); color: var(--primary); }

input:focus, textarea:focus, select:focus { box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12); }
.badge-primary { background: rgba(var(--primary-rgb), .13); color: #ffd66b; border-color: rgba(var(--primary-rgb), .28); }
.automation-actions span { background: rgba(var(--primary-rgb), .13); color: #ffd66b; }
.token-code, .token-copy-box input { color: #ffd66b; border-color: rgba(var(--primary-rgb), .2); }
.glow-purple, .glow-blue { box-shadow: inset 0 0 18px rgba(var(--primary-rgb), .035), 0 14px 34px rgba(0,0,0,.18); }

.mobile-menu-btn, .sidebar-close, .sidebar-scrim { display: none; }

/* Login editorial e responsivo */
.login-wrapper {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 470px);
  gap: clamp(44px, 8vw, 130px);
  padding: clamp(30px, 7vw, 100px);
  background:
    radial-gradient(circle at 12% 15%, rgba(24, 65, 110, .62), transparent 36%),
    radial-gradient(circle at 88% 90%, rgba(var(--primary-rgb), .12), transparent 34%),
    linear-gradient(135deg, #040b15, #08172b 58%, #050d19);
  position: relative;
  overflow: auto;
}
.login-wrapper::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .2;
  background-image: linear-gradient(rgba(255,255,255,.024) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.024) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(90deg, #000, transparent 72%);
}
.login-brand-panel { align-self: center; position: relative; z-index: 1; max-width: 650px; }
.login-eyebrow, .login-kicker { color: var(--primary); font-size: .72rem; font-weight: 800; letter-spacing: .19em; }
.login-brand-panel h1 { margin-top: 18px; font-size: clamp(2.8rem, 5.4vw, 5.5rem); line-height: .99; letter-spacing: -.052em; }
.login-brand-panel h1 span { color: var(--primary); }
.login-brand-panel > p { color: #a9b8cb; max-width: 520px; margin-top: 25px; font-size: 1.05rem; line-height: 1.7; }
.login-feature-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.login-feature-row span { display: flex; align-items: center; gap: 7px; border: 1px solid rgba(var(--primary-rgb), .18); background: rgba(7, 21, 39, .64); border-radius: 999px; padding: 9px 13px; color: #c5d1df; font-size: .78rem; }
.login-feature-row i { width: 15px; color: var(--primary); }
.login-card { max-width: 470px; padding: clamp(28px, 4vw, 46px); border-radius: 22px; position: relative; z-index: 1; background: rgba(8, 23, 42, .88); border-color: rgba(var(--primary-rgb), .2); box-shadow: 0 30px 80px rgba(0,0,0,.38); }
.login-logo { width: 78px; height: 78px; object-fit: cover; border-radius: 19px; margin-bottom: 18px; box-shadow: 0 0 0 1px rgba(var(--primary-rgb), .5), 0 14px 35px rgba(0,0,0,.4); }
.login-header { margin-bottom: 28px; }
.login-header h2 { font-size: 1.75rem; margin-top: 9px; }
.login-header p { margin-top: 7px; }
.login-card label { font-size: .78rem; letter-spacing: .025em; }
.login-input-wrap { position: relative; }
.login-input-wrap i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); width: 17px; color: #6f8299; pointer-events: none; }
.login-input-wrap input { width: 100%; padding-left: 44px; min-height: 48px; background: rgba(2, 12, 24, .58); color: #f6f9fd; caret-color: #ffc83d; -webkit-text-fill-color: #f6f9fd; }
.login-input-wrap input::placeholder { color: #8295ac; opacity: 1; }
.login-card .btn-primary { min-height: 48px; justify-content: center; margin-top: 8px; }
.login-card .btn-primary i { width: 17px; }

@media (max-width: 900px) {
  body.menu-open { overflow: hidden; }
  .mobile-menu-btn { display: flex; position: fixed; top: 14px; left: 14px; z-index: 90; width: 42px; height: 42px; align-items: center; justify-content: center; border: 1px solid rgba(var(--primary-rgb), .25); border-radius: 11px; color: var(--primary); background: rgba(6, 18, 34, .94); box-shadow: 0 8px 22px rgba(0,0,0,.3); cursor: pointer; }
  .mobile-menu-btn i { width: 20px; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 100; width: min(88vw, 306px); transform: translateX(-105%); transition: transform .28s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 95; background: rgba(1, 6, 13, .7); backdrop-filter: blur(3px); opacity: 0; visibility: hidden; transition: .25s ease; }
  .sidebar-scrim.is-open { display: block; opacity: 1; visibility: visible; }
  .sidebar-close { display: flex; margin-left: auto; width: 34px; height: 34px; align-items: center; justify-content: center; border: 0; background: rgba(255,255,255,.045); border-radius: 8px; color: var(--text-muted); cursor: pointer; }
  .sidebar-close i { width: 17px; }
  .main-content { padding: 72px 18px 28px; width: 100vw; }
  .login-wrapper { grid-template-columns: 1fr; padding: 28px 18px; }
  .login-brand-panel { display: none; }
  .login-card { width: 100%; justify-self: center; }
}

@media (max-width: 560px) {
  .page-header, .form-row, .log-actions { flex-direction: column; align-items: stretch; }
  .page-header { gap: 16px; }
  .form-control-inline, .log-actions select { width: 100% !important; }
  .card-header, .card-body, .table th, .table td { padding-left: 16px; padding-right: 16px; }
  .drawer { width: 100%; }
  .toast-container { left: 14px; right: 14px; bottom: 14px; }
  .toast { min-width: 0; width: 100%; }
  .login-card { padding: 28px 22px; }
  .login-logo { width: 68px; height: 68px; }
}

/* Componente Integrações & API Clients */
.token-code {
  background: rgba(15, 23, 42, 0.7);
  color: #38bdf8;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.token-copy-box {
  display: flex;
  gap: 10px;
  align-items: center;
}

.token-copy-box input {
  flex: 1;
  font-family: monospace;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  color: #38bdf8;
  padding: 8px 12px;
  border-radius: 6px;
}

.code-tabs {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.code-header {
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.code-block {
  margin: 0;
  padding: 14px;
  background: #090d16;
  color: #e2e8f0;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.85rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.badge-purple {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.sub-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Evolution API - central multi-número */
.evolution-page { display: flex; flex-direction: column; gap: 18px; min-height: calc(100vh - 44px); }
.evolution-topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.evolution-topbar h2 { margin: 4px 0 4px; font-size: clamp(1.45rem, 2vw, 2rem); color: #f8fafc; }
.evolution-topbar p { margin: 0; color: #91a4bb; max-width: 760px; }
.evolution-eyebrow { color: #f8b82e; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; display: flex; gap: 8px; align-items: center; }
.evolution-live-dot { width: 8px; height: 8px; background: #22c55e; border-radius: 50%; box-shadow: 0 0 0 4px rgba(34,197,94,.14); }
.evolution-top-actions { display: flex; align-items: center; gap: 10px; }
.evolution-safety-badge { border: 1px solid rgba(55,209,159,.28); color: #81e6c3; background: rgba(17, 79, 70, .25); border-radius: 999px; padding: 9px 12px; display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; white-space: nowrap; }
.evolution-notice { min-height: 42px; background: linear-gradient(100deg, rgba(246,184,46,.13), rgba(12,31,55,.35)); border: 1px solid rgba(246,184,46,.24); color: #dbe4ef; border-radius: 12px; padding: 10px 14px; display: flex; align-items: center; gap: 9px; font-size: .85rem; }
.evolution-notice svg { color: #f8c34a; width: 18px; height: 18px; flex: none; }
.evolution-grid { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(380px, 1.1fr); gap: 18px; }
.evolution-card { min-width: 0; }
.evolution-card .card-header { display: flex; justify-content: space-between; align-items: center; }
.evo-config-status, .evo-count { font-size: .72rem; color: #92a6bb; }
.evo-config-status.is-online { color: #67e8b2; }
.evo-config-status.is-warning { color: #f6c65c; }
.evo-form { display: grid; gap: 11px; }
.evo-form label { display: grid; gap: 6px; font-size: .78rem; color: #aebed0; }
.evo-form input, .evo-form select, .evo-create-form input { width: 100%; border: 1px solid rgba(147, 166, 190, .26); background: rgba(7, 20, 36, .76); color: #eef4fb; border-radius: 8px; padding: 10px 11px; outline: none; }
.evo-form input:focus, .evo-form select:focus, .evo-create-form input:focus, .evo-search input:focus, .evo-composer textarea:focus { border-color: #f8b82e; box-shadow: 0 0 0 3px rgba(248,184,46,.14); }
.form-hint { font-size: .7rem; line-height: 1.35; color: #71859e; margin-top: -5px; }
.evo-webhook-copy { margin-top: 15px; border-top: 1px solid rgba(146,166,190,.16); padding-top: 12px; display: grid; grid-template-columns: 1fr auto; gap: 7px; align-items: center; }
.evo-webhook-copy span { grid-column: 1/-1; font-size: .73rem; color: #93a8bf; }
.evo-webhook-copy code { min-width: 0; font-size: .68rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #f7cc63; }
.evo-instance-list { display: grid; gap: 7px; min-height: 44px; }
.evo-instance { width: 100%; display: grid; grid-template-columns: auto minmax(0,1fr) auto auto; gap: 9px; align-items: center; text-align: left; border: 1px solid rgba(147,166,190,.18); background: rgba(8, 21, 38, .58); color: #e5edf7; border-radius: 10px; padding: 9px 10px; cursor: pointer; transition: .18s ease; }
.evo-instance:hover, .evo-instance.is-selected { border-color: rgba(248,184,46,.7); background: rgba(31,40,55,.76); }
.evo-instance-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: rgba(248,184,46,.14); color: #f8c34a; }
.evo-instance-icon svg { width: 17px; height: 17px; }
.evo-instance-main { min-width: 0; display: grid; gap: 2px; }
.evo-instance-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .83rem; }
.evo-instance-main small { color: #8ea3ba; font-size: .71rem; overflow: hidden; text-overflow: ellipsis; }
.evo-instance-state { display: inline-flex; align-items: center; gap: 5px; font-size: .67rem; white-space: nowrap; color: #f3c65a; }
.evo-instance-state.is-online { color: #6ee7b7; }
.evo-instance-state.is-muted { color: #8da0b8; }
.evo-state-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.evo-instance-actions { display: inline-flex; gap: 6px; color: #8498b0; }
.evo-ai-mini.is-on { color: #f8c34a; }
.evo-instance-actions svg { width: 15px; height: 15px; }
.evo-create-form { margin-top: 13px; border-top: 1px solid rgba(146,166,190,.16); padding-top: 13px; display: grid; gap: 9px; }
.evo-create-heading { display: grid; gap: 2px; }
.evo-create-heading strong { color: #e7edf5; font-size: .8rem; }
.evo-create-heading span { color: #788da6; font-size: .7rem; }
.evo-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.evo-form-row:last-child { grid-template-columns: 1fr auto; }
.evolution-workspace { min-height: 510px; display: grid; grid-template-columns: 260px minmax(0,1fr) 220px; overflow: hidden; padding: 0; }
.evo-inbox { border-right: 1px solid rgba(147,166,190,.16); min-width: 0; }
.evo-inbox-header { display: flex; justify-content: space-between; align-items: center; padding: 17px 16px 12px; }
.evo-inbox-header div { display: grid; gap: 3px; }
.evo-inbox-header strong { font-size: .9rem; }
.evo-inbox-header small { color: #8296ad; font-size: .7rem; }
.evo-inbox-header svg { color: #f8bf43; width: 19px; }
.evo-search { margin: 0 11px 11px; position: relative; }
.evo-search svg { position: absolute; top: 10px; left: 10px; width: 15px; color: #73869d; }
.evo-search input { width: 100%; border: 1px solid rgba(147,166,190,.2); background: rgba(7,19,34,.7); color: #e8eff8; border-radius: 8px; padding: 8px 9px 8px 32px; font-size: .75rem; }
.evo-conversation-list { display: grid; max-height: 388px; overflow-y: auto; }
.evo-conversation { width: 100%; display: grid; grid-template-columns: 32px minmax(0,1fr) auto; gap: 9px; text-align: left; border: 0; border-top: 1px solid rgba(147,166,190,.1); background: transparent; color: #e5edf7; padding: 10px 12px; cursor: pointer; }
.evo-conversation:hover, .evo-conversation.is-selected { background: rgba(248,184,46,.1); }
.evo-avatar { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #f8c74f, #b56c13); color: #131c29; display: grid; place-items: center; font-size: .78rem; font-weight: 800; flex: none; }
.evo-conversation-main { min-width: 0; display: grid; gap: 4px; }
.evo-conversation-main strong { font-size: .77rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evo-conversation-main small { color: #8296ad; font-size: .69rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evo-conversation-meta { display: grid; justify-items: end; gap: 4px; color: #7d91a8; font-size: .63rem; }
.evo-conversation-meta b { background: #f8b82e; color: #17202d; border-radius: 99px; min-width: 16px; height: 16px; display: grid; place-items: center; font-size: .62rem; }
.evo-chat { min-width: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto auto; background: linear-gradient(150deg, rgba(9,25,44,.6), rgba(7,17,30,.8)); }
.evo-chat-header { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid rgba(147,166,190,.16); }
.evo-chat-header > div:nth-child(2) { min-width: 0; display: grid; gap: 3px; }
.evo-chat-header strong { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evo-chat-header small { color: #8296ad; font-size: .66rem; }
.evo-chat-header-badge { margin-left: auto; color: #8de7c3; font-size: .66rem; display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.evo-chat-header-badge svg { width: 14px; }
.evo-message-list { padding: 16px; overflow-y: auto; min-height: 280px; max-height: 370px; display: flex; flex-direction: column; gap: 7px; }
.evo-message-row { display: flex; }
.evo-message-row.is-out { justify-content: flex-end; }
.evo-message { max-width: min(84%, 430px); padding: 8px 10px; border-radius: 10px 10px 10px 3px; background: rgba(31,52,75,.8); color: #e5edf7; font-size: .76rem; line-height: 1.4; box-shadow: 0 5px 13px rgba(0,0,0,.12); }
.evo-message-row.is-out .evo-message { border-radius: 10px 10px 3px 10px; background: linear-gradient(135deg, rgba(178,118,21,.72), rgba(116,76,17,.8)); color: #fff8df; }
.evo-message span { white-space: pre-wrap; overflow-wrap: anywhere; }
.evo-message time { display: block; margin-top: 4px; color: rgba(229,237,247,.57); font-size: .6rem; text-align: right; }
.evo-composer { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; align-items: end; padding: 11px 13px 4px; border-top: 1px solid rgba(147,166,190,.14); }
.evo-composer textarea { resize: vertical; min-height: 45px; max-height: 120px; background: rgba(5,16,29,.8); border: 1px solid rgba(147,166,190,.22); color: #eff5fc; border-radius: 8px; padding: 9px 10px; font: inherit; font-size: .75rem; }
.evo-composer .btn { min-height: 45px; }
.evo-composer-hint { color: #70859e; font-size: .64rem; padding: 0 13px 11px; display: flex; align-items: center; gap: 4px; }
.evo-composer-hint svg { width: 13px; }
.evo-chat-side { border-left: 1px solid rgba(147,166,190,.16); padding: 15px; }
.evo-side-empty { display: grid; gap: 8px; justify-items: center; text-align: center; color: #8195ad; font-size: .72rem; padding: 45px 5px; }
.evo-side-empty svg { width: 24px; color: #f7c34f; }
.evo-side-card { display: grid; gap: 9px; color: #dce7f3; }
.evo-side-icon { width: 38px; height: 38px; display: grid; place-items: center; background: rgba(248,184,46,.14); color: #f8c34a; border-radius: 11px; }
.evo-side-icon svg { width: 21px; }
.evo-side-card strong { font-size: .87rem; }
.evo-side-status { font-size: .68rem; }
.evo-side-status.is-online { color: #71e5b4; }
.evo-side-status.is-warning { color: #f6c65c; }
.evo-side-status.is-muted { color: #8da0b8; }
.evo-side-card p { font-size: .7rem; color: #8296ad; line-height: 1.4; margin: 1px 0 4px; }
.evo-toggle-row { display: flex; align-items: center; gap: 8px; font-size: .73rem; cursor: pointer; }
.evo-toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.evo-switch { width: 31px; height: 18px; margin-left: auto; border-radius: 99px; background: #33455b; position: relative; transition: .2s; }
.evo-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #b9c6d6; transition: .2s; }
.evo-toggle-row input:checked + .evo-switch { background: #d9991b; }
.evo-toggle-row input:checked + .evo-switch::after { transform: translateX(13px); background: #fff8de; }
.evo-no-items { padding: 20px 12px; display: grid; justify-items: center; gap: 7px; color: #71859e; font-size: .7rem; text-align: center; }
.evo-no-items svg { width: 21px; }
.evo-qr-box { display: grid; gap: 7px; justify-items: center; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid rgba(147,166,190,.15); color: #8fa3ba; font-size: .66rem; text-align: center; }
.evo-qr-box img { width: 150px; height: 150px; background: #fff; border-radius: 8px; padding: 6px; }
@media (max-width: 1180px) { .evolution-workspace { grid-template-columns: 230px minmax(0,1fr); } .evo-chat-side { display: none; } }
@media (max-width: 850px) { .evolution-grid { grid-template-columns: 1fr; } .evolution-topbar { flex-direction: column; } .evolution-top-actions { width: 100%; justify-content: space-between; } .evolution-workspace { grid-template-columns: 210px minmax(0,1fr); } }
@media (max-width: 650px) { .evolution-workspace { grid-template-columns: 1fr; } .evo-inbox { border-right: 0; border-bottom: 1px solid rgba(147,166,190,.16); } .evo-conversation-list { max-height: 180px; } .evo-chat { min-height: 430px; } .evo-form-row { grid-template-columns: 1fr; } .evo-form-row:last-child { grid-template-columns: 1fr; } .evolution-safety-badge { white-space: normal; } }

/* Motor WAHA: tela operacional simples com a identidade YD */
.waha-auto-page { max-width: 1180px; margin: 0 auto; padding: 8px 0 42px; color: #e8eef8; }
.waha-auto-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.waha-auto-eyebrow { color: #ffc940; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.waha-auto-live-dot { width: 8px; height: 8px; border-radius: 50%; background: #ffc940; box-shadow: 0 0 0 4px rgba(255,201,64,.13); }
.waha-auto-hero h2 { margin: 8px 0 6px; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.waha-auto-hero p { margin: 0; color: #99abc2; max-width: 640px; }
.waha-auto-header-actions { display: flex; align-items: center; gap: 10px; }
.waha-auto-status-pill, .waha-auto-state { border: 1px solid rgba(147,166,190,.28); border-radius: 999px; padding: 8px 12px; color: #a8b7c9; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.waha-auto-status-pill.is-online, .waha-auto-state.is-on { color: #67e5ae; border-color: rgba(103,229,174,.4); background: rgba(103,229,174,.09); }
.waha-auto-status-pill.is-warning { color: #ffd166; border-color: rgba(255,209,102,.4); background: rgba(255,209,102,.08); }
.waha-auto-grid { display: grid; grid-template-columns: minmax(0,1.35fr) minmax(300px,.8fr); gap: 18px; }
.waha-auto-card { min-height: 100%; }
.waha-auto-muted { color: #8da0b8; font-size: .78rem; }
.waha-auto-card .card-header { align-items: flex-start; }
.waha-auto-card .card-header p { margin: 5px 0 0; }
.waha-auto-label { display: block; margin: 0 0 8px; color: #becbe0; font-size: .82rem; font-weight: 700; }
.waha-auto-textarea { width: 100%; min-height: 210px; resize: vertical; border: 1px solid rgba(127,153,185,.3); border-radius: 12px; background: rgba(6,22,42,.66); color: #f4f7fb; padding: 14px; font: inherit; line-height: 1.5; outline: none; }
.waha-auto-textarea:focus { border-color: #ffc940; box-shadow: 0 0 0 3px rgba(255,201,64,.12); }
.waha-auto-form-footer, .waha-auto-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.waha-auto-form-footer small { color: #778ca5; }
.waha-auto-toggle.is-danger { background: #be4a55; border-color: #d56a73; }
.waha-auto-rule-card h4 { margin: 12px 0 7px; font-size: 1.02rem; }
.waha-auto-rule-card p { color: #a7b7ca; line-height: 1.5; font-size: .84rem; }
.waha-auto-rule-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: rgba(255,201,64,.14); color: #ffc940; }
.waha-auto-rule-icon svg { width: 22px; }
.waha-auto-checks { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 10px; color: #becbe0; font-size: .8rem; }
.waha-auto-checks li { display: flex; align-items: center; gap: 8px; }
.waha-auto-checks svg { width: 15px; color: #ffc940; }
.waha-auto-warning { display: flex; gap: 9px; padding: 11px; border-radius: 10px; color: #ffd783; background: rgba(255,201,64,.08); border: 1px solid rgba(255,201,64,.2); font-size: .75rem; line-height: 1.4; }
.waha-auto-warning svg { flex: 0 0 auto; width: 16px; }
.waha-auto-connection { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 15px 18px; }
.waha-auto-connection-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: #ffc940; background: rgba(255,201,64,.12); }
.waha-auto-connection strong { font-size: .86rem; }
.waha-auto-connection p { margin: 3px 0 0; color: #8da0b8; font-size: .76rem; }
.waha-auto-connection .btn { margin-left: auto; }
.waha-auto-qr { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 18px; padding: 17px 20px; border-color: rgba(255,201,64,.28); }
.waha-auto-qr strong { font-size: .9rem; }
.waha-auto-qr p { margin: 4px 0 0; color: #8da0b8; font-size: .77rem; }
.waha-auto-qr img { width: 190px; height: 190px; object-fit: contain; border-radius: 12px; background: #fff; padding: 8px; }
@media (max-width: 760px) { .waha-auto-hero { flex-direction: column; } .waha-auto-header-actions { width: 100%; justify-content: space-between; } .waha-auto-grid { grid-template-columns: 1fr; } .waha-auto-connection { align-items: flex-start; flex-wrap: wrap; } .waha-auto-connection .btn { margin-left: 48px; } }

/* Painel único YD-Connect */
.yd-single-shell { width: 100%; height: 100vh; height: 100dvh; overflow: hidden; display: grid; place-items: center; padding: 14px 18px; background: radial-gradient(circle at 50% -15%, rgba(255,193,54,.12), transparent 42%), #061426; }
.yd-single-view { width: min(100%, 1040px); height: 100%; min-height: 0; }
.yd-control-panel { width: 100%; height: 100%; max-height: 100%; overflow: hidden; display: flex; flex-direction: column; border: 1px solid rgba(255,201,64,.3); border-radius: 24px; background: linear-gradient(145deg, rgba(13,34,61,.98), rgba(5,19,37,.98)); box-shadow: 0 28px 80px rgba(0,0,0,.35), 0 0 0 1px rgba(10,29,52,.65); color: #eef4fc; }
.yd-control-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 24px 28px; border-bottom: 1px solid rgba(148,169,198,.18); }
.yd-brand-lockup { display: flex; align-items: center; gap: 13px; }
.yd-control-logo { width: 54px; height: 54px; object-fit: contain; border-radius: 14px; box-shadow: 0 8px 24px rgba(255,184,32,.18); }
.yd-brand-overline, .yd-section-kicker { display: block; color: #ffc83d; font-size: .67rem; font-weight: 800; letter-spacing: .13em; }
.yd-brand-lockup h1 { margin: 2px 0 1px; font-size: 1.45rem; letter-spacing: -.03em; }
.yd-brand-lockup p { margin: 0; color: #8fa5bf; font-size: .76rem; }
.yd-waha-status { padding: 8px 12px; border: 1px solid rgba(255,200,61,.35); border-radius: 999px; color: #ffd66b; font-size: .72rem; font-weight: 800; white-space: nowrap; }
.yd-waha-status.is-online { color: #70e5ae; border-color: rgba(112,229,174,.4); background: rgba(112,229,174,.08); }
.yd-header-actions { display: flex; align-items: center; gap: 10px; }
.yd-logout-button { border: 1px solid rgba(255,200,61,.35); border-radius: 999px; padding: 8px 13px; background: rgba(5,18,34,.55); color: #ffd66b; cursor: pointer; font: inherit; font-size: .72rem; font-weight: 800; }
.yd-logout-button:hover { border-color: rgba(255,200,61,.7); background: rgba(255,200,61,.1); }
.yd-logout-button:disabled { cursor: wait; opacity: .65; }
.yd-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.yd-section-heading h2 { margin: 5px 0 5px; font-size: 1.25rem; }
.yd-section-heading p { margin: 0; color: #91a6bd; font-size: .78rem; line-height: 1.45; }
.yd-connection-card { margin-top: 18px; padding: 17px 18px; border: 1px solid rgba(255,200,61,.24); border-radius: 14px; background: linear-gradient(135deg, rgba(255,200,61,.08), rgba(7,24,44,.58)); }
.yd-connection-card.is-connected { border-color: rgba(112,229,174,.38); background: linear-gradient(135deg, rgba(112,229,174,.09), rgba(7,24,44,.58)); }
.yd-connection-card.is-failed { border-color: rgba(255,105,105,.44); background: linear-gradient(135deg, rgba(255,105,105,.08), rgba(7,24,44,.58)); }
.yd-connection-card-heading { display: flex; align-items: center; gap: 11px; }
.yd-connection-icon { width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: rgba(255,200,61,.14); color: #ffc83d; font-size: 1.1rem; font-weight: 900; }
.yd-connection-card.is-connected .yd-connection-icon { background: rgba(112,229,174,.16); color: #70e5ae; }
.yd-connection-card.is-failed .yd-connection-icon { background: rgba(255,105,105,.16); color: #ff8f8f; }
.yd-connection-card strong { display: block; font-size: .92rem; }
.yd-connection-card p { margin: 3px 0 0; color: #9eb1c7; font-size: .73rem; line-height: 1.4; }
.yd-connection-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 15px; }
.yd-reconnect-button, .yd-disconnect-button { border-radius: 9px; padding: 10px 13px; cursor: pointer; font: inherit; font-size: .72rem; font-weight: 800; transition: .18s ease; }
.yd-reconnect-button { border: 1px solid rgba(255,200,61,.25); background: linear-gradient(135deg, #ffd45b, #e9a30d); color: #091a2d; }
.yd-reconnect-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.yd-disconnect-button { border: 1px solid rgba(255,111,111,.62); background: transparent; color: #ff9b9b; }
.yd-disconnect-button:hover:not(:disabled) { background: rgba(255,111,111,.12); }
.yd-reconnect-button:disabled, .yd-disconnect-button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.yd-control-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -ms-overflow-style: none; cursor: grab; touch-action: none; }
.yd-control-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }
.yd-control-scroll.is-dragging { cursor: grabbing; user-select: none; }
.yd-qr-section, .yd-message-section { padding: 25px 28px; }
.yd-message-section { border-top: 1px solid rgba(148,169,198,.18); }
.yd-icon-button { width: 36px; height: 36px; border: 1px solid rgba(148,169,198,.3); border-radius: 10px; background: rgba(10,27,49,.7); color: #ffc83d; cursor: pointer; font-size: 1.35rem; line-height: 1; }
.yd-qr-area { min-height: 250px; margin-top: 19px; display: grid; place-items: center; align-content: center; gap: 8px; border: 1px dashed rgba(255,200,61,.36); border-radius: 16px; background: rgba(3,15,30,.55); text-align: center; }
.yd-qr-image { width: 218px; height: 218px; object-fit: contain; padding: 9px; border-radius: 14px; background: #fff; }
.yd-qr-area small, .yd-connected-mark + strong + small { color: #91a6bd; font-size: .72rem; }
.yd-qr-placeholder { color: #8fa5bf; font-size: .8rem; }
.yd-connected-mark { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: rgba(112,229,174,.14); color: #70e5ae; font-size: 2rem; }
.yd-message-input { width: 100%; min-height: 160px; margin-top: 18px; resize: vertical; border: 1px solid rgba(140,166,197,.32); border-radius: 13px; background: rgba(4,17,33,.75); color: #f6f9fd; padding: 14px; outline: none; font: inherit; line-height: 1.5; }
.yd-message-input:focus { border-color: #ffc83d; box-shadow: 0 0 0 3px rgba(255,200,61,.12); }
.yd-message-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; color: #718aa5; font-size: .72rem; }
.yd-save-button { border: 0; border-radius: 9px; padding: 10px 16px; background: linear-gradient(135deg, #ffd45b, #f2a900); color: #091a2d; cursor: pointer; font-weight: 800; }
.yd-sent-counter { display: flex; align-items: baseline; gap: 8px; margin-top: 18px; padding: 13px 15px; border: 1px solid rgba(255,200,61,.2); border-radius: 11px; background: rgba(255,200,61,.06); }
.yd-sent-counter strong { color: #ffc83d; font-size: 1.45rem; }
.yd-sent-counter span { color: #d2ddec; font-size: .8rem; }
.yd-sent-counter small { margin-left: auto; color: #8096af; font-size: .68rem; }
.yd-activation-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; padding: 14px 15px; border: 1px solid rgba(148,169,198,.2); border-radius: 12px; background: rgba(3,15,30,.42); }
.yd-activation-row.is-active { border-color: rgba(112,229,174,.35); background: rgba(112,229,174,.06); }
.yd-activation-row strong, .yd-activation-row small { display: block; }
.yd-activation-row strong { font-size: .86rem; }
.yd-activation-row small { margin-top: 4px; color: #8fa5bf; font-size: .7rem; }
.yd-switch { position: relative; display: inline-block; width: 52px; height: 29px; flex: 0 0 auto; cursor: pointer; }
.yd-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.yd-switch-track { position: absolute; inset: 0; border-radius: 999px; background: #34475d; transition: .2s; }
.yd-switch-track::after { content: ''; position: absolute; width: 21px; height: 21px; left: 4px; top: 4px; border-radius: 50%; background: #d5dfec; transition: .2s; }
.yd-switch input:checked + .yd-switch-track { background: #d59c18; box-shadow: 0 0 0 4px rgba(255,200,61,.1); }
.yd-switch input:checked + .yd-switch-track::after { transform: translateX(23px); background: #fff8dc; }
.yd-control-footer { padding: 0 28px 22px; color: #607894; font-size: .62rem; font-weight: 800; letter-spacing: .12em; }
.yd-control-footer span { padding: 0 4px; color: #ffc83d; }
.yd-qr-section { display: flex; flex-direction: column; }
.yd-qr-section .yd-section-heading { order: 1; }
.yd-qr-section .yd-connection-card { order: 2; margin-top: 14px; padding: 13px 15px; }
.yd-qr-section .yd-qr-area { order: 3; }
.yd-connection-actions { margin-top: 10px; }
.yd-connection-icon { width: 31px; height: 31px; font-size: .95rem; }
.yd-reconnect-button, .yd-disconnect-button { padding: 8px 11px; }
@media (min-width: 901px) and (min-height: 680px) {
  .yd-control-scroll { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); align-content: start; overflow-y: auto; }
  .yd-qr-section { min-width: 0; }
  .yd-message-section { min-width: 0; border-top: 0; border-left: 1px solid rgba(148,169,198,.18); }
  .yd-control-footer { grid-column: 1 / -1; }
  .yd-qr-section, .yd-message-section { padding: 21px 24px; }
  .yd-qr-area { min-height: 270px; }
  .yd-qr-image { width: 230px; height: 230px; }
}
@media (max-width: 600px) { .yd-single-shell { padding: 12px 9px; } .yd-control-header, .yd-qr-section, .yd-message-section { padding-left: 18px; padding-right: 18px; } .yd-control-header { align-items: flex-start; flex-direction: column; } .yd-header-actions { width: 100%; justify-content: space-between; } .yd-waha-status { align-self: flex-start; } .yd-connection-actions { flex-direction: column; } .yd-reconnect-button, .yd-disconnect-button { width: 100%; } .yd-sent-counter { flex-wrap: wrap; } .yd-sent-counter small { width: 100%; margin-left: 0; } }
