/* ==========================================================================
   GUIMOO CRM JURÍDICO — ESTILOS DO PAINEL KANBAN & CHAT AO VIVO
   ========================================================================== */

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

:root {
  --crm-bg: #090d1a;
  --crm-surface: #0f172a;
  --crm-surface-card: #141e36;
  --crm-surface-hover: #1e294b;
  --crm-border: #1e293b;
  --crm-border-light: rgba(255, 255, 255, 0.08);

  --crm-primary: #2563eb;
  --crm-primary-light: #3b82f6;
  --crm-primary-glow: rgba(37, 99, 235, 0.25);

  --crm-emerald: #10b981;
  --crm-fuchsia: #d946ef;
  --crm-purple: #a855f7;
  --crm-cyan: #0ea5e9;
  --crm-amber: #f59e0b;
  --crm-rose: #f43f5e;

  --crm-text: #f8fafc;
  --crm-text-muted: #94a3b8;
  --crm-text-subtle: #64748b;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', sans-serif;
}

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

body.crm-body {
  font-family: var(--font-sans);
  background-color: var(--crm-bg);
  color: var(--crm-text);
  min-height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Sidebar */
.crm-sidebar {
  width: 260px;
  background: var(--crm-surface);
  border-right: 1px solid var(--crm-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
}

.crm-sidebar-head {
  padding: 20px;
  border-bottom: 1px solid var(--crm-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.crm-brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--crm-text);
}

.crm-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--crm-primary), #1d4ed8);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px var(--crm-primary-glow);
}

.crm-nav-menu {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.crm-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--crm-text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.crm-nav-link:hover {
  background: var(--crm-surface-hover);
  color: var(--crm-text);
}

.crm-nav-link.active {
  background: var(--crm-primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--crm-primary-glow);
}

.crm-nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
}

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

.btn-sidebar-back {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--crm-border-light);
  color: var(--crm-text-muted);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-sidebar-back:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--crm-text);
}

/* Área Principal do CRM */
.crm-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Topbar */
.crm-topbar {
  height: 68px;
  background: var(--crm-surface);
  border-bottom: 1px solid var(--crm-border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}

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

.crm-title-box h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--crm-text);
}

.crm-title-box p {
  font-size: 0.78rem;
  color: var(--crm-text-muted);
}

.crm-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.crm-search-input {
  background: var(--crm-bg);
  border: 1px solid var(--crm-border);
  color: var(--crm-text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  width: 240px;
  outline: none;
}

.crm-search-input:focus {
  border-color: var(--crm-primary-light);
}

.crm-agent-filter {
  background: var(--crm-bg);
  border: 1px solid var(--crm-border);
  color: var(--crm-text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

.btn-crm-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}

.btn-crm-primary {
  background: var(--crm-primary);
  color: #fff;
  box-shadow: 0 4px 12px var(--crm-primary-glow);
}

.btn-crm-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.btn-crm-sim-lead {
  background: linear-gradient(135deg, var(--crm-emerald), #059669);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-crm-sim-lead:hover {
  transform: translateY(-1px);
}

/* Faixa de Métricas / KPIs */
.crm-kpis-bar {
  background: var(--crm-bg);
  border-bottom: 1px solid var(--crm-border);
  padding: 12px 24px;
  display: flex;
  gap: 24px;
  overflow-x: auto;
  flex-shrink: 0;
}

.kpi-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  border-radius: 10px;
  min-width: 170px;
}

.kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.kpi-data p {
  font-size: 0.72rem;
  color: var(--crm-text-subtle);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.kpi-data h4 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--crm-text);
  line-height: 1.1;
}

/* Kanban Board Container */
.crm-kanban-board {
  flex: 1;
  padding: 20px 24px;
  display: flex;
  gap: 18px;
  overflow-x: auto;
  overflow-y: hidden;
}

.kanban-col {
  width: 320px;
  min-width: 320px;
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.kanban-col-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--crm-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.col-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.col-indicator-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.col-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--crm-text);
}

.col-count {
  background: var(--crm-bg);
  border: 1px solid var(--crm-border);
  color: var(--crm-text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
}

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

.kanban-col-body.drag-over {
  background: rgba(37, 99, 235, 0.08);
  border-radius: 10px;
}

/* Lead Card no Kanban */
.lead-card {
  background: var(--crm-surface-card);
  border: 1px solid var(--crm-border-light);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  user-select: none;
}

.lead-card:hover {
  background: var(--crm-surface-hover);
  border-color: var(--crm-primary-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.lead-card.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.lead-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.lead-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--crm-text);
  line-height: 1.2;
}

.lead-phone {
  font-size: 0.75rem;
  color: var(--crm-text-subtle);
  margin-top: 2px;
}

.lead-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.lead-last-msg {
  font-size: 0.8rem;
  color: var(--crm-text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lead-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--crm-text-subtle);
  border-top: 1px solid var(--crm-border-light);
  padding-top: 8px;
}

.lead-icons-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lead-icon-tag {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Drawer de Chat ao Vivo do WhatsApp */
.crm-chat-drawer {
  position: fixed;
  top: 0;
  right: -480px;
  width: 480px;
  height: 100vh;
  background: var(--crm-surface);
  border-left: 1px solid var(--crm-border);
  z-index: 500;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}

.crm-chat-drawer.open {
  right: 0;
}

.crm-drawer-head {
  padding: 16px 20px;
  background: #008069;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.crm-drawer-lead-info h4 {
  font-size: 1rem;
  font-weight: 700;
}

.crm-drawer-lead-info p {
  font-size: 0.78rem;
  opacity: 0.85;
}

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

.btn-toggle-human {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-toggle-human.human-active {
  background: #ef4444;
  border-color: #ef4444;
}

.btn-close-drawer {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}

.crm-drawer-body {
  flex: 1;
  background: #efeae2;
  background-image: radial-gradient(#d3c8b8 1px, transparent 1px);
  background-size: 18px 18px;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.crm-drawer-input-bar {
  background: #f0f2f5;
  padding: 12px 16px;
  border-top: 1px solid var(--crm-border);
  display: flex;
  gap: 10px;
}

.crm-drawer-input-bar input {
  flex: 1;
  background: #fff;
  border: 1px solid #d1d5db;
  color: #111b21;
  padding: 10px 14px;
  border-radius: 20px;
  font-size: 0.88rem;
  outline: none;
}

.crm-drawer-input-bar button {
  width: 42px;
  height: 42px;
  background: #008069;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   VIEWS ADICIONAIS DO CRM (CONVERSAS, CONTATOS, MÉTRICAS E AGENTES)
   ========================================================================== */

.crm-view-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.crm-view {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.crm-view.active {
  display: flex;
}

/* Animação de pulso para novo lead simulado */
@keyframes leadPulseHighlight {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); border-color: #10b981; transform: scale(1); }
  50% { box-shadow: 0 0 24px 6px rgba(16, 185, 129, 0.4); border-color: #10b981; transform: scale(1.02); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); transform: scale(1); }
}

.lead-pulse-new {
  animation: leadPulseHighlight 2.5s ease-in-out infinite;
  border-color: #10b981 !important;
}

/* Indicador de Digitando */
.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: #10b981;
  font-weight: 600;
}

.typing-indicator span {
  width: 5px;
  height: 5px;
  background: #10b981;
  border-radius: 50%;
  animation: typingBounce 0.8s infinite alternate;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  from { transform: translateY(0); opacity: 0.3; }
  to { transform: translateY(-4px); opacity: 1; }
}

/* ==========================================================================
   VIEW 2: CONVERSAS WHATSAPP (INTERFACE WHATSAPP WEB COMPLETA)
   ========================================================================== */
.crm-view-conversas {
  display: flex;
  flex-direction: row;
  height: 100%;
  overflow: hidden;
  background: var(--crm-bg);
}

.conversas-inbox-col {
  width: 320px;
  background: var(--crm-surface);
  border-right: 1px solid var(--crm-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.inbox-search-box {
  padding: 12px 16px;
  border-bottom: 1px solid var(--crm-border);
}

.inbox-search-input {
  width: 100%;
  background: var(--crm-bg);
  border: 1px solid var(--crm-border);
  color: var(--crm-text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  outline: none;
}

.inbox-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.inbox-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--crm-border-light);
  cursor: pointer;
  transition: all 0.15s ease;
}

.inbox-item:hover {
  background: var(--crm-surface-hover);
}

.inbox-item.active {
  background: rgba(37, 99, 235, 0.15);
  border-left: 3px solid var(--crm-primary);
}

.inbox-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b, #334155);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
  flex-shrink: 0;
  position: relative;
}

.inbox-avatar .online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  background: #10b981;
  border: 2px solid var(--crm-surface);
  border-radius: 50%;
}

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

.inbox-info-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.inbox-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--crm-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-time {
  font-size: 0.7rem;
  color: var(--crm-text-subtle);
}

.inbox-lastmsg {
  font-size: 0.76rem;
  color: var(--crm-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversas-chat-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #efeae2;
  position: relative;
  overflow: hidden;
}

.conversas-chat-head {
  padding: 10px 20px;
  background: #008069;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.chat-head-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-head-name {
  font-size: 0.98rem;
  font-weight: 700;
}

.chat-head-status {
  font-size: 0.75rem;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.conversas-chat-body {
  flex: 1;
  background-image: radial-gradient(#d3c8b8 1px, transparent 1px);
  background-size: 18px 18px;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.conversas-chat-footer {
  background: #f0f2f5;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #d1d5db;
}

.btn-chat-icon {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #54656f;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.btn-chat-icon:hover {
  color: #111b21;
}

.conversas-chat-input {
  flex: 1;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 0.9rem;
  color: #111b21;
  outline: none;
}

.conversas-profile-col {
  width: 320px;
  background: var(--crm-surface);
  border-left: 1px solid var(--crm-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px;
  gap: 18px;
  flex-shrink: 0;
}

.profile-card-head {
  text-align: center;
}

.profile-avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--crm-primary), #6366f1);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 4px 14px var(--crm-primary-glow);
}

.profile-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--crm-text);
}

.profile-phone {
  font-size: 0.8rem;
  color: var(--crm-text-subtle);
  margin-top: 2px;
}

.profile-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--crm-text-subtle);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.score-meter-box {
  background: var(--crm-bg);
  border: 1px solid var(--crm-border);
  border-radius: 10px;
  padding: 12px;
}

.score-meter-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.score-meter-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 4px;
}

.docs-checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.docs-check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--crm-bg);
  border: 1px solid var(--crm-border);
  border-radius: 6px;
  font-size: 0.78rem;
}

.docs-status-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.docs-status-ok { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.docs-status-wait { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

/* ==========================================================================
   VIEW 3: CONTATOS & LEADS (TABELA COMPLETA)
   ========================================================================== */
.crm-view-contatos {
  padding: 20px 24px;
  overflow-y: auto;
  gap: 16px;
}

.contatos-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.contatos-table-wrap {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  border-radius: 12px;
  overflow: hidden;
}

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

.crm-table th {
  background: var(--crm-surface-card);
  padding: 12px 16px;
  color: var(--crm-text-subtle);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--crm-border);
}

.crm-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--crm-border-light);
  color: var(--crm-text);
  vertical-align: middle;
}

.crm-table tr:hover td {
  background: var(--crm-surface-hover);
}

.btn-table-action {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--crm-border-light);
  color: var(--crm-text);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-table-action:hover {
  background: var(--crm-primary);
  border-color: var(--crm-primary);
}

/* ==========================================================================
   VIEW 4: MÉTRICAS & ROI
   ========================================================================== */
.crm-view-metricas {
  padding: 20px 24px;
  overflow-y: auto;
  gap: 20px;
}

.metricas-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.metric-big-card {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric-big-card .val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--crm-text);
  font-family: var(--font-display);
}

.metric-big-card .sub {
  font-size: 0.75rem;
  color: #10b981;
  font-weight: 600;
}

.metricas-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.chart-card-box {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chart-card-box h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--crm-text);
}

/* Funil Visual com Barras */
.funnel-step {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.funnel-label {
  width: 140px;
  font-size: 0.78rem;
  color: var(--crm-text-muted);
}

.funnel-bar-bg {
  flex: 1;
  height: 22px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}

.funnel-bar-fill {
  height: 100%;
  border-radius: 6px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  transition: width 0.5s ease;
}

/* ==========================================================================
   VIEW 5: CATÁLOGO DE AGENTES (CENTRAL DE AGENTES IA)
   ========================================================================== */
.crm-view-agentes {
  padding: 20px 24px;
  overflow-y: auto;
  gap: 16px;
}

.agentes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.agent-grid-card {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s ease;
}

.agent-grid-card:hover {
  border-color: var(--crm-primary-light);
  transform: translateY(-2px);
}

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

.agent-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-switch {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 34px;
}

.slider-switch:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider-switch {
  background-color: var(--crm-primary);
}

input:checked + .slider-switch:before {
  transform: translateX(18px);
}

/* Modal Sandbox de Simulação */
.crm-modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.crm-modal-overlay.open {
  display: flex;
}

.crm-modal-content {
  background: var(--crm-surface);
  border: 1px solid var(--crm-border);
  border-radius: 16px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

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

.crm-modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Responsividade */
@media (max-width: 1024px) {
  .crm-sidebar {
    width: 70px;
  }
  .crm-sidebar .crm-nav-link span,
  .crm-sidebar .crm-brand-logo span,
  .crm-sidebar .crm-nav-badge,
  .crm-sidebar .btn-sidebar-back span {
    display: none;
  }
  .conversas-profile-col {
    display: none;
  }
  .metricas-charts-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .crm-chat-drawer {
    width: 100vw;
  }
  .crm-sidebar {
    display: none;
  }
  .conversas-inbox-col {
    width: 100%;
  }
  .conversas-chat-col {
    display: none;
  }
}

