/* =========================================
   GENESIS ENGINE V2.6 - MASTER STYLE (FULL PRODUCTION)
   ========================================= */

/* 1. RESET Y BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

:root {
  /* PALETA DE MARCA */
  --brand-black: #06180A;   
  --brand-berry: #862359;   
  --brand-olive: #B7B932;   
  
  /* TEMA CLARO (LIGHT) */
  --bg-app: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  --bg-sidebar: rgba(255, 255, 255, 0.7);
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-input: #ffffff;
  --bg-hover: rgba(244, 244, 245, 0.8);
  
  --text-main: var(--brand-black);
  --text-muted: #71717a;
  --border-color: #e4e4e7;
  
  /* ESTADOS */
  --color-primary: var(--brand-berry);
  --color-success: var(--brand-olive);
  --color-danger: #ef4444;
  
  /* DIMENSIONES Y EFECTOS */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-glow-primary: 0 4px 15px rgba(134, 35, 89, 0.3);
  --sidebar-width: 260px;
  --header-height-mobile: 80px;
  --radius: 12px;
}

/* TEMA OSCURO (DARK MODE) */
body.dark-mode {
  --bg-app: linear-gradient(135deg, #18181b 0%, #09090b 100%);       
  --bg-sidebar: rgba(39, 39, 42, 0.7);   
  --bg-card: rgba(39, 39, 42, 0.85);      
  --bg-input: #3f3f46;
  --bg-hover: rgba(63, 63, 70, 0.7);
  
  --text-main: #ffffff;
  --text-muted: #a1a1aa;
  --border-color: #3f3f46;
  
  --color-primary: #d9468f; 
  --color-success: #eef255; 
  
  --shadow-card: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow-primary: 0 4px 25px rgba(217, 70, 143, 0.5); 
}

body {
  font-family: 'Inter Tight', sans-serif;
  background: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* =========================================
   REMOVED BACKGROUND ANIMATION
   ========================================= */

/* Para que el contenido principal siempre esté sobre el fondo animado (z-index 0) */
.main-content, .sidebar {
  position: relative;
  z-index: 1;
}

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

/* =========================================
   COMPONENTES DE UI
   ========================================= */

/* BOTONES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-size: 12px;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  color: var(--text-main);
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-berry), #5e173e);
  color: #fff !important;
  box-shadow: var(--shadow-glow-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.15);
  box-shadow: 0 6px 20px rgba(134, 35, 89, 0.4);
}

.btn-secondary {
  background: var(--bg-sidebar); /* Blanco en Light, Negro en Dark */
  color: var(--text-main);    /* Negro en Light, Blanco en Dark */
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* TABS DE CONFIGURACIÓN */
.stab-btn {
  flex: 1;
  min-width: 80px;
  padding: 10px 14px;
  border: none;
  border-radius: 9px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.stab-btn:hover {
  background: var(--bg-card);
  color: var(--text-main);
}

.stab-btn.active {
  background: var(--bg-card);
  color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stab-panel {
  animation: stabFadeIn 0.2s ease;
}

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

@media (max-width: 600px) {
  .stab-btn {
    font-size: 10px;
    padding: 8px 6px;
  }
}

/* TITULOS DE PÁGINA */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0;
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* TARJETAS DE ESTADÍSTICAS (KPIs) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 36px;
  font-weight: 800;
  margin-top: 8px;
  color: var(--color-primary);
}

/* GRÁFICOS Y ANALÍTICA */
.chart-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
}

.analytics-dashboard {
  display: grid;
  gap: 20px;
  margin-bottom: 40px;
  grid-template-columns: 2fr 1fr;
}

/* TARJETAS DE ASISTENTES */
.assistants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.assistant-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  transition: 0.3s;
}

.assistant-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-primary);
}

.assistant-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.assistant-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}

/* LISTAS DE NÚMEROS */
.numbers-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.number-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

/* FORMULARIOS E INPUTS */
.form-input, .form-select, textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-input);
  color: var(--text-main);
  margin-bottom: 16px;
  display: block;
  font-family: inherit;
  transition: 0.2s;
}

.form-input:focus, .form-select:focus, textarea:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(134, 35, 89, 0.1);
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  display: block;
  color: var(--text-main);
}

/* FILTROS DE FECHA */
.filter-group {
  display: inline-flex;
  background: var(--bg-hover);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.filter-btn {
  background: transparent;
  border: none;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 7px;
  transition: 0.2s;
}

.filter-btn.active {
  background: var(--bg-card);
  color: var(--color-primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* FACTURACIÓN Y BILLETERA */
.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

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

.wallet-card {
  background: linear-gradient(135deg, var(--brand-black), #4a1331);
  color: white;
  border-radius: 16px;
  padding: 30px;
  position: relative;
  overflow: hidden;
  margin-bottom: 30px;
  box-shadow: var(--shadow-glow-primary);
}

.wallet-balance-value {
  font-size: 48px;
  font-weight: 800;
  margin: 10px 0;
  letter-spacing: -1px;
}

/* MODALES */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
}

.modal.show {
  display: flex !important;
}

.modal-content {
  background: var(--bg-card);
  padding: 40px;
  border-radius: 20px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}

/* ADMIN */
.admin-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-user-row {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--brand-berry);
  padding: 16px 24px;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* INTERRUPTOR (SWITCH) */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

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

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

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

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

input:checked + .slider:before {
  transform: translateX(24px);
}

/* TABLAS (Nuevo para Historial de Facturación) */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 12px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-weight: 600;
}
td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

/* =========================================
   DISEÑO DE ESCRITORIO (DESKTOP)
   ========================================= */
@media (min-width: 769px) {
  body {
    display: flex;
  }
  
  .mobile-header, .mobile-overlay {
    display: none !important;
  }

  /* SIDEBAR FIJO */
  .sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 50;
  }
  
  .sidebar-header {
    padding: 32px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
  }
  
  .sidebar-logo-img {
    width: 140px;
    height: auto;
    object-fit: contain;
  }
  
  .sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
  }
  
  .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
  }
  
  .nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-main);
  }
  
.nav-item.active {
    /* Fondo sólido suave del color de marca en lugar de gris/transparente */
    background-color: rgba(134, 35, 89, 0.08) !important; 
    color: var(--brand-berry) !important;
    font-weight: 800;
    border-left: 4px solid var(--brand-berry);
    /* Eliminamos el degradado que se ve sucio */
    background-image: none; 
}

/* Ajuste para Modo Oscuro (asegura legibilidad) */
body.dark-mode .nav-item.active {
    background-color: rgba(217, 70, 143, 0.15) !important;
    color: #d9468f !important; /* Berry más brillante */
    border-left-color: #d9468f;
}
  
  .sidebar-footer {
    padding: 0;
    border-top: none;
  }

  /* CONTENIDO PRINCIPAL */
  .main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px;
    width: calc(100% - var(--sidebar-width));
  }
}

/* =========================================
   DISEÑO MÓVIL (MOBILE) - TOUCH FRIENDLY V2 (FINAL)
   ========================================= */
@media (max-width: 768px) {
  
  body {
    display: block !important;
    overflow-x: hidden;
    background: var(--bg-app);
  }

  /* HEADER SUPERIOR */
  .mobile-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    height: 80px; 
    padding: 0 24px;
    background: var(--bg-card); 
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
  }

  .mobile-logo {
    max-width: 140px;
    height: auto;
  }

  .btn-menu {
    font-size: 28px;
    background: var(--bg-hover);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: var(--text-main);
    cursor: pointer; 
  }

  /* SIDEBAR (EL MENÚ) */
  .sidebar {
    display: none;
    position: fixed;
    top: 80px; /* Coincide con altura header */
    left: 0;
    width: 100%;
    height: calc(100vh - 80px);
    background: var(--bg-app);
    z-index: 1000;
    flex-direction: column;
    overflow-y: auto;
    padding-bottom: 60px;
  }

  .sidebar.open {
    display: flex !important;
    animation: slideIn 0.3s ease;
  }

  /* Ocultamos logo interno */
  .sidebar-header, .sidebar-logo-img {
    display: none !important;
  } 

  /* NAVEGACIÓN TÁCTIL (ESTILO APP) */
  .sidebar-nav {
    padding: 24px 20px;
    gap: 12px;
  }

  .nav-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 18px 24px; /* Área de toque GRANDE */
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    transition: transform 0.1s, background 0.2s;
  }

  /* Efecto al tocar con el dedo */
  .nav-item:active {
    transform: scale(0.97);
    background: var(--bg-hover);
  }

  /* Ítem Activo */
  .nav-item.active {
    background: var(--color-primary) !important;
    color: white !important;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(134, 35, 89, 0.3);
  }

  /* FOOTER DEL MENÚ (PERFIL) */
  .sidebar-footer {
    margin: 20px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
  }

  /* OVERLAY */
  .mobile-overlay {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 900;
    display: none;
    backdrop-filter: blur(5px);
  }
  .mobile-overlay.show {
    display: block;
  }

  /* AJUSTES CONTENIDO */
  .main-content {
    margin-left: 0 !important;
    padding: 20px;
    width: 100%;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header button {
    width: 100%;
    height: 50px;
    font-size: 16px;
  }
  
  .analytics-dashboard {
    grid-template-columns: 1fr;
  }

  .admin-user-row {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .wallet-card {
    padding: 20px;
  }

  .wallet-balance-value {
    font-size: 36px;
  }
  
  @keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

body.auth-guard {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease-in-out;
}

body.auth-guard.app-ready {
    opacity: 1;
    pointer-events: auto;
}

/* =======================================================
   REDELIVERY: ESTILO PREMIUM 
    Agentes y Marcador
   ======================================================= */

/* 1. EL MARCADOR (Targeting específico para no afectar Analítica) */
#dashboard-section .chart-card {
    /* Fondo Degradado Berry "Lujoso" */
    background: linear-gradient(135deg, #2d0f1f 0%, var(--brand-berry) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px -10px rgba(134, 35, 89, 0.5); /* Resplandor */
    border-radius: 16px;
    padding: 30px;
    position: relative;
    overflow: hidden;
}

/* Texto del Título "MARCADOR DE PRUEBA" */
#dashboard-section .chart-card h3 {
    color: white !important;
    letter-spacing: 1.5px;
    opacity: 0.9;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
    display: inline-block;
}

/* Etiquetas (Labels) */
#dashboard-section .chart-card label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Inputs y Selects dentro del Marcador */
#dashboard-section .chart-card .form-input,
#dashboard-section .chart-card .form-select {
    background: rgba(255, 255, 255, 0.1); /* Transparente */
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(5px);
}

#dashboard-section .chart-card .form-input:focus,
#dashboard-section .chart-card .form-select:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: white;
    box-shadow: 0 0 0 4px rgba(255,255,255,0.1);
}

/* Placeholder (Texto de ayuda) */
#dashboard-section .chart-card input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* Botón "LLAMAR" - Debe resaltar (Color Lima/Oro) */
#dashboard-section .chart-card #btnDial {
    background-color: #B7B932; /* Tu color Brand Olive */
    color: #050505 !important;
    font-weight: 800;
    border: none;
    box-shadow: 0 5px 15px rgba(183, 185, 50, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

#dashboard-section .chart-card #btnDial:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(183, 185, 50, 0.6);
    background-color: #dbe032;
}


/* 2. TARJETAS DE AGENTES (Efecto Flotante 3D) */
.assistant-card {
    background: var(--bg-card); /* ✅ CORREGIDO: Usa variable dinámica */
    border: 1px solid var(--border-color) !important; /* Agregamos borde sutil para modo oscuro */
    /* La línea de color izquierda se mantiene porque está inline en el HTML */
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    z-index: 1;
}

/* Efecto HOVER: La tarjeta se levanta */
.assistant-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-glow-primary);
    z-index: 2;
    border-color: var(--brand-berry) !important;
}

/* Icono del Agente */
.assistant-icon {
    border: 3px solid var(--bg-app); /* ✅ CORREGIDO: Borde dinámico */
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    width: 52px;
    height: 52px;
}

/* Botón "Editar" dentro de la tarjeta */
.assistant-card button:first-of-type {
    background-color: var(--bg-hover) !important; /* ✅ CORREGIDO */
    color: var(--text-main) !important; /* ✅ CORREGIDO */
    border: 1px solid var(--border-color) !important;
    font-weight: 600;
}
.assistant-card button:first-of-type:hover {
    background-color: var(--border-color) !important;
    filter: brightness(1.1);
}
/* =========================================
   GENESIS CALENDAR (FULLCALENDAR OVERRIDES)
   ========================================= */

/* Contenedor y Tipografía */
.fc {
    font-family: 'Inter Tight', sans-serif !important;
}

/* Encabezado (Mes/Semana) */
.fc .fc-toolbar-title {
    font-size: 20px !important;
    font-weight: 800 !important;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

/* Botones de Navegación (Hoy, Atrás, Adelante) */
.fc .fc-button-primary {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
    font-weight: 700;
    text-transform: capitalize;
    box-shadow: none !important;
    transition: all 0.2s;
}
.fc .fc-button-primary:hover {
    background-color: var(--bg-hover) !important;
    transform: translateY(-1px);
}
.fc .fc-button-primary:disabled {
    opacity: 0.6;
}

/* Días de la semana */
.fc .fc-col-header-cell-cushion {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    padding: 10px 0 !important;
}

/* Celdas del calendario */
.fc .fc-daygrid-day-number {
    font-weight: 600;
    color: var(--text-main);
    font-size: 13px;
    padding: 8px !important;
}
.fc .fc-day-today {
    background-color: rgba(134, 35, 89, 0.03) !important; /* Berry muy suave */
}

/* LOS EVENTOS (LAS CITAS) */
.fc-event {
    border: none !important;
    border-radius: 6px !important;
    padding: 2px 4px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.1s;
}
.fc-event:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}

/* Indicador de "Hora Actual" en vista semanal */
.fc .fc-timegrid-now-indicator-line {
    border-color: var(--brand-berry);
}
.fc .fc-timegrid-now-indicator-arrow {
    border-color: var(--brand-berry);
}


/* =========================================
   FIX: ALINEACIÓN Y ESTRUCTURA (Agrega al final)
   ========================================= */

/* 1. Reset Global para evitar desbordes */
* {
    box-sizing: border-box; /* Vital para que padding no sume ancho */
}

/* 2. Tarjetas de Agentes (Altura Igual y Botones al fondo) */
.assistant-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%; /* Ocupar toda la altura de la celda del grid */
    min-height: 220px; /* Altura mínima para uniformidad */
}

/* El contenido superior de la tarjeta debe empujar los botones abajo */
.assistant-card .assistant-header {
    flex: 1; 
    margin-bottom: 15px; /* Espacio seguro antes de los botones */
}

/* 3. Inputs y Selects (Alineación perfecta en formularios) */
.form-group {
    margin-bottom: 15px;
    width: 100%;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text-main);
}

.form-group input, 
.form-group select, 
.form-group textarea {
    width: 100%; /* Forzar ancho completo */
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background-color: var(--bg-input);
    color: var(--text-main);
}

/* 4. Lista de Teléfonos (Alinear texto izq y botón der) */
.number-item {
    display: flex;
    justify-content: space-between; /* Texto a la izq, X a la der */
    align-items: center; /* Centrado vertical */
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 8px;
    background: var(--bg-hover);
}

/* 5. Modal Footer (Botones alineados a la derecha siempre) */
.modal-footer {
    display: flex;
    justify-content: flex-end; /* Empujar botones a la derecha */
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}


/* --- ESTILOS PARA SELECTOR DE PLANES EN REGISTRO --- */
.plan-selector-container {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 columnas */
    gap: 10px;
    margin-bottom: 20px;
    margin-top: 10px;
}

.plan-option {
    position: relative;
    cursor: pointer;
}

.plan-option input {
    display: none; /* Ocultar el radio button feo */
}

.plan-card-mini {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    transition: all 0.2s;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--bg-card);
}

/* Estado Seleccionado */
.plan-option input:checked + .plan-card-mini {
    border-color: #862359; /* Tu color Berry */
    background-color: var(--bg-hover);
    box-shadow: 0 0 0 2px #862359;
}

/* Badge de Recomendado */
.best-value-badge {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    background: #862359;
    color: white;
    font-size: 9px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: bold;
    white-space: nowrap;
}

.plan-name { font-size: 13px; font-weight: bold; color: #333; }
.plan-price { font-size: 16px; font-weight: 800; color: #862359; margin: 4px 0; }
.plan-desc { font-size: 10px; color: #666; line-height: 1.3; }

/* Responsive: 1 columna en móviles */
@media (max-width: 500px) {
    .plan-selector-container { grid-template-columns: 1fr; }
}


/* =========================================
   WIZARD DE CREACIÓN DE AGENTE (3 PASOS)
   ========================================= */

/* Modal más ancho para el wizard */
#createModal .modal-content {
  max-width: 600px;
}

/* Barra de progreso del wizard */
.wizard-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 32px;
  padding: 0 10px;
}

.wizard-progress-step {
  display: flex;
  align-items: center;
  gap: 0;
}

.wizard-step-indicator {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  border: 2px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-muted);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.wizard-step-indicator.active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(134, 35, 89, 0.15);
}

.wizard-step-indicator.completed {
  border-color: #059669;
  background: #059669;
  color: #fff;
}

.wizard-step-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-left: 8px;
  white-space: nowrap;
  transition: color 0.3s;
}

.wizard-step-label.active {
  color: var(--color-primary);
}

.wizard-step-label.completed {
  color: #059669;
}

.wizard-step-connector {
  width: 40px;
  height: 2px;
  background: var(--border-color);
  margin: 0 8px;
  transition: background 0.3s;
  flex-shrink: 0;
}

.wizard-step-connector.completed {
  background: #059669;
}

/* Contenedor de pasos (slide) */
.wizard-steps-container {
  position: relative;
  overflow: hidden;
  min-height: 280px;
}

.wizard-step-content {
  display: none;
  animation: wizardFadeIn 0.3s ease;
}

.wizard-step-content.active {
  display: block;
}

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

/* Grid de tarjetas de industria */
.industry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.industry-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 8px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-input);
  text-align: center;
  gap: 6px;
  min-height: 80px;
}

.industry-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 24px rgba(134, 35, 89, 0.12);
  border-color: var(--text-muted);
}

.industry-card.selected {
  border-color: var(--color-primary);
  background: rgba(134, 35, 89, 0.06);
  box-shadow: 0 0 0 3px rgba(134, 35, 89, 0.1);
}

body.dark-mode .industry-card.selected {
  background: rgba(217, 70, 143, 0.1);
  border-color: #d9468f;
}

.industry-card-icon {
  font-size: 28px;
  line-height: 1;
}

.industry-card-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

/* Agent type cards (Inbound/Outbound) */
.agent-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.agent-type-card {
  padding: 18px 14px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-input);
  text-align: center;
}

.agent-type-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.agent-type-card.selected {
  border-color: var(--color-primary);
  background: rgba(134, 35, 89, 0.06);
  box-shadow: 0 0 0 3px rgba(134, 35, 89, 0.1);
}

body.dark-mode .agent-type-card.selected {
  background: rgba(217, 70, 143, 0.1);
  border-color: #d9468f;
}

.agent-type-card .type-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.agent-type-card .type-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.agent-type-card .type-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Wizard footer buttons */
.wizard-footer {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.wizard-footer .btn {
  flex: 1;
}

.wizard-footer .btn-back {
  flex: 0 0 auto;
  background: var(--bg-hover);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

/* Confirmation summary card */
.wizard-summary-card {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.wizard-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}

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

.wizard-summary-label {
  font-weight: 600;
  color: var(--text-muted);
}

.wizard-summary-value {
  font-weight: 700;
  color: var(--text-main);
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-summary-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 2px solid var(--color-primary);
}

.wizard-summary-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-berry), #5e173e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
}

.wizard-summary-name {
  font-size: 18px;
  font-weight: 800;
}

/* =========================================
   STEPPER DE CREACIÓN (PROGRESO EN VIVO)
   ========================================= */

.creation-stepper {
  padding: 20px 0;
}

.stepper-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.stepper-step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.stepper-step.active {
  border-color: var(--color-primary);
  background: rgba(134, 35, 89, 0.04);
}

.stepper-step.completed {
  border-color: #059669;
  background: rgba(5, 150, 105, 0.04);
}

.stepper-step.error {
  border-color: var(--color-danger);
  background: rgba(239, 68, 68, 0.04);
}

.stepper-step-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  background: var(--bg-hover);
  color: var(--text-muted);
  transition: all 0.3s ease;
}

.stepper-step.active .stepper-step-icon {
  background: var(--color-primary);
  color: #fff;
  animation: stepPulse 1.5s infinite;
}

.stepper-step.completed .stepper-step-icon {
  background: #059669;
  color: #fff;
  animation: none;
}

.stepper-step.error .stepper-step-icon {
  background: var(--color-danger);
  color: #fff;
  animation: none;
}

.stepper-step-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.stepper-step.active .stepper-step-text {
  color: var(--color-primary);
}

.stepper-step.completed .stepper-step-text {
  color: #059669;
}

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

.stepper-error-msg {
  font-size: 11px;
  color: var(--color-danger);
  margin-top: 2px;
  display: none;
}

.stepper-step.error .stepper-error-msg {
  display: block;
}

/* Barra de progreso del stepper */
.stepper-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-hover);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.stepper-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-berry), #d9468f);
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s ease;
}

.stepper-progress-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

@keyframes stepPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.95); }
}

/* Pantalla de éxito */
.creation-success {
  text-align: center;
  padding: 20px 0;
  animation: wizardFadeIn 0.4s ease;
}

.success-check-container {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
}

.success-check-circle {
  fill: none;
  stroke: #059669;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: drawCircle 0.6s ease forwards;
}

.success-check-path {
  fill: none;
  stroke: #059669;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: drawCheck 0.4s 0.4s ease forwards;
}

@keyframes drawCircle {
  to { stroke-dashoffset: 0; }
}

@keyframes drawCheck {
  to { stroke-dashoffset: 0; }
}

.success-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-main);
}

.success-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.success-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* Stepper error retry buttons */
.stepper-error-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

/* Mobile responsive for wizard */
@media (max-width: 768px) {
  #createModal .modal-content {
    max-width: 100%;
    padding: 24px 20px;
    border-radius: 16px 16px 0 0;
    max-height: 95vh;
  }

  .industry-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .wizard-step-label {
    display: none;
  }

  .wizard-step-connector {
    width: 24px;
  }

  .agent-type-grid {
    grid-template-columns: 1fr;
  }

  .wizard-progress {
    margin-bottom: 24px;
  }
}