/* =============================================
   1. FUNDACIÓN Y VARIABLES GLOBALES
   ============================================= */
:root {
    --primary: #007bff;
    --primary-dark: #0056b3;
    --primary-light: #e6f2ff;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --dark: #212529;
    --muted: #6c757d;
    --light: #f8f9fa;
    --white: #ffffff;
    --line: #dee2e6;
    --bg: #f8f9fa;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
    font-size: 15px;
}

body.login-active {
    background-color: var(--light);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}


/* =============================================
   2. LAYOUT PRINCIPAL (APP Y SIDEBAR) - DISEÑO MODERNO
   ============================================= */
.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  /* Nuevo fondo más oscuro y profesional */
  background-color: #111827; 
  color: var(--light);
  display: flex;
  flex-direction: column;
  padding: 1rem; /* Ajuste de padding */
  position: fixed;
  height: 100%;
  width: 260px;
  z-index: 100;
}

/* Separador visual para el logo */
.sidebar h1 {
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem; /* Un poco más de espacio vertical */
  border-radius: 8px;
  text-decoration: none;
  color: #9ca3af; /* Color de texto más suave */
  transition: var(--transition);
  position: relative; /* Necesario para el indicador */
  font-weight: 500;
}

/* Hover sutil */
.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--white);
}

/* Estilo del link activo (sin fondo azul) */
.nav-link.active {
  background-color: transparent;
  color: var(--white); /* Texto más brillante */
  font-weight: 600;
}

/* El nuevo indicador visual para el link activo */
.nav-link.active::before {
  content: '';
  position: absolute;
  left: -1rem; /* Se posiciona fuera del padding */
  top: 50%;
  transform: translateY(-50%);
  height: 60%;
  width: 4px;
  background-color: var(--primary);
  border-radius: 0 4px 4px 0;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.main-content {
  grid-column: 2 / 3;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;   /* ocupa toda la altura de la ventana */
  overflow-y: auto;
}


.page { display: none; }
.page.active { display: block; animation: fadeIn 0.5s ease-out; }

/* =============================================
   ESTILOS PARA EL NUEVO FOOTER DEL SIDEBAR
   ============================================= */

.sidebar-footer {
    margin-top: auto; /* Empuja el footer hacia abajo */
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Alinea los elementos */
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--light);
    opacity: 0.8;
    /* Para evitar que el correo largo se desborde */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info i {
    font-size: 1.5rem; /* Ícono de usuario más grande */
}

.logout-btn {
    color: var(--muted); /* Mantenemos un color suave por defecto */
    text-decoration: none;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 8px; /* Un poco más redondeado */
    transition: all 0.3s ease; /* Transición suave para todos los cambios */
}

.logout-btn:hover {
    background-color: rgba(220, 53, 69, 0.1); /* Fondo rojo muy claro */
    color: var(--danger); /* El ícono se vuelve rojo intenso */
    transform: scale(1.2) rotate(10deg); /* La animación: crece y rota un poco */
}

/* =============================================
   3. COMPONENTES REUTILIZABLES
   ============================================= */

/* Estilo específico para el botón de WhatsApp */
.btn-whatsapp {
    background-color: #25D366; /* Color verde oficial de WhatsApp */
    color: var(--white);
    border-color: #25D366;
}

.btn-whatsapp:hover {
    background-color: #1DA851; /* Un verde un poco más oscuro al pasar el mouse */
    border-color: #1DA851;
    transform: translateY(-2px);
}

/* --- BOTONES --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 15px;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn.primary { background-color: var(--primary); color: var(--white); border-color: var(--primary); }
.btn.primary:hover { background-color: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-2px); }

.btn.secondary { background-color: var(--primary-light); color: var(--primary); border-color: var(--primary-light); }
.btn.secondary:hover { background-color: #d1e5ff; }

.btn.ghost { background-color: transparent; color: var(--muted); border-color: var(--line); }
.btn.ghost:hover { background-color: var(--light); color: var(--dark); }

.btn.danger { background-color: var(--danger); color: var(--white); border-color: var(--danger); }
.btn.danger:hover { background-color: #c82333; border-color: #c82333; }

.btn.success { background-color: var(--success); color: var(--white); border-color: var(--success); }

.btn-sm { padding: 6px 16px; font-size: 14px; }
.btn-icon {
  padding: 0;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 999px;
}
.table-actions .btn-icon {
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}
.btn-icon i {
  font-size: 1rem;
}

.btn-group { display: flex; border: 1px solid var(--line); border-radius: 50px; overflow: hidden; }
.btn-group .btn { border-radius: 0; border: none; background-color: var(--white); color: var(--muted); }
.btn-group .btn.active { background-color: var(--primary); color: var(--white); }

/* --- TARJETAS (CARDS) --- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem 2rem; position: relative; }
.card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 5px; background-color: var(--primary); border-radius: var(--radius) var(--radius) 0 0; }

/* --- FORMULARIOS --- */
label { display: block; margin-bottom: 0.5rem; font-weight: 600; font-size: 14px; }
input, select, textarea { width: 100%; padding: 10px 15px; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; transition: var(--transition); font-family: inherit; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2); }
fieldset:disabled { opacity: 0.6; pointer-events: none; background-color: #fafafa; }

/* --- TABLAS --- */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead { background-color: var(--light); }
th { font-weight: 600; font-size: 14px; }
.right { text-align: right; }
.table-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; }

/* --- INSIGNIAS (BADGES) --- */
.badge { padding: 4px 10px; border-radius: 50px; font-size: 12px; font-weight: 600; }
.badge-success { background-color: #e9f7ef; color: #28a745; }
.badge-info { background-color: #e8f7fa; color: #17a2b8; }
.badge-danger { background-color: #fceeee; color: #dc3545; }
.badge-warning { background-color: #fff8e9; color: #b45309; }
.badge-muted { background-color: #f1f3f5; color: #6c757d; }

/* --- NOTIFICACIONES (TOASTS) --- */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 5000; display: flex; flex-direction: column; gap: 10px; }
.toast { display: flex; align-items: center; gap: 1rem; background-color: var(--white); color: var(--dark); padding: 1rem; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.15); border-left: 5px solid; min-width: 300px; animation: slideIn 0.4s ease-out; }
.toast.hiding { animation: slideOut 0.4s ease-in forwards; }
.toast-icon { font-size: 1.5rem; }
.toast.success { border-color: var(--success); } .toast.success .toast-icon { color: var(--success); }
.toast.error { border-color: var(--danger); } .toast.error .toast-icon { color: var(--danger); }
.toast.warning { border-color: var(--warning); } .toast.warning .toast-icon { color: var(--warning); }
.toast.info { border-color: var(--info); } .toast.info .toast-icon { color: var(--info); }
.toast p { margin: 0; }
.toast-close { margin-left: auto; cursor: pointer; font-size: 1.5rem; color: var(--muted); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }


/* =============================================
   4. ESTILOS DE PÁGINAS Y COMPONENTES ESPECÍFICOS
   ============================================= */


/* --- DASHBOARD --- */
.page-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem; }
.page-header h2 { display: flex; align-items: center; gap: 1rem; font-size: 2rem; margin: 0; }
.toolbar { display: flex; gap: 1rem; flex-wrap: wrap; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.stat-card { text-align: center; }
.stat-card .card::before { display: none; } /* Ocultar borde azul en tarjetas de stats */
.stat-value { font-size: 2.2rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: 0.9rem; }

/* --- TOGGLE SWITCH (Factura de Contingencia) --- */
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(22px); }

/* --- OTROS COMPONENTES --- */
.hr { border: none; border-top: 1px solid var(--line); margin: 1.5rem 0; }
.client-selector, .product-adder-grid { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.product-adder-grid { grid-template-columns: 1fr 80px auto; }
.total-box { background: var(--light); padding: 1rem; border-radius: 8px; }
.search-box { position: relative; }
.search-box input { padding-left: 40px; }
.search-box svg { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.responsibilities-container { display: flex; flex-wrap: wrap; gap: 8px; padding: 5px; min-height: 40px; }
.responsibility-tag { background-color: var(--primary-light); color: var(--primary-dark); padding: 5px 10px; border-radius: 50px; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.responsibility-tag span { cursor: pointer; }
/* =============================================
   PAGINACIÓN – ESTILO MODERNO
   ============================================= */
.pagination-controls {
  margin-top: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background-color: var(--white);
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

/* Contenedor centrado dentro de la card */
.card .pagination-controls {
  display: inline-flex;
}

/* Botones de la paginación */
.pagination-controls .btn {
  margin: 0;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.7rem;
  border-radius: 999px;
  border: none;
  font-size: 0.8rem;
  font-weight: 500;
  background-color: transparent;
  color: var(--muted);
  box-shadow: none;
}

/* Desactivamos el "salto" vertical de los btn en hover solo aquí */
.pagination-controls .btn:hover {
  background-color: #EEF2FF;
  color: var(--primary);
  transform: none;
}

/* Página activa */
.pagination-controls .btn.active {
  background-color: var(--primary);
  color: var(--white);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.45);
}

/* Prev / Next (primer y último botón) un poco más anchos */
.pagination-controls .btn:first-child,
.pagination-controls .btn:last-child {
  padding-inline: 0.9rem;
  font-weight: 600;
}

/* Botón deshabilitado (cuando no hay página anterior/siguiente) */
.pagination-controls .btn[disabled],
.pagination-controls .btn:disabled {
  opacity: 0.45;
  cursor: default;
  background-color: transparent;
  box-shadow: none;
  color: rgba(148, 163, 184, 0.9);
}

/* Responsive: si hay muchas páginas, que se acomode mejor */
@media (max-width: 576px) {
  .pagination-controls {
    flex-wrap: wrap;
    row-gap: 0.25rem;
    padding-inline: 0.5rem;
  }

  .pagination-controls .btn {
    min-width: 2rem;
    height: 2rem;
    font-size: 0.75rem;
  }
}

/* Modo oscuro (si usas dark-mode) */
body.dark-mode .pagination-controls {
  background-color: #020617;
  border-color: rgba(148, 163, 184, 0.35);
  box-shadow: 0 10px 35px rgba(15, 23, 42, 0.9);
}

body.dark-mode .pagination-controls .btn {
  color: #e5e7eb;
}

body.dark-mode .pagination-controls .btn:hover {
  background-color: rgba(37, 99, 235, 0.1);
  color: var(--primary-light);
}

body.dark-mode .pagination-controls .btn.active {
  background-color: var(--primary);
  color: #f9fafb;
}


/* =============================================
   Estilos para Banner Global (Diseño Moderno)
   ============================================= */

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

#global-banner {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  color: var(--white);
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 1500;
  animation: slideDown 0.5s ease-out;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.banner-content {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.banner-icon {
  font-size: 1.25rem;
}

.banner-close {
  background: none;
  border: none;
  color: var(--white);
  opacity: 0.7;
  font-size: 1.5rem;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.banner-close:hover {
  opacity: 1;
}

/* Colores específicos */
#global-banner.info { background-color: var(--info); }
#global-banner.success { background-color: var(--success); }
#global-banner.warning { background-color: var(--warning); color: var(--dark); }
#global-banner.warning .banner-close { color: var(--dark); } /* Para que el botón de cierre sea visible */
#global-banner.danger { background-color: var(--danger); }

/* =============================================
   MODALES - CÓDIGO ACTUALIZADO
   ============================================= */

/* Contenedor general del modal (Overlay) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000; /* Prioridad base para modales principales */
}

/* Caja del modal (Contenido) */
.modal-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem;
  width: 90%;
  max-width: 650px; /* Ancho máximo para modales de formulario (Producto, Cliente, etc.) */
  box-shadow: 0 15px 50px rgba(0,0,0,0.2);
  animation: fadeIn 0.3s ease-out;
}

/* --- AJUSTES DE TAMAÑO ESPECÍFICOS --- */
/* El modal de Estado de Cuenta necesita ser más ancho */
#modalEstadoCuenta .modal-box {
  max-width: 850px;
}
/* Los modales de selección pueden ser más angostos */
.modal-selection .modal-box {
  max-width: 500px;
}

/* --- CORRECCIÓN DE ORDEN (Z-INDEX) --- */
/* Los modales que se abren encima de otros necesitan una prioridad mayor */
#modalSeleccionCliente,
#modalSeleccionProducto,
#modalSeleccionFactura,
#modalSeleccionResponsabilidad {
  z-index: 5000; /* Prioridad más alta para que siempre aparezcan delante */
}


/* --- Estilos internos del modal (sin cambios) --- */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.modal-header h3 {
  margin: 0;
  font-size: 1.5rem;
}
.items-container {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
}
.item-card {
  padding: 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.item-card:hover, .item-card.selected {
  background-color: var(--primary-light);
}
.item-card h4 {
  margin: 0 0 5px;
}
.item-card p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
.no-results {
  text-align: center;
  padding: 1rem;
  color: var(--muted);
}

/* --- FOOTER DE LA APP --- */
footer { grid-column: 2 / 3; background: var(--white); border-top: 1px solid var(--line); color: var(--muted); padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; }
footer a { color: var(--primary); text-decoration: none; }

/* =============================================
   5. ESTILOS ADICIONALES Y CORRECCIONES
   ============================================= */

.logo-preview {
  max-width: 140px;
  height: 80px;
  object-fit: contain; /* Asegura que la imagen se ajuste sin deformarse */
  border: 1px dashed var(--line);
  border-radius: 8px;
  background-color: var(--light);
}

/* Corrección para el tamaño de los íconos del menú */
.nav-link svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0; /* Evita que el ícono se encoja si el texto es largo */
}

/* Iconos Font Awesome en el sidebar */
.nav-link i {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;          /* Que el icono no se deforme */
}

/* Que el texto no se pegue demasiado al icono */
.sidebar-nav .nav-link span {
  font-size: 0.9rem;
  font-weight: 500;
}


/* Corrección para íconos en Títulos de Página y Login */

/* Para los títulos de sección (ej: "Dashboard", "Clientes") */
.page-header h2 svg {
  width: 32px;
  height: 32px;
}

/* Para los íconos dentro de los campos de Login */
.input-group svg {
  width: 20px;
  height: 20px;
}

/* =============================================
   6. MODAL DE SUSCRIPCIÓN VENCIDA
   ============================================= */

.suscripcion-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000; /* Asegura que esté por encima de todo */
  padding: 1rem;
}

.suscripcion-card {
  text-align: center;
  max-width: 500px;
  width: 100%;
  animation: fadeIn 0.4s ease-out;
}

.suscripcion-icon {
  width: 60px;
  height: 60px;
  color: var(--danger);
  margin-bottom: 1rem;
}

.suscripcion-card h2 {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
  color: var(--dark);
}

.suscripcion-card p {
  color: var(--muted);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.suscripcion-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* =============================================
   7. SISTEMA DE REJILLA Y CORRECCIONES ADICIONALES
   ============================================= */

/* Sistema de rejilla para organizar formularios */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }


/* Corrección para los íconos de lupa en los modales */
.search-box svg {
  width: 20px;
  height: 20px;
}

/* =============================================
   8. CORRECCIONES FINALES DE LAYOUT Y VISIBILIDAD
   ============================================= */

/* 1. Ocultar el menú de hamburguesa en escritorio y mostrarlo en móvil */
.mobile-menu-btn {
  display: none; 
}
@media (max-width: 992px) {
  .mobile-menu-btn {
    display: flex;
    /* Estilos adicionales para posicionarlo si es necesario */
  }
}

/* 2. Estilos para la información del usuario en sesión */
.current-user-info {
  font-size: 13px;
  color: var(--light);
  opacity: 0.8;
  margin-bottom: 0.5rem;
  word-break: break-all;
}

/* 3. Asegurar visibilidad de items en el modal de Responsabilidades */
#responsabilidadesList .item-card {
  display: block; /* Asegura que los items sean visibles */
}


/* 4. Estilos para el footer DENTRO del contenido principal */
.main-content footer {
  background: var(--white);
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 0.75rem 2rem;
  margin-top: auto;                  /* 🔹 Empuja el footer hacia el fondo */
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  gap: 1rem;
  flex-wrap: wrap;                   /* Para que sea flexible en pantallas pequeñas */
}

.main-content footer a {
  color: var(--primary);
  text-decoration: none;
}

/* Responsive footer en móvil */
@media (max-width: 768px) {
  .main-content {
    padding: 1rem;
  }

  .main-content footer {
    padding: 0.75rem 1rem;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* =============================================
   9. CORRECCIÓN DE TOGGLES Y LAYOUTS DE PÁGINA
   ============================================= */

/* 1. Reglas para que los botones TOGGLE funcionen en toda la app */
.toggle-view {
  display: none; /* Oculta todos los paneles por defecto */
}

.toggle-view.active {
  display: block; /* Muestra ÚNICAMENTE el panel que tiene la clase 'active' */
  animation: fadeIn 0.4s ease-out;
}

/* 2. Layout para la página de CONFIGURACIÓN */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

/* 3. Layout para las tarjetas de estadísticas en REPORTES */
#reportes-ventas-view .grid.cols-4,
#reportes-recaudo-view .grid.cols-3,
#reportes-rentabilidad-view .grid.cols-4 {
    display: grid;
    gap: 1.5rem;
}

/* =============================================
   10. AJUSTES FINALES DE FORMULARIOS Y COMPONENTES
   ============================================= */

/* 1. Eliminar el borde del recuadro en los formularios */
fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

/* 2. Restaurar diseño de acordeones en Ayuda y Soporte */
.faq-item, .ticket-item {
  margin-bottom: 1rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background-color: var(--white);
}

.faq-item summary, .ticket-item summary {
  font-weight: 600;
  padding: 1rem 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.faq-item details[open] summary, .ticket-item details[open] summary {
  background-color: var(--light);
  color: var(--primary);
}

.faq-item p, .ticket-item .ticket-content {
  color: var(--muted);
  padding: 0 1.5rem 1.5rem;
}

/* Estilos específicos para los tickets */
.ticket-summary-info {
  display: flex;
  flex-direction: column;
}
.ticket-summary-info small {
  font-size: 0.8rem;
  color: var(--muted);
}
.ticket-content strong {
  color: var(--dark);
}
.ticket-response {
  margin-top: 1rem;
  padding: 1rem;
  background-color: #f0f0f0;
  border-radius: 8px;
}
.ticket-response small {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--muted);
}

/* =============================================
   11. ESTILOS PARA LA BARRA DE SCROLL DEL MENÚ
   ============================================= */

/* Para navegadores WebKit (Chrome, Safari, Edge) */
.sidebar-nav::-webkit-scrollbar {
  width: 8px; /* Ancho de la barra */
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent; /* Fondo del riel, transparente para que no se vea */
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background-color: #4b5563; /* Color del scroll */
  border-radius: 20px; /* Bordes redondeados */
  border: 2px solid #111827; /* Espacio alrededor del scroll, del mismo color del menú */
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background-color: #6b7280; /* Color del scroll al pasar el mouse */
}

/* Para Firefox */
.sidebar-nav {
  scrollbar-width: thin; /* Hace la barra más delgada */
  scrollbar-color: #4b5563 #111827; /* Color del scroll y del fondo */
}

/* =============================================
   12. CORRECCIÓN VISUAL PARA RESPONSABILIDADES FISCALES
   ============================================= */

.responsibilities-container {
  /* Estilos para crear el recuadro visual */
  border: 1px solid var(--line);
  background-color: var(--light);
  border-radius: 8px;
  padding: 8px;
  min-height: 45px; /* Altura mínima para que sea visible cuando está vacío */
  
  /* Estilos que ya tenía para alinear las etiquetas */
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* =============================================
   13. TRANSICIÓN SUAVE PARA MODAL DE PRODUCTO
   ============================================= */

.collapsible-section {
  /* Estado oculto por defecto */
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-top: 0 !important; /* Anula el margen cuando está oculto */
  padding-top: 0;
  padding-bottom: 0;
  transition: all 0.4s ease-in-out;
}

.collapsible-section.visible {
  /* Estado visible con animación */
  max-height: 150px; /* Altura suficiente para el contenido */
  opacity: 1;
  margin-top: 16px !important; /* Restaura el margen original */
}

/* =============================================
   14. MEJORAS PARA MODALES ALTOS (CON SCROLL)
   ============================================= */

/* Hacemos que el modal sea un contenedor flexible en columna */
.modal-box {
  display: flex;
  flex-direction: column;
  max-height: 90vh; /* El modal nunca superará el 90% de la altura de la pantalla */
}

/* El área del formulario ahora es scrollable */
.modal-body {
  overflow-y: auto; /* Añade scroll vertical si el contenido se desborda */
  flex-grow: 1; /* Permite que esta área crezca para ocupar el espacio disponible */
  padding: 1rem 0; /* Espaciado interno */
}

/* El header y el footer se mantienen fijos */
.modal-header, .modal-box .toolbar {
  flex-shrink: 0; /* Evita que el header y el footer se encojan */
}

/* =============================================
   15. ESTILOS PARA EL MENÚ MÓVIL (HAMBURGUESA)
   ============================================= */

/* El velo oscuro que cubre la página cuando el menú está abierto */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}


/* Media Query que se activa solo en pantallas pequeñas (tablets y móviles) */
@media (max-width: 992px) {

    /* =============================================
    MEJORAS PARA TABS EN MÓVILES Y TABLETS
    ============================================= */

  /* 1. Hacemos que el contenedor de botones sea deslizable */
  .btn-group {
      overflow-x: auto;      /* Permite el scroll horizontal */
      flex-wrap: nowrap;     /* Evita que los botones salten de línea */
      -webkit-overflow-scrolling: touch; /* Mejora el deslizamiento en iOS */
      scroll-snap-type: x mandatory;   /* Hace que el scroll "encaje" en cada botón */
  }

  /* 2. Ocultamos la barra de scroll para un look más limpio */
  .btn-group::-webkit-scrollbar {
      display: none; /* Para Chrome, Safari, Edge */
  }
  .btn-group {
      -ms-overflow-style: none;  /* Para Internet Explorer y Edge (versiones antiguas) */
      scrollbar-width: none;     /* Para Firefox */
  }

  /* 3. Aseguramos que cada botón sea un punto de "encaje" para el scroll */
  .btn-group .btn {
      flex: 0 0 auto; /* Evita que los botones se encojan */
      scroll-snap-align: start; /* Cada botón se alinea al inicio al deslizar */
  }

  .app-layout {
    grid-template-columns: 1fr;
  }
  .main-content, footer {
    grid-column: 1 / -1;
  }

  /* Posicionamos la barra lateral fuera de la pantalla por defecto */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.4s ease-out;
    z-index: 100;
  }

  /* Cuando tiene la clase .active, la deslizamos para que sea visible */
  .sidebar.active {
    transform: translateX(0);
  }

  /* Mostramos el botón de hamburguesa que estaba oculto en escritorio */
  .mobile-menu-btn {
    display: flex;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 101; /* Por encima de todo, excepto el menú cuando se abra */
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  }
}

/* =============================================
   16. ESTILOS PARA LA PÁGINA DE ESTADO DE CUENTA
   ============================================= */

.summary-gastos {
  margin-bottom: 1.5rem;
  background-color: var(--primary-light);
  text-align: center;
}

/* Estilos para los filtros del modal de Estado de Cuenta */
.ec-filters {
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

/* =============================================
   18. AJUSTE DE ANCHO PARA TABLAS EN ESTADO DE CUENTA
   ============================================= */

#modalEstadoCuenta .items-container {
  width: 97%;
  box-sizing: border-box; /* Asegura que el padding no afecte el ancho total */
}

/* =============================================
   19. BOTÓN DE AYUDA CONTEXTUAL
   ============================================= */

.help-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s ease;
  flex-shrink: 0; /* Evita que se encoja */
}

.help-button:hover {
  background-color: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* =============================================
   20. OPTIMIZACIÓN TABLETAS
   ============================================= */
@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 70px 1fr; /* Sidebar más delgada */
  }
  .sidebar {
    width: 70px;
    padding: 0.5rem;
  }
  .sidebar h1 img {
    width: 45px;
    height: auto;
  }
  .sidebar-nav .nav-link span {
    display: none; /* Solo iconos en tablet para ahorrar espacio */
  }
}

@media (max-width: 768px) {
  .main-content {
    padding: 1rem;
  }
  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Cards más compactos */
    gap: 1rem;
  }
  .stat-value {
    font-size: 1.6rem; /* Reducir fuente en stats */
  }
  .card {
    padding: 1rem;
  }
}

/* =============================================
   21. MODO OSCURO (DARK MODE)
   ============================================= */

body.dark-mode {
  background-color: #121212;
  color: #e5e5e5;
}
body.dark-mode .card {
  background-color: #1e1e1e;
  color: #f5f5f5;
}
body.dark-mode .sidebar {
  background-color: #0d1117;
}
body.dark-mode .nav-link.active::before {
  background-color: var(--primary-light);
}
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background-color: #222;
  color: #eee;
  border-color: #444;
}

/* ========== TABLAS EN MODO OSCURO ========== */
body.dark-mode table {
  color: #e5e5e5;
  background-color: #1e1e1e;
}

body.dark-mode thead {
  background-color: #2a2a2a;
  color: #ffffff;
}

body.dark-mode th,
body.dark-mode td {
  border-color: #444;
}

/* ========== FOOTER EN MODO OSCURO ========== */
body.dark-mode footer,
body.dark-mode .footer {
  background-color: #0d1117;
  color: #aaa;
}

body.dark-mode footer a,
body.dark-mode .footer a {
  color: var(--primary);
}

/* =========================
   FORMULARIOS EN MODO OSCURO
   ========================= */
body.dark-mode label {
  color: #ddd;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background-color: #1e1e1e;
  color: #f5f5f5;
  border: 1px solid #444;
}

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
  color: #888; /* placeholders más suaves */
}

body.dark-mode fieldset:disabled {
  background-color: #2a2a2a; /* en vez de gris feo */
  opacity: 0.7;
}

body.dark-mode .card {
  background-color: #181818;
  border: 1px solid #333;
}

body.dark-mode .btn.primary {
  background-color: var(--primary);
  border-color: var(--primary-dark);
  color: #fff;
}
body.dark-mode .btn.primary:hover {
  background-color: var(--primary-dark);
}

#toggle-theme-btn svg {
  transition: opacity 0.3s ease;
}

/* ========================
   SECCIÓN AYUDA - FAQ
   ======================== */
body.dark-mode .faq-item,
body.dark-mode .faq-answer {
  background-color: #1e1e1e;
  color: #e5e5e5;
  border: 1px solid #333;
}

body.dark-mode .faq-question {
  color: #4da3ff; /* azul llamativo para preguntas */
}

body.dark-mode .faq-answer strong {
  color: #fff;
}

/* ========================
   INPUT DE VENCIMIENTO
   ======================== */
body.dark-mode input[type="date"],
body.dark-mode input[type="text"],
body.dark-mode input[type="email"],
body.dark-mode input[type="number"] {
  background-color: #ffffff;
  color: #000000;
  border: 1px solid #b8b8b8;
}

body.dark-mode input[type="date"]::placeholder {
  color: #aaa;
}

/* ========================
   INPUT DATE EN MODO OSCURO
   ======================== */
body.dark-mode input[type="date"] {
  background-color: #1e1e1e;
  color: #f5f5f5; /* <-- color del texto de la fecha */
  border: 1px solid #444;
}

/* Calendario desplegable (en navegadores que lo soportan) */
body.dark-mode input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1); /* icono calendario en blanco */
}

/* ========================
   LOGIN EN MODO OSCURO
   ======================== */
body.dark-mode .login-container {
  background-color: #121212; /* fondo global */
  color: #f5f5f5;
}

body.dark-mode .login-card {
  background-color: #1e1e1e;
  border: 1px solid #333;
  color: #e5e5e5;
}

body.dark-mode .login-card h2,
body.dark-mode .login-card h3 {
  color: #fff;
}

body.dark-mode .login-card input {
  background-color: #222;
  color: #eee;
  border: 1px solid #444;
}

body.dark-mode .login-card input::placeholder {
  color: #aaa;
}

body.dark-mode .login-card .btn.primary {
  background-color: var(--primary);
  border-color: var(--primary-dark);
  color: #fff;
}
body.dark-mode .login-card .btn.primary:hover {
  background-color: var(--primary-dark);
}

/* BOTÓN MODO OSCURO/CLARO */
#toggle-theme-btn svg {
  width: 26px;
  height: 26px;
  transition: transform 0.4s ease, opacity 0.3s ease;
}

#toggle-theme-btn:hover svg {
  transform: rotate(25deg) scale(1.1);
  color: var(--primary);
}

/* TICKETS - MODO OSCURO */
body.dark-mode .ticket-item {
  background-color: #1e1e1e;
  border: 1px solid #333;
  color: #eee;
}

body.dark-mode .ticket-item .ticket-header {
  color: #4da3ff; /* azul para títulos */
}

body.dark-mode .ticket-message {
  background-color: #2a2a2a;
  color: #ddd;
  border: 1px solid #444;
}

/* FIELDSET BLOQUEADO */
fieldset:disabled {
  opacity: 0.4; /* más opaco */
  pointer-events: none; /* evita clicks */
}

/* En dark mode */
body.dark-mode fieldset:disabled {
  background-color: #201c1c;
  opacity: 0.5; /* sensación de bloqueado más clara */
}

/* ===============================
   ANIMACIÓN BOTONES DEL MENÚ
   =============================== */
.sidebar-nav .nav-link {
  position: relative;
  transition: all 0.3s ease;
}

.sidebar-nav .nav-link:hover {
  background-color: var(--primary-light);
  color: #3c4fe2;
  border-radius: 8px;
}

/* =========================
   FECHA DE VENCIMIENTO
   ========================= */
#em_fecha_vencimiento {
  color: var(--dark); /* color en modo claro */
}

body.dark-mode #em_fecha_vencimiento {
  background-color: #1e1e1e !important;
  color: #f5f5f5 !important;  /* texto claro visible */
  border: 1px dashed #555 !important;
}

/* ===============================
   ITEM-CARD EN MODALES
   =============================== */
.item-card {
  background-color: #f9f9f9;
  color: #222;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

/* Hover (modo claro) */
.item-card:hover {
  background-color: #e6f0ff;
  color: #000;
}

/* Seleccionado (modo claro) */
.item-card.selected {
  background-color: #007bff;
  color: #fff;
}

/* ===============================
   DARK MODE
   =============================== */
body.dark-mode .item-card {
  background-color: #1e1e1e;
  color: #eee;
  border: 1px solid #333;
}

/* Hover (modo oscuro) */
body.dark-mode .item-card:hover {
  background-color: #2a2a2a;
  color: #4da3ff;
}

/* Seleccionado (modo oscuro) */
body.dark-mode .item-card.selected {
  background-color: #333 !important;
  color: #4da3ff !important;
  border-color: #555;
}
/* ===============================
   BOTÓN MODO CLARO/OSCURO
   =============================== */
#toggle-theme-btn {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Hover en modo claro */
body.light-mode #toggle-theme-btn:hover,
body:not(.dark-mode) #toggle-theme-btn:hover {
  background-color: rgba(0, 0, 0, 0.08);
  color: var(--primary);
  border-radius: 8px;
}

/* Hover en modo oscuro */
body.dark-mode #toggle-theme-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #4da3ff;
  border-radius: 8px;
}

/* Animación del icono */
#toggle-theme-btn svg {
  transition: transform 0.3s ease;
}

#toggle-theme-btn:hover svg {
  transform: rotate(20deg) scale(1.1);
}

/* ===============================
   OPTIMIZACIÓN PARA TABLETS
   =============================== */
/* Añade esta nueva regla al final de tu style.css */
@media (max-width: 1024px) {
  .historial-card {
    overflow-x: auto; /* Permite el scroll horizontal SÓLO en esta tarjeta */
  }

  /* Tablas scroll horizontal si es necesario */
  .card table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* Botones dentro de tablas más compactos */
  .card table td .btn {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }
  .card table td .btn svg {
    width: 18px;
    height: 18px;
  }
}

/* =============================================
   24. MEJORAS DE RESPONSIVE DESIGN (NUEVO)
   ============================================= */

/* Ajusta el contenido principal para evitar desbordes */
.main-content {
    overflow-x: hidden; /* Evita el scroll horizontal no deseado */
}

/* Reemplaza la regla anterior para .dashboard-grid con esta */
@media (max-width: 768px) {
  .dashboard-grid {
    display: var(--radius);         /* 1. Cambiamos el contenedor a Flexbox */
    overflow-x: auto;      /* 2. Habilitamos el scroll horizontal */
    flex-wrap: nowrap;     /* 3. Evitamos que las tarjetas se apilen */
    padding-bottom: 1rem;  /* 4. Damos espacio para que el scroll no moleste */
  }
  
  /* 5. Damos un tamaño base a cada tarjeta para que no se compriman */
  .dashboard-grid .stat-card {
    flex: 0 0 200px; /* Cada tarjeta ocupará al menos 220px de ancho */
  }
}

/* =============================================
   22. CORRECCIÓN PARA FORMULARIO DE LOGIN
   ============================================= */

/* Esta regla unifica la apariencia de TODOS los inputs dentro del 
  formulario de login para el modo claro (por defecto).
*/
.login-box .input-group .login-input {
  background-color: var(--white); /* Fondo siempre blanco en modo claro */
  color: var(--dark);             /* Texto oscuro */
  border: 1px solid var(--line);  /* Borde estándar gris */
}

/*
  Esta regla se aplica ÚNICAMENTE en modo oscuro para los mismos inputs.
*/
body.dark-mode .login-box .input-group .login-input {
  background-color: #222; /* Fondo gris oscuro */
  color: #eee;           /* Texto claro para contraste */
  border: 1px solid #444; /* Borde más oscuro */
}

/*
  Mejora la visibilidad del texto de placeholder en modo oscuro.
*/
body.dark-mode .login-box .input-group .login-input::placeholder {
  color: #888; /* Color de placeholder más sutil */
}

/* =============================================
   23. CORRECCIÓN DE TEXTOS OPACOS EN LOGIN
   ============================================= */

/* Para el título "Bienvenido" */
.login-box h2 {
  color: #000000; /* Color oscuro y sólido (variable --dark) */
  margin-bottom: 8px; /* Ajusta el espacio inferior */
}

/* Para el subtítulo "Ingresa tus credenciales..." */
.login-box p {
  color: #424e5a; /* Un gris más legible (variable --muted) */
  margin-bottom: 24px; /* Aumenta el espacio antes de los campos */
}

/* --- Ajustes para el Modo Oscuro --- */

body.dark-mode .login-box h2 {
  color: #0c0808; /* Blanco para el título */
}

body.dark-mode .login-box p {
  color: #869ebd; /* Gris claro (muy legible) */
}

/* =============================================
   ESTILOS PARA EL NUEVO MENÚ DE ESTADO
   ============================================= */

.status-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-menu-container {
    position: relative;
    display: inline-block;
}

.status-menu-trigger {
    background-color: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.status-menu-trigger:hover {
    background-color: var(--light);
    color: var(--dark);
}

.status-dropdown-menu {
    display: none; /* Oculto por defecto */
    position: absolute;
    right: 0;
    top: calc(100% + 5px); /* Aparece debajo del botón */
    z-index: 10;
    background-color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--line);
    overflow: hidden;
    width: 220px; /* Ancho del menú */
    animation: fadeIn 0.2s ease-out;
}

.status-dropdown-menu.active {
    display: block; /* Lo mostramos con JS */
}

.status-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
}

.status-dropdown-item:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.status-dropdown-item i {
    width: 16px; /* Para alinear los íconos */
}

/* =============================================
   ESTILOS PARA TOOLTIP INFORMATIVO
   ============================================= */

.tooltip-container {
    position: relative;
    display: inline-flex; /* Cambiado para alinear el ícono */
    align-items: center;
    gap: 0.5rem; /* Espacio entre el texto y el ícono */
}

.tooltip-container .tooltip-text {
    visibility: hidden;
    width: 280px;
    background-color: var(--dark);
    color: var(--white);
    text-align: center;
    border-radius: var(--radius);
    padding: 1rem;
    position: absolute;
    z-index: 1;
    bottom: 125%; /* Posición encima del elemento */
    left: 50%;
    margin-left: -140px; /* Centrar el tooltip */
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.9rem;
    font-weight: normal;
    line-height: 1.5;
}

/* Flecha del tooltip */
.tooltip-container .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--dark) transparent transparent transparent;
}

/* Muestra el tooltip al pasar el mouse */
.tooltip-container:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.info-icon {
    cursor: help; /* Cambia el cursor para indicar que es un elemento de ayuda */
    color: var(--muted);
}

/* =============================================
   ESTILOS PARA VALIDADOR DE CONTRASEÑA
   ============================================= */
.password-rules {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0 0.5rem;
    font-size: 0.9rem;
    /* Lógica para la animación */
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.4s ease-in-out;
}

.password-rules.visible {
    max-height: 200px; /* Altura suficiente para mostrar todo */
    opacity: 1;
}

.password-rules li {
    color: var(--muted);
    transition: all 0.3s ease;
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.25rem;
}

.password-rules li::before {
    content: '✖';
    position: absolute;
    left: 0;
    color: var(--danger);
    font-weight: bold;
}

.password-rules li.valid {
    color: var(--success);
}

.password-rules li.valid::before {
    content: '✔';
    color: var(--success);
}

/* =============================================
   ESTILOS PARA WIZARD DE ONBOARDING
   ============================================= */
.onboarding-step {
    animation: fadeIn 0.5s ease-out;
}

/* --- ESTILO PARA TRUNCAR TEXTO LARGO EN EL USUARIO --- */

.user-info {
  /* Hacemos que el contenedor del usuario ocupe el espacio disponible */
  flex: 1;
  min-width: 0; /* Truco de CSS para que el truncado funcione dentro de un flexbox */
}

#currentUserDisplay {
  display: block; /* Necesario para que el truncado funcione */
  white-space: nowrap; /* Evita que el texto salte a la siguiente línea */
  overflow: hidden; /* Oculta el texto que se desborda */
  text-overflow: ellipsis; /* Añade los "..." al final del texto cortado */
  text-align: left; /* Alinea el texto a la izquierda */
}

/* Añade al final de style.css */
.status-dropdown-menu.align-left {
    right: auto; /* Anula el 'right: 0' */
    left: 0;     /* Lo alinea a la izquierda del botón */
}

/* =============================================
   25. CORRECCIÓN MODO OSCURO: CUADRO DE TOTALES
   ============================================= */

/* Corrige la visibilidad del cuadro de totales en modo oscuro */
body.dark-mode .total-box {
    background-color: #2a2a2a; /* 1. Asigna un fondo oscuro */
    color: #e5e5e5;           /* 2. Asegura que el texto sea claro */
}

/* Ajusta el color del borde superior del total para que sea visible */
body.dark-mode .total-box span[style*="border-top"] {
    border-color: #444 !important; /* 3. Aclara el color de la línea divisoria */
}

/* =============================================
   26. CORRECCIÓN MODO OSCURO: OPCIONES DE IMPUESTOS
   ============================================= */

/* Estilo base para el contenedor de opciones de impuestos */
.tax-options-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg);
    padding: 12px;
    border-radius: var(--radius);
}

/* Anulación para el modo oscuro */
body.dark-mode .tax-options-box {
    background-color: #2a2a2a; /* Fondo oscuro, igual al del total-box */
}

/* --- Layout de Login COMPACTO (Nubifica) --- */
:root{
  --white: #ffffff;
  --light: #f5f7fa; /* mismo tono que el bg */
}

/* Contenedor pantalla completa */
#login-wall {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background-color: var(--light);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw; height: 100vh;
}

/* hacemos que la side del form no meta un div extra */
.login-form-side { padding: 2rem; display: contents; }

/* Tarjeta compacta */
.compact-login-card {
  display: flex;
  max-width: 800px;
  width: 90%;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,.15);
  overflow: hidden;
}

/* Lado imagen (bienvenida) */
.login-image-side {
  flex: 1;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  color: var(--white);
  min-height: 450px;
}
.login-image-side::after{
  content:''; position:absolute; inset:0;
  background: rgba(0,0,0,.4); z-index:1;
}
.side-content{ z-index:2; padding:2rem; text-align:left; }
.side-content h2{ font-size:2rem; margin-bottom:.5rem; }
.side-content p{ font-size:1.1rem; opacity:.9; }

/* Lado formulario */
.login-form-content{
  width: 380px; flex-shrink: 0;
  padding: 2.5rem;
  display:flex; flex-direction:column; justify-content:center;
}
.login-box{ width:100%; text-align:center; }

/* Como en este diseño quitamos los íconos inline, ajustamos inputs */
.login-box .input-group{
  display:block; /* simplificamos el layout del input */
  margin-bottom: .75rem;
}
.login-input{
  width:100%;
  padding: .9rem 1rem;
  border:1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}
.login-input:focus{ border-color: var(--primary); }

/* En este diseño no usamos la imagen superior por defecto */
.login-logo-img{ display:none; }

.login-link,
.forgot-password-link{
  display:inline-block; margin-top:.75rem; font-size:.95rem;
  text-decoration:none; color: var(--primary);
}
.login-link:hover, .forgot-password-link:hover{ text-decoration:underline; }

.login-error-message,
#reset-error{
  color:#b00020; min-height:1.25rem; margin-top:.25rem; font-size:.95rem;
}

/* Responsive: ocultar imagen en pantallas pequeñas */
@media (max-width: 850px){
  .compact-login-card{ max-width: 380px; }
  .login-image-side{ display:none; }
  .login-form-content{ width:100%; padding:2rem; }
}

/* FIN estilos de login */

/* Estilos finos para iconos de acciones en tablas */
.table-actions .btn-icon i.fa-pen-to-square {
  color: var(--primary);
}



.table-actions .btn-icon i.fa-clock-rotate-left {
  color: #7c3aed; /* morado para historial */
}
