/* =============================================
   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;
  transition: grid-template-columns 0.3s ease;
}

.app-layout.collapsed {
  grid-template-columns: 80px 1fr;
}

.sidebar {
  /* Nuevo fondo mÃ¡s oscuro y profesional */
  background-color: #111827;
  color: var(--light);
  display: flex;
  flex-direction: column;
  padding: 1rem;
  position: fixed;
  height: 100%;
  width: 260px;
  z-index: 1000;
  transition: all 0.3s ease;
  overflow-x: hidden;
}

.sidebar.collapsed {
  width: 80px;
  padding: 1rem 0.5rem;
}

/* Header del Sidebar */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
  margin: 0;
  display: flex;
  align-items: center;
  width: 100%;
  justify-content: center;
}

.sidebar-logo {
  max-width: 160px;
  width: 100%;
  height: auto;
  transition: opacity 0.2s ease;
}

.sidebar-logo-mini {
  width: 32px;
  height: auto;
}

.sidebar.collapsed .sidebar-header {
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 1rem;
}

.sidebar.collapsed .sidebar-logo {
  display: none;
}

.sidebar.collapsed .sidebar-logo-mini {
  display: block !important;
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.2rem;
  transition: var(--transition);
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  color: var(--white);
  transform: scale(1.1);
}

.sidebar.collapsed .sidebar-toggle i {
  transform: rotate(180deg);
  transition: transform 0.3s ease;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  text-decoration: none;
  color: #9ca3af;
  transition: var(--transition);
  position: relative;
  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;
}

/* Estilos de Nav Link cuando el menÃº estÃ¡ colapsado */
.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 0.65rem 0;
}

.sidebar.collapsed .nav-link span {
  display: none;
}

.sidebar.collapsed .nav-link i {
  font-size: 1.3rem;
  margin: 0;
}

.sidebar.collapsed .nav-link.active::before {
  left: -0.5rem;
  /* Ajuste del indicador porque el padding cambia */
}

/* 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;
}



.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 LA BARRA SUPERIOR DE USUARIO
   ============================================= */

.top-user-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 0 1rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
  gap: 1.5rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-info i {
  font-size: 1.5rem;
  color: var(--primary);
  /* Cambiar a un color visible sobre fondo claro */
}

.logout-btn {
  color: var(--muted);
  color: var(--muted);
  text-decoration: none;
  font-size: 1.2rem;
  padding: 0.4rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.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.1);
  /* AnimaciÃ³n: crece un poco */
}

.sidebar.collapsed .logout-btn {
  width: 100%;
}

/* =============================================
   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 {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  padding: 1.5rem;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.stat-card .card::before {
  display: none;
}

/* Ocultar borde azul en tarjetas de stats */
.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.25rem;
  z-index: 1;
}

.stat-label {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 500;
  z-index: 1;
}

.stat-icon {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  opacity: 0.8;
  z-index: 0;
}

.stat-icon.green {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
}

.stat-icon.red {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

.stat-icon.blue {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
}

.stat-icon.purple {
  background: rgba(168, 85, 247, 0.15);
  color: #9333ea;
}

/* --- TABS --- */
.config-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--line);
  margin-bottom: 2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  /* Superponer sobre la lÃ­nea del contenedor */
  transition: all 0.2s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tab-btn:hover {
  color: var(--primary);
  background: rgba(0, 0, 0, 0.02);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
  display: block;
}

/* --- 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: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.nav-link:hover i,
.nav-link.active i {
  background-color: rgba(255, 255, 255, 0.15);
  transform: scale(1.1);
}

/* 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;
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 2000;
  background: var(--white);
  border: 1px solid var(--line);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
  color: var(--dark);

}

/* 11. ESTILOS PARA LA BARRA DE SCROLL DEL MENÚ */
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background-color: #4b5563; border-radius: 20px; border: 2px solid #111827; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background-color: #6b7280; }
.sidebar-nav { scrollbar-width: thin; scrollbar-color: #4b5563 #111827; }

/* 12. CORRECCIÓN VISUAL PARA RESPONSABILIDADES FISCALES */
.responsibilities-container { border: 1px solid var(--line); background-color: var(--light); border-radius: 8px; padding: 8px; min-height: 45px; display: flex; flex-wrap: wrap; gap: 8px; }

/* 13. TRANSICIÓN SUAVE PARA MODAL DE PRODUCTO */
.collapsible-section { max-height: 0; opacity: 0; overflow: hidden; margin-top: 0 !important; padding-top: 0; padding-bottom: 0; transition: all 0.4s ease-in-out; }
.collapsible-section.visible { max-height: 150px; opacity: 1; margin-top: 16px !important; }

/* 14. MEJORAS PARA MODALES ALTOS (CON SCROLL) */
.modal-box { display: flex; flex-direction: column; max-height: 90vh; }
.modal-body { overflow-y: auto; flex-grow: 1; padding: 1rem 0; }
.modal-header, .modal-box .toolbar { flex-shrink: 0; }

/* 15. ESTILOS PARA EL MENÚ MÓVIL (HAMBURGUESA) */
.sidebar-overlay { position: fixed; inset: 0; background-color: rgba(0, 0, 0, 0.5); z-index: 1999; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
.sidebar-overlay.active { opacity: 1; visibility: visible; }
/* 2. Informacion del usuario en sesion */
.current-user-info {
  font-size: 13px;
  color: var(--light);
  opacity: 0.8;
  margin-bottom: 0.5rem;
  word-break: break-all;
}

/* 3. Items en modal de Responsabilidades */
#responsabilidadesList .item-card { display: block; }

/* 4. 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;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.main-content footer a { color: var(--primary); text-decoration: none; }

/* 9. Toggle views y config grid */
.toggle-view { display: none; }
.toggle-view.active { display: block; animation: fadeIn 0.4s ease-out; }
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 1.5rem; }

/* 10. FAQ, Tickets y Soporte */
fieldset { border: none; padding: 0; margin: 0; }
.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; }
.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); }

/* Estado de Cuenta */
.summary-gastos { margin-bottom: 1.5rem; background-color: var(--primary-light); text-align: center; }
.ec-filters { justify-content: space-between; align-items: flex-end; margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
#modalEstadoCuenta .items-container { width: 97%; box-sizing: border-box; }

/* Boton 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; }
.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); }

/* Status cell y dropdown menu */
.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; position: absolute; right: 0; top: calc(100% + 5px); z-index: 10; background-color: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; width: 220px; animation: fadeIn 0.2s ease-out; }
.status-dropdown-menu.active { display: block; }
.status-dropdown-menu.align-left { right: auto; left: 0; }
.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; }

/* Tooltip informativo */
.tooltip-container { position: relative; display: inline-flex; align-items: center; gap: 0.5rem; }
.tooltip-container .tooltip-text { visibility: hidden; width: 280px; background-color: var(--dark); color: var(--white); border-radius: 8px; padding: 1rem; position: absolute; z-index: 1; bottom: 125%; left: 50%; margin-left: -140px; opacity: 0; transition: opacity 0.3s; font-size: 0.9rem; line-height: 1.5; }
.tooltip-container .tooltip-text::after { content: ""; position: absolute; top: 100%; left: 50%; border-width: 5px; border-style: solid; border-color: var(--dark) transparent transparent transparent; }
.tooltip-container:hover .tooltip-text { visibility: visible; opacity: 1; }
.info-icon { cursor: help; color: var(--muted); }

/* Validador de contrasena */
.password-rules { list-style: none; padding: 0; margin: 0.75rem 0 0 0.5rem; max-height: 0; opacity: 0; overflow: hidden; transition: all 0.4s ease-in-out; }
.password-rules.visible { max-height: 200px; 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: 'x'; position: absolute; left: 0; font-weight: bold; }
.password-rules li.valid { color: var(--success); }
.password-rules li.valid::before { content: 'v'; color: var(--success); }

/* Onboarding wizard */
.onboarding-step { animation: fadeIn 0.5s ease-out; }

/* Truncar texto de usuario */
.user-info { flex: 1; min-width: 0; }
#currentUserDisplay { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }

/* Cuadro de totales dark mode */
body.dark-mode .total-box { background-color: #2a2a2a; color: #e5e5e5; }
body.dark-mode .total-box span[style*="border-top"] { border-color: #444 !important; }

/* Opciones de impuestos */
.tax-options-box { display: flex; flex-direction: column; gap: 10px; background-color: var(--light); padding: 12px; border-radius: var(--radius); }
body.dark-mode .tax-options-box { background-color: #2a2a2a; }

/* =============================================
   LAYOUT DE LOGIN COMPACTO
   ============================================= */
#login-wall {
  position: fixed; inset: 0; z-index: 2000;
  background: linear-gradient(135deg, var(--light) 0%, #e2e8f0 100%);
  display: flex; align-items: center; justify-content: center;
  width: 100vw; height: 100vh;
}
.login-form-side { padding: 2rem; display: contents; }
.compact-login-card {
  display: flex; max-width: 900px; width: 90%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0,0,0,.1);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.login-image-side {
  flex: 1.2; 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: 500px;
}
.login-image-side::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom right, rgba(15, 23, 42, 0.6), rgba(37, 99, 235, 0.4));
  z-index: 1;
}
.side-content { z-index: 2; padding: 3rem; text-align: left; }
.side-content h2 { font-size: 2.5rem; margin-bottom: 1rem; font-weight: 700; line-height: 1.2; }
.side-content p { font-size: 1.2rem; opacity: .9; font-weight: 300; }
.login-form-content { width: 420px; flex-shrink: 0; padding: 3rem; display: flex; flex-direction: column; justify-content: center; }
.login-box { width: 100%; text-align: left; }
.login-box h3 { font-size: 1.8rem; font-weight: 700; color: var(--ink); margin-bottom: 2rem !important; }
.login-box label { display: block; font-size: 0.9rem; font-weight: 600; color: var(--muted); margin-bottom: 0.5rem; }
.login-box .input-group { display: block; margin-bottom: 1.2rem; }
#login-email, #login-password, .login-input {
  width: 100%; padding: 0.9rem 1.2rem;
  background-color: var(--bg-body); border: 1px solid transparent;
  border-radius: 12px; font-size: 1rem; transition: all 0.3s ease; box-sizing: border-box;
}
#login-email:focus, #login-password:focus, .login-input:focus {
  outline: none; background-color: var(--white);
  border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}
#login-button {
  margin-top: 1rem; padding: 1rem; border-radius: 12px;
  font-size: 1.1rem; font-weight: 600;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3); transition: all 0.3s ease;
}
#login-button:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4); }
.login-logo-img { display: none; }
.login-link, .forgot-password-link { display: inline-block; margin-top: 1rem; font-size: .95rem; text-decoration: none; color: var(--primary); font-weight: 500; }
.login-link:hover, .forgot-password-link:hover { text-decoration: underline; }
.login-error-message, #login-error, #reset-error { color: var(--danger); min-height: 1.25rem; margin-top: .5rem; font-size: .95rem; font-weight: 500; }

/* Login responsive */
@media (max-width: 850px) {
  .compact-login-card { max-width: 400px; }
  .login-image-side { display: none; }
  .login-form-content { width: 100%; padding: 2.5rem 2rem; }
}

/* =============================================
   DARK MODE COMPLETO
   ============================================= */
body.dark-mode { background-color: #121212; color: #e5e5e5; }
body.dark-mode .card { background-color: #1e1e1e; color: #f5f5f5; border: 1px solid #333; }
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: #1e1e1e; color: #f5f5f5; border: 1px solid #444; }
body.dark-mode input::placeholder, body.dark-mode textarea::placeholder { color: #888; }
body.dark-mode fieldset:disabled { background-color: #2a2a2a; opacity: 0.7; }
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; }
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); }
body.dark-mode label { color: #ddd; }
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); }
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; }
body.dark-mode .faq-answer strong { color: #fff; }
body.dark-mode input[type="date"] { background-color: #1e1e1e; color: #f5f5f5; border: 1px solid #444; }
body.dark-mode input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(1); }
body.dark-mode .login-container { background-color: #121212; 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 .ticket-item { background-color: #1e1e1e; border: 1px solid #333; color: #eee; }
body.dark-mode .ticket-item .ticket-header { color: #4da3ff; }
body.dark-mode .ticket-message { background-color: #2a2a2a; color: #ddd; border: 1px solid #444; }
body.dark-mode fieldset:disabled { opacity: 0.5; }
body.dark-mode .item-card { background-color: #1e1e1e; color: #eee; border: 1px solid #333; }
body.dark-mode .item-card:hover { background-color: #2a2a2a; color: #4da3ff; }
body.dark-mode .item-card.selected { background-color: #333 !important; color: #4da3ff !important; border-color: #555; }
body.dark-mode #toggle-theme-btn:hover { background-color: rgba(255,255,255,0.1); color: #4da3ff; border-radius: 8px; }
body.dark-mode #em_fecha_vencimiento { background-color: #1e1e1e !important; color: #f5f5f5 !important; border: 1px dashed #555 !important; }

/* Toggle de tema */
#toggle-theme-btn { transition: background-color 0.3s ease, color 0.3s ease; }
#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); }
body:not(.dark-mode) #toggle-theme-btn:hover { background-color: rgba(0,0,0,0.08); color: var(--primary); border-radius: 8px; }

/* Animacion nav links */
.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); }

/* Item-card en modales (modo claro) */
.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; }
.item-card:hover { background-color: #e6f0ff; color: #000; }
.item-card.selected { background-color: #007bff; color: #fff; }

/* Tablas optimizacion tablet */
@media (max-width: 1024px) {
  .historial-card { overflow-x: auto; }
  .card table { display: block; width: 100%; overflow-x: auto; white-space: nowrap; }
  .card table td .btn { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
  .card table td .btn svg { width: 18px; height: 18px; }
}

/* Secciones de formulario */
.form-section { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.form-section-title { font-size: 1.1rem; font-weight: 600; color: var(--ink); margin-bottom: 1.25rem; display: flex; align-items: center; gap: 0.5rem; border-bottom: 1px solid var(--line); padding-bottom: 0.75rem; }

/* Tablas responsivas */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 1rem; border-radius: 8px; border: 1px solid var(--line); }
.table-responsive table { margin-top: 0 !important; min-width: 800px; }

/* Iconos de accion 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; }

/* Graficos de reportes */
.report-chart-container { position: relative; height: 300px; width: 100%; }


/* =============================================
   RESPONSIVE MOVIL - SIDEBAR Y LAYOUT
   ============================================= */

/* TABLET (1024px): sidebar contraida, solo iconos */
@media (max-width: 1024px) {
  .app-layout { grid-template-columns: 70px 1fr; }
  .sidebar { width: 70px; padding: 0.5rem; }
  .sidebar h1 img { width: 45px; height: auto; }
  .sidebar-nav .nav-link span { display: none; }
}

/* MOVIL (992px): sidebar fuera de pantalla, menu hamburguesa */
@media (max-width: 992px) {
  .mobile-menu-btn { display: flex; align-items: center; justify-content: center; }
  .app-layout { grid-template-columns: 1fr !important; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    width: 260px !important;
    z-index: 2000;
    transition: transform 0.4s ease, width 0.3s ease;
    box-shadow: 10px 0 30px rgba(0,0,0,0.2);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-toggle { display: flex !important; }
  .main-content { grid-column: 1 / -1; padding-top: 4.5rem; }
  #currentUserDisplay, .user-info { display: none !important; }

  /* Cuando el sidebar esta ABIERTO y NO colapsado: mostrar icono + texto */
  .sidebar.mobile-open:not(.collapsed) .nav-link span {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: auto !important;
    overflow: visible !important;
    white-space: nowrap;
  }

  /* Cuando esta COLAPSADO (solo iconos): ocultar texto siempre */
  .sidebar.collapsed .nav-link span { display: none !important; }
  .sidebar.collapsed { width: 70px !important; }
  .sidebar.collapsed .nav-link { justify-content: center; padding: 0.65rem 0; }
}

/* MOVIL PEQUENO (768px): cards, dashboard y formularios */
@media (max-width: 768px) {
  .main-content {
    padding: 1rem !important;
    padding-top: 5rem !important;
  }

  .dashboard-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  .dashboard-grid .card {
    grid-column: 1 / -1 !important;
  }

  .stat-card {
    padding: 1.25rem !important;
  }

  .stat-value {
    font-size: 1.8rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: 1fr !important;
  }

  .form-section { padding: 1rem; }

  .main-content footer {
    flex-direction: column;
    text-align: center;
    padding: 0.75rem 1rem;
  }

  .toolbar { flex-wrap: wrap; }

  #toast-container {
  left: 1rem;
    right: 1rem;
    top: auto;
    bottom: 1rem;
  }

  .toast { min-width: unset; width: 100%; }
}


/* =============================================
   🔔 CAMPANA DE NOTIFICACIONES
   ============================================= */

.notif-wrapper {
  position: relative;
}

/* Panel dropdown */
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 360px;
  max-height: 480px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0,0,0,0.14);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.notif-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header del panel */
.notif-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--light);
  font-weight: 700;
  font-size: 14px;
  color: var(--dark);
  flex-shrink: 0;
}

.notif-panel-header span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
}

/* Lista de notificaciones */
.notif-lista {
  overflow-y: auto;
  flex: 1;
}

/* Estado vacío */
.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: var(--muted);
  text-align: center;
}

.notif-empty i {
  font-size: 2.5rem;
  opacity: 0.4;
}

.notif-empty p {
  margin: 0;
  font-size: 14px;
}

/* Ítem de notificación */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: var(--light);
}

.notif-item.nueva {
  background: #eff6ff;
}

.notif-item.nueva:hover {
  background: #dbeafe;
}

.notif-item.leida {
  opacity: 0.7;
}

/* Ícono coloreado */
.notif-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.notif-icon-wrap.admin {
  background: rgba(0,123,255,0.12);
  color: var(--primary);
}

.notif-icon-wrap.ticket {
  background: rgba(40,167,69,0.12);
  color: var(--success);
}

/* Contenido */
.notif-content {
  flex: 1;
  min-width: 0;
}

.notif-titulo {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notif-msg {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.notif-fecha {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.8;
}

/* Punto indicador de no leído */
.notif-dot {
  width: 9px;
  height: 9px;
  background: var(--primary);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

/* Responsive */
@media (max-width: 480px) {
  .notif-panel {
    width: calc(100vw - 2rem);
    right: -1rem;
  }
}

/* Botón de acciones por ítem (eliminar) */
.notif-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s;
}

.notif-item:hover .notif-actions {
  opacity: 1;
}

