:root {
  --bg: #f7f9fc; 
  --card: #ffffff; 
  --ink: #111827; 
  --muted: #6b7280; 
  --primary: #3b82f6;
  --primary-dark: #2563eb; 
  --primary-light: #eff6ff; 
  --accent: #111827; 
  --line: #e5e7eb;
  --danger: #ef4444; 
  --success: #10b981; 
  --warning: #f59e0b; 
  --info: #3b82f6;
  --sidebar-bg: #111827; 
  --sidebar-ink: #d1d5db; 
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg); 
  color: var(--ink); 
  font-size: 14px; 
  line-height: 1.6;
}

/* ===== NUEVOS ESTILOS DE LOGIN ===== */
#login-wall {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-form-side {
  width: 100%;
  max-width: 960px;
  animation: slideUp 0.6s ease-out;
}

.compact-login-card {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--card);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--line);
}

.login-image-side {
  display: none; /* Oculto en móvil por defecto, visible en desktop */
  background-size: cover;
  background-position: center;
  position: relative;
  color: white;
}

.side-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2.5rem;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
}

.side-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.side-content p {
  font-size: 1rem;
  opacity: 0.9;
}

.login-form-content {
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 100%;
  max-width: 380px;
}

.login-box h3 {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
}

.login-box p {
  text-align: center;
  color: var(--muted);
}

.input-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.login-input {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-size: 1rem;
  transition: var(--transition);
  font-weight: 500;
}

.login-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
  outline: none;
}

.forgot-password-link {
  font-size: 0.875rem;
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 500;
  display: block;
  text-align: right;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

.forgot-password-link:hover {
  text-decoration: underline;
  color: var(--primary-dark);
}

.full-width {
  width: 100%;
}

.login-error-message {
  display: none;
  background: rgba(239, 68, 68, 0.1);
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  border-left: 4px solid var(--danger);
  align-items: flex-start;
  gap: 0.75rem;
  margin-top: 1rem;
}

.login-error-message.show {
  display: flex;
  animation: shake 0.5s ease-in-out;
}

.error-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
  color: var(--danger);
}

.login-submit-btn {
  position: relative;
  overflow: hidden;
}

.btn-text, .btn-loading {
  transition: var(--transition);
}

.btn-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.login-submit-btn.loading .btn-text {
  display: none;
}

.login-submit-btn.loading .btn-loading {
  display: flex;
}

.spinner {
  width: 16px;
  height: 16px;
  animation: spin 1s linear infinite;
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}
/* ===== FIN ESTILOS DE LOGIN ===== */


/* ===== APP LAYOUT ===== */
.app-layout { 
  display: grid; 
  grid-template-columns: 260px 1fr; 
  min-height: 100vh; 
  position: relative;
}

.sidebar { 
  background: var(--sidebar-bg); 
  color: var(--sidebar-ink); 
  padding: 1.5rem; 
  display: flex; 
  flex-direction: column; 
  position: relative;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.sidebar h1 { 
  font-size: 1.5rem; 
  color: #fff; 
  display: flex; 
  align-items: center; 
  gap: 0.75rem; 
  font-weight: 700; 
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--sidebar-ink);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: var(--transition);
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

.sidebar-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.sidebar-nav { 
  display: flex; 
  flex-direction: column; 
  gap: 0.5rem; 
  flex: 1;
}

.sidebar-nav a { 
  display: flex; 
  align-items: center; 
  gap: 0.75rem; 
  padding: 0.85rem 1rem; 
  border-radius: var(--radius); 
  color: var(--sidebar-ink); 
  text-decoration: none; 
  font-weight: 500; 
  transition: var(--transition);
  position: relative;
}

.sidebar-nav a:hover { 
  background: #1f2937; 
  color: #fff; 
  transform: translateX(4px);
}

.sidebar-nav a.active { 
  background: var(--primary); 
  color: #fff; 
  font-weight: 600; 
}

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: #fff;
  border-radius: 0 2px 2px 0;
}

.sidebar-nav a svg { 
  width: 1.25rem; 
  height: 1.25rem; 
  transition: var(--transition);
}

.sidebar-nav a:hover svg {
  transform: scale(1.1);
}

.sidebar-footer { 
  margin-top: auto; 
  font-size: 0.8rem; 
  color: #9ca3af; 
  padding-top: 1.5rem; 
  text-align: center; 
}

.connection-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

.status-text {
  font-size: 0.875rem;
  color: var(--muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px; /* Ajusta según el ancho de tu sidebar */
}



/* ===== MOBILE NAVIGATION ===== */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-top: 1px solid var(--line);
  z-index: 90;
  padding: 0.5rem;
  box-shadow: 0 -4px 6px -1px rgb(0 0 0 / 0.1);
  backdrop-filter: blur(10px);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 0.5rem;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.75rem;
  border-radius: var(--radius);
  transition: var(--transition);
  position: relative;
}

.mobile-nav-item.active {
  color: var(--primary);
  background: var(--primary-light);
}

.mobile-nav-item.active::after {
  content: '';
  position: absolute;
  top: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
}

.mobile-nav-item svg {
  width: 1.25rem;
  height: 1.25rem;
  margin-bottom: 0.25rem;
  transition: var(--transition);
}

.mobile-nav-item.active svg {
  transform: scale(1.1);
}

.mobile-nav-item span {
  font-size: 0.7rem;
  font-weight: 500;
}

/* ===== NUEVO MAIN WRAPPER Y HEADER ===== */
.main-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden; /* Evita que el wrapper scrollee */
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  z-index: 80;
  flex-shrink: 0;
}

.mobile-sidebar-toggle {
  display: none; /* Oculto en desktop */
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius);
}

.mobile-sidebar-toggle svg {
  width: 1.5rem;
  height: 1.5rem;
}

.header-user-menu {
  position: relative;
  margin-left: auto; /* Empuja el menú a la derecha */
}

.user-menu-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-light);
  border: 1px solid var(--line);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}

.user-menu-button:hover {
  background: var(--line);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar svg {
  width: 14px;
  height: 14px;
}

.user-menu-email {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
}

.user-menu-chevron {
  width: 1rem;
  height: 1rem;
  color: var(--muted);
  transition: var(--transition);
}

.user-menu-button.active .user-menu-chevron {
  transform: rotate(180deg);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 110;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: var(--transition);
  padding: 0.5rem;
}

.user-menu-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.875rem;
  border-radius: 8px;
  transition: var(--transition);
}

.user-menu-item:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.user-menu-item svg {
  width: 1rem;
  height: 1rem;
}

.main-content { 
  padding: 2rem; 
  overflow-y: auto; /* Contenido principal scrollea */
  flex: 1; /* Ocupa el espacio restante */
  padding-bottom: 80px; /* Space for mobile nav */
}
/* ===== FIN NUEVO MAIN WRAPPER Y HEADER ===== */


.page { 
  display: none; 
  animation: fadeIn 0.4s ease-in-out; 
}

.full-width-page .card {
  max-width: 100%;
}

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

.page.active { 
  display: block; 
}

.page-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  margin-bottom: 2rem; 
  gap: 1rem; 
  flex-wrap: wrap; 
}

.page-header h2 { 
  margin: 0; 
  font-size: 1.75rem; 
  display: flex; 
  align-items: center; 
  gap: 0.75rem; 
  font-weight: 700; 
}

.toolbar { 
  display: flex; 
  gap: 0.75rem; 
  flex-wrap: wrap; 
}

.grid { 
  display: grid; 
  gap: 1.75rem; 
}

.cols-3 { 
  grid-template-columns: repeat(3, minmax(0, 1fr)); 
}

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

.cols-4 { 
  grid-template-columns: repeat(4, minmax(0, 1fr)); 
}

.card { 
  background: var(--card); 
  border: 1px solid var(--line); 
  border-radius: var(--radius); 
  padding: 1.75rem; 
  box-shadow: var(--shadow); 
  transition: var(--transition);
}

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

.full-width-card {
  max-width: 100%;
}

.stat-card { 
  text-align: center; 
  padding: 1.5rem; 
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--success));
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card .stat-value { 
  font-size: 2rem; 
  font-weight: 800; 
  color: var(--primary); 
  margin-bottom: 0.25rem; 
}

.stat-card .stat-label { 
  font-size: 0.9rem; 
  color: var(--muted); 
  font-weight: 500; 
}

label { 
  font-size: 0.875rem; 
  font-weight: 500; 
  color: var(--muted); 
  display: block; 
  margin-bottom: 0.5rem; 
}

input, select, textarea { 
  width: 100%; 
  padding: 0.75rem 1rem; 
  border: 1px solid var(--line); 
  border-radius: var(--radius); 
  background: var(--bg); 
  font-size: 0.9rem; 
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus { 
  border-color: var(--primary); 
  background: var(--card); 
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15); 
  outline: none;
}

.btn { 
  appearance: none; 
  border: 1px solid transparent; 
  padding: 0.75rem 1.25rem; 
  border-radius: var(--radius); 
  cursor: pointer; 
  font-weight: 600; 
  display: inline-flex; 
  align-items: center; 
  justify-content: center; 
  gap: 0.5rem; 
  font-size: 0.875rem; 
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transition: width 0.3s, height 0.3s, top 0.3s, left 0.3s;
}

.btn:active::after {
  width: 100px;
  height: 100px;
  top: -50px;
  left: -50px;
}

.btn.primary { 
  background: var(--primary); 
  border-color: var(--primary); 
  color: #fff; 
}

.btn.primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
}

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

.btn.secondary:hover {
  background: rgba(59, 130, 246, 0.15);
  transform: translateY(-1px);
}

.btn.danger { 
  background: var(--danger); 
  border-color: var(--danger); 
  color: #fff; 
}

.btn.danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  transform: translateY(-1px);
}

.btn.success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.btn.success:hover {
  background: #0da271;
  border-color: #0da271;
  transform: translateY(-1px);
}

.btn svg {
  width: 1.25rem;
  height: 1.25rem;
  transition: var(--transition);
}

.btn:hover svg {
  transform: scale(1.1);
}

/* ===== ESTILOS BOTONES DE ICONO ===== */
.btn.icon-btn {
  padding: 0.5rem;
  width: 36px;
  height: 36px;
}
.btn.icon-btn svg {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
}

/* ===== ESTILO PARA CAMPANA NOTIFICACION ===== */
#notification-bell {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  overflow: visible !important; /* CRÍTICO: permite que el badge se muestre fuera */
}

#notification-bell svg {
  width: 20px;
  height: 20px;
}

/* Efecto hover en la campana */
#notification-bell:hover {
  background: var(--primary-light);
  transform: scale(1.05);
}

/* Animación de la campana cuando hay notificaciones */
@keyframes bell-ring {
  0%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(-10deg); }
  20%, 40% { transform: rotate(10deg); }
}

#notification-bell.has-notifications {
  animation: bell-ring 0.5s ease;
}

#notification-count {
  position: absolute;
  top: -4px;
  right: -4px;

  /* Tamaño fijo tipo “bolita” */
  min-width: 18px;
  height: 18px;
  border-radius: 999px;

  /* Centrar el número */
  display: none; /* JS lo cambia a flex */
  align-items: center;
  justify-content: center;

  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  padding: 0; /* sin padding para que no se deforme */

  background: var(--danger);
  color: #fff;
  pointer-events: none;

  /* Aro blanco alrededor para que no se “pegue” al fondo */
  box-shadow: 0 0 0 2px var(--card);
}

#notification-count.show {
  display: block;
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}

table { 
  width: 100%; 
  border-collapse: collapse; 
  min-width: 600px;
}

th, td { 
  border-bottom: 1px solid var(--line); 
  padding: 1rem 0.75rem; 
  text-align: left; 
  font-size: 0.9rem; 
}

th { 
  color: var(--muted); 
  font-weight: 600; 
  font-size: 0.75rem; 
  text-transform: uppercase; 
  background: var(--primary-light);
  position: sticky;
  top: 0;
}

tbody tr { 
  transition: var(--transition);
}

tbody tr:hover { 
  background: var(--primary-light); 
  /* transform: scale(1.01); <- ELIMINADO: Rompía el scroll horizontal y sticky header */
}

.right { 
  text-align: right; 
}
.table-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.badge { 
  display: inline-block; 
  padding: 0.3rem 0.75rem; 
  border-radius: 9999px; 
  font-size: 0.75rem; 
  font-weight: 600; 
  text-transform: uppercase; 
}

.badge-success { 
  background-color: var(--success); 
  color: white; 
}

.badge-warning { 
  background-color: var(--warning); 
  color: var(--ink); 
}

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

.badge-info {
  background-color: var(--info);
  color: white;
}

/* Badge principal (usada para "Mejora", "Otro", etc.) */
.badge-primary {
  background-color: var(--primary);
  color: white;
}


/* ===== ESTILOS DE MODAL CORREGIDOS ===== */
.modal-overlay { 
  position: fixed; 
  inset: 0; 
  background: rgba(17, 24, 39, 0.6); 
  z-index: 200; /* Aumentado para estar sobre el sidebar */
  display: none; 
  align-items: center; 
  justify-content: center; 
  backdrop-filter: blur(8px); 
  padding: 1rem;
  animation: fadeIn 0.3s ease;
}

.modal-box { 
  background: var(--card); 
  border-radius: var(--radius); 
  padding: 0; /* Padding movido al header/content/footer */
  width: 100%; 
  max-width: 650px; 
  box-shadow: var(--shadow-lg); 
  max-height: 90vh; 
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease;
}

.modal-header { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.modal-header h3 { 
  margin: 0; 
  font-size: 1.5rem; 
}

.modal-content {
  overflow-y: auto;
  padding: 1.5rem 2rem;
  flex: 1; /* Permite que el contenido crezca y scrollee */
}

.modal-box .toolbar {
  padding: 1.5rem 2rem;
  margin-top: 0;
  border-top: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.close-modal {
  font-size: 1.5rem;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  transition: var(--transition);
}

.close-modal:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: scale(1.1);
}

/* ===== TOAST NOTIFICATION ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 380px;
  opacity: 0;
  visibility: hidden; /* Oculta el elemento para que no bloquee clics */
  transform: translateY(20px);
  transition: all 0.3s ease; /* Transiciona todo, incluyendo visibility */
  z-index: 200;
  /* --- FIN DE LA CORRECCIÓN --- */
}

.toast.show {
  /* Lo trae de vuelta */
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.toast.success { 
  background: var(--success); 
}

.toast.error { 
  background: var(--danger); 
}

.toast.info {
  background: var(--info);
}

.toast.warning {
  background: var(--warning);
  color: var(--ink);
}

.toast-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.toast.success .toast-icon::before {
  content: "";
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
}

.toast.error .toast-icon::before {
  content: "";
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='15' y1='9' x2='9' y2='15'%3E%3C/line%3E%3Cline x1='9' y1='9' x2='15' y2='15'%3E%3C/line%3E%3C/svg%3E");
}

.toast.info .toast-icon::before {
  content: "";
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='16' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'%3E%3C/line%3E%3C/svg%3E");
}

.toast.warning .toast-icon::before {
  content: "";
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111827' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'%3E%3C/path%3E%3Cline x1='12' y1='9' x2='12' y2='13'%3E%3C/line%3E%3Cline x1='12' y1='17' x2='12.01' y2='17'%3E%3C/line%3E%3C/svg%3E");
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.toast-message {
  font-size: 0.875rem;
  opacity: 0.9;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transition: var(--transition);
  border-radius: 4px;
}

.toast-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.hr { 
  height: 1px; 
  background: var(--line); 
  margin: 2rem 0; 
  border: none; 
}

.mini { 
  font-size: 0.85rem; 
  color: var(--muted); 
}

.search-box { 
  position: relative; 
  max-width: 250px; 
}

.search-box input { 
  padding-left: 2.5rem; 
}

.search-box svg { 
  position: absolute; 
  left: 0.75rem; 
  top: 50%; 
  transform: translateY(-50%); 
  width: 1.25rem; 
  height: 1.25rem; 
  color: var(--muted); 
}

.dashboard-grid { 
  display: grid; 
  gap: 1.75rem; 
  grid-template-columns: repeat(4, 1fr); 
}

.tag-container { 
  display: flex; 
  flex-wrap: wrap; 
  gap: 0.5rem; 
}

.tag { 
  background-color: var(--primary-light); 
  color: var(--primary-dark); 
  padding: 0.25rem 0.75rem; 
  border-radius: 9999px; 
  font-size: 0.8rem; 
  display: flex; 
  align-items: center; 
  gap: 0.5rem; 
}

.tag span { 
  cursor: pointer; 
  color: var(--danger); 
  opacity: 0.7; 
}

/* ===== ACCORDION STYLES ===== */
.accordion {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.accordion-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.accordion-item:hover {
  border-color: var(--primary);
}

.accordion-header {
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: none;
  text-align: left;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
}

.accordion-header:hover {
  background: var(--primary-light);
}

.accordion-icon {
  width: 1.25rem;
  height: 1.25rem;
  transition: var(--transition);
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  background: var(--primary-light);
}

.accordion-item.active .accordion-content {
  padding: 1rem 1.25rem;
  max-height: 500px;
}

.accordion-content p {
  margin: 0;
  color: var(--ink);
}

.support-form { 
  max-width: 100%; 
}

.support-form textarea { 
  min-height: 120px; 
  resize: vertical; 
}

.support-form .btn { 
  margin-top: 1rem; 
}

.feedback-list { 
  margin-top: 1.5rem; 
}

.feedback-item { 
  border: 1px solid var(--line); 
  border-radius: var(--radius); 
  padding: 1rem; 
  margin-bottom: 1rem; 
  transition: var(--transition);
}

.feedback-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.feedback-header { 
  display: flex; 
  justify-content: space-between; 
  margin-bottom: 0.5rem; 
}

.feedback-date { 
  color: var(--muted); 
  font-size: 0.85rem; 
}

.feedback-status { 
  font-size: 0.75rem; 
  padding: 0.25rem 0.5rem; 
  border-radius: 9999px; 
}

.status-pendiente { 
  background-color: var(--warning); 
  color: white; 
}

.status-resolved { 
  background-color: var(--success); 
  color: white; 
}

.status-review { 
  background-color: var(--info); 
  color: white; 
}
.status-pendiente {
  background-color: var(--warning);
  color: var(--ink);
}

/* ===== ESTILOS DE LOADER ===== */
.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
  position: relative;
}
.btn.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1rem;
  height: 1rem;
  margin-top: -0.5rem;
  margin-left: -0.5rem;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.btn.secondary.is-loading::after {
  border-color: rgba(0, 0, 0, 0.2);
  border-top-color: var(--primary);
}
.btn.is-loading svg {
  visibility: hidden;
}

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

/* ===== RESPONSIVE DESIGN ===== */
@media (min-width: 768px) {
  .compact-login-card {
    grid-template-columns: 1fr 1fr;
  }
  .login-image-side {
    display: block;
  }
  .login-form-content {
    padding: 3rem;
  }
}

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

@media (max-width: 1024px) {
  .app-layout { 
    grid-template-columns: 1fr; 
  }
  
  .sidebar { 
    position: fixed; 
    left: -260px; 
    transition: left 0.3s ease; 
    z-index: 100; 
    width: 260px; 
    height: 100vh; 
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar.active { 
    left: 0; 
  }
  
  .sidebar-toggle {
    display: block;
  }
  
  .mobile-nav {
    display: flex;
  }
  
  .cols-3, .cols-2, .cols-4, .row { 
    grid-template-columns: 1fr; 
  }
  
  .main-wrapper {
    height: auto; /* Reajusta la altura en móvil */
  }
  .main-content {
    padding: 1.5rem 1rem;
    padding-bottom: 80px;
    height: auto;
    overflow-y: visible;
  }
  
  .page-header h2 {
    font-size: 1.5rem;
  }

  .main-header {
    padding: 0.75rem 1rem;
  }
  
  .mobile-sidebar-toggle {
    display: block;
  }
  
  .user-menu-email {
    display: none; /* Oculta email en móvil */
  }

  .toast { 
    bottom: 5rem; /* Sigue apareciendo encima del nav móvil */
    right: 1rem; 
    left: 1rem; 
    max-width: none;
    z-index: 300;
    /* Lo mueve 150% hacia abajo (fuera de la pantalla) */
    transform: translateY(150%);
  }
}

@media (max-width: 768px) {
  .page-header { 
    flex-direction: column; 
    align-items: flex-start; 
    gap: 1rem;
  }
  
  .toolbar {
    width: 100%;
    justify-content: flex-start;
  }
  
  .dashboard-grid { 
    grid-template-columns: 1fr; 
  }
  
  .card { 
    padding: 1.25rem; 
  }
  
  .modal-box { 
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }
  .modal-header, .modal-content, .modal-box .toolbar {
    padding: 1rem 1.25rem;
  }
  
  .toast { 
    bottom: 5rem; 
    right: 1rem; 
    left: 1rem; 
    max-width: none;
    z-index: 300;
    transform: translateY(150%);
  }
  
  .login-form-content {
    padding: 2rem 1.5rem;
  }
  
  .table-responsive {
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }
}

@media (max-width: 480px) {
  .main-content {
    padding: 1rem 0.75rem;
    padding-bottom: 80px;
  }
  
  .page-header h2 {
    font-size: 1.5rem;
  }
  
  .card {
    padding: 1rem;
    margin: 0.5rem 0;
  }
  
  .modal-box {
    margin: 0.5rem;
    max-height: calc(100vh - 1rem);
  }
  
  .btn {
    padding: 0.65rem 1rem;
    font-size: 0.8rem;
  }
  
  .stat-card .stat-value {
    font-size: 1.75rem;
  }
  
  .mobile-nav-item span {
    font-size: 0.65rem;
  }
  
  .mobile-nav {
    padding: 0.25rem;
  }
  
  .login-form-content {
    padding: 1.5rem 1.25rem;
  }
  
  .login-box h3 {
    font-size: 1.5rem;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --line: #000000;
    --muted: #333333;
  }
  
  .card {
    border: 2px solid var(--line);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== ESTILOS PANTALLA DE VALIDACIÓN ===== */
#validation-wall {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 150; /* Entre el login y los modales */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* ===== ESTILOS PARA TABS EN MODAL ===== */
.modal-tabs {
  display: flex;
  background: var(--bg);
  padding: 0.5rem 2rem 0 2rem;
  border-bottom: 1px solid var(--line);
  gap: 1rem;
}
.tab-link {
  padding: 0.75rem 0.25rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.tab-link:hover {
  color: var(--ink);
}
.tab-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}
#tab-actuales .modal-content {
  padding: 0;
}

/* Oculta el campo de nombre de empresa por defecto en el registro */
#register-company-group {
  display: none;
}

/* ===== NUEVO FOOTER DE APLICACIÓN ===== */
.app-footer {
  display: flex;
  flex-wrap: wrap; /* Para que se apile en pantallas pequeñas */
  justify-content: space-between; /* Pone los spans en extremos opuestos */
  align-items: center;
  gap: 0.5rem 1.5rem; /* Espacio vertical y horizontal */
  padding: 0.75rem 2rem; /* Padding igual al header */
  background: var(--card);
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  flex-shrink: 0; /* Evita que el footer se encoja */
  z-index: 50;
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: var(--transition);
}

.app-footer a:hover {
  text-decoration: underline;
  color: var(--primary-dark);
}

.footer-left {
  text-align: left;
}

.footer-right {
  text-align: right;
}

/* Ocultar footer en móviles */
@media (max-width: 768px) {
  .app-footer {
    display: none;
  }
}


/* --- Responsive para el Footer --- */
@media (max-width: 1024px) {
  .app-footer {
    /* Se apila y se centra en pantallas pequeñas */
    flex-direction: column;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    text-align: center;
    /* IMPORTANTE: Deja espacio para la barra de navegación móvil */
    margin-bottom: 56px; 
  }
  
  .footer-left, .footer-right {
    text-align: center;
  }
}
/* ===== MODAL CONFIRM Z-INDEX  ===== */
#modalConfirm {
  z-index: 210; /* Un valor más alto que los otros modales (200) */
}
/* ===== Productos: KPIs, Filtros, Cards y FAB ===== */
.kpi-productos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: var(--card, #fff);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 12px);
  padding: 1rem;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.kpi-label {
  color: var(--muted);
  font-size: .9rem;
}
.kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary, #12659e);
}

/* ----- Filtros ----- */
.filters-card {
  margin-bottom: 1rem;
}
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}
.filter-item {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.filter-item label {
  font-size: .85rem;
  color: var(--muted);
}
.filter-actions {
  display: flex;
  align-items: center;
}

/* ----- Vista Cards ----- */
.hidden { display: none !important; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}
.p-card {
  background: var(--card, #fff);
  border: 1px solid var(--line, #e5e7eb);
  border-radius: var(--radius, 12px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  transition: transform .15s ease, box-shadow .15s ease;
}
.p-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.08);
}
.p-card.low {
  outline: 2px dashed #ffc10733;
}
.p-card.zero {
  outline: 2px dashed #ff6b6b33;
}
.p-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}
.p-card-head .sku {
  font-weight: 700;
}
.p-card-head .type {
  font-size: .85rem;
  color: var(--muted);
}
.p-card-body .name {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: .25rem;
}
.p-card-body .stock {
  font-size: .95rem;
  color: var(--muted);
}
.p-card-body .state {
  margin-top: .4rem;
}
.p-card-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: .4rem;
}
.p-card-actions .btn.sm {
  padding: .35rem .6rem;
  font-size: .85rem;
}

/* ----- FAB (botón flotante) ----- */
.fab-wrap {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
}
.fab {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--primary, #12659e);
  color: #fff;
  border: none;
  font-size: 1.6rem;
  box-shadow: 0 10px 22px rgba(0,0,0,0.18);
  cursor: pointer;
}
.fab-menu {
  display: none;
  position: absolute;
  bottom: 64px;
  right: 0;
  flex-direction: column;
  gap: .4rem;
}
.fab-menu.open {
  display: flex;
}
.fab-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .45rem .8rem;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
  font-size: .9rem;
  color: var(--primary, #12659e);
}
.fab-item:hover {
  background: var(--primary, #12659e);
  color: #fff;
}

/* ----- Estados vacíos y responsividad ----- */
.empty {
  padding: 1rem;
  color: var(--muted);
  text-align: center;
}

/* ----- Colores modo oscuro (si usas dark mode) ----- */
@media (prefers-color-scheme: dark) {
  .p-card, .kpi-card {
    background: #1f1f1f;
    border-color: #2c2c2c;
    color: #e5e5e5;
  }
  .fab-item {
    background: #2c2c2c;
    color: #e5e5e5;
  }
  .fab-item:hover {
    background: var(--primary, #3b990b);
  }
}

/* ===== ESTILOS PARA KARDEX (Reportes) ===== */
.kardex-header {
  padding: 1rem;
  background: var(--primary-light);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.kardex-header h4 {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
  color: var(--primary-dark);
}
.kardex-header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

#kardexTable tbody tr.entrada td {
  color: var(--success);
}
#kardexTable tbody tr.salida td {
  color: var(--danger);
}
#kardexTable tbody tr.ajuste td {
  color: var(--warning);
  font-style: italic;
}
#kardexTable tbody tr.traslado td {
  color: var(--info);
  font-style: italic;
}
#kardexTable tbody tr td:nth-child(5),
#kardexTable tbody tr td:nth-child(6) {
  font-weight: 600;
}

/* ===== ESTILOS PARA FILA INACTIVA ===== */
.inactive-row {
  opacity: 0.6;
  background-color: var(--line);
  font-style: italic;
}
.inactive-row:hover {
  opacity: 1;
  background-color: var(--primary-light);
}

/* ===== ESTILOS PARA ALMACÉN PREDETERMINADO ===== */
.default-star-btn {
  color: var(--muted); /* Color inactivo (gris) */
}
.default-star-btn.is-default {
  color: var(--warning); /* Color activo (amarillo) */
}
.default-star-btn:hover {
  color: var(--warning);
}

/* ===== ESTILOS PARA PESTAÑAS (Configuración) ===== */
.config-tabs-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* En PC, las pestañas van a la izquierda */
@media (min-width: 768px) {
  .config-tabs-container {
    flex-direction: row;
    align-items: flex-start;
  }
  .config-tabs {
    flex: 0 0 200px; /* Ancho fijo de 200px para el menú de pestañas */
    position: sticky;
    top: 1.5rem;
  }
  .config-tabs .tab-link {
    justify-content: flex-start;
  }
  .config-tab-content {
    flex: 1; /* El contenido toma el resto del espacio */
    margin-top: 0;
  }
}

.config-tab-content > .tab-content.active {
  display: block;
}

.config-tabs .tab-link svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0; /* Evita que el SVG se encoja */
}

/* En Móvil, las pestañas son botones horizontales */
.config-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.config-tabs .tab-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}
.config-tabs .tab-link:hover {
  color: var(--ink);
  background-color: var(--primary-light);
}
.config-tabs .tab-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
  border-color: var(--primary);
  font-weight: 600;
}

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

/* ===== ESTILOS PARA PESTAÑAS (Configuración) ===== */
.config-tabs-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* En PC, las pestañas van a la izquierda */
@media (min-width: 768px) {
  .config-tabs-container {
    flex-direction: row;
    align-items: flex-start;
  }
  .config-tabs {
    flex: 0 0 200px; /* Ancho fijo de 200px para el menú de pestañas */
    position: sticky;
    top: 1.5rem;
  }
  .config-tabs .tab-link {
    justify-content: flex-start;
  }
  .config-tab-content {
    flex: 1; /* El contenido toma el resto del espacio */
    margin-top: 0;
  }
}

/* En Móvil, las pestañas son botones verticales */
.config-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.config-tabs .tab-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-weight: 500;
  color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}
.config-tabs .tab-link:hover {
  color: var(--ink);
  background-color: var(--primary-light);
}
.config-tabs .tab-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
  border-color: var(--primary);
  font-weight: 600;
}

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

/* LA CORRECCIÓN DE ICONOS ESTÁ AQUÍ  */
.config-tabs .tab-link svg {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0; /* Evita que el SVG se encoja */
}

/* ===== ESTILOS PARA CATEGORÍA EN CARD ===== */
.p-card-body .category {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
}

/* ===== ESTILOS PARA ZONA DE PELIGRO (Config) ===== */
.danger-zone-card {
  border-color: var(--danger);
  background: linear-gradient(to bottom, var(--card) 95%, #fff1f2);
}
.danger-zone-card h3 {
  color: var(--danger);
}
.danger-zone-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.danger-zone-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.danger-zone-item:first-of-type {
  padding-top: 0;
}
.danger-zone-item div {
  flex: 1;
  min-width: 250px;
}
.danger-zone-item p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0;
}
.danger-zone-item .btn.danger {
  background: #fff1f2;
  color: var(--danger);
  border-color: var(--danger);
}
.danger-zone-item .btn.danger:hover {
  background: var(--danger);
  color: white;
}

/* ===== MENSAJE DE INVITACIÓN EN REGISTRO ===== */
#invite-info-message {
  animation: slideDown 0.3s ease;
}

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

#register-company-group {
  transition: all 0.3s ease;
}

/* ===== CENTRO DE SOPORTE: TABS ===== */
.support-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--line);
  overflow-x: auto;
}

.support-tab-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.support-tab-link svg {
  width: 1.125rem;
  height: 1.125rem;
}

.support-tab-link:hover {
  color: var(--ink);
  background: var(--primary-light);
}

.support-tab-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.support-tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.support-tab-content.active {
  display: block;
}

/* ===== LISTA DE TICKETS ===== */
.ticket-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.ticket-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.ticket-item.has-new-response {
  border-left: 4px solid var(--success);
  background: linear-gradient(to right, rgba(16, 185, 129, 0.05), transparent);
}

.ticket-item.has-new-response::before {
  content: 'Nueva respuesta';
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 0.7rem;
  background: var(--success);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
}

.ticket-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.ticket-id {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.ticket-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0.25rem 0;
  color: var(--ink);
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.ticket-meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ticket-meta-item svg {
  width: 1rem;
  height: 1rem;
}

.ticket-description {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.5rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.ticket-responses-count {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ticket-responses-count svg {
  width: 1rem;
  height: 1rem;
}

/* ===== ESTADOS DE TICKET ===== */
.ticket-status {
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

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

.ticket-status.revision {
  background: #dbeafe;
  color: #1e40af;
}

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

.ticket-status.cerrado {
  background: #e5e7eb;
  color: #374151;
}

/* ===== PRIORIDADES ===== */
.ticket-priority {
  font-size: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-weight: 600;
}

.ticket-priority.baja {
  background: #d1fae5;
  color: #065f46;
}

.ticket-priority.media {
  background: #fef3c7;
  color: #92400e;
}

.ticket-priority.alta {
  background: #fed7aa;
  color: #9a3412;
}

.ticket-priority.critica {
  background: #fecaca;
  color: #991b1b;
}

/* ===== DETALLE DEL TICKET ===== */
.ticket-detail-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.ticket-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ticket-info-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.ticket-info-value {
  font-size: 0.95rem;
  color: var(--ink);
  font-weight: 500;
}

/* ===== CONVERSACIÓN DEL TICKET ===== */
.ticket-conversacion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 400px;
  overflow-y: auto;
  padding: 1rem 0;
}

.mensaje-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.mensaje-item.usuario {
  background: var(--primary-light);
  border-color: var(--primary);
  margin-right: 2rem;
}

.mensaje-item.soporte {
  background: var(--bg);
  margin-left: 2rem;
  border-left: 3px solid var(--success);
}

.mensaje-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.mensaje-item.soporte .mensaje-avatar {
  background: var(--success);
}

.mensaje-content {
  flex: 1;
}

.mensaje-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.mensaje-autor {
  font-weight: 600;
  font-size: 0.9rem;
}

.mensaje-fecha {
  font-size: 0.75rem;
  color: var(--muted);
}

.mensaje-texto {
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ===== ESTADO VACÍO ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}

.empty-state svg {
  width: 4rem;
  height: 4rem;
  color: var(--muted);
  opacity: 0.5;
  margin-bottom: 1rem;
}

.empty-state h4 {
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ===== ESTADO DE CARGA ===== */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  gap: 1rem;
}

.loading-state p {
  color: var(--muted);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .ticket-header {
    flex-direction: column;
  }
  
  .ticket-meta {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .ticket-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  .mensaje-item.usuario {
    margin-right: 0;
  }
  
  .mensaje-item.soporte {
    margin-left: 0;
  }
}

/* =================================== */
/* ▼▼▼ PEGAR ESTO AL FINAL DE STYLES.CSS ▼▼▼ */
/* =================================== */

/* 1. Estilos para el Mobile Header 
     (Arregla: "Falta el mobile header")
*/
.mobile-header {
  display: none; /* Oculto en desktop */
  align-items: center;
  padding: 0 1rem;
  height: 3.5rem; /* 56px */
  background-color: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.hamburger-btn {
  color: var(--muted);
}

.mobile-header-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 auto;
  font-weight: 700;
  color: var(--ink);
}

.mobile-header-logo svg {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--primary);
}

/* 2. Estilos para el Overlay 
     (Arregla: "Falta el overlay")
*/
.app-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
}

/* 3. Lógica Responsive (en Móvil) 
*/
@media (max-width: 1023px) {

  /* Arregla: "El main-header debe ocultarse en móvil" 
  */
  .main-header {
    display: none;
  }
  
  /* Muestra el mobile-header */
  .mobile-header {
    display: flex;
  }
  
  /* Posiciona el sidebar fuera de la pantalla */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 40;
    transition: transform 0.3s ease-out;
    width: 280px; /* Ancho del menú móvil */

    /* 🔽 Scroll vertical sutil */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

    /* Scrollbar sutil para el menú lateral en móvil */
  .sidebar::-webkit-scrollbar {
    width: 6px;
  }

  .sidebar::-webkit-scrollbar-track {
    background: transparent;
  }

  .sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 999px;
  }


  /* ⭐ IMPORTANTE: Esta clase es la que activa el sidebar */
  .app-layout.sidebar-open .sidebar {
    transform: translateX(0);
  }
  
  .app-layout.sidebar-open .app-overlay {
    opacity: 1;
    visibility: visible;
  }
  
  /* El main-wrapper no se mueve */
  .main-wrapper {
    margin-left: 0;
  }
}

/* --- Barra de Anuncio Global (desde Admin) --- */
.global-announcement {
  margin: 0 1.5rem 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--primary-light);
  border: 1px solid var(--primary);
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.global-announcement.show {
  display: flex;
}

.global-announcement .ga-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.ga-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--primary);
  color: white;
}

.global-announcement.info .ga-pill { background: var(--info); }
.global-announcement.success .ga-pill { background: var(--success); }
.global-announcement.warning .ga-pill { background: var(--warning); }
.global-announcement.danger .ga-pill { background: var(--danger); }

.ga-close {
  border: none;
  background: transparent;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  border-radius: 999px;
}

.ga-close:hover {
  background: rgba(0,0,0,0.04);
}

/* ===== MEJORAS DE NOTIFICACIONES ===== */

/* Badge de contador visible siempre */
.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border: 2px solid var(--bg);
  z-index: 10;
  white-space: nowrap;
  transition: all 0.2s ease;
}

/* Badge con números grandes (10-99) */
.notification-badge:not(:empty) {
  min-width: 22px;
  padding: 0 5px;
}

/* Badge con números muy grandes (100+) */
.notification-badge[data-count="100"],
.notification-badge[data-count^="1"],
.notification-badge[data-count^="2"],
.notification-badge[data-count^="3"] {
  min-width: 26px;
  padding: 0 4px;
  font-size: 10px;
}

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

/* Dropdown más ancho */
.notification-dropdown {
  width: 380px !important;
  max-height: 500px;
  padding: 0;
}

/* Header del dropdown */
.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.notification-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
  text-decoration: underline;
  padding: 0;
}

.btn-link:hover {
  color: var(--primary-dark);
}

/* Tabs de Notificaciones */
.notification-tabs {
  display: flex;
  border-bottom: 2px solid var(--line);
  background: var(--bg);
}

.notification-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.notification-tab svg {
  width: 1rem;
  height: 1rem;
}

.notification-tab:hover {
  background: var(--primary-light);
  color: var(--ink);
}

.notification-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* Contenido de Tabs */
.notification-tab-content {
  display: none;
  max-height: 350px;
  overflow-y: auto;
  padding: 0.5rem;
}

.notification-tab-content.active {
  display: block;
}

.empty-notif {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
}

/* Items de Notificación Mejorados */
.notification-item {
  padding: 0.75rem;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
  border: 1px solid var(--line);
  transition: var(--transition);
  background: var(--card);
  cursor: pointer;
}

.notification-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.notification-item.stock-notif {
  border-left: 3px solid var(--warning);
}

.notification-item.admin-notif {
  border-left: 3px solid var(--info);
}

.notification-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.notification-title-row strong {
  font-size: 0.9rem;
  color: var(--ink);
  flex: 1;
}

.notification-tags {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.notification-item .badge {
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  .notification-dropdown {
    width: calc(100vw - 2rem) !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, 10px);
  }

  .notification-dropdown.active {
    transform: translate(-50%, 0);
  }
}

/* ===== AJUSTES DE LAYOUT EN MÓVIL ===== */

@media (max-width: 1023px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: var(--transition);
    width: 260px;
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-toggle,
  .mobile-nav {
    display: flex;
  }

  .main-header {
    display: flex;
    padding: 0.75rem 1rem;
  }

  .main-content {
    padding: 1rem;
    padding-bottom: 80px;
  }
}

/* Modo solo lectura para el modal de Órdenes de Venta */
#modalOrdenVenta.view-only select,
#modalOrdenVenta.view-only input {
  background-color: var(--bg-elevated, #f5f5f5);
  cursor: default;
}

/* Ocultar botón "Quitar" de cada fila al ver detalle */
#modalOrdenVenta.view-only button[onclick^="removeOVItem"] {
  display: none;
}

/* Ocultar el botón Guardar y desactivar Añadir en modo detalle
   (el display de Guardar ya lo manejamos también por JS) */
#modalOrdenVenta.view-only #btnGuardarOrdenVenta {
  display: none;
}

/* ===== Tarjeta "Estado de suscripción" (Config > Empresa) ===== */

.subscription-status-card {
  margin-bottom: 1.5rem;
  padding: 1.1rem 1.3rem;
  border-radius: 1rem;
  background:
    radial-gradient(circle at top left, rgba(59,130,246,0.12), transparent 55%),
    radial-gradient(circle at bottom right, rgba(16,185,129,0.12), transparent 55%),
    var(--card);
  border: 1px solid rgba(148,163,184,0.35);
  box-shadow: 0 14px 30px rgba(15,23,42,0.08);
}

.subscription-status-header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}

.subscription-status-icon {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0, #fff, rgba(15,23,42,0.06));
  border: 1px solid rgba(148,163,184,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.subscription-status-icon-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
}

.subscription-status-texts h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.subscription-status-texts p {
  margin: 0.2rem 0 0;
  color: var(--muted);
}

.subscription-chip {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.subscription-chip.chip-neutral {
  background: rgba(148,163,184,0.12);
  color: #6b7280;
  border-color: rgba(148,163,184,0.4);
}

.subscription-chip.chip-active {
  background: rgba(16,185,129,0.12);
  color: #047857;
  border-color: rgba(16,185,129,0.5);
}

.subscription-chip.chip-warning {
  background: rgba(245,158,11,0.12);
  color: #92400e;
  border-color: rgba(245,158,11,0.55);
}

.subscription-chip.chip-danger {
  background: rgba(239,68,68,0.12);
  color: #b91c1c;
  border-color: rgba(239,68,68,0.55);
}

.subscription-status-body {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.subscription-status-block .label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.subscription-status-block strong {
  font-size: 0.95rem;
  color: var(--ink);
}

/* Barra de progreso */
.subscription-status-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: space-between;
}

.subscription-progress-wrapper {
  flex: 1 1 auto;
  min-width: 220px;
}

.subscription-progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(148,163,184,0.25);
  overflow: hidden;
  position: relative;
}

.subscription-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 0.35s ease-out, background 0.25s ease-out;
}

.subscription-progress-fill.is-warning {
  background: linear-gradient(90deg, var(--warning), #f97316);
}

.subscription-progress-fill.is-danger {
  background: linear-gradient(90deg, var(--danger), #b91c1c);
}

.subscription-progress-hint {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
}

@media (max-width: 768px) {
  .subscription-status-body {
    grid-template-columns: 1fr;
  }

  .subscription-status-header {
    align-items: flex-start;
  }

  .subscription-status-card {
    margin-bottom: 1.25rem;
  }
}
/* ========= Estilos Manual de Usuario ========= */

.manual-body {
  background: var(--bg, #f3f4f6);
  color: var(--ink, #111827);
}

/* Header superior del manual */
.manual-header-bar {
  background: var(--card, #ffffff);
  border-bottom: 1px solid var(--line, #e5e7eb);
  box-shadow: 0 2px 20px rgba(15, 23, 42, 0.08);
}

.manual-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.manual-logo-img {
  height: 40px;
  width: auto;
}

/* Contenedor principal */
.manual-container {
  max-width: 1100px;
  margin: 1.5rem auto 2rem;
  padding: 0 1.5rem;
}

/* Título */
.manual-page-title h1 {
  margin: 0 0 0.25rem;
}

.manual-page-title p {
  margin: 0;
}

/* Layout: índice + contenido */
.manual-layout {
  margin-top: 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 290px) minmax(0, 1fr);
  gap: 1.5rem;
}

/* Buscador del manual */
.manual-toc-container {
  position: sticky;
  
  /* (Ajusta esto a la altura de tu header + margen) */
  top: 90px; 
  
  align-self: start;

  /* Le decimos que su altura máxima sea el 85% de 
     la altura de la ventana (viewport height) */
  max-height: 85vh;
  
  /* Si el contenido (buscador + índice) es más alto 
     que eso, le aparece un scroll INTERNO. */
  overflow-y: auto;
}

.manual-search-box {
  padding: 0.9rem 1rem;
}

.manual-search-input {
  position: relative;
  margin-top: 0.3rem;
}

#manualSearchInput {
  width: 100%;
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  font-size: 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line, #e5e7eb);
  background: var(--bg-elevated, #ffffff);
}

.manual-search-input i {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--muted, #6b7280);
}

.manual-search-info {
  margin-top: 0.35rem;
  color: var(--muted, #6b7280);
}

/* Índice (TOC) */
.manual-toc h2 {
  margin-top: 0;
  margin-bottom: 0.6rem;
  font-size: 1rem;
}

.manual-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
}

.manual-toc li {
  margin-bottom: 0.25rem;
}

.manual-toc a {
  display: block;
  padding: 0.25rem 0.45rem;
  border-radius: 0.45rem;
  text-decoration: none;
  color: var(--ink-soft, #4b5563);
  transition: background 0.2s ease, color 0.2s ease;
}

.manual-toc a:hover {
  background: rgba(37, 99, 235, 0.06);
  color: var(--primary, #2563eb);
}

.manual-toc a.active {
  background: var(--primary, #2563eb);
  color: #ffffff;
}

/* Secciones del manual */
.manual-articles {
  padding: 1.5rem 1.75rem;
}

.manual-article {
  border-bottom: 1px solid var(--line-soft, #e5e7eb);
  padding-bottom: 1rem;
  margin-bottom: 0.5rem;
}

.manual-article:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.manual-article > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.9rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary, #2563eb);
  outline: none;
}

.manual-article > summary::-webkit-details-marker {
  display: none;
}

.manual-article > summary i {
  width: 1.1rem;
  text-align: center;
}

.manual-article > summary::after {
  content: "\f078";              
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-left: auto;
  font-size: 0.8rem;
  transition: transform 0.25s ease;
  color: var(--muted, #6b7280);
}


.manual-article[open] > summary::after {
  transform: rotate(180deg);
}

.manual-article[open] > summary {
  color: var(--primary-dark, #1d4ed8);
}

.manual-article-content {
  padding-bottom: 0.75rem;
  font-size: 0.95rem;
  color: var(--ink-soft, #374151);
}

.manual-article-content h3 {
  margin-top: 0.9rem;
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.manual-article-content p,
.manual-article-content ul,
.manual-article-content ol {
  margin-bottom: 0.65rem;
}

.manual-article-content ul,
.manual-article-content ol {
  padding-left: 1.1rem;
}

.manual-article-content li {
  margin-bottom: 0.35rem;
}

/* Código inline */
.code-inline {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 0.3rem;
  background: rgba(79, 70, 229, 0.06);
  color: #4338ca;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.82rem;
}

/* Imágenes del manual */
.manual-media {
  display: block;
  width: 100%;
  max-width: 800px;
  margin: 0.7rem auto 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid var(--line, #e5e7eb);
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.manual-media:hover {
  transform: scale(1.01);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
}

/* Glosario */
.manual-glossary {
  margin: 0;
}

.manual-glossary dt {
  font-weight: 600;
  margin-top: 0.6rem;
}

.manual-glossary dd {
  margin: 0.2rem 0 0.2rem 0;
  color: var(--muted, #6b7280);
}

/* Botón Volver arriba */
#manualBackToTop {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: none;
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--primary, #2563eb);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.4);
  z-index: 999;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#manualBackToTop:hover {
  transform: translateY(-3px);
  background: var(--primary-dark, #1d4ed8);
  box-shadow: 0 14px 35px rgba(37, 99, 235, 0.5);
}

/* Lightbox */
.manual-lightbox {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  padding-top: 60px;
}

.manual-lightbox-content {
  margin: auto;
  display: block;
  width: 80%;
  max-width: 900px;
}

.manual-lightbox-close {
  position: absolute;
  right: 30px;
  top: 15px;
  font-size: 2rem;
  color: #e5e7eb;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 900px) {
  .manual-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .manual-toc-container {
    position: static;
  }
}

@media (max-width: 640px) {
  .manual-container {
    padding: 0 1rem;
  }

  .manual-header-inner {
    padding: 0.75rem 1rem;
  }

  .manual-articles {
    padding: 1.25rem 1.25rem;
  }

  .manual-page-title {
    padding: 1.1rem 1.25rem;
  }
}

.btn-back {
      color: var(--primary);
      text-decoration: none;
      font-weight: 600;
      font-size: 0.9rem;
    }

  .manual-article {
  scroll-margin-top: 80px; 
}

.badge-estado-producto {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
}

.badge-activo {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.badge-inactivo {
  background: rgba(148, 163, 184, 0.2);
  color: #4b5563;
}

/* Fila de producto inactivo, más tenue */
.row-producto-inactivo {
  opacity: 0.65;
}

/* --- INICIO MEJORA 3: ESTILOS DEL LOGO --- */
.sidebar-logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: var(--transition);
}
.sidebar-logo-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
}
.sidebar-logo-icon {
  width: 28px;
  height: 28px;
  color: #3b82f6; /* Color primario */
}
.sidebar-logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f9fafb; /* Color de texto del sidebar */
}
/* Oculta el botón "X" que añadimos (se usará en JS) */
#menu-toggle-mobile-close {
  display: none;
}
/* --- FIN MEJORA 3 --- */


/* 1.A - Arreglo del CONTADOR (para que quepan 2 dígitos) */

.notification-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background-color: var(--danger, #ef4444);
  color: white !important;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px; /* ⭐ Cambiar a pill shape */
  height: 18px;
  min-width: 18px;
  padding: 0 5px; /* ⭐ Más espacio horizontal */
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--card, #fff);
  z-index: 10;
  white-space: nowrap; /* ⭐ Evitar saltos de línea */
}

/* 1.B - Arreglo del DROPDOWN (para centrarlo en móvil) */
@media (max-width: 640px) {
  .notification-dropdown {
    /* --- ESTE ES EL CAMBIO --- */
    position: fixed; /* <-- Fija la posición a la pantalla, no al header */
    top: 60px;       /* <-- Lo baja un poco desde el top (ajusta si es necesario) */
    left: 50%;       /* <-- Centra horizontalmente */
    transform: translateX(-50%);
    right: auto;     /* <-- Anula el 'right: 0' de escritorio */
    /* --- FIN DEL CAMBIO --- */
    
    width: 95vw;
    max-width: 450px; /* Un poco más de espacio */
    max-height: 70vh;
    overflow-y: auto;
    z-index: 999; /* Asegura que esté por encima de todo */
  }
}

/* ========================================
   🔍 SEARCH DROPDOWN (Autocompletado)
   ======================================== */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  margin-top: 4px;
}

.search-dropdown-list {
  padding: 0.5rem 0;
}

.search-dropdown-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--bg);
}

.search-dropdown-item:hover {
  background: var(--primary-light);
}

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

.search-dropdown-item strong {
  display: block;
  font-size: 0.95rem;
  color: var(--ink);
  margin-bottom: 0.25rem;
}

.search-dropdown-item .mini {
  color: var(--muted);
  font-size: 0.85rem;
}

.search-dropdown-empty {
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Resaltar coincidencias en la búsqueda */
.search-highlight {
  background: rgba(59, 130, 246, 0.2);
  font-weight: 600;
  color: var(--primary);
}

/* === Modal: Mensajes del Admin (#modalNotificacionAdmin) === */

/* Caja del modal */
#modalNotificacionAdmin .modal-box {
  max-width: 520px;            /* un poco más ancho */
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.35);
}

/* Cabecera con gradiente (título + icono) */
#modalNotificacionAdmin .modal-header {
  background: linear-gradient(135deg, var(--primary), #4f46e5);
  color: #fff;
  padding: 1.25rem 1.75rem;
  border-bottom: none;
}

#modalNotificacionAdmin .modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Iconito antes del título */
#modalNotificacionAdmin .modal-header h3::before {
  content: "";
  font-size: 1.4rem;
}

/* Cuerpo del modal */
#modalNotificacionAdmin .modal-content {
  padding: 1.5rem 1.75rem;
  background: var(--card);
}

/* Fecha del mensaje */
#modalNotificacionAdmin #notif-admin-fecha {
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

/* Texto del mensaje */
#modalNotificacionAdmin #notif-admin-mensaje {
  margin-top: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
  padding-left: 0.75rem;
  border-left: 3px solid var(--primary-light);
}

/* Footer / botones del modal */
#modalNotificacionAdmin .toolbar {
  padding: 1rem 1.75rem 1.25rem;
  background: var(--bg);
  border-top: 1px solid var(--line);
  margin-top: 0;               /* sobrescribe inline si quedara algo */
  justify-content: flex-end;
  gap: 0.5rem;
}

#modalNotificacionAdmin .toolbar .btn {
  min-width: 110px;
}



/* --- 4. Estilos Barra de Búsqueda Admin --- */
.search-box-admin {
    position: relative;
    width: 100%;
    max-width: 300px;
}
.search-box-admin input {
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    border-radius: 999px;
    background-color: var(--bg);
}
.search-box-admin input:focus {
    background-color: var(--card);
}

/* ===========================================
   MEJORA: Iconos de Acciones (Empresas)
   =========================================== */

/* 1. Estilos generales para los iconos en botones */
.icon-btn svg {
  /* Ajusta el tamaño y centrado */
  width: 16px;
  height: 16px;
  vertical-align: middle;
  /* Hereda el color del texto del botón */
  stroke: currentColor;
}

/* 2. Colores para los iconos de estado (Activar/Desactivar) */
/* (Estos se aplican directamente al SVG) */
.icon-success {
  stroke: var(--success);
}
.icon-danger {
  stroke: var(--danger);
}

/* 3. Asegura que el botón de eliminar sea rojo */
.btn.btn-danger {
  color: var(--danger);
  background-color: transparent;
}
.btn.btn-danger:hover {
  /* Al pasar el mouse, invierte los colores */
  color: #ffffff;
  background-color: var(--danger);
}

/* 4. Estilo para el botón de calendario (neutral) */
.icon-btn[data-action="config-suscripcion"] {
  color: var(--muted);
}
.icon-btn[data-action="config-suscripcion"]:hover {
  color: var(--primary);
}

/* ===========================================
   MEJORA: Modal de Confirmación Genérico
   =========================================== */

#modalConfirmacion .modal-header {
  /* Hacemos la cabecera más limpia */
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}

#modalConfirmacion .modal-content {
  /* Damos más espacio al mensaje */
  padding-top: 1.5rem;
  padding-bottom: 1rem;
}

/* Estilo para el botón de confirmar (rojo por defecto) */
#modalConfirmacion #btn-confirm-action.danger {
  background-color: var(--danger);
  color: white;
}
#modalConfirmacion #btn-confirm-action.danger:hover {
  background-color: #dc2626; /* Un rojo más oscuro */
}

/* Estilo para un botón de confirmar normal (ej. azul) */
#modalConfirmacion #btn-confirm-action.primary {
  background-color: var(--primary);
  color: white;
}
#modalConfirmacion #btn-confirm-action.primary:hover {
  background-color: var(--primary-dark);
}

/* ===========================================
   ESTILOS PARA EL WIZARD DE ONBOARDING
   =========================================== */

/* Contenedor del modal */
.wizard-modal .modal-box {
  /* Quitamos el padding por defecto para controlar el layout */
  padding: 0;
  overflow: hidden;
}
.wizard-modal .modal-header {
  padding: 1.25rem 1.75rem;
}
.wizard-content {
  padding: 1.5rem 1.75rem;
}

/* Barra de progreso */
.wizard-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 0 1rem;
}
.wizard-progress .progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  gap: 0.5rem;
}
.wizard-progress .progress-step::before {
  /* El círculo numérico */
  content: attr(data-step);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  width: 30px;
  border-radius: 50%;
  background-color: var(--line);
  color: var(--muted);
  font-weight: 700;
  border: 2px solid var(--line);
  transition: var(--transition);
}
.wizard-progress .progress-line {
  flex-grow: 1;
  height: 2px;
  background-color: var(--line);
}

/* Estilo de paso activo */
.wizard-progress .progress-step.active {
  color: var(--primary);
  font-weight: 700;
}
.wizard-progress .progress-step.active::before {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* Contenedor de los pasos (el contenido) */
.wizard-steps-container {
  min-height: 180px; /* Evita saltos de altura */
}

.wizard-step {
  display: none; /* Ocultos por defecto */
}
.wizard-step.active {
  display: block; /* Visible */
  animation: fadeIn 0.3s ease-out;
}
.wizard-step h4 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.wizard-step p {
  line-height: 1.6;
  color: var(--muted);
}
.wizard-step p.mini {
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

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

/* Botones del toolbar */
.wizard-modal .toolbar {
  background-color: var(--bg);
  border-top: 1px solid var(--line);
  padding: 1rem 1.75rem;
}

/* --- Estilo de Toggle Switch (para Config) --- */
/* Este CSS ahora es específico y no chocará con el admin */

.toggle-switch-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  transition: var(--transition);
}
.toggle-switch-label:hover {
  background: var(--bg);
  border-color: var(--muted);
}
.toggle-content {
  margin-right: 1.5rem;
}
.toggle-content .form-help {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* 1. Contenedor del switch */
.toggle-switch-label .toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px; 
  height: 28px; 
  flex-shrink: 0;
}
.toggle-switch-label .toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* 2. El fondo del slider (la barra gris/verde) */
.toggle-switch-label .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--line);
  transition: var(--transition);
  border-radius: 34px;
}

/* 3. El círculo blanco que se mueve */
.toggle-switch-label .slider:before {
  position: absolute;
  content: "";
  height: 20px; 
  width: 20px; 
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: var(--transition);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 4. Estilos cuando está ACTIVADO (checked) */
.toggle-switch-label input:checked + .slider {
  background-color: var(--success);
}
.toggle-switch-label input:checked + .slider:before {
  transform: translateX(22px);
}

/* ===== PRODUCTOS FUERA DE LÍMITE ===== */
.row-fuera-limite {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(148, 163, 184, 0.05) 10px,
    rgba(148, 163, 184, 0.05) 20px
  );
  opacity: 0.7;
}

.row-fuera-limite:hover {
  opacity: 0.9;
  background: rgba(148, 163, 184, 0.1);
}

.badge-muted {
  background: rgba(148, 163, 184, 0.2);
  color: #64748b;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

/* ===== ALERTA DE RECURSOS BLOQUEADOS ===== */
.alert-recursos-bloqueados {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(245, 158, 11, 0.15));
  border: 2px solid var(--warning);
  border-left: 6px solid var(--warning);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.15);
  animation: slideDown 0.4s ease-out;
}

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

/* ===== PRODUCTOS BLOQUEADOS EN DROPDOWN ===== */
.search-dropdown-item.item-bloqueado {
  opacity: 0.7;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 8px,
    rgba(245, 158, 11, 0.03) 8px,
    rgba(245, 158, 11, 0.03) 16px
  );
  cursor: not-allowed;
}

.search-dropdown-item.item-bloqueado:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: var(--warning);
}

/* === MODALES DE LÍMITE Y REPORTE === */
.small-modal, .medium-modal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
  max-width: 480px;
  margin: auto;
  position: relative;
}
.medium-modal { max-width: 700px; }

.usage-bar {
  background: var(--line);
  height: 12px;
  border-radius: var(--radius);
  margin: 1rem 0;
  overflow: hidden;
}
.usage-progress {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--warning));
  width: 0%;
  transition: width 0.5s ease;
}
.card-uso {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.card-uso h4 {
  font-size: 1rem;
  color: var(--primary-dark);
}
.card-uso p {
  font-size: 0.9rem;
  color: var(--muted);
}

/* === BOTÓN DE CIERRE DE MODALES === */
.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--danger);
  transform: scale(1.15);
}

/* Asegura que los encabezados de los modales se vean bien */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  position: relative;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}


/* Validación de formularios */
.input-error {
  border-color: var(--danger) !important;
  background: rgba(239, 68, 68, 0.05);
}

.error-message {
  display: block;
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.pagination-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-top: 1px solid var(--line);
  margin-top: 1rem;
}

.pagination-info {
  font-size: 0.9rem;
  color: var(--muted);
}

/* ===== Reporte de Uso dentro de Estado de Suscripción ===== */
.sub-usage {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
}

.usage-row {
  display: grid;
  gap: 0.5rem;
}

.usage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.usage-title {
  font-weight: 600;
  color: var(--ink);
}

.usage-count {
  font-size: 0.875rem;
  color: var(--muted);
}

.usage-left {
  color: var(--ink);
  font-weight: 600;
  margin-left: 0.35rem;
}

.usage-bar {
  width: 100%;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.usage-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Advertencia y peligro según % usado */
.usage-bar-fill.is-warning {
  background: linear-gradient(90deg, var(--warning), #fbbf24);
}
.usage-bar-fill.is-danger {
  background: linear-gradient(90deg, var(--danger), #f87171);
}
/* Bloqueo total de la interfaz cuando la suscripción está vencida */
body.modal-locked {
  overflow: hidden;
  pointer-events: none;
}

/* Permitimos interacción solo con el modal de Suscripción vencida */
body.modal-locked #modalSuscripcionVencida {
  pointer-events: auto;
}

/**
 * CSS adicional para corregir el Dashboard en móvil
 * Agregar este CSS al archivo styles.css o en un <style> en el HTML
 */

@media (max-width: 768px) {
  /* Contenedor principal del dashboard */
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  
  /* Cards de estadísticas */
  .stat-card {
    min-width: 0;
    width: 100%;
    padding: 1rem;
  }
  
  /* Gráficos y tablas */
  .grid.cols-2 {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }
  
  /* Canvas de gráficos */
  canvas {
    max-width: 100%;
    height: auto !important;
  }
  
  /* Tablas responsivas */
  .table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* Contenido de la página */
  .page {
    padding: 1rem;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  
  /* Header de página */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
  }
  
  .page-header .toolbar {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  
  /* KPIs de productos */
  .kpi-grid.kpi-productos {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem;
  }
  
  /* Valor de estadísticas */
  .stat-value {
    font-size: 1.5rem !important;
  }
  
  .stat-label {
    font-size: 0.75rem !important;
  }
  
  /* Cards de tablas */
  .card {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  
  /* Filtros */
  .filters-bar {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .filter-item {
    width: 100% !important;
    min-width: 0 !important;
  }
  
  /* Botones en toolbar */
  .toolbar button {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
  }
  
  /* Ocultar columnas menos importantes en tablas */
  table th:nth-child(n+4),
  table td:nth-child(n+4) {
    display: none;
  }
  
  /* Mostrar solo columnas esenciales en Dashboard */
  #tablaBajoStock th:nth-child(2),
  #tablaBajoStock td:nth-child(2) {
    display: table-cell;
  }
}

/* Extra pequeños (<576px) */
@media (max-width: 576px) {
  .kpi-grid.kpi-productos {
    grid-template-columns: 1fr !important;
  }
  
  .stat-card {
    padding: 0.75rem;
  }
  
  .page {
    padding: 0.75rem;
  }
}

/* pRUEBA */

/* Cambiar color del badge */
.notification-badge {
  background: #8b5cf6; /* Púrpura */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); /* Gradiente */
}

/* Cambiar tamaño del badge */
.notification-badge {
  min-width: 24px;
  height: 24px;
  font-size: 12px;
}

/* Deshabilitar animaciones */
.notification-badge {
  animation: none !important;
  transition: none !important;
}

/* ==========================================
   CONTROLES DE PAGINACIÓN
   ========================================== */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--line);
  margin-top: 1rem;
}

.pagination-info {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.pagination-controls .btn {
  min-width: 100px;
}

.pagination-controls .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (max-width: 768px) {
  .pagination-controls {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .pagination-controls .btn {
    width: 100%;
  }
}

/* ==========================================
   CONTROLES DE PAGINACIÓN (MEJORADOS)
   ========================================== */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  background: var(--bg);
  border-radius: 0 0 var(--radius) var(--radius);
}

.pagination-info {
  font-size: 0.95rem;
  color: var(--ink);
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.pagination-separator {
  color: var(--muted);
  font-weight: 300;
}

.pagination-controls .btn {
  min-width: 120px;
  gap: 0.5rem;
}

.pagination-controls .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--line);
}

.pagination-controls .btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Animación suave al cambiar de página */
#tickets-container,
#tablaProductos tbody,
#cardsProductos {
  animation: fadeIn 0.3s ease-in-out;
}

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

/* Responsive */
@media (max-width: 768px) {
  .pagination-controls {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .pagination-controls .btn {
    width: 100%;
    min-width: unset;
  }
  
  .pagination-info {
    font-size: 0.85rem;
  }
}

/* Ocultar footer en móviles */
@media (max-width: 768px) {
    footer {
        display: none !important;
    }
}

/* ============================================
   ESCÁNER DE CÓDIGOS QR
   ============================================ */

#qr-reader {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
}

#qr-reader__scan_region {
  border-radius: var(--radius);
}

#qr-reader__camera_selection {
  margin-bottom: 1rem;
}

#qr-reader__dashboard_section_csr {
  border: none !important;
}

.scanner-overlay {
  position: relative;
  margin-top: 1rem;
}

.scanner-status {
  text-align: center;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  margin-top: 1rem;
}

.scanner-status.scanning {
  border: 2px solid var(--primary);
  background: var(--primary-light);
}

.scanner-status.success {
  border: 2px solid var(--success);
  background: var(--success-light);
}

.scanner-status.error {
  border: 2px solid var(--danger);
  background: var(--danger-light);
}

/* ============================================
   SKELETON LOADERS
   ============================================ */

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg) 0%,
    var(--line) 20%,
    var(--bg) 40%,
    var(--bg) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
  border-radius: var(--radius);
}

.skeleton-row {
  display: grid;
  grid-template-columns: 100px 1fr 100px 100px 120px 100px 180px;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.skeleton-cell {
  height: 20px;
}

.skeleton-card {
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.skeleton-card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.skeleton-text {
  height: 16px;
  margin-bottom: 0.5rem;
}

.skeleton-text.large {
  height: 24px;
  width: 70%;
}

.skeleton-text.small {
  width: 40%;
}

/* ============================================
   EMPTY STATES (Estados Vacíos)
   ============================================ */

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.empty-state-icon {
  width: 120px;
  height: 120px;
  opacity: 0.3;
  color: var(--muted);
}

.empty-state h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.5rem;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  max-width: 400px;
}

.empty-state .btn {
  margin-top: 1rem;
}

/* Modal: Atajos de teclado (mejorado) */
#modalAtajosTeclado .modal-box {
  max-width: 720px;
}

#modalAtajosTeclado .modal-content {
  max-height: 70vh;
  overflow-y: auto;
}

.shortcuts-intro {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.shortcut-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.shortcut-group-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.25rem;
}

.shortcut-item {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 0.6rem 0.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.theme-dark #modalAtajosTeclado .shortcut-item {
  background: var(--bg-card);
}

.shortcut-key {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.shortcut-key .kbd {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 2px 8px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
  font-size: 0.8rem;
  background: var(--bg-body);
}

.shortcut-alt {
  opacity: 0.7;
  padding: 0 2px;
}

.shortcut-action {
  font-size: 0.9rem;
  color: var(--ink);
}


/* Productos BLOQUEADOS por límite de plan */
.row-fuera-limite,
.p-card.row-fuera-limite {
  background-color: rgba(239, 68, 68, 0.05) !important;
  opacity: 0.7;
  border-left: 3px solid var(--danger) !important;
}

.row-fuera-limite td {
  color: #666 !important;
}

/* Productos INACTIVOS manualmente */
.row-producto-inactivo,
.p-card.row-producto-inactivo {
  background-color: rgba(156, 163, 175, 0.1) !important;
  opacity: 0.6;
  border-left: 3px solid var(--muted) !important;
}

.row-producto-inactivo td {
  color: #999 !important;
}

/* Badges */
.badge-success {
  background-color: var(--success);
  color: white;
}

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

.badge-muted {
  background-color: var(--muted);
  color: white;
}


@media (max-width: 768px) {
  #tab-empresa .card > div { grid-template-columns: 1fr !important; }
}