/* ============================================================================
   CRM KANBAN V2 - Multi-Tenant Drag & Drop
   ============================================================================ */

.crm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.crm-header-left h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.crm-subtitle {
  font-size: 14px;
  color: var(--text-tertiary);
  opacity: 0.85;
}

.crm-header-right {
  display: flex;
  gap: 0.75rem;
}

/* Filtros */
.crm-filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.filter-group label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}

/* Kanban Grid */
.crm-kanban {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.5rem;
  min-height: 500px;
}

.kanban-column {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

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

.kanban-column-header h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.kanban-count {
  font-size: 12px;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
}

.kanban-cards {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 100px;
}

/* Card do Lead */
.pilar-page .lead-card {
  background: #1a1a1a;
  /* FIX: Removido !important usando especificidade */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 200, 0, 0.15);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  cursor: move;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.lead-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 200, 0, 0.2);
  border-color: rgba(255, 200, 0, 0.3);
}

/* Light mode: cards menos “cinza” e mais premium-glass */
body[data-mode="light"] .lead-card {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
}

body[data-mode="light"] .lead-card:hover {
  background: rgba(255, 255, 255, 0.90);
  border-color: rgba(var(--accent-rgb), 0.28);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.16);
}

.lead-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.lead-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.lead-card {
  position: relative;
}

.lead-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex: 0 0 auto;
  margin-right: 10px;
}

.lead-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.lead-badges {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.lead-badge {
  font-size: 10px;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.03em;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.lead-badge--wa {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #10b981;
}

.lead-badge--temp.lead-badge--hot {
  background: rgba(255, 69, 0, 0.14);
  border-color: rgba(255, 69, 0, 0.25);
}

.lead-badge--temp.lead-badge--warm {
  background: rgba(255, 200, 0, 0.12);
  border-color: rgba(255, 200, 0, 0.22);
}

.lead-badge--temp.lead-badge--cold {
  background: rgba(66, 133, 244, 0.12);
  border-color: rgba(66, 133, 244, 0.22);
}

.lead-badge--rotten {
  background: rgba(239, 68, 68, 0.10);
  border-color: rgba(239, 68, 68, 0.25);
  color: #ef4444;
}

.pilar-page .lead-card.lead-card--rotten {
  border-color: rgba(239, 68, 68, 0.35);
  box-shadow: 0 8px 26px rgba(239, 68, 68, 0.10);
}

.lead-quick-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.lead-card:hover .lead-quick-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.lead-action {
  width: 34px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(20, 20, 20, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  cursor: pointer;
}

body[data-mode="light"] .lead-action {
  border-color: rgba(0, 0, 0, 0.10);
  background: rgba(255, 255, 255, 0.72);
}

body[data-mode="light"] .lead-action:hover {
  border-color: rgba(var(--accent-rgb), 0.28);
}

.lead-action:hover {
  border-color: rgba(255, 200, 0, 0.35);
  transform: translateY(-1px);
}

.lead-action i {
  width: 16px;
  height: 16px;
}

.lead-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.lead-phone {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
}

.lead-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.lead-tag {
  font-size: 10px;
  padding: 0.2rem 0.5rem;
  background: var(--color-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-full);
  font-weight: 600;
}

.lead-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  font-size: 11px;
  color: var(--text-tertiary);
}

body[data-mode="light"] .lead-card-footer {
  border-top-color: rgba(0, 0, 0, 0.08);
  color: rgba(0, 0, 0, 0.55);
}

/* Drag over feedback */
.kanban-cards.drag-over {
  background: rgba(255, 200, 0, 0.1);
  border: 2px dashed var(--color-primary);
  border-radius: var(--radius-md);
}

.btn-load-more {
  width: 100%;
  margin-top: 10px;
  justify-content: center;
  opacity: 0.95;
}

.btn-load-more:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Responsivo */
@media (max-width: 1600px) {
  .crm-kanban {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1100px) {
  .crm-kanban {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .crm-kanban {
    grid-template-columns: 1fr;
  }

  .crm-filters {
    flex-direction: column;
  }

  .crm-header {
    flex-direction: column;
    gap: 1rem;
  }

  .crm-header-right {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ============================================================================
   MODAL DE DETALHES DO LEAD
   ============================================================================ */

.modal-subtitle {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
}

/* Lead detail edit layout (remove inline styles do HTML) */
.lead-detail-edit {
  margin-top: 1rem;
}

.lead-detail-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .lead-detail-edit-grid {
    grid-template-columns: 1fr;
  }
}

.field-hint--label {
  display: block;
  margin-bottom: 0.25rem;
}

.lead-detail-edit-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.lead-detail-save-note {
  margin-top: 0.5rem;
}

.next-action-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: 0.75rem;
}

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

.next-action-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.handoff-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.handoff-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.04em;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.handoff-pill--auto {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.25);
  background: rgba(16, 185, 129, 0.10);
}

.handoff-pill--human {
  color: #ffc800;
  border-color: rgba(255, 200, 0, 0.25);
  background: rgba(255, 200, 0, 0.10);
}

.timeline-item.event {
  opacity: 0.95;
}

.timeline-item.event .timeline-bubble {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.timeline-item.event .timeline-message {
  font-style: italic;
  color: var(--text-secondary);
}

.lead-detail-quick-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.quick-info-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.quick-info-item i {
  width: 20px;
  height: 20px;
  color: var(--color-primary);
}

.quick-info-item .label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 600;
  letter-spacing: 0.05em;
  display: block;
}

.quick-info-item .value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  display: block;
  margin-top: 0.25rem;
}

.tags-editable {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 32px;
  padding: 0.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.tag-editable {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.75rem;
  background: var(--color-primary);
  color: var(--bg-primary);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

.tag-editable button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.tag-editable button:hover {
  opacity: 1;
}

.conversation-timeline {
  max-height: 400px;
  overflow-y: auto;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.timeline-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-tertiary);
}

.timeline-empty i {
  width: 48px;
  height: 48px;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.timeline-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.timeline-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.timeline-item.incoming .timeline-bubble {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--color-primary);
}

.timeline-item.outgoing .timeline-bubble {
  background: rgba(255, 200, 0, 0.1);
  border-left: 3px solid var(--color-primary);
}

.timeline-bubble {
  flex: 1;
  padding: 0.75rem;
  border-radius: var(--radius-md);
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
}

.timeline-message {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}

.lead-detail-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .lead-detail-actions {
    flex-direction: column;
  }

  .lead-detail-actions button {
    width: 100%;
    margin-left: 0;
  }
}

/* ============================================================================
   CSV IMPORT MODAL
   ============================================================================ */

.file-drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.file-drop-zone:hover {
  border-color: var(--color-primary);
  background: rgba(255, 200, 0, 0.05);
}

.file-drop-zone.drag-over {
  border-color: var(--color-primary);
  background: rgba(255, 200, 0, 0.1);
  transform: scale(1.02);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-top: 1rem;
}

.file-info strong {
  font-weight: 600;
  color: var(--text-primary);
}

.mapping-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.mapping-table th {
  text-align: left;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-secondary);
}

.mapping-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.mapping-table select {
  width: 100%;
}

.import-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 1rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.import-errors {
  padding: 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid #ef4444;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}

.import-errors h4 {
  color: #ef4444;
  margin-bottom: 0.5rem;
  font-size: 14px;
  font-weight: 700;
}

.import-errors ul {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0 0;
  max-height: 200px;
  overflow-y: auto;
}

.import-errors li {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
  font-size: 14px;
  color: var(--text-primary);
}

.import-errors li:last-child {
  border-bottom: none;
}

.import-progress {
  padding: 2rem;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 1rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #ff6b35);
  transition: width 0.3s ease;
  border-radius: var(--radius-full);
}

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

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 768px) {
  .file-drop-zone {
    padding: 2rem 1rem;
  }
}

/* ============================================================================
   BULK ACTIONS & EXTRAS
   ============================================================================ */

.lead-checkbox {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  cursor: pointer;
  accent-color: var(--color-primary);
  opacity: 0.4;
  transition: opacity 0.2s;
}

.lead-card:hover .lead-checkbox,
.lead-checkbox:checked {
  opacity: 1;
}

.lead-value {
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.bulk-action-bar {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 1rem 1.5rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  z-index: 999;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body[data-mode="light"] .bulk-action-bar {
  background: white;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.bulk-action-bar.hidden {
  display: none;
}

.bulk-count {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 14px;
  white-space: nowrap;
}

.bulk-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 100%);
    opacity: 0;
  }

  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* ============================================================================
   ARQUIVO 2: FIX LIGHT MODE - CARDS ILEGÍVEIS
   Problema: Cards cinzas demais no modo claro (imagem 1)
   Solução: Background branco sólido + sombra premium + contraste WCAG AAA
   ============================================================================ */

/* ============================================================================
   LEAD CARDS - MODO CLARO (SaaS Enterprise Level)
   ============================================================================ */

/* CARD BASE: Branco sólido clean com sombra suave */
body[data-mode="light"] .lead-card {
  background: #FFFFFF !important;
  /* Branco puro (era rgba cinza) */
  border: 1px solid rgba(0, 0, 0, 0.12) !important;

  /* Sombra premium estilo Notion/Linear */
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.08),
    0 4px 12px rgba(0, 0, 0, 0.04) !important;

  /* Remove backdrop-filter que causava cinza */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* HOVER: Elevação sutil */
body[data-mode="light"] .lead-card:hover {
  background: #FFFFFF !important;
  border-color: rgba(0, 0, 0, 0.18) !important;

  /* Sombra mais pronunciada no hover */
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.10),
    0 8px 20px rgba(0, 0, 0, 0.06) !important;

  transform: translateY(-2px) scale(1.01);
}

/* TEXTOS: Contraste máximo */
body[data-mode="light"] .lead-card .lead-name {
  color: #1a1a1a !important;
  /* Quase preto (era #666) */
  font-weight: 600;
}

body[data-mode="light"] .lead-card .lead-phone {
  color: #4a4a4a !important;
  /* Cinza escuro legível (era #999) */
  font-weight: 500;
}

/* FOOTER: Separador sutil */
body[data-mode="light"] .lead-card-footer {
  border-top-color: rgba(0, 0, 0, 0.08) !important;
  /* Era transparente */
}

/* DATA E STAGE */
body[data-mode="light"] .lead-created,
body[data-mode="light"] .lead-stage {
  color: #666666 !important;
  /* Legibilidade */
  font-size: 0.75rem;
  font-weight: 500;
}

/* ============================================================================
   MODAL - MODO CLARO (Legibilidade Extrema - Imagem 2)
   ============================================================================ */

/* CONTAINER PRINCIPAL DO MODAL */
body[data-mode="light"] .modal-box {
  background: #FFFFFF !important;
  /* Fundo branco sólido */
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2) !important;
}

/* HEADER DO MODAL */
body[data-mode="light"] .modal-header {
  background: #FAFAFA !important;
  /* Cinza muito leve para diferenciar */
  border-bottom: 1px solid rgba(0, 0, 0, 0.06) !important;
}

body[data-mode="light"] .modal-header h2 {
  color: #111111 !important;
  /* Título preto */
}

/* INPUTS DENTRO DO MODAL */
body[data-mode="light"] .modal-body input,
body[data-mode="light"] .modal-body select,
body[data-mode="light"] .modal-body textarea,
body[data-mode="light"] .input-dark {
  background: #F5F5F7 !important;
  /* Cinza iOS clarinho */
  border: 1px solid #D1D1D6 !important;
  color: #1C1C1E !important;
  /* Texto escuro */
}

/* INPUT HOVER/FOCUS */
body[data-mode="light"] .modal-body input:focus,
body[data-mode="light"] .modal-body select:focus,
body[data-mode="light"] .modal-body textarea:focus {
  background: #FFFFFF !important;
  border-color: var(--color-primary) !important;
  box-shadow: 0 0 0 3px rgba(255, 200, 0, 0.2) !important;
}

/* LABELS */
body[data-mode="light"] .modal-body label {
  color: #48484A !important;
  /* Cinza médio escuro */
  font-weight: 600 !important;
}

/* INFO CARDS (topo do modal) */
body[data-mode="light"] .info-grid .info-item {
  background: #F2F2F7 !important;
  border: 1px solid #E5E5EA !important;
}

body[data-mode="light"] .info-grid .info-item span:first-child {
  color: #8E8E93 !important;
  /* Label */
}

body[data-mode="light"] .info-grid .info-item span:last-child {
  color: #1C1C1E !important;
  /* Valor */
  font-weight: 600;
}

/* TIMELINE (Mensagens) */
body[data-mode="light"] .timeline-item .timeline-bubble {
  background: #F2F2F7 !important;
  border: 1px solid #E5E5EA !important;
  color: #1C1C1E !important;
}

body[data-mode="light"] .timeline-item.incoming .timeline-bubble {
  background: #E9F4FF !important;
  /* Azulzinho muito leve para cliente */
  border-color: #D6E8FF !important;
}

body[data-mode="light"] .timeline-item.outgoing .timeline-bubble {
  background: #FFF9E6 !important;
  /* Amarelinho muito leve para Mikael/Humano */
  border-color: #FFECC0 !important;
}

body[data-mode="light"] .timeline-message {
  color: #111111 !important;
}

/* BOTÕES DE AÇÃO */
body[data-mode="light"] .btn-secondary {
  background: #E5E5EA !important;
  color: #000000 !important;
  border: 1px solid #D1D1D6 !important;
}

body[data-mode="light"] .btn-secondary:hover {
  background: #D1D1D6 !important;
}

/* FIX: Ensure modal content is visible in light mode */
body[data-mode="light"] .modal-content,
body[data-mode="light"] .modal-box {
  color: #000000 !important;
}

body[data-mode="light"] .modal-body textarea,
body[data-mode="light"] .modal-body input {
  color: #000000 !important;
  background: #F0F0F0 !important;
  border-color: #ccc !important;
}

/* ============================================================================
   FIX: ZEUS DASHBOARD (Tabela e Colunas)
   ============================================================================ */
/* Tabela com layout fixo para respeitar larguras */
.zeus-table table {
  table-layout: fixed;
  width: 100%;
}

/* Coluna NOME (40%) */
.zeus-table th:nth-child(1),
.zeus-table td:nth-child(1) {
  width: 35%;
}

/* Coluna PLANO (15%) - Evita quebra de linha */
.zeus-table th:nth-child(2),
.zeus-table td:nth-child(2) {
  width: 15%;
  white-space: nowrap;
}

.plan-badge {
  display: inline-block;
  /* Garante que respeite o nowrap */
  margin: 0;
  max-width: 100%;
}

/* Colunas MÉTRICAS (Leads, Msgs, Videos) - 10% cada */
.zeus-table th:nth-child(3),
.zeus-table td:nth-child(3),
.zeus-table th:nth-child(4),
.zeus-table td:nth-child(4),
.zeus-table th:nth-child(5),
.zeus-table td:nth-child(5) {
  width: 10%;
  text-align: center;
}

/* Coluna AÇÕES (20%) */
.zeus-table th:nth-child(6),
.zeus-table td:nth-child(6) {
  width: 20%;
  text-align: right;
}

/* ============================================================================
   FIX: CRM UI POLISH (Light Mode, Tabs, Header)
   ============================================================================ */

/* 1. AGENT HEADER COMPACTO (Reduzir altura drasticamente) */
/* Override forte para garantir */
.pilar-header-main {
  padding: 1.5rem 1rem !important;
  /* Reduzido de 3rem ou mais */
  min-height: auto !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1400px;
  /* Limita largura em telas gigantes */
  margin: 0 auto;
}

.pilar-header-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}

.pilar-icon-wrapper {
  width: 56px !important;
  /* Menor (era 80px) */
  height: 56px !important;
  min-width: 56px;
}

.pilar-title h1 {
  font-size: 1.75rem !important;
  /* Menor (era 2.5rem) */
  margin-bottom: 0.25rem !important;
}

.pilar-description {
  font-size: 0.9rem !important;
  max-width: 600px;
  line-height: 1.4;
}

/* Esconder badge MVP se atrapalhar, ou diminuir */
.pilar-badge {
  position: relative;
  top: auto;
  right: auto;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
}


/* 2. TABS CENTRALIZADAS & GLOW */
.tab-navigation {
  justify-content: center !important;
  /* Centraliza as abas */
  margin-top: -1.5rem;
  /* Sobe um pouco pra ficar perto do header compacto */
  margin-bottom: 2rem;
  gap: 0.5rem;
}

.tab-btn {
  border-radius: 99px !important;
  /* Pill shape */
  padding: 0.6rem 1.5rem !important;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

/* Active State com GLOW/GRADIENT */
.tab-btn.active {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary)) !important;
  color: #000 !important;
  /* Texto preto no gradiente */
  box-shadow: 0 4px 15px rgba(255, 200, 0, 0.4) !important;
  /* Brilho */
  border: none !important;
  transform: translateY(-1px);
}

.tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

/* 3. MODAL SAVE BUTTON ROUNDED */
.btn-primary,
.btn-secondary,
.btn-danger {
  border-radius: 12px !important;
  /* Arredondado moderno (não quadrado, nem pill total) */
  font-family: var(--font-primary) !important;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 0.85rem;
}

/* Modal Inputs & Labels (Reforço) */
.modal-body label {
  font-family: var(--font-primary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
  display: block;
}

/* Light Mode Cards Fix (Final Nuclear Option) foi aplicado no passo anterior, 
mas vou colocar um override extra aqui caso 13-crm.css tenha conflito */
body[data-mode="light"] .lead-card {
  background: #ffffff !important;
}

/* ============================================================================
   NUCLEAR OPTION: LIGHT MODE & FONTS (V3.1)
   Este arquivo contém overrides que DEVEM ganhar de qualquer outro.
   ============================================================================ */

/* 1. LIGHT MODE CARDS (Especificidade Máxima) */
html body[data-mode="light"] div[data-pilar="mikael"] .lead-card,
html body[data-mode="light"] .lead-card,
html body[data-mode="light"] .lead-card[draggable="true"] {
  background-color: #FFFFFF !important;
  background: #FFFFFF !important;
  border: 1px solid #E5E5E5 !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
  color: #1F2937 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Garante texto legível no card light */
html body[data-mode="light"] .lead-card h3,
html body[data-mode="light"] .lead-card p,
html body[data-mode="light"] .lead-card span {
  color: #111827 !important;
  /* Quase preto */
}

html body[data-mode="light"] .lead-card .lead-phone {
  color: #4B5563 !important;
  /* Cinza médio */
}

/* 2. AGENT HEADER (Compacto) */
html body .pilar-page .pilar-header-main,
.pilar-header-main {
  padding: 1rem 1.5rem !important;
  min-height: 80px !important;
  max-height: 120px !important;
  background: transparent !important;
  margin-bottom: 2rem !important;
}

.pilar-header-main h1 {
  font-family: var(--font-primary) !important;
  font-size: 1.5rem !important;
  margin: 0 !important;
}

/* 3. FONTS (Global Enforcement) */
* {
  font-family: inherit;
  /* Herança por padrão */
}

body,
p,
input,
select,
textarea,
button,
span,
div {
  font-family: var(--font-secondary) !important;
}

h1,
h2,
h3,
h4,
h5,
h6,
.modal-header h2,
.pilar-title h1 {
  font-family: var(--font-primary) !important;
}


/* 4. TABS (Centered & Glowing) */
.tab-navigation {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  margin-top: -1rem !important;
  margin-bottom: 2rem !important;
  gap: 0.75rem !important;
  width: 100% !important;
}

.tab-btn.active {
  background: var(--gradient-primary) !important;
  color: #000000 !important;
  box-shadow: 0 4px 15px rgba(255, 69, 0, 0.3) !important;
  border: none !important;
}

/* 5. MODAL SAVE BUTTON (Rounded) */
.modal-footer .btn-primary,
.btn-primary {
  border-radius: 12px !important;
  font-family: var(--font-primary) !important;
}

/* 6. LIGHT MODE: MODAL & INPUT LEGIBILITY */
body[data-mode="light"] .modal-box {
  background: #FFFFFF !important;
  border-color: #E2E8F0 !important;
  color: #0F172A !important;
}

body[data-mode="light"] .modal-header h2,
body[data-mode="light"] .modal-header h3,
body[data-mode="light"] .modal-title {
  color: #0F172A !important;
}

body[data-mode="light"] .modal-body label {
  color: #334155 !important;
  font-weight: 700 !important;
}

body[data-mode="light"] .modal-body input,
body[data-mode="light"] .modal-body select,
body[data-mode="light"] .modal-body textarea {
  background: #F8FAFC !important;
  border: 1px solid #CBD5E1 !important;
  color: #0F172A !important;
}

body[data-mode="light"] .modal-body input:focus,
body[data-mode="light"] .modal-body select:focus,
body[data-mode="light"] .modal-body textarea:focus {
  border-color: var(--color-primary) !important;
  background: #FFFFFF !important;
}

/* Enforce Global Fonts (Final Shield) */
body,
p,
input,
select,
textarea,
button,
span,
div {
  font-family: var(--font-secondary) !important;
}

h1,
h2,
h3,
h4,
h5,
h6,
.modal-header h2,
.pilar-title h1 {
  font-family: var(--font-primary) !important;
}
/* ============================================================================
   HANDOFF TOGGLE - Modo Atendimento (Bot/Humano)
   ============================================================================ */

.handoff-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 20px;
  color: #10B981;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
}

.handoff-toggle:hover {
  transform: scale(1.02);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.handoff-toggle[data-active="false"] {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #EF4444;
}

.handoff-toggle[data-active="false"]:hover {
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.handoff-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10B981;
  animation: handoff-pulse 2s infinite;
}

.handoff-toggle[data-active="false"] .handoff-indicator {
  background: #EF4444;
  animation: none;
}

@keyframes handoff-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

.quick-info-item--toggle {
  cursor: pointer;
}

.quick-info-item--toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}
