/* ===================== VARIABLES - COLOR PETRÓLEO ===================== */
:root {
  /* COLOR PETRÓLEO - NUEVO COLOR PRINCIPAL */
  --petroleo: #1a4a4a;
  --petroleo-claro: #2a5f5f;
  --petroleo-oscuro: #0f3333;
  --petroleo-suave: #e8f0f0;
  
  /* AHORA primary USA PETRÓLEO en lugar de morado */
  --primary: #1a4a4a;        /* Cambiado a petróleo */
  --primary-dark: #0f3333;    /* Petróleo oscuro */
  --secondary: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --light: #f9fafb;
  --dark: #1f2937;
  --gray: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* ===================== RESET & BASE ===================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
  height: 100vh;
  overflow: hidden;
}

/* ===================== LOGIN SCREEN ===================== */
/* ===================== LOGIN SCREEN REDISEÑADO ===================== */
.login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: var(--petroleo); /* Fondo color petróleo */
  padding: 20px;
}

.login-container {
  width: 100%;
  max-width: 450px;
  background: white; /* Fondo blanco */
  border-radius: 24px;
  padding: clamp(30px, 6vw, 50px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
  text-align: center;
  animation: fadeInUp 0.5s ease;
}

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

/* Logo */
.login-logo {
  margin-bottom: 25px;
}

.login-logo img {
  max-width: 120px;
  height: auto;
  margin-bottom: 15px;
}

/* Si usas ícono Font Awesome como logo temporal */
.login-logo-icon {
  width: 80px;
  height: 80px;
  background: var(--petroleo);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 20px rgba(26, 74, 74, 0.3);
}

.login-logo-icon i {
  font-size: 40px;
  color: white;
}

/* Título */
.login-title {
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 700;
  color: #000000; /* Negro */
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: clamp(13px, 3.5vw, 15px);
  color: #666666; /* Gris oscuro */
  margin-bottom: 35px;
  font-weight: 500;
}

/* Campos de entrada */
.login-input-group {
  position: relative;
  margin-bottom: 20px;
}

.login-input {
  width: 100%;
  padding: 15px 18px;
  padding-left: 50px;
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  font-size: 15px;
  transition: all 0.3s;
  background: #f9fafb;
  color: #000000;
}

.login-input:focus {
  outline: none;
  border-color: var(--petroleo);
  background: white;
  box-shadow: 0 0 0 4px rgba(26, 74, 74, 0.1);
}

.login-input::placeholder {
  color: #9ca3af;
}

.login-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--petroleo);
  font-size: 18px;
}

/* Botón de ingresar - VERDE PETRÓLEO */
.login-btn {
  width: 100%;
  padding: 15px;
  background: var(--petroleo); /* Color petróleo */
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-btn:hover {
  background: var(--petroleo-oscuro);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(26, 74, 74, 0.3);
}

.login-btn:active {
  transform: translateY(0);
}

/* Footer */
.login-footer {
  margin-top: 30px;
  font-size: 13px;
  color: #9ca3af;
  border-top: 1px solid #e5e7eb;
  padding-top: 20px;
}

/* Mensaje de error */
#loginError {
  color: #ef4444 !important;
  margin-top: 15px;
  font-size: 13px;
  background: #fef2f2;
  padding: 10px;
  border-radius: 10px;
}

/* Responsive */
@media (max-width: 480px) {
  .login-container {
    max-width: 95%;
    padding: 25px 20px;
  }
  
  .login-input {
    padding: 12px 15px;
    padding-left: 45px;
    font-size: 14px;
  }
  
  .login-btn {
    padding: 12px;
    font-size: 15px;
  }
}
/* ===================== DASHBOARD ===================== */
/* ==================== SIDEBAR PETRÓLEO NUEVO ==================== */
.dashboard {
  display: none;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR - COLOR PETRÓLEO */
.sidebar {
  width: 220px;
  background: var(--petroleo) !important; /* Color petróleo */
  color: white;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
  position: relative;
  z-index: 10;
  transition: all 0.3s ease;
}

/* Perfil de usuario */
.user-profile {
  padding: 0 15px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
}

.avatar {
  width: 60px;
  height: 60px;
  background: white;
  border-radius: 50%;
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: var(--petroleo);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.user-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 5px;
  color: white;
}

.user-role {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.15);
  padding: 4px 12px;
  border-radius: 20px;
  display: inline-block;
}

/* Botón de estado */
.estado-btn {
  width: 100%;
  margin-top: 15px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: white;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.3s;
}

.estado-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.estado-actual {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

/* Menú */
.menu {
  flex: 1;
  padding: 20px 0;
  overflow-y: auto;
}

/* Grupos de menú */
.menu-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.4);
  padding: 15px 20px 8px 20px;
  font-weight: 600;
}

/* Items del menú */
.menu-item {
  padding: 10px 15px;
  margin: 2px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.85);
  position: relative;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(5px);
}

.menu-item.active {
  background: white;
  color: var(--petroleo);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.menu-item.active .menu-icon {
  color: var(--petroleo);
}

.menu-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
}

.menu-item.active .menu-icon {
  color: var(--petroleo);
}

.menu-text {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

/* Badge de notificaciones */
.menu-badge {
  background: #ef4444;
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
}

/* Scrollbar del menú */
.menu::-webkit-scrollbar {
  width: 5px;
}

.menu::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
}

/* Responsive - Móvil */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: left 0.3s ease;
  }
  
  .sidebar.open {
    left: 0;
  }
  
  .menu-toggle {
    display: block;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--petroleo);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
  }
}

@media (min-width: 769px) {
  .menu-toggle {
    display: none;
  }
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #f5f7fa;
  overflow: hidden;
}

.header {
  background: white;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  z-index: 5;
}

.header-left h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--dark);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.notification {
  position: relative;
  cursor: pointer;
  font-size: 20px;
  color: var(--gray);
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
}

.logout-btn {
  background: var(--light);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--gray);
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

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

.content-area {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ===================== DASHBOARD HOME ===================== */
.dashboard-home {
  display: none;
}

.welcome-section {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: white;
  padding: 25px 30px;
  border-radius: 16px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}

.welcome-section::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 200px;
  height: 200px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  transform: translate(30%, -30%);
}

.welcome-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.welcome-subtitle {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 25px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  padding: 18px 20px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 15px;
  transition: transform 0.3s;
}

.stat-card:hover {
  transform: translateY(-5px);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.stat-icon.chats { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-icon.pendientes { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.atendidos { background: linear-gradient(135deg, #10b981, #059669); }
.stat-icon.cerrados { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }

.stat-info h3 {
  font-size: 14px;
  color: var(--gray);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-number {
  font-size: 26px;
  font-weight: 700;
  color: var(--dark);
}

.stat-trend {
  font-size: 12px;
  color: var(--success);
}

.recent-activity {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: var(--shadow);
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  border-radius: 10px;
  background: var(--light);
  transition: all 0.3s;
}

.activity-item:hover {
  background: #f0f4ff;
}

.activity-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: white;
}

.activity-icon.whatsapp { background: #25D366; }
.activity-icon.call { background: var(--primary); }
.activity-icon.message { background: var(--info); }

.activity-content {
  flex: 1;
}

.activity-title {
  font-weight: 600;
  margin-bottom: 3px;
}

.activity-time {
  font-size: 12px;
  color: var(--gray);
}

/* ===================== CHATS ===================== */
.chats-section {
  display: none;
}

.chats-layout {
  display: grid;
  grid-template-columns: 230px 1fr 220px;
  gap: 12px;
  height: calc(100vh - 160px);
}

/* CHAT LIST */
.chat-list-container {
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


.chat-list-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.chat-search {
  position: relative;
}

.chat-search input {
  width: 100%;
  padding: 9px 12px;
  padding-left: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}

.chat-search i {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray);
}

.chat-filters {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 12px;
  background: var(--light);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.chat-items {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.chat-item {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid transparent;
}

.chat-item:hover {
  background: #f0f4ff;
  border-color: var(--primary);
}

.chat-item.active {
  background: #f0f4ff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

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

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

.client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 14px;
}

.client-info h4 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.client-info p {
  font-size: 12px;
  color: var(--gray);
}

.chat-time {
  font-size: 12px;
  color: var(--gray);
}

.chat-preview {
  font-size: 13px;
  color: var(--gray);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.chat-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-channel {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--light);
  color: var(--gray);
}

.unread-badge {
  background: var(--danger);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

/* CHAT BOX */
.chat-box-container {
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.chat-client-details {
  display: flex;
  align-items: center;
  gap: 15px;
}

.chat-header-info h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 3px;
}

.chat-header-info p {
  font-size: 13px;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 5px;
}

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

.action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--light);
  color: var(--gray);
  cursor: pointer;
  transition: all 0.3s;
}

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

.messages-container {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  background: #fafafa;
}

.message {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 18px;
  position: relative;
  animation: fadeIn 0.3s;
}

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

.message.cliente {
  background: white;
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 5px;
}

/* ===================== AGENTE EN AZUL ===================== */
.message.agente {
    background: #e3f2fd !important;  /* Azul claro */
    background-color: #e3f2fd !important;
    background-image: none !important;
    border: 1px solid #bbdefb !important;  /* Borde azul más oscuro */
    color: #111b21 !important;
}

.message.sistema {
  background: #fef3c7;
  color: #92400e;
  align-self: center;
  font-size: 12px;
  padding: 8px 16px;
  border-radius: 20px;
}

.message.ia {
  background: #dbeafe;
  border-left: 4px solid var(--info);
  align-self: flex-start;
}

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

.message-sender {
  font-weight: 600;
  font-size: 13px;
}

.message-time {
  font-size: 11px;
  opacity: 0.7;
}

.message-content {
  font-size: 14px;
  line-height: 1.5;
}

.message-attachment {
  margin-top: 10px;
  padding: 10px;
  background: rgba(0,0,0,0.05);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.attachment-icon {
  font-size: 20px;
  color: var(--primary);
}

.attachment-info h5 {
  font-size: 13px;
  margin-bottom: 3px;
}

.attachment-info p {
  font-size: 11px;
  color: var(--gray);
}

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

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

.tool-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--light);
  color: var(--gray);
  cursor: pointer;
  transition: all 0.3s;
}

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

.message-input {
  flex: 1;
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: 25px;
  font-size: 14px;
  resize: none;
  min-height: 40px;
  max-height: 120px;
}

.message-input:focus {
  outline: none;
  border-color: var(--primary);
}

.send-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
}

.send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(79, 70, 229, 0.3);
}

/* EMOJI PICKER */
.emoji-picker {
  position: absolute;
  bottom: 80px;
  left: 20px;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  padding: 15px;
  width: 300px;
  display: none;
  z-index: 100;
}

.emoji-picker.show {
  display: block;
  animation: slideUp 0.3s;
}

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

.emoji-categories {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.emoji-category {
  padding: 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.emoji-category.active {
  background: var(--primary);
  color: white;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 10px 0;
}

.emoji {
  font-size: 20px;
  cursor: pointer;
  text-align: center;
  padding: 5px;
  border-radius: 8px;
}

.emoji:hover {
  background: var(--light);
}

/* CHAT INFO */
.chat-info-container {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px;
  overflow-y: auto;
}

.info-section {
  margin-bottom: 16px;
}

.info-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}

.info-label {
  font-weight: 500;
  color: var(--gray);
}

.info-value {
  font-weight: 600;
  color: var(--dark);
}

.client-notes textarea {
  width: 100%;
  height: 100px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  resize: none;
  font-size: 14px;
  margin-bottom: 15px;
}

.save-notes {
  width: 100%;
  padding: 10px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.save-notes:hover {
  background: var(--primary-dark);
}

/* ===================== CDR SECTION ===================== */
.cdr-section {
  display: none;
}

.cdr-filters {
  background: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: var(--shadow);
  margin-bottom: 25px;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.filter-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--dark);
}

.filter-group input,
.filter-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
}

.filter-actions {
  display: flex;
  gap: 15px;
  justify-content: flex-end;
}

.cdr-table-container {
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
}

.cdr-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
}

.cdr-table th {
  background: var(--light);
  padding: 15px;
  text-align: left;
  font-weight: 600;
  color: var(--dark);
  border-bottom: 2px solid var(--border);
}

.cdr-table td {
  padding: 15px;
  border-bottom: 1px solid var(--border);
}

.cdr-table tr:hover {
  background: #f9fafb;
}

.status-badge {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-answered {
  background: #d1fae5;
  color: #065f46;
}

.status-noanswer {
  background: #fef3c7;
  color: #92400e;
}

.status-failed {
  background: #fee2e2;
  color: #991b1b;
}

/* ===================== USERS SECTION ===================== */
.users-section {
  display: none;
}

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

.users-table-container {
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
}

.users-table th {
  background: var(--light);
  padding: 18px;
  text-align: left;
  font-weight: 600;
  color: var(--dark);
  border-bottom: 2px solid var(--border);
}

.users-table td {
  padding: 18px;
  border-bottom: 1px solid var(--border);
}

.users-table tr:hover {
  background: #f9fafb;
}

.user-avatar-cell {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 18px;
}

.user-details h4 {
  font-weight: 600;
  margin-bottom: 3px;
}

.user-details p {
  font-size: 13px;
  color: var(--gray);
}

.role-badge {
  padding: 6px 15px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.role-admin {
  background: #ede9fe;
  color: #7c3aed;
}

.role-supervisor {
  background: #dbeafe;
  color: #1d4ed8;
}

.role-agente {
  background: #dcfce7;
  color: #16a34a;
}

.status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
}

.status-active {
  background: #d1fae5;
  color: #065f46;
}

.status-inactive {
  background: #f3f4f6;
  color: #6b7280;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all 0.3s;
}

.btn-edit {
  background: #dbeafe;
  color: var(--info);
}

.btn-delete {
  background: #fee2e2;
  color: var(--danger);
}

.btn-icon:hover {
  transform: translateY(-2px);
}

/* ===================== ESTADÍSTICAS ===================== */
.stats-section {
  display: none;
}

.stats-container {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: var(--shadow);
}

.stats-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-wrap: wrap;
  gap: 15px;
}

.stats-filters {
  display: flex;
  gap: 15px;
  align-items: center;
}

.stats-filters input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.export-btn {
  background: var(--secondary);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.export-btn:hover {
  background: #0da271;
}

.stats-grid-large {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.stat-card-large {
  background: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ===================== CONFIGURACIÓN ===================== */
.config-section {
  display: none;
}

.config-container {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: var(--shadow);
}

.config-group {
  margin-bottom: 30px;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--border);
}

.config-group:last-child {
  border-bottom: none;
}

.config-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.config-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding: 15px;
  background: var(--light);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.config-label {
  font-weight: 500;
  color: var(--dark);
}

.config-value {
  display: flex;
  align-items: center;
  gap: 15px;
}

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

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

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

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

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

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

.config-input {
  padding: 10px 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  width: 200px;
}

.save-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 10px 25px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s;
}

.save-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
}

/* ===================== PLANTILLAS Y FLUJOS ===================== */
.templates-section {
  display: none;
}

.templates-container {
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: var(--shadow);
}

.tabs-header {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
}

.tab-btn {
  padding: 12px 24px;
  background: var(--light);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  color: var(--gray);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s;
}

.tab-btn.active {
  background: var(--primary);
  color: white;
}

.tab-btn:hover:not(.active) {
  background: #e5e7eb;
}

.tabs-content {
  margin-top: 20px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s;
}

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

.filters-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
  padding: 20px;
  background: var(--light);
  border-radius: 12px;
}

.filter-group select, .filter-group input {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.template-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s;
  cursor: pointer;
}

.template-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

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

.template-title {
  font-weight: 600;
  color: var(--dark);
  font-size: 16px;
}

.template-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-texto { background: #dbeafe; color: #1d4ed8; }
.badge-botones { background: #ede9fe; color: #7c3aed; }
.badge-imagen { background: #fce7f3; color: #be185d; }
.badge-lista { background: #dcfce7; color: #16a34a; }

.template-content {
  color: var(--gray);
  font-size: 14px;
  margin-bottom: 15px;
  line-height: 1.5;
  max-height: 100px;
  overflow: hidden;
}

.template-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

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

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-small:hover {
  transform: translateY(-2px);
}

.btn-use {
  background: var(--primary);
  color: white;
}

.btn-edit {
  background: var(--light);
  color: var(--gray);
  border: 1px solid var(--border);
}

/* Flujos */
.flows-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.flow-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

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

.flow-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-active { background: #10b981; }
.status-inactive { background: #ef4444; }

.flow-options {
  margin-top: 15px;
  padding: 15px;
  background: var(--light);
  border-radius: 8px;
}

.option-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-bottom: 1px dashed var(--border);
}

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

/* Conexiones */
.connections-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

.connection-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  position: relative;
}

.connection-type {
  position: absolute;
  top: 15px;
  right: 15px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.type-mysql { background: #f0f9ff; color: #0369a1; }
.type-postgresql { background: #f0fdf4; color: #166534; }
.type-sqlserver { background: #fefce8; color: #854d0e; }

.connection-info {
  margin-top: 25px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px dashed #e5e7eb;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  color: var(--gray);
  font-size: 13px;
}

.info-value {
  font-weight: 500;
  font-size: 13px;
}

/* ===================== MODALES ===================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.show {
  display: flex;
  animation: fadeIn 0.3s;
}

.modal {
  background: white;
  border-radius: 20px;
  width: 500px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
  animation: modalSlideUp 0.4s;
}

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

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

.modal-header h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--dark);
}

.close-modal {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--light);
  color: var(--gray);
  cursor: pointer;
  border: none;
  transition: all 0.3s;
}

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

.modal-body {
  padding: 25px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--dark);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.modal-footer {
  padding: 20px 25px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 15px;
}

.btn {
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  border: none;
  font-size: 14px;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
  background: var(--light);
  color: var(--gray);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

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

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(239, 68, 68, 0.3);
}

/* Modal de Plantilla */
.modal-wide {
  width: 700px;
  max-width: 95%;
}

.template-editor {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.editor-tabs {
  display: flex;
  gap: 10px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 10px;
}

.editor-tab {
  padding: 10px 20px;
  background: var(--light);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.editor-tab.active {
  background: var(--primary);
  color: white;
}

.editor-content {
  min-height: 300px;
}

.template-preview {
  background: #f9fafb;
  padding: 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-top: 20px;
}

.botones-editor {
  margin-top: 20px;
}

.boton-item {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.boton-item input {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.btn-add-boton {
  width: 100%;
  padding: 10px;
  background: var(--light);
  border: 1px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--gray);
}

.btn-add-boton:hover {
  background: #e5e7eb;
}

/* Upload de imagen */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.upload-area:hover {
  border-color: var(--primary);
  background: #f8fafc;
}

.upload-area i {
  font-size: 48px;
  color: var(--gray);
  margin-bottom: 15px;
}

.image-preview {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  margin-top: 15px;
}

/* Variables */
.variables-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.variable-tag {
  padding: 4px 10px;
  background: #e0e7ff;
  color: #4f46e5;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
}

.variable-tag:hover {
  background: #4f46e5;
  color: white;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1200px) {
  .chats-layout {
    grid-template-columns: 300px 1fr;
  }
  
  .chat-info-container {
    display: none;
  }
}

@media (max-width: 992px) {
  .sidebar {
    width: 80px;
    padding: 20px 0;
  }
  
  .user-profile, .menu-text {
    display: none;
  }
  
  .menu-item {
    justify-content: center;
    padding: 15px;
  }
  
  .menu-icon {
    font-size: 20px;
  }
  
  .chats-layout {
    grid-template-columns: 1fr;
  }
  
  .chat-list-container {
    display: none;
  }
  
  .templates-grid {
    grid-template-columns: 1fr;
  }
  
  .connections-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .login-container {
    width: 90%;
    padding: 30px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .filter-row {
    grid-template-columns: 1fr;
  }
  
  .header-right {
    gap: 10px;
  }
  
  .users-table th,
  .users-table td {
    padding: 12px;
  }
  
  .action-buttons {
    flex-direction: column;
    gap: 5px;
  }
  
  .tabs-header {
    flex-direction: column;
  }
  
  .modal-wide {
    width: 95%;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ===================== UTILITIES ===================== */
.hidden {
  display: none !important;
}

.text-success { color: #10b981; }
.text-danger { color: #ef4444; }
.text-warning { color: #f59e0b; }
.text-info { color: #3b82f6; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1d4ed8; }

.shadow-sm { box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.shadow-md { box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.shadow-lg { box-shadow: 0 10px 25px rgba(0,0,0,0.1); }

.rounded { border-radius: 8px; }
.rounded-lg { border-radius: 12px; }
.rounded-xl { border-radius: 16px; }
.rounded-full { border-radius: 9999px; }

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(79, 70, 229, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
}

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

.scrollbar-custom::-webkit-scrollbar {
  width: 8px;
}

.scrollbar-custom::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.scrollbar-custom::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 10px;
}

.scrollbar-custom::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* ===================== ESTILOS PARA GESTIÓN DE AGENTES ===================== */
.agent-item {
    transition: all 0.2s;
}

.agent-item:hover:not([style*="opacity: 0.5"]) {
    background: #f0f4ff !important;
    border-color: var(--primary) !important;
    transform: translateX(3px);
}

#agentsListContainer::-webkit-scrollbar {
    width: 6px;
}

#agentsListContainer::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

#agentsListContainer::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

#agentsListContainer::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

.status-btn-active {
    transform: scale(0.95);
    box-shadow: 0 0 0 2px var(--primary);
}

/* ===================== ESTILOS WHATSAPP ===================== */
.whatsapp-style {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.whatsapp-style .message {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 7.5px;
    position: relative;
    word-wrap: break-word;
    margin-bottom: 2px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.05);
}

/* Cliente - Fondo blanco/gris muy claro */
.whatsapp-style .message.cliente {
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    color: #111b21;
}

/* Agente (Agente) - Verde WhatsApp */
.whatsapp-style .message.agente {
    background-color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    color: #ffffff;
}

/* IA - Fondo gris claro */
.whatsapp-style .message.ia {
    background-color: #f0f0f0;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    color: #111b21;
}

/* Sistema - Fondo amarillo claro (mensajes del sistema) */
.whatsapp-style .message.sistema {
    background-color: #fff3cd;
    align-self: center;
    font-size: 12px;
    color: #856404;
    max-width: 80%;
    border-radius: 20px;
    padding: 6px 16px;
}

.whatsapp-style .message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
}

.whatsapp-style .message-sender {
    font-weight: 600;
}

/* Color del nombre según el tipo */
.whatsapp-style .message.cliente .message-sender {
    color: #128C7E;  /* Verde oscuro WhatsApp */
}

.whatsapp-style .message.agente .message-sender {
    color: #0d47a1 !important;  /* Azul oscuro para el nombre */
}

.whatsapp-style .message.ia .message-sender {
    color: #3b4a54;  /* Gris azulado */
}

.whatsapp-style .message-time {
    font-size: 11px;
    color: #667781;
    margin-left: 8px;
}

.whatsapp-style .message-content {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 2px;
}

/* Timeline de mensajes (separadores de fecha) */
.message-timeline {
    margin: 10px 0;
    text-align: center;
    position: relative;
}

.message-timeline span {
    background: #e9edef;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    color: #667781;
}

/* Opcional: burbujas con cola estilo WhatsApp */
.whatsapp-style .message.cliente::before {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0 10px 10px 0;
    border-color: transparent #ffffff transparent transparent;
}

.whatsapp-style .message.agente::after {
    content: '';
    position: absolute;
    right: -8px;
    bottom: 0;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 10px 0 0;
    border-color: #dcf8c6 transparent transparent transparent;
}


/* ===================== DOBLE CHECK ESTILO WHATSAPP ===================== */
.chat-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--gray);
}

.message-status {
    display: flex;
    align-items: center;
    margin-left: 5px;
    font-size: 16px;
}

/* Check simple (enviado) */
.message-status .check-single {
    color: #8696a0;
}

/* Doble check (entregado) */
.message-status .check-double {
    color: #8696a0;
}

/* Doble check azul (leído) */
.message-status .check-double.read {
    color: #53bdeb;
}

/* Para alinear correctamente */
.chat-item .chat-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* ===================== SOLO CAMBIAR EL AGENTE A BLANCO ===================== */
.message.agente {
    background: #ffffff !important;
    background-color: #ffffff !important;
    background-image: none !important;
    border: 1px solid #e5e5e5 !important;
    color: #111b21 !important;
}

.message.agente .message-sender {
    color: #128C7E !important;
}
/* Ocultar visualmente el número pero mantenerlo para búsqueda */
.phone-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

<!-- Estilos adicionales para el monitoreo -->
.agents-monitoring-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.agent-monitor-card {
  background: white;
  border-radius: 15px;
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 6px solid;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.agent-monitor-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.agent-monitor-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  border-radius: 50%;
  transform: translate(30px, -30px);
}

.agent-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.agent-avatar-large {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.agent-info h4 {
  font-size: 18px;
  margin-bottom: 3px;
}

.agent-info p {
  font-size: 13px;
  color: var(--gray);
}

.estado-badge-large {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 30px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 15px;
}

.estado-timer {
  font-family: monospace;
  font-size: 20px;
  font-weight: bold;
  margin: 10px 0;
}

.estado-progress {
  width: 100%;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  margin: 15px 0;
  overflow: hidden;
}

.estado-progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
}

.agent-stats-row {
  display: flex;
  justify-content: space-around;
  margin: 15px 0;
  padding: 15px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.agent-stat-item {
  text-align: center;
}

.agent-stat-value {
  font-size: 18px;
  font-weight: bold;
  color: var(--dark);
}

.agent-stat-label {
  font-size: 11px;
  color: var(--gray);
  text-transform: uppercase;
}

.agent-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.agent-action-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--light);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

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

.agent-action-btn.danger:hover {
  background: var(--danger);
  border-color: var(--danger);
}

/* Estados grid en modal */
.estados-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 15px;
}

.estado-option {
  padding: 15px;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s;
}

.estado-option:hover {
  border-color: var(--primary);
  background: var(--light);
  transform: scale(1.02);
}

.estado-option.selected {
  border-color: var(--primary);
  background: #e0e7ff;
}

.estado-option i {
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

.estado-option .estado-nombre {
  font-weight: 600;
  font-size: 14px;
}

.estado-option .estado-desc {
  font-size: 11px;
  color: var(--gray);
  margin-top: 3px;
}

/* Alertas */
.alerta-item {
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 15px;
  animation: slideIn 0.3s;
}

.alerta-item.warning {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
}

.alerta-item.danger {
  background: #fee2e2;
  border-left: 4px solid #ef4444;
}

.alerta-item.info {
  background: #dbeafe;
  border-left: 4px solid #3b82f6;
}

.alerta-icon {
  font-size: 24px;
}

.alerta-content {
  flex: 1;
}

.alerta-titulo {
  font-weight: 600;
  margin-bottom: 3px;
}

.alerta-desc {
  font-size: 13px;
  opacity: 0.8;
}

.alerta-time {
  font-size: 11px;
  opacity: 0.6;
}

.alerta-close {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.3s;
}

.alerta-close:hover {
  opacity: 1;
}


/* ===================== DROPDOWN MENÚ DENTRO DE LA TARJETA ===================== */
.agent-actions {
  display: flex;
  gap: 8px;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid #edf2f7;
  position: relative;
}

.agent-action-btn {
  flex: 1;
  padding: 8px 0;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #4a5568;
}

.agent-action-btn i {
  font-size: 12px;
}

.agent-action-btn:hover {
  background: #f7fafc;
  border-color: #cbd5e0;
}

.view-btn {
  color: #3182ce;
  border-color: #bee3f8;
}

.view-btn:hover {
  background: #ebf8ff;
  border-color: #90cdf4;
}

.dropdown-toggle {
  position: relative;
}

/* Menú desplegable - DENTRO de la tarjeta */
.dropdown-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  width: 200px;
  z-index: 100;
  overflow: hidden;
  animation: slideUp 0.2s ease;
}

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

.dropdown-item {
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
  color: #2d3748;
}

.dropdown-item i {
  width: 16px;
  color: #718096;
  font-size: 13px;
}

.dropdown-item:hover {
  background: #f7fafc;
}

.dropdown-item:hover i {
  color: #3182ce;
}

.dropdown-item.danger {
  color: #e53e3e;
}

.dropdown-item.danger i {
  color: #e53e3e;
}

.dropdown-item.danger:hover {
  background: #fff5f5;
}

.dropdown-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 5px 0;
}

/* Ajuste para que el dropdown no se salga de la tarjeta */
.agent-monitor-card {
  position: relative;
  overflow: visible !important;
}

.agent-monitor-card::before {
  display: none; /* Elimina el efecto de desbordamiento */
}

/* Botón TOMAR más llamativo */
.chat-meta .btn-success {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: white !important;
  border: none !important;
  padding: 4px 12px !important;
  border-radius: 20px !important;
  font-weight: 600 !important;
  font-size: 12px !important;
  box-shadow: 0 2px 5px rgba(16, 185, 129, 0.3) !important;
  transition: all 0.3s ease !important;
  animation: pulse 2s infinite !important;
}

.chat-meta .btn-success:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.5) !important;
  background: linear-gradient(135deg, #059669, #047857) !important;
}

.chat-meta .btn-success i {
  margin-right: 4px;
  font-size: 11px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

/* Estilos para visualización de archivos */
.message .message-content img {
    max-width: 100%;
    border-radius: 8px;
    transition: transform 0.2s;
}

.message .message-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Estilo para enlaces de descarga */
.message .message-content a {
    text-decoration: none;
    transition: all 0.2s;
}

.message .message-content a:hover {
    opacity: 0.8;
}

/* Estilo para PDF viewer */
.pdf-viewer {
    width: 100%;
    height: 500px;
    border: none;
    border-radius: 8px;
}

/* Lightbox para imágenes */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.image-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* Estilos mejorados para archivos multimedia */
.message .message-content video,
.message .message-content audio {
    width: 100%;
    border-radius: 8px;
    margin: 5px 0;
}

.message .message-content video {
    max-height: 300px;
    background: #000;
}

/* Lightbox para imágenes */
.image-lightbox {
    animation: fadeIn 0.3s ease;
}

.image-lightbox img {
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Botones de acción para archivos */
.message .btn-small {
    transition: all 0.2s;
}

.message .btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* Estilo para el contenedor de archivos */
.message .message-content > div {
    transition: all 0.2s;
}

.message .message-content > div:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Estilos para tablas responsivas */
@media (max-width: 768px) {
    .cdr-table-container {
        overflow-x: auto;
    }
    
    .stat-card .stat-number {
        font-size: 20px !important;
    }
    
    .tab-btn {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
}

/* Badges de estado */
.badge-success {
    background: #d1fae5 !important;
    color: #065f46 !important;
}

.badge-warning {
    background: #fef3c7 !important;
    color: #92400e !important;
}

.badge-danger {
    background: #fee2e2 !important;
    color: #991b1b !important;
}

.badge-info {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
}

.badge-secondary {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
}
/* ==================== ETIQUETAS EN CHAT ==================== */
.chat-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
    min-height: 30px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 500;
    cursor: default;
}

.tag .tag-remove {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.tag .tag-remove:hover {
    opacity: 1;
}

.tag-option {
    transition: background 0.2s;
}

.tag-option:hover {
    background: var(--light);
}

/* Selector de etiquetas */
.tag-selector {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    margin-top: 5px;
    overflow: hidden;
}

/* El contenedor de etiquetas debe tener posición relativa */
.info-section {
    position: relative;
}


/* Mejoras para la tabla de reportes */
.cdr-table-container table {
    width: 100%;
    border-collapse: collapse;
}

.cdr-table-container th {
    background: var(--primary);
    color: white;
    font-weight: 600;
    padding: 12px 8px;
    white-space: nowrap;
}

.cdr-table-container td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.cdr-table-container tr:hover {
    background: #f8fafc;
}

/* Badges */
.badge-success {
    background: #d1fae5 !important;
    color: #065f46 !important;
}

.badge-warning {
    background: #fef3c7 !important;
    color: #92400e !important;
}

.badge-danger {
    background: #fee2e2 !important;
    color: #991b1b !important;
}

.badge-info {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
}

/* Tarjetas de monitoreo más compactas */
.agent-monitor-card {
    transition: all 0.2s;
}

.agent-monitor-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.agent-action-btn {
    transition: all 0.2s;
}

.agent-action-btn:hover {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

/* Grid responsivo */
.agents-monitoring-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

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

/* Badges de tiempo */
.badge-time {
    font-family: monospace;
    font-size: 11px;
}

/* ===================== LISTA DE CHATS MÁS ANGOSTA ===================== */

/* Contenedor principal del chat */
.chats-layout {
    display: flex !important;
    gap: 12px !important;
    height: calc(100vh - 140px) !important;
}

/* Lista de chats - más angosta */
.chat-list-container {
    width: 260px !important;
    min-width: 260px !important;
    max-width: 260px !important;
    flex-shrink: 0 !important;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat box - ocupa todo el espacio restante */
.chat-box-container {
    flex: 1 !important;
    min-width: 400px !important;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Panel de información - más compacto */
.chat-info-container {
    width: 260px !important;
    min-width: 260px !important;
    flex-shrink: 0 !important;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 12px;
    overflow-y: auto;
}

/* Items de chat más compactos */
.chat-item {
    padding: 8px 10px !important;
    margin-bottom: 6px !important;
}

.chat-client {
    gap: 6px !important;
}

.client-avatar {
    width: 28px !important;
    height: 28px !important;
    font-size: 11px !important;
}

.client-info h4 {
    font-size: 12px !important;
    margin-bottom: 1px !important;
}

.client-info p {
    font-size: 9px !important;
}

.chat-preview {
    font-size: 10px !important;
    margin: 3px 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    margin-top: 3px !important;
}

.chat-time {
    font-size: 9px !important;
}

.chat-channel span {
    font-size: 9px !important;
    padding: 2px 6px !important;
}

/* Header de la lista de chats */
.chat-list-header {
    padding: 10px !important;
}

.chat-search input {
    padding: 6px 10px 6px 30px !important;
    font-size: 11px !important;
}

.chat-search i {
    font-size: 12px !important;
    left: 10px !important;
}

.chat-filters {
    gap: 4px !important;
    margin-top: 8px !important;
}

.filter-btn {
    padding: 3px 8px !important;
    font-size: 10px !important;
}

/* Responsive */
@media (max-width: 1200px) {
    .chat-info-container {
        display: none !important;
    }
}

@media (max-width: 992px) {
    .chat-list-container {
        display: none !important;
    }
    .chat-box-container {
        min-width: 100% !important;
    }
}

@media (min-width: 1400px) {
    .chat-list-container {
        width: 280px !important;
        min-width: 280px !important;
    }
    .chat-info-container {
        width: 280px !important;
        min-width: 280px !important;
    }
}

/* Asegurar que el modal se muestre correctamente */
.modal-overlay.show {
    display: flex !important;
}

/* FORZAR MODAL SIMPLE - IMPORTANTE */
#miModalSimple {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0,0,0,0.8) !important;
    z-index: 999999 !important;
    justify-content: center !important;
    align-items: center !important;
}

#miModalSimple[style*="display: flex"] {
    display: flex !important;
}


/* Estilos para el Telefonito WebRTC */
.webrtc-section .phone-dialer .dialer-btn {
    transition: all 0.2s;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
}

.webrtc-section .phone-dialer .dialer-btn:hover {
    background: var(--primary) !important;
    color: white !important;
    transform: scale(0.95);
}

.webrtc-section .phone-dialer .dialer-btn:active {
    transform: scale(0.9);
}

#activeCallPanel {
    transition: all 0.3s;
}

#activeCallPanel .action-btn {
    cursor: pointer;
    transition: all 0.2s;
}

#activeCallPanel .action-btn:hover {
    background: var(--primary) !important;
    color: white !important;
    transform: translateY(-2px);
}

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

#activeCallPanel .fa-phone-volume {
    animation: pulse 2s infinite;
}



/* Tarjetas modernas */
.stat-card {
  background: white;
  padding: 24px;
  border-radius: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  text-align: center;
  transition: all 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.stat-title { font-size: 13px; color: #6b7280; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-value { font-size: 36px; font-weight: 700; color: #1f2937; margin-bottom: 8px; }
.stat-change { font-size: 12px; }
.stat-change.positive { color: #10b981; }
.stat-change.negative { color: #ef4444; }

/* Tabla de agentes */
.agents-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.agents-table th { text-align: left; padding: 12px 8px; color: #6b7280; font-weight: 500; border-bottom: 1px solid #e5e7eb; }
.agents-table td { padding: 12px 8px; border-bottom: 1px solid #f3f4f6; }
.status-badge { display: inline-block; padding: 4px 8px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.status-badge.available { background: #d1fae5; color: #065f46; }
.status-badge.busy { background: #fee2e2; color: #991b1b; }
.status-badge.away { background: #fef3c7; color: #92400e; }

/* Llamadas en tiempo real */
.calls-card { background: white; border-radius: 24px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.call-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f3f4f6; }
.call-item .call-status { margin-left: auto; font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.call-item.incoming .call-status { background: #fee2e2; color: #991b1b; }
.call-item.waiting .call-status { background: #fef3c7; color: #92400e; }
.call-item.ended .call-status { background: #d1fae5; color: #065f46; }

/* Actividad reciente */
.activity-timeline { display: flex; flex-direction: column; gap: 12px; }
.activity-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.activity-item span { margin-left: auto; color: #9ca3af; font-size: 11px; }
.activity-item i { width: 24px; color: #6b7280; }

/* Gráficos */
.chart-card { background: white; border-radius: 24px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.chart-legend, .channel-legend { display: flex; gap: 16px; justify-content: center; margin-top: 16px; font-size: 12px; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 10px; margin-right: 6px; }
.time-labels { display: flex; justify-content: space-between; margin-top: 12px; color: #9ca3af; font-size: 10px; }
.table-card, .activity-card { background: white; border-radius: 24px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }

/* ==================== ESTILOS PARA REPORTES ==================== */
.reportes-container { background: #f0f2f5; min-height: 100vh; padding: 20px; }
.reportes-header { background: linear-gradient(135deg, #0d5d56 0%, #0a4a44 100%); color: white; padding: 25px 30px; border-radius: 15px; margin-bottom: 25px; }
.reportes-header h1 { font-size: 28px; margin-bottom: 10px; }
.reportes-header p { opacity: 0.8; font-size: 14px; }

.reportes-tabs { display: flex; flex-wrap: wrap; gap: 8px; background: white; padding: 12px 20px; border-radius: 12px; margin-bottom: 25px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.tab-btn { padding: 10px 18px; border: none; background: transparent; cursor: pointer; font-size: 13px; font-weight: 500; border-radius: 8px; color: #4a5568; }
.tab-btn i { margin-right: 8px; }
.tab-btn:hover { background: #e9ecef; }
.tab-btn.active { background: #0d5d56; color: white; }

.tab-content { display: none; animation: fadeIn 0.3s; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.cdr-filters, .report-header { background: white; border-radius: 12px; padding: 20px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.section-title { color: #0d5d56; margin-bottom: 20px; font-size: 16px; }

.filter-row { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 15px; }
.filter-group { flex: 1; min-width: 180px; }
.filter-group label { display: block; font-size: 12px; font-weight: 600; color: #4a5568; margin-bottom: 5px; }
.filter-group input, .filter-group select { width: 100%; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 8px; font-size: 14px; }

.btn-advanced-toggle { background: #f0fdf9; border: 1px solid #0d5d56; color: #0d5d56; padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; margin: 10px 0; display: inline-flex; align-items: center; gap: 8px; }
.filter-actions, .filter-bar { display: flex; gap: 12px; justify-content: flex-end; margin-top: 15px; flex-wrap: wrap; }

.btn { padding: 10px 20px; border: none; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; }
.btn-primary { background: #0d5d56; color: white; }
.btn-secondary { background: #e2e8f0; color: #4a5568; }
.btn-success { background: #2f855a; color: white; }

.stats-cards, .kpi-cards { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 20px; }
.stat-card { flex: 1; min-width: 150px; background: white; padding: 15px 20px; border-radius: 12px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-left: 4px solid #0d5d56; }
.stat-card .stat-number, .stat-card .stat-value { font-size: 28px; font-weight: bold; color: #0d5d56; display: block; }
.stat-card .stat-label { font-size: 12px; color: #718096; margin-top: 5px; }

.kpi-card { flex: 1; min-width: 200px; background: linear-gradient(135deg, #0d5d56 0%, #0a4a44 100%); color: white; padding: 25px; border-radius: 12px; text-align: center; }
.kpi-card .kpi-value { font-size: 36px; font-weight: bold; }

.data-table { width: 100%; border-collapse: collapse; background: white; border-radius: 12px; overflow: hidden; }
.data-table th { background: #f0fdf9; padding: 12px 15px; text-align: left; font-weight: 600; color: #0d5d56; border-bottom: 2px solid #0d5d56; }
.data-table td { padding: 12px 15px; border-bottom: 1px solid #e2e8f0; color: #2d3748; }
.data-table tr:hover { background: #f0fdf9; }

.status-badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.status-badge.ANSWERED { background: #c6f6d5; color: #22543d; }
.status-badge.NOANSWER { background: #fed7d7; color: #742a2a; }

.chart-container { background: white; padding: 20px; border-radius: 12px; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.ocupacion-grid { display: flex; flex-wrap: wrap; gap: 20px; }
.ocupacion-card { flex: 1; min-width: 280px; background: white; border-radius: 12px; padding: 20px; border-top: 4px solid #0d5d56; }
.progress-bar { background: #e2e8f0; border-radius: 10px; height: 24px; overflow: hidden; }
.progress { height: 100%; display: flex; align-items: center; justify-content: center; color: white; font-size: 12px; font-weight: bold; }

.pagination { display: flex; justify-content: center; gap: 8px; padding: 15px; border-top: 1px solid #e2e8f0; }
.pagination button { padding: 6px 12px; border: 1px solid #ddd; background: white; border-radius: 6px; cursor: pointer; }
.pagination button.active { background: #0d5d56; color: white; }

.loading-text { text-align: center; padding: 40px; color: #718096; }

@media (max-width: 768px) {
    .reportes-container { padding: 10px; }
    .filter-row { flex-direction: column; }
    .filter-group { width: 100%; }
    .filter-actions { flex-direction: column; }
    .filter-actions .btn { width: 100%; justify-content: center; }
    .reportes-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .tab-btn { white-space: nowrap; }
}
/* Asegurar que FontAwesome esté cargado */
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css');

/* Badges de motivos */
.motivo-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.motivo-busy { background: #fee2e2; color: #991b1b; border-left: 3px solid #ef4444; }
.motivo-noanswer { background: #ffedd5; color: #9a3412; border-left: 3px solid #f97316; }
.motivo-congestion { background: #fef3c7; color: #92400e; border-left: 3px solid #f59e0b; }
.motivo-failed { background: #f3f4f6; color: #374151; border-left: 3px solid #6b7280; }
.motivo-unknown { background: #dbeafe; color: #1e40af; border-left: 3px solid #3b82f6; }

/* Tiempo de timbrado */
.ring-time-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #f1f5f9;
    color: #475569;
}

.ring-time-badge.long-ring {
    background: #fee2e2;
    color: #dc2626;
}

.ring-time-badge.medium-ring {
    background: #fed7aa;
    color: #9a3412;
}

/* Números de teléfono */
.phone-number {
    font-family: monospace;
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 13px;
}

/* Unique ID */
.uniqueid-badge {
    font-family: monospace;
    font-size: 11px;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.uniqueid-badge:hover {
    background: #e2e8f0;
}

/* Íconos de la tabla */
.data-table th i {
    margin-right: 5px;
    color: #0d5d56;
}

/* Botón de detalles */
.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    color: #0d5d56;
    transition: all 0.2s;
}

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

.no-data {
    color: #cbd5e0;
}
/* ==================== ESTILOS PARA REPORTE ABANDONADAS ==================== */

/* Badges para campaña y grupo */
.badge-campana {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    background: #dbeafe;
    color: #1e40af;
}

.badge-grupo {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    background: #f1f5f9;
    color: #475569;
}

/* Tiempo de timbrado */
.ring-time {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    background: #f1f5f9;
    color: #475569;
    font-family: monospace;
}

.ring-time.badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

.ring-time.badge-warning {
    background: #fef3c7;
    color: #d97706;
}

/* Números de teléfono */
.phone-number {
    font-family: monospace;
    font-weight: 500;
    background: #f8fafc;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
}

/* Botón de detalles */
.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    color: #0d5d56;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #e2e8f0;
    transform: scale(1.05);
}

/* Asegurar que las tarjetas se vean igual que las de CDR */
.stat-card {
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-left: 4px solid #0d5d56;
}

.stat-card .stat-number {
    font-size: 28px;
    font-weight: bold;
    color: #0d5d56;
    display: block;
}

.stat-card .stat-label {
    font-size: 12px;
    color: #718096;
    margin-top: 5px;
}
/* Top Anexos Container */
.top-anexos-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.top-anexos-container h4 {
    margin: 0 0 15px 0;
    color: #0d5d56;
    font-size: 14px;
}

/* ==================== BOTÓN DEVOLVER LLAMADA ==================== */
.btn-call {
    background: #0d5d56;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-call:hover {
    background: #0a4a44;
    transform: scale(1.02);
}



/* Botón de grabación de audio */
#grabarAudioBtn {
    background: var(--light);
    border: 1px solid var(--border);
    color: var(--dark);
    transition: all 0.2s ease;
}

#grabarAudioBtn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

#grabarAudioBtn:active {
    transform: scale(0.95);
}

/* Estilo cuando está grabando */
#grabarAudioBtn.grabando {
    background: #ef4444 !important;
    color: white !important;
    animation: pulseGrabacion 1s infinite;
}

/* Animación de pulsación */
@keyframes pulseGrabacion {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Indicador flotante de grabación */
#indicadorGrabacion {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    font-family: monospace;
    font-size: 14px;
}



/* Estilo para botones en vista previa */
.template-preview .btn-preview {
  display: inline-block;
  padding: 8px 16px;
  margin: 5px;
  background: var(--primary);
  color: white;
  border-radius: 30px;
  font-size: 13px;
  cursor: default;
}

/* Estilo para mensajes con botones en el chat */
.message-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chat-button {
  background: var(--primary);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.chat-button:hover {
  background: #0a4a44;
  transform: scale(1.02);
}

/* Números grandes en tarjetas de monitoreo */
@media screen and (max-width: 1380px) {
  #agentesActivosCount, #chatsEsperaCount, #chatsActivosTotal,
  #resueltosHoy, #tiempoPromedio, #inactivosCount {
    font-size: 24px !important;
  }
  /* Padding de tarjetas inline del monitoreo */
  .metrics-grid-6 > div {
    padding: 14px !important;
  }
}

/* Grid de métricas del monitoreo */
.metrics-grid-6 {
  display: grid !important;
  grid-template-columns: repeat(6, 1fr) !important;
  gap: 15px;
  margin-bottom: 25px;
}

@media screen and (max-width: 1380px) {
  .metrics-grid-6 {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px;
  }
}

@media screen and (max-width: 1024px) {
  .metrics-grid-6 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media screen and (max-width: 768px) {
  .metrics-grid-6 {
    grid-template-columns: repeat(1, 1fr) !important;
  }
}

/* =====================================================================
   RESPONSIVE - PANTALLAS MEDIANAS (evita necesitar zoom al 80%)
   Targets: laptops 1280-1440px y monitores estándar 1024-1280px
   ===================================================================== */

/* Dashboard flex layout */
.dashboard {
  display: flex !important; /* sobreescrito cuando está activo */
}
.dashboard[style*="flex"] {
  flex-direction: row;
}

/* ── Pantallas entre 1024px y 1380px ── */
@media screen and (max-width: 1380px) {
  .sidebar { width: 210px; }
  .menu-text { font-size: 13px; }
  .menu-item { padding: 9px 12px; margin: 2px 6px; gap: 9px; }
  .menu-icon { font-size: 16px; }
  .avatar { width: 54px; height: 54px; font-size: 20px; }
  .user-name { font-size: 14px; }
  .user-role { font-size: 11px; }

  .content-area { padding: 16px 18px; }
  .header { padding: 10px 18px; }
  .header-left h2 { font-size: 18px; }

  /* Dashboard home */
  .welcome-section { padding: 20px 24px; }
  .welcome-title { font-size: 20px; }
  .welcome-subtitle { font-size: 14px; margin-bottom: 16px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
  .stat-card { padding: 14px 16px; gap: 12px; }
  .stat-icon { width: 46px; height: 46px; font-size: 20px; }
  .stat-number { font-size: 22px; }
  .stat-info h3 { font-size: 12px; }

  /* Chats layout */
  .chats-layout { grid-template-columns: 200px 1fr 200px; gap: 10px; height: calc(100vh - 145px); }
  .chat-list-header { padding: 14px; }

  /* Monitoreo - grids de 6 columnas a 3 */
  [style*="grid-template-columns: repeat(6, 1fr)"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  [style*="grid-template-columns: repeat(4, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Tablas */
  .data-table th, .data-table td { padding: 9px 12px; font-size: 13px; }

  /* Buttons */
  .btn { padding: 7px 14px; font-size: 13px; }
  .logout-btn { padding: 6px 12px; font-size: 13px; }
}

/* ── Pantallas entre 768px y 1024px ── */
@media screen and (max-width: 1024px) {
  .sidebar { width: 190px; }
  .menu-text { font-size: 12px; }
  .menu-item { padding: 8px 10px; margin: 2px 5px; }

  .content-area { padding: 12px 14px; }

  /* Chats: ocultar panel lateral derecho si no hay espacio */
  .chats-layout { grid-template-columns: 230px 1fr; gap: 10px; height: calc(100vh - 135px); }
  .chat-info-panel { display: none; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* Monitoreo grids */
  [style*="grid-template-columns: repeat(6, 1fr)"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ── Pantallas hasta 768px (móvil) ── */
@media screen and (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -220px;
    width: 220px;
    top: 0; bottom: 0;
    z-index: 1000;
    transition: left 0.3s ease;
  }
  .sidebar.open { left: 0; }

  .chats-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .content-area { padding: 10px; }
}






/* ================================================================
   CDR - Estilos para botones de grabación y chat
   ================================================================ */

/* Botón de grabación - Reproducir */
.btn-recording {
    background: #0d5d56;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.btn-recording:hover {
    background: #0a4a44;
    transform: scale(1.02);
}

/* Botón de descarga */
.btn-download {
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.btn-download:hover {
    background: #4b5563;
    transform: scale(1.02);
}

/* Botón de chat */
.btn-chat {
    background: #0d5d56;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s ease;
}

.btn-chat:hover {
    background: #0a4a44;
    transform: scale(1.02);
}

/* Badge para el anexo */
.anexo-badge {
    font-family: monospace;
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

/* Tabla CDR - mejorar visual */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: #0d5d56;
    color: white;
    padding: 12px 8px;
    font-weight: 600;
    font-size: 12px;
    text-align: left;
}

.data-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}

.data-table tr:hover {
    background: #f8fafc;
}








/* Estilos para Reportes IA */
.ia-reportes-section .stats-container {
  padding: 20px;
}

.ia-reportes-section .filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: end;
}

.ia-reportes-section .filter-group {
  flex: 1;
  min-width: 150px;
}

.ia-reportes-section .filter-group label {
  display: block;
  font-size: 12px;
  color: var(--gray);
  margin-bottom: 5px;
}

.ia-reportes-section .filter-group input,
.ia-reportes-section .filter-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.ia-reportes-section .ia-stats-grid .stat-card {
  transition: transform 0.2s;
}

.ia-reportes-section .ia-stats-grid .stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}


/* En tu archivo CSS o en el <style> */
.chat-preview {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: block !important;
  line-height: 1.4 !important;
}

.chat-preview * {
  display: inline !important;
  white-space: nowrap !important;
}

</style>
</head>

<body>